mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
CR-IU-617 IDEA-122113
This commit is contained in:
@@ -28,9 +28,7 @@ import com.intellij.debugger.impl.DebuggerSession;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.xdebugger.impl.actions.DebuggerActionHandler;
|
||||
@@ -49,9 +47,7 @@ public class RunToCursorActionHandler extends DebuggerActionHandler {
|
||||
|
||||
@Override
|
||||
public boolean isEnabled(final @NotNull Project project, final AnActionEvent event) {
|
||||
|
||||
Editor editor = event.getData(CommonDataKeys.EDITOR);
|
||||
|
||||
if (editor == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -61,9 +57,7 @@ public class RunToCursorActionHandler extends DebuggerActionHandler {
|
||||
return false;
|
||||
}
|
||||
|
||||
final VirtualFile virtualFile = file.getVirtualFile();
|
||||
FileType fileType = virtualFile != null ? virtualFile.getFileType() : null;
|
||||
if (DebuggerUtils.supportsJVMDebugging(fileType) || DebuggerUtils.supportsJVMDebugging(file)) {
|
||||
if (DebuggerUtils.isDebugActionAware(file)) {
|
||||
DebuggerSession debuggerSession = DebuggerManagerEx.getInstanceEx(project).getContext().getDebuggerSession();
|
||||
return debuggerSession != null && debuggerSession.isPaused();
|
||||
}
|
||||
|
||||
+1
-7
@@ -25,10 +25,7 @@ import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.Presentation;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.fileEditor.FileEditorManager;
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.openapi.fileTypes.FileTypeManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -74,10 +71,7 @@ public class ToggleBreakpointEnabledAction extends AnAction {
|
||||
return;
|
||||
}
|
||||
|
||||
FileTypeManager fileTypeManager = FileTypeManager.getInstance();
|
||||
final VirtualFile virtualFile = file.getVirtualFile();
|
||||
FileType fileType = virtualFile != null ? virtualFile.getFileType() : null;
|
||||
if (DebuggerUtils.supportsJVMDebugging(fileType) || DebuggerUtils.supportsJVMDebugging(file)) {
|
||||
if (DebuggerUtils.isBreakpointAware(file)) {
|
||||
Breakpoint breakpoint = findBreakpoint(project);
|
||||
if (breakpoint == null) {
|
||||
presentation.setEnabled(false);
|
||||
|
||||
+2
-7
@@ -20,7 +20,6 @@ import com.intellij.debugger.engine.DebuggerUtils;
|
||||
import com.intellij.debugger.ui.JavaDebuggerSupport;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager;
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.openapi.fileTypes.StdFileTypes;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
@@ -88,15 +87,11 @@ public abstract class JavaLineBreakpointTypeBase<P extends JavaBreakpointPropert
|
||||
public final boolean canPutAt(@NotNull VirtualFile file, final int line, @NotNull Project project) {
|
||||
PsiFile psiFile = PsiManager.getInstance(project).findFile(file);
|
||||
// JSPX supports jvm debugging, but not in XHTML files
|
||||
// JS has it's own breakpoints
|
||||
if (psiFile == null || psiFile.getVirtualFile().getFileType() == StdFileTypes.XHTML || psiFile.getVirtualFile().getFileType() == StdFileTypes.JS) {
|
||||
if (psiFile == null || psiFile.getVirtualFile().getFileType() == StdFileTypes.XHTML) {
|
||||
return false;
|
||||
}
|
||||
|
||||
FileType fileType = psiFile.getFileType();
|
||||
if (!StdFileTypes.CLASS.equals(fileType) &&
|
||||
!DebuggerUtils.supportsJVMDebugging(fileType) &&
|
||||
!DebuggerUtils.supportsJVMDebugging(psiFile)) {
|
||||
if (!StdFileTypes.CLASS.equals(psiFile.getFileType()) && !DebuggerUtils.isBreakpointAware(psiFile)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.components.ServiceManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.openapi.fileTypes.LanguageFileType;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -43,6 +42,7 @@ import com.intellij.util.StringBuilderSpinAllocator;
|
||||
import com.sun.jdi.*;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.*;
|
||||
@@ -564,13 +564,50 @@ public abstract class DebuggerUtils {
|
||||
|
||||
public abstract PsiClass chooseClassDialog(String title, Project project);
|
||||
|
||||
/**
|
||||
* Don't use directly, will be private in IDEA 14.
|
||||
* @deprecated to remove in IDEA 15
|
||||
*/
|
||||
@Deprecated
|
||||
public static boolean supportsJVMDebugging(FileType type) {
|
||||
return type instanceof LanguageFileType && ((LanguageFileType)type).isJVMDebuggingSupported();
|
||||
}
|
||||
|
||||
public static boolean supportsJVMDebugging(PsiFile file) {
|
||||
final JVMDebugProvider[] providers = Extensions.getExtensions(JVMDebugProvider.EP_NAME);
|
||||
for (JVMDebugProvider provider : providers) {
|
||||
/**
|
||||
* @deprecated Use {@link #isBreakpointAware(com.intellij.psi.PsiFile)}
|
||||
* to remove in IDEA 15
|
||||
*/
|
||||
@Deprecated
|
||||
public static boolean supportsJVMDebugging(@NotNull PsiFile file) {
|
||||
return isBreakpointAware(file);
|
||||
}
|
||||
|
||||
/**
|
||||
* IDEA-122113
|
||||
* Will be removed when Java debugger will be moved to XDebugger API
|
||||
*/
|
||||
public static boolean isDebugActionAware(@NotNull PsiFile file) {
|
||||
return isDebugAware(file, false);
|
||||
}
|
||||
|
||||
public static boolean isBreakpointAware(@NotNull PsiFile file) {
|
||||
return isDebugAware(file, true);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private static boolean isDebugAware(@NotNull PsiFile file, boolean breakpointAware) {
|
||||
FileType fileType = file.getFileType();
|
||||
if (supportsJVMDebugging(fileType)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (JavaDebugAware provider : JavaDebugAware.EP_NAME.getExtensions()) {
|
||||
if (breakpointAware ? provider.isBreakpointAware(file, fileType) : provider.isActionAware(file, fileType)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
for (JVMDebugProvider provider : JVMDebugProvider.EP_NAME.getExtensions()) {
|
||||
if (provider.supportsJVMDebugging(file)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 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.
|
||||
@@ -19,8 +19,10 @@ import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.psi.PsiFile;
|
||||
|
||||
/**
|
||||
* @author Dennis.Ushakov
|
||||
* @deprecated Extends {@link com.intellij.debugger.engine.JavaDebugAware}
|
||||
* to remove in IDEA 15
|
||||
*/
|
||||
@Deprecated
|
||||
public interface JVMDebugProvider {
|
||||
ExtensionPointName<JVMDebugProvider> EP_NAME = ExtensionPointName.create("com.intellij.debugger.jvmDebugProvider");
|
||||
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* 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.engine;
|
||||
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public abstract class JavaDebugAware {
|
||||
static final ExtensionPointName<JavaDebugAware> EP_NAME = ExtensionPointName.create("com.intellij.debugger.javaDebugAware");
|
||||
|
||||
public abstract boolean isBreakpointAware(@NotNull PsiFile psiFile, @NotNull FileType fileType);
|
||||
|
||||
// IDEA-122113, will be removed when Java debugger will be moved to XDebugger API
|
||||
public boolean isActionAware(@NotNull PsiFile psiFile, @NotNull FileType fileType) {
|
||||
return isBreakpointAware(psiFile, fileType);
|
||||
}
|
||||
}
|
||||
@@ -63,7 +63,7 @@ public abstract class LanguageFileType implements FileType{
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated implement own {@link com.intellij.debugger.engine.JVMDebugProvider} instead
|
||||
* @deprecated implement own {@link com.intellij.debugger.engine.JavaDebugAware} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean isJVMDebuggingSupported() {
|
||||
|
||||
@@ -88,6 +88,8 @@
|
||||
|
||||
<extensionPoint name="debugger.jvmDebugProvider"
|
||||
interface="com.intellij.debugger.engine.JVMDebugProvider"/>
|
||||
<extensionPoint name="debugger.javaDebugAware"
|
||||
interface="com.intellij.debugger.engine.JavaDebugAware"/>
|
||||
|
||||
<extensionPoint name="debugger.positionManagerFactory"
|
||||
interface="com.intellij.debugger.PositionManagerFactory"
|
||||
|
||||
Reference in New Issue
Block a user