本文整理汇总了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);
}