// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.xdebugger.attach;

import com.intellij.execution.process.ProcessInfo;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.UserDataHolder;
import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * @deprecated use {@link XAttachDebuggerProvider} instead
 */
public interface XLocalAttachDebuggerProvider extends XAttachDebuggerProvider {
  ExtensionPointName<XAttachDebuggerProvider> EP = ExtensionPointName.create("com.intellij.xdebugger.localAttachDebuggerProvider");

  /**
   * @deprecated use {@link XAttachDebuggerProvider#getAvailableDebuggers(Project, XAttachHost, ProcessInfo, UserDataHolder)} instead
   */
  List<XLocalAttachDebugger> getAvailableDebuggers(@NotNull Project project,
                                                     @NotNull ProcessInfo process,
                                                     @NotNull UserDataHolder contextHolder);

  /**
   * @deprecated use {@link XAttachDebuggerProvider#getPresentationGroup()} instead
   */
  @NotNull
  default XAttachPresentationGroup<ProcessInfo> getAttachGroup() {
    return XLocalAttachGroup.DEFAULT;
  }

  @NotNull
  @Override
  default XAttachPresentationGroup<ProcessInfo> getPresentationGroup() {
    return getAttachGroup();
  }

  @Override
  default boolean isAttachHostApplicable(@NotNull XAttachHost attachHost) {
    return attachHost instanceof LocalAttachHost;
  }

  @NotNull
  @Override
  default List<XAttachDebugger> getAvailableDebuggers(@NotNull Project project,
                                                     @NotNull XAttachHost hostInfo,
                                                     @NotNull ProcessInfo process,
                                                     @NotNull UserDataHolder contextHolder) {

    if(hostInfo instanceof LocalAttachHost)
      return new ArrayList<>(getAvailableDebuggers(project, process, contextHolder));
    else
      return Collections.emptyList();
  }
}

@@ -453,38 +453,8 @@
 st;%0A
-import java.util.Collections;%0A
 impo
@@ -1339,16 +1339,23 @@
 return X
+Default
 LocalAtt
@@ -1367,15 +1367,16 @@
 oup.
-DEFAULT
+INSTANCE
 ;%0A  
@@ -2019,16 +2019,19 @@
 ) %7B%0A
-%0A
     
-if(
+assert 
 host
@@ -2065,12 +2065,11 @@
 Host
-)%0A  
+;%0A%0A
     
@@ -2152,55 +2152,8 @@
 ));%0A
-    else%0A      return Collections.emptyList();%0A
   %7D%0A

assert that given host is local in LocalAttachDebuggerProvider