Ejemplo n.º 1
0
  public void processVariants(final PsiScopeProcessor processor) {
    if (processor instanceof JavaCompletionProcessor) {
      final Map<CustomizableReferenceProvider.CustomizationKey, Object> options = getOptions();
      if (options != null
              && (JavaClassReferenceProvider.EXTEND_CLASS_NAMES.getValue(options) != null
                  || JavaClassReferenceProvider.NOT_INTERFACE.getBooleanValue(options)
                  || JavaClassReferenceProvider.CONCRETE.getBooleanValue(options))
          || JavaClassReferenceProvider.CLASS_KIND.getValue(options) != null) {
        ((JavaCompletionProcessor) processor).setCompletionElements(getVariants());
        return;
      }
    }

    PsiScopeProcessor processorToUse = processor;
    if (myInStaticImport) {
      // allows to complete members
      processor.handleEvent(JavaScopeProcessorEvent.CHANGE_LEVEL, null);
    } else {
      if (isDefinitelyStatic()) {
        processor.handleEvent(JavaScopeProcessorEvent.START_STATIC, null);
      }
      processorToUse =
          new PsiScopeProcessor() {
            public boolean execute(PsiElement element, ResolveState state) {
              return !(element instanceof PsiClass || element instanceof PsiPackage)
                  || processor.execute(element, state);
            }

            public <V> V getHint(Key<V> hintKey) {
              return processor.getHint(hintKey);
            }

            public void handleEvent(Event event, Object associated) {
              processor.handleEvent(event, associated);
            }
          };
    }
    super.processVariants(processorToUse);
  }
Ejemplo n.º 2
0
 @Nullable
 public ClassKind getClassKind() {
   return JavaClassReferenceProvider.CLASS_KIND.getValue(getOptions());
 }