當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。