removed unused old inspect panel

This commit is contained in:
Egor.Ushakov
2016-03-18 19:45:50 +03:00
parent b45268ae10
commit 4019bbb6ae
5 changed files with 1 additions and 304 deletions

View File

@@ -1,129 +0,0 @@
/*
* 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.
* 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.
*/
/*
* Class InspectAction
* @author Jeka
*/
package com.intellij.debugger.actions;
import com.intellij.debugger.DebuggerBundle;
import com.intellij.debugger.DebuggerInvocationUtil;
import com.intellij.debugger.engine.evaluation.EvaluateException;
import com.intellij.debugger.engine.evaluation.TextWithImports;
import com.intellij.debugger.engine.evaluation.expression.Modifier;
import com.intellij.debugger.engine.events.DebuggerContextCommandImpl;
import com.intellij.debugger.impl.DebuggerContextImpl;
import com.intellij.debugger.impl.DebuggerSession;
import com.intellij.debugger.impl.DebuggerStateManager;
import com.intellij.debugger.ui.impl.InspectDialog;
import com.intellij.debugger.ui.impl.watch.*;
import com.intellij.idea.ActionsBundle;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
import com.sun.jdi.Field;
public class InspectAction extends DebuggerAction {
public void actionPerformed(AnActionEvent e) {
final Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
final DebuggerTreeNodeImpl node = getSelectedNode(e.getDataContext());
if(node == null) return;
final NodeDescriptorImpl descriptor = node.getDescriptor();
final DebuggerStateManager stateManager = getContextManager(e.getDataContext());
if(!(descriptor instanceof ValueDescriptorImpl) || stateManager == null) return;
final DebuggerContextImpl context = stateManager.getContext();
if (!canInspect((ValueDescriptorImpl)descriptor, context)) {
return;
}
context.getDebugProcess().getManagerThread().schedule(new DebuggerContextCommandImpl(context) {
public void threadAction() {
try {
final TextWithImports evaluationText = DebuggerTreeNodeExpression.createEvaluationText(node, context);
final NodeDescriptorImpl inspectDescriptor;
if (descriptor instanceof WatchItemDescriptor) {
inspectDescriptor = (NodeDescriptorImpl) ((WatchItemDescriptor) descriptor).getModifier().getInspectItem(project);
}
else {
inspectDescriptor = descriptor;
}
DebuggerInvocationUtil.swingInvokeLater(project, new Runnable() {
public void run() {
final InspectDialog dialog = new InspectDialog(project, stateManager, ActionsBundle.actionText(DebuggerActions.INSPECT) + " '" + evaluationText + "'", inspectDescriptor);
dialog.show();
}
});
}
catch (final EvaluateException e1) {
DebuggerInvocationUtil.swingInvokeLater(project, new Runnable() {
public void run() {
Messages.showErrorDialog(project, e1.getMessage(), ActionsBundle.actionText(DebuggerActions.INSPECT));
}
});
}
}
});
}
private static boolean canInspect(ValueDescriptorImpl descriptor, DebuggerContextImpl context) {
DebuggerSession session = context.getDebuggerSession();
if (session == null || !session.isPaused()) return false;
boolean isField = descriptor instanceof FieldDescriptorImpl;
if(descriptor instanceof WatchItemDescriptor) {
Modifier modifier = ((WatchItemDescriptor)descriptor).getModifier();
if(modifier == null || !modifier.canInspect()) return false;
isField = modifier instanceof Field;
}
if (isField) { // check if possible
if (!context.getDebugProcess().canWatchFieldModification()) {
Messages.showMessageDialog(
context.getProject(),
DebuggerBundle.message("error.modification.watchpoints.not.supported"),
ActionsBundle.actionText(DebuggerActions.INSPECT),
Messages.getInformationIcon()
);
return false;
}
}
return true;
}
public void update(AnActionEvent e) {
DebuggerTreeNodeImpl selectedNode = getSelectedNode(e.getDataContext());
boolean enabled = false;
if(selectedNode != null) {
NodeDescriptorImpl descriptor = selectedNode.getDescriptor();
if(descriptor != null) {
if(descriptor instanceof LocalVariableDescriptorImpl || descriptor instanceof FieldDescriptorImpl || descriptor instanceof ArrayElementDescriptorImpl) {
enabled = true;
}
else if(descriptor instanceof WatchItemDescriptor){
Modifier modifier = ((WatchItemDescriptor)descriptor).getModifier();
enabled = modifier != null && modifier.canInspect();
}
}
}
e.getPresentation().setVisible(enabled);
}
}

View File

