extension point for enabling jvm debugging for specific files

This commit is contained in:
Dennis Ushakov
2010-01-15 16:12:49 +03:00
parent a8bd62db93
commit 2aa32c1034
7 changed files with 48 additions and 4 deletions
@@ -27,6 +27,7 @@ import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.components.ApplicationComponent;
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;
@@ -454,4 +455,14 @@ public abstract class DebuggerUtils implements ApplicationComponent {
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) {
if (provider.supportsJVMDebugging(file)) {
return true;
}
}
return false;
}
}
@@ -0,0 +1,28 @@
/*
* Copyright 2000-2010 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.psi.PsiFile;
/**
* @author Dennis.Ushakov
*/
public interface JVMDebugProvider {
ExtensionPointName<JVMDebugProvider> EP_NAME = ExtensionPointName.create("com.intellij.debugger.jvmDebugProvider");
boolean supportsJVMDebugging(PsiFile file);
}