本文整理匯總了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);
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}