@@ -1,92 +0,0 @@
/*
* 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.
* 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.ui.impl;
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.watch.NodeDescriptorImpl;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
public class InspectDialog extends DialogWrapper implements DebuggerContextListener {
private InspectPanel myInspectView;
private final DebuggerContextImpl myDebuggerContext;
public InspectDialog(Project project, DebuggerStateManager stateManager, String title, NodeDescriptorImpl inspectDescriptor) {
super(project, true);
setTitle(title);
setModal(false);
myDebuggerContext = stateManager.getContext();
final DebuggerSession session = myDebuggerContext.getDebuggerSession();
assert session != null;
myInspectView = new InspectPanel(project, session.getContextManager(), inspectDescriptor);
myInspectView.setBorder(BorderFactory.createEtchedBorder());
init();
session.getContextManager().addListener(this);
getInspectView().rebuildIfVisible(DebuggerSession.Event.CONTEXT);
}
protected JComponent createCenterPanel() {
return myInspectView;
}
protected JComponent createSouthPanel() {
return null;
}
public void dispose() {
final DebuggerSession session = myDebuggerContext.getDebuggerSession();
if (session != null) {
session.getContextManager().removeListener(this);
}
if (myInspectView != null) {
myInspectView.dispose();
myInspectView = null;
}
super.dispose();
}
protected String getDimensionServiceKey(){
return "#com.intellij.debugger.ui.impl.InspectDialog";
}
public InspectPanel getInspectView() {
return myInspectView;
}
public void changeEvent(@NotNull DebuggerContextImpl newContext, DebuggerSession.Event event) {
if(event == DebuggerSession.Event.DETACHED) {
close(CANCEL_EXIT_CODE);
}
}
@Nullable
@Override
public JComponent getPreferredFocusedComponent() {
return myInspectView.getInspectTree();
}
}

View File

@@ -1,68 +0,0 @@
/*
* 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.
* 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.
*/
/*
* Class InspectPanel
* @author Jeka
*/
package com.intellij.debugger.ui.impl;
import com.intellij.debugger.actions.DebuggerAction;
import com.intellij.debugger.actions.DebuggerActions;
import com.intellij.debugger.impl.DebuggerContextImpl;
import com.intellij.debugger.impl.DebuggerSession;
import com.intellij.debugger.impl.DebuggerStateManager;
import com.intellij.debugger.ui.impl.watch.DebuggerTree;
import com.intellij.debugger.ui.impl.watch.NodeDescriptorImpl;
import com.intellij.openapi.actionSystem.ActionPopupMenu;
import com.intellij.openapi.actionSystem.CommonShortcuts;
import com.intellij.openapi.project.Project;
import com.intellij.ui.ScrollPaneFactory;
import org.jetbrains.annotations.NotNull;
import java.awt.*;
public class InspectPanel extends DebuggerTreePanel {
public InspectPanel(Project project, DebuggerStateManager stateManager, @NotNull NodeDescriptorImpl inspectDescriptor) {
super(project, stateManager);
getInspectTree().setInspectDescriptor(inspectDescriptor);
add(ScrollPaneFactory.createScrollPane(getInspectTree()), BorderLayout.CENTER);
registerDisposable(DebuggerAction.installEditAction(getInspectTree(), DebuggerActions.EDIT_NODE_SOURCE));
overrideShortcut(getInspectTree(), DebuggerActions.COPY_VALUE, CommonShortcuts.getCopy());
setUpdateEnabled(true);
}
protected void changeEvent(DebuggerContextImpl newContext, DebuggerSession.Event event) {
if (event != DebuggerSession.Event.THREADS_REFRESH) {
super.changeEvent(newContext, event);
}
}
protected DebuggerTree createTreeView() {
return new InspectDebuggerTree(getProject());
}
protected ActionPopupMenu createPopupMenu() {
return InspectDebuggerTree.createPopupMenu();
}
public InspectDebuggerTree getInspectTree() {
return (InspectDebuggerTree)getTree();
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* Copyright 2000-2016 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.
@@ -22,9 +22,6 @@ import com.intellij.debugger.impl.DebuggerStateManager;
import com.intellij.debugger.ui.DebuggerView;
import com.intellij.openapi.CompositeDisposable;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.ActionManager;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.ShortcutSet;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Disposer;
import org.jetbrains.annotations.NotNull;
@@ -109,14 +106,4 @@ public abstract class UpdatableDebuggerView extends JPanel implements DebuggerVi
public void dispose() {
Disposer.dispose(myDisposables);
}
protected void overrideShortcut(final JComponent forComponent, final String actionId, final ShortcutSet shortcutSet) {
final AnAction action = ActionManager.getInstance().getAction(actionId);
action.registerCustomShortcutSet(shortcutSet, forComponent);
registerDisposable(new Disposable() {
public void dispose() {
action.unregisterCustomShortcutSet(forComponent);
}
});
}
}

View File

@@ -172,7 +172,6 @@
</action>
<group id="JavaDebuggerActions">
<!--<action id="Debugger.Inspect" class="com.intellij.debugger.actions.InspectAction"/>-->
<action id="Debugger.CustomizeContextView" class="com.intellij.debugger.actions.CustomizeContextViewAction">
<add-to-group group-id="XDebugger.Variables.Tree.Popup" anchor="last"/>
<add-to-group group-id="XDebugger.Watches.Tree.Popup" anchor="last"/>