当前位置: 首页>>代码示例>>Java>>正文


Java ArrayUtil.prepend方法代码示例

本文整理汇总了Java中com.intellij.util.ArrayUtil.prepend方法的典型用法代码示例。如果您正苦于以下问题:Java ArrayUtil.prepend方法的具体用法?Java ArrayUtil.prepend怎么用?Java ArrayUtil.prepend使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.util.ArrayUtil的用法示例。


在下文中一共展示了ArrayUtil.prepend方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findSuperElements

import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
@NotNull
private PsiElement[] findSuperElements(@NotNull PsiFile file, int offset) {
  PsiElement element = getElement(file, offset);
  if (element == null) return PsiElement.EMPTY_ARRAY;

  final PsiElement psiElement = PsiTreeUtil.getParentOfType(element, PsiFunctionalExpression.class, PsiMember.class);
  if (psiElement instanceof PsiFunctionalExpression) {
    final PsiMethod interfaceMethod = LambdaUtil.getFunctionalInterfaceMethod(psiElement);
    if (interfaceMethod != null) {
      return ArrayUtil.prepend(interfaceMethod, interfaceMethod.findSuperMethods(false));
    }
  }

  final PsiNameIdentifierOwner parent = PsiTreeUtil.getNonStrictParentOfType(element, PsiMethod.class, PsiClass.class);
  if (parent == null) {
    return PsiElement.EMPTY_ARRAY;
  }

  return FindSuperElementsHelper.findSuperElements(parent);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:JavaGotoSuperHandler.java

示例2: composeSuperMethods

import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
@NotNull
private static PsiMethod[] composeSuperMethods(@NotNull PsiMethod method, boolean acceptSelf) {
  PsiElement[] superElements = FindSuperElementsHelper.findSuperElements(method);

  PsiMethod[] superMethods = ContainerUtil.map(superElements, new Function<PsiElement, PsiMethod>() {
    @Override
    public PsiMethod fun(PsiElement element) {
      return (PsiMethod)element;
    }
  }, PsiMethod.EMPTY_ARRAY);
  if (acceptSelf) {
    superMethods = ArrayUtil.prepend(method, superMethods);
  }
  return superMethods;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:MarkerType.java

示例3: createReturnTypePanel

import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
@Nullable
private JPanel createReturnTypePanel() {
  if (TypeConversionUtil.isPrimitiveWrapper(myReturnType) && myNullness == Nullness.NULLABLE) {
    return null;
  }
  final TypeSelectorManagerImpl manager = new TypeSelectorManagerImpl(myProject, myReturnType, findOccurrences(), areTypesDirected()) {
    @Override
    public PsiType[] getTypesForAll(boolean direct) {
      final PsiType[] types = super.getTypesForAll(direct);
      return !isVoidReturn() ? types : ArrayUtil.prepend(PsiType.VOID, types);
    }
  };
  mySelector = manager.getTypeSelector();
  final JComponent component = mySelector.getComponent();
  if (component instanceof JComboBox) {
    if (isVoidReturn()) {
      mySelector.selectType(PsiType.VOID);
    }
    final JPanel returnTypePanel = new JPanel(new BorderLayout(2, 0));
    final JLabel label = new JLabel(RefactoringBundle.message("changeSignature.return.type.prompt"));
    returnTypePanel.add(label, BorderLayout.NORTH);
    returnTypePanel.add(component, BorderLayout.SOUTH);
    DialogUtil.registerMnemonic(label, component);
    ((JComboBox)component).addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e) {
        if (myGenerateAnnotations != null) {
          final PsiType selectedType = mySelector.getSelectedType();
          final boolean enabled = PsiUtil.resolveClassInType(selectedType) != null;
          if (!enabled) {
            myGenerateAnnotations.setSelected(false);
          }
          myGenerateAnnotations.setEnabled(enabled);
        }
        updateSignature();
      }
    });
    return returnTypePanel;
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:42,代码来源:ExtractMethodDialog.java

示例4: getReferences

import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
@NotNull
@Override
public PsiReference[] getReferences() {
  final PsiReference[] fromProviders = ReferenceProvidersRegistry.getReferencesFromProviders(this);
  return ArrayUtil.prepend(new JsonPropertyNameReference(this), fromProviders);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:JsonPropertyMixin.java

示例5: ValidationResult

import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
private ValidationResult(@NotNull Status status, @Nullable Message message, @NotNull String field, Object... messageParams) {
  myStatus = status;
  myMessage = message;
  myMessageParams = ArrayUtil.prepend(field, messageParams);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:WizardUtils.java


注:本文中的com.intellij.util.ArrayUtil.prepend方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。