package com.intellij.codeInsight.completion.actions;

import com.intellij.codeInsight.CodeInsightActionHandler;
import com.intellij.codeInsight.actions.BaseCodeInsightAction;
import com.intellij.codeInsight.completion.ClassNameCompletionHandler;
import com.intellij.codeInsight.lookup.Lookup;
import com.intellij.codeInsight.lookup.LookupItem;
import com.intellij.featureStatistics.FeatureUsageTracker;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiElement;

/**
 *
 */
public class ClassNameCompletionAction extends BaseCodeInsightAction {
  public ClassNameCompletionAction() {
    setEnabledInModalContext(true);
  }

  public void actionPerformedImpl(Project project, Editor editor) {
    FeatureUsageTracker.getInstance().triggerFeatureUsed("editing.completion.classname");
    super.actionPerformedImpl(project, editor);
  }

  protected CodeInsightActionHandler getHandler() {
    return new ClassNameCompletionHandler();
  }

  public boolean isValidForLookup(Lookup lookup, DataContext context) {
    if (lookup == null) return false;
    final LookupItem item = lookup.getCurrentItem();
    if (item == null) return false;
    
    final Object o = item.getObject();
    return o instanceof PsiElement && ((PsiElement) o).isValid() && isValidForFile(null, null, ((PsiElement)o).getContainingFile());
  }

  protected boolean isValidForLookup() {
    return true;
  }
}

@@ -263,197 +263,45 @@
 lij.
-codeInsight.lookup.Lookup;%0Aimport com.intellij.codeInsight.lookup.LookupItem;%0Aimport com.intellij.featureStatistics.FeatureUsageTracker;%0Aimport com.intellij.openapi.actionSystem.DataContext
+featureStatistics.FeatureUsageTracker
 ;%0Aim
@@ -389,44 +389,8 @@
 ect;
-%0Aimport com.intellij.psi.PsiElement;
 %0A%0A/*
@@ -808,24 +808,24 @@
 Handler() %7B%0A
+
     return n
@@ -866,389 +866,8 @@
  %7D%0A%0A
-  public boolean isValidForLookup(Lookup lookup, DataContext context) %7B%0A    if (lookup == null) return false;%0A    final LookupItem item = lookup.getCurrentItem();%0A    if (item == null) return false;%0A    %0A    final Object o = item.getObject();%0A    return o instanceof PsiElement && ((PsiElement) o).isValid() && isValidForFile(null, null, ((PsiElement)o).getContainingFile());%0A  %7D%0A%0A
   pr

enable in lookups