Search in sources :

Example 1 with CamelCatalogService

use of com.github.cameltooling.idea.service.CamelCatalogService in project camel-idea-plugin by camel-tooling.

the class CamelDebuggerRunner method checkConfiguration.

private void checkConfiguration(@NotNull Module module) {
    String currentVersion = null;
    CamelService camelService = module.getProject().getService(CamelService.class);
    if (camelService != null) {
        CamelCatalogService camelCatalogService = module.getProject().getService(CamelCatalogService.class);
        if (camelCatalogService != null) {
            currentVersion = camelCatalogService.get().getLoadedVersion();
            ComparableVersion version = new ComparableVersion(currentVersion);
            if (version.compareTo(new ComparableVersion(MIN_CAMEL_VERSION)) < 0) {
                // This is an older version of Camel, debugger is not supported
                NotificationGroupManager.getInstance().getNotificationGroup("Debugger messages").createNotification("Camel version is " + version + ". Minimum required version for debugger is 3.15.0", MessageType.WARNING).notify(module.getProject());
            }
        }
    }
    List<OrderEntry> entries = Arrays.asList(ModuleRootManager.getInstance(module).getOrderEntries());
    long debuggerDependenciesCount = entries.stream().filter(entry -> isDebuggerDependency(entry)).count();
    if (debuggerDependenciesCount <= 0) {
        NotificationGroupManager.getInstance().getNotificationGroup("Debugger messages").createNotification("Camel Debugger is not found in classpath. \nPlease add camel-debug or camel-debug-starter" + " JAR to your project dependencies.", MessageType.WARNING).notify(module.getProject());
    }
}
Also used : Arrays(java.util.Arrays) MessageType(com.intellij.openapi.ui.MessageType) CamelService(com.github.cameltooling.idea.service.CamelService) DefaultDebugEnvironment(com.intellij.debugger.DefaultDebugEnvironment) ExecutionException(com.intellij.execution.ExecutionException) XDebuggerManager(com.intellij.xdebugger.XDebuggerManager) NonNls(org.jetbrains.annotations.NonNls) HashMap(java.util.HashMap) XDebugProcess(com.intellij.xdebugger.XDebugProcess) XDebugSessionImpl(com.intellij.xdebugger.impl.XDebugSessionImpl) XDebugProcessStarter(com.intellij.xdebugger.XDebugProcessStarter) AtomicReference(java.util.concurrent.atomic.AtomicReference) RunProfileState(com.intellij.execution.configurations.RunProfileState) DebuggerSession(com.intellij.debugger.impl.DebuggerSession) CamelCatalogService(com.github.cameltooling.idea.service.CamelCatalogService) ExecutionEnvironment(com.intellij.execution.runners.ExecutionEnvironment) CamelMessageInfo(com.github.cameltooling.idea.runner.debugger.stack.CamelMessageInfo) Map(java.util.Map) Project(com.intellij.openapi.project.Project) ExecutionResult(com.intellij.execution.ExecutionResult) ComparableVersion(org.apache.maven.artifact.versioning.ComparableVersion) Logger(com.intellij.openapi.diagnostic.Logger) Module(com.intellij.openapi.module.Module) XDebugSession(com.intellij.xdebugger.XDebugSession) DefaultExecutionResult(com.intellij.execution.DefaultExecutionResult) DefaultDebugExecutor(com.intellij.execution.executors.DefaultDebugExecutor) RemoteConnection(com.intellij.execution.configurations.RemoteConnection) NotificationGroupManager(com.intellij.notification.NotificationGroupManager) RunConfigurationBase(com.intellij.execution.configurations.RunConfigurationBase) DebugProcessImpl(com.intellij.debugger.engine.DebugProcessImpl) BatchEvaluator(com.intellij.debugger.ui.tree.render.BatchEvaluator) OrderEntry(com.intellij.openapi.roots.OrderEntry) RunProfile(com.intellij.execution.configurations.RunProfile) Nullable(org.jetbrains.annotations.Nullable) LibraryOrderEntry(com.intellij.openapi.roots.LibraryOrderEntry) List(java.util.List) ModuleRootManager(com.intellij.openapi.roots.ModuleRootManager) RunContentDescriptor(com.intellij.execution.ui.RunContentDescriptor) JavaDebugProcess(com.intellij.debugger.engine.JavaDebugProcess) ApplicationManager(com.intellij.openapi.application.ApplicationManager) DebuggerManagerEx(com.intellij.debugger.DebuggerManagerEx) NotNull(org.jetbrains.annotations.NotNull) GenericDebuggerRunner(com.intellij.debugger.impl.GenericDebuggerRunner) OrderEntry(com.intellij.openapi.roots.OrderEntry) LibraryOrderEntry(com.intellij.openapi.roots.LibraryOrderEntry) CamelCatalogService(com.github.cameltooling.idea.service.CamelCatalogService) CamelService(com.github.cameltooling.idea.service.CamelService) ComparableVersion(org.apache.maven.artifact.versioning.ComparableVersion)

Aggregations

CamelMessageInfo (com.github.cameltooling.idea.runner.debugger.stack.CamelMessageInfo)1 CamelCatalogService (com.github.cameltooling.idea.service.CamelCatalogService)1 CamelService (com.github.cameltooling.idea.service.CamelService)1 DebuggerManagerEx (com.intellij.debugger.DebuggerManagerEx)1 DefaultDebugEnvironment (com.intellij.debugger.DefaultDebugEnvironment)1 DebugProcessImpl (com.intellij.debugger.engine.DebugProcessImpl)1 JavaDebugProcess (com.intellij.debugger.engine.JavaDebugProcess)1 DebuggerSession (com.intellij.debugger.impl.DebuggerSession)1 GenericDebuggerRunner (com.intellij.debugger.impl.GenericDebuggerRunner)1 BatchEvaluator (com.intellij.debugger.ui.tree.render.BatchEvaluator)1 DefaultExecutionResult (com.intellij.execution.DefaultExecutionResult)1 ExecutionException (com.intellij.execution.ExecutionException)1 ExecutionResult (com.intellij.execution.ExecutionResult)1 RemoteConnection (com.intellij.execution.configurations.RemoteConnection)1 RunConfigurationBase (com.intellij.execution.configurations.RunConfigurationBase)1 RunProfile (com.intellij.execution.configurations.RunProfile)1 RunProfileState (com.intellij.execution.configurations.RunProfileState)1 DefaultDebugExecutor (com.intellij.execution.executors.DefaultDebugExecutor)1 ExecutionEnvironment (com.intellij.execution.runners.ExecutionEnvironment)1 RunContentDescriptor (com.intellij.execution.ui.RunContentDescriptor)1