diff --git a/java/debugger/impl/src/com/intellij/debugger/actions/InspectAction.java b/java/debugger/impl/src/com/intellij/debugger/actions/InspectAction.java deleted file mode 100644 index 80b6d617d7bd..000000000000 --- a/java/debugger/impl/src/com/intellij/debugger/actions/InspectAction.java +++ /dev/null @@ -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); - } - -} diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/impl/InspectDialog.java b/java/debugger/impl/src/com/intellij/debugger/ui/impl/InspectDialog.java deleted file mode 100644 index 09f76f0e9234..000000000000 --- a/java/debugger/impl/src/com/intellij/debugger/ui/impl/InspectDialog.java +++ /dev/null @@ -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(); - } -} diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/impl/InspectPanel.java b/java/debugger/impl/src/com/intellij/debugger/ui/impl/InspectPanel.java deleted file mode 100644 index 35392ba78f58..000000000000 --- a/java/debugger/impl/src/com/intellij/debugger/ui/impl/InspectPanel.java +++ /dev/null @@ -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(); - } -} diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/impl/UpdatableDebuggerView.java b/java/debugger/impl/src/com/intellij/debugger/ui/impl/UpdatableDebuggerView.java index f0cb5d3b6969..4a99a054d7c0 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/impl/UpdatableDebuggerView.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/impl/UpdatableDebuggerView.java @@ -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); - } - }); - } } diff --git a/resources/src/idea/JavaActions.xml b/resources/src/idea/JavaActions.xml index 924c36a1c0e2..c4da47998a0c 100644 --- a/resources/src/idea/JavaActions.xml +++ b/resources/src/idea/JavaActions.xml @@ -172,7 +172,6 @@ -