From 4f61ead1deed8cddf15162e223222403a0aea2a9 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Wed, 21 Jan 2015 19:12:36 +0300 Subject: [PATCH] K2JS: fix breakpoints when use JavaScript debugger. --- idea/src/META-INF/javaScriptDebug.xml | 2 +- .../KotlinJavaScriptBreakpointAware.java | 38 ------------------ .../debugger/KotlinJavaScriptDebugAware.java | 40 +++++++++++++++++++ 3 files changed, 41 insertions(+), 39 deletions(-) delete mode 100644 idea/src/org/jetbrains/kotlin/idea/debugger/KotlinJavaScriptBreakpointAware.java create mode 100644 idea/src/org/jetbrains/kotlin/idea/debugger/KotlinJavaScriptDebugAware.java diff --git a/idea/src/META-INF/javaScriptDebug.xml b/idea/src/META-INF/javaScriptDebug.xml index baaf7752b2f..9a419ad50fd 100644 --- a/idea/src/META-INF/javaScriptDebug.xml +++ b/idea/src/META-INF/javaScriptDebug.xml @@ -1,5 +1,5 @@ - + diff --git a/idea/src/org/jetbrains/kotlin/idea/debugger/KotlinJavaScriptBreakpointAware.java b/idea/src/org/jetbrains/kotlin/idea/debugger/KotlinJavaScriptBreakpointAware.java deleted file mode 100644 index cc1de85c54d..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/debugger/KotlinJavaScriptBreakpointAware.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2010-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 org.jetbrains.kotlin.idea.debugger; - -import com.intellij.openapi.module.Module; -import com.intellij.openapi.module.ModuleUtilCore; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.util.PairProcessor; -import org.jetbrains.kotlin.idea.JetFileType; -import org.jetbrains.kotlin.idea.project.ProjectStructureUtil; - -public class KotlinJavaScriptBreakpointAware implements PairProcessor { - @Override - public boolean process(VirtualFile file, Project project) { - if (file.getFileType() == JetFileType.INSTANCE) { - Module module = ModuleUtilCore.findModuleForFile(file, project); - if (module != null) { - return ProjectStructureUtil.isJsKotlinModule(module); - } - } - return false; - } -} diff --git a/idea/src/org/jetbrains/kotlin/idea/debugger/KotlinJavaScriptDebugAware.java b/idea/src/org/jetbrains/kotlin/idea/debugger/KotlinJavaScriptDebugAware.java new file mode 100644 index 00000000000..640fe3ff3f4 --- /dev/null +++ b/idea/src/org/jetbrains/kotlin/idea/debugger/KotlinJavaScriptDebugAware.java @@ -0,0 +1,40 @@ +/* + * Copyright 2010-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 org.jetbrains.kotlin.idea.debugger; + +import com.intellij.debugger.ui.breakpoints.JavaLineBreakpointType; +import com.intellij.openapi.fileTypes.FileType; +import com.intellij.openapi.project.Project; +import com.intellij.xdebugger.breakpoints.XBreakpointType; +import com.intellij.xdebugger.breakpoints.XLineBreakpointType; +import com.jetbrains.javascript.debugger.JavaScriptDebugAware; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +public class KotlinJavaScriptDebugAware extends JavaScriptDebugAware { + @Nullable + @Override + public FileType getFileType() { + return null; + } + + @Nullable + @Override + public XLineBreakpointType getBreakpointTypeClass(@NotNull Project project) { + return XBreakpointType.EXTENSION_POINT_NAME.findExtension(JavaLineBreakpointType.class); + } +}