本文整理汇总了Java中com.intellij.util.ArrayUtil.indexOf方法的典型用法代码示例。如果您正苦于以下问题:Java ArrayUtil.indexOf方法的具体用法?Java ArrayUtil.indexOf怎么用?Java ArrayUtil.indexOf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.util.ArrayUtil
的用法示例。
在下文中一共展示了ArrayUtil.indexOf方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: refreshTable
import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
private void refreshTable() {
IDevice[] devices = myDetectedDevicesRef.get();
myDisplayedDevices = devices;
final IDevice[] selectedDevices = getSelectedDevices();
final TIntArrayList selectedRows = new TIntArrayList();
for (int i = 0; i < devices.length; i++) {
if (ArrayUtil.indexOf(selectedDevices, devices[i]) >= 0) {
selectedRows.add(i);
}
}
myProcessSelectionFlag = false;
myDeviceTable.setModel(new MyDeviceTableModel(devices));
if (selectedRows.size() == 0 && devices.length > 0) {
myDeviceTable.getSelectionModel().setSelectionInterval(0, 0);
}
for (int selectedRow : selectedRows.toNativeArray()) {
if (selectedRow < devices.length) {
myDeviceTable.getSelectionModel().addSelectionInterval(selectedRow, selectedRow);
}
}
fireSelectedDevicesChanged();
myProcessSelectionFlag = true;
updatePreviouslySelectedSerials();
}
示例2: getInitializerGroovy
import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
@Override
@Nullable
public GrExpression getInitializerGroovy() {
final PsiElement parent = getParent();
if (parent instanceof GrVariableDeclaration && ((GrVariableDeclaration)parent).isTuple()){
final GrVariableDeclaration tuple = (GrVariableDeclaration)parent;
final GrExpression initializer = tuple.getTupleInitializer();
if (initializer instanceof GrListOrMap){
final GrListOrMap listOrMap = (GrListOrMap)initializer;
final GrExpression[] initializers = listOrMap.getInitializers();
final int varNumber = ArrayUtil.indexOf(tuple.getVariables(), this);
if (initializers.length < varNumber + 1) return null;
return initializers[varNumber];
}
}
return GroovyPsiElementImpl.findExpressionChild(this);
}
示例3: minus
import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
@NotNull
@Override
public KeyFMap minus(@NotNull Key<?> key) {
int oldSize = size();
int keyCode = key.hashCode();
if (!containsKey(keyCode)) {
return this;
}
if (oldSize == ArrayBackedFMap.ARRAY_THRESHOLD + 1) {
int[] keys = keys();
Object[] values = getValues();
int i = ArrayUtil.indexOf(keys, keyCode);
keys = ArrayUtil.remove(keys, i);
values = ArrayUtil.remove(values, i);
return new ArrayBackedFMap(keys, values);
}
return new MapBackedFMap(this, keyCode);
}
示例4: setValue
import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
@Override
public void setValue(@NotNull final RadViewComponent component, Object value) throws Exception {
final int index = ArrayUtil.indexOf(COMBO_ITEMS, value);
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
XmlTag tag = component.getTag();
for (int i = 0; i < ATTR_ITEMS.length; i++) {
if (i == index) {
tag.setAttribute(ATTR_ITEMS[i], SdkConstants.NS_RESOURCES, "true");
}
else {
RadComponentOperations.deleteAttribute(tag, ATTR_ITEMS[i]);
}
}
}
});
}
示例5: indexForElementInParameterList
import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
/**
* Get index for PsiElement which is child in ArrayCreationExpression or Method
* @param psiElement
* @return
*/
public static int indexForElementInParameterList(PsiElement psiElement) {
PsiElement parent = psiElement.getParent();
if (parent == null) {
return -1;
}
if (parent instanceof ParameterList) {
return ArrayUtil.indexOf(((ParameterList) parent).getParameters(), psiElement);
}
return indexForElementInParameterList(parent);
}
示例6: getPrevSibling
import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
@Override
public PsiElement getPrevSibling() {
final PsiElement[] psiElements = getParent().getChildren();
final int i = ArrayUtil.indexOf(psiElements, this);
if (i < 1) {
return null;
}
return psiElements[i - 1];
}
示例7: getCellInfo
import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
@Override
protected Point getCellInfo() {
RadTableLayoutComponent tableComponent = (RadTableLayoutComponent)myComponent.getParent().getParent();
GridInfo gridInfo = tableComponent.getVirtualGridInfo();
int row = tableComponent.getChildren().indexOf(myComponent.getParent());
int column = ArrayUtil.indexOf(gridInfo.components[row], myComponent);
return new Point(column, row);
}
示例8: isCompatibleJdk
import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
private boolean isCompatibleJdk(final Sdk projectJdk, final @Nullable SdkType type) {
if (type != null) {
return projectJdk.getSdkType() == type;
}
if (myAllowedJdkTypes != null) {
return ArrayUtil.indexOf(myAllowedJdkTypes, projectJdk.getSdkType()) >= 0;
}
return true;
}
示例9: contains
import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
@Override
@Nullable
public Boolean contains(@NotNull String word) {
UnitBitSet bs = encoder.encode(word, false);
if (bs == Encoder.WORD_OF_ENTIRELY_UNKNOWN_LETTERS) return null;
if (bs == null) return false;
//TODO throw new EncodingException("WORD_WITH_SOME_UNKNOWN_LETTERS");
byte[] compressed = bs.pack();
int index = ArrayUtil.indexOf(lengths, compressed.length);
return index != -1 && contains(compressed, words[index]);
}
示例10: removeHighlights
import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
private void removeHighlights() {
MarkupModel markupModel = myEditor.getMarkupModel();
RangeHighlighter[] allHighlighters = markupModel.getAllHighlighters();
for (RangeHighlighter highlighter : myAddedHighlighters) {
if (ArrayUtil.indexOf(allHighlighters, highlighter) != -1) {
highlighter.dispose();
}
}
myAddedHighlighters.clear();
}
示例11: removeExtraSeparator
import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
private void removeExtraSeparator(final InlineProgressIndicator indicator) {
final Component[] all = myProcessBox.getComponents();
final int index = ArrayUtil.indexOf(all, indicator.getComponent());
if (index == -1) return;
if (index == 0 && all.length > 1) {
myProcessBox.remove(1);
} else if (all.length > 2 && index < all.length - 1) {
myProcessBox.remove(index + 1);
}
myProcessBox.remove(indicator.getComponent());
}
示例12: findChildById
import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
public VirtualFileSystemEntry findChildById(int id, boolean cachedOnly) {
if (ArrayUtil.indexOf(myData.myChildrenIds, id) >= 0) {
return VfsData.getFileById(id, this);
}
if (cachedOnly) return null;
String name = ourPersistence.getName(id);
return findChild(name, false, false, getFileSystem());
}
示例13: computeTargetType
import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
@Nullable
private static PsiType computeTargetType(PsiElement element) {
PsiMethodCallExpression call = PsiTreeUtil.getParentOfType(element, PsiMethodCallExpression.class);
if (call != null) {
PsiExpressionList expressionList = PsiTreeUtil.getParentOfType(element, PsiExpressionList.class, true);
if (expressionList != null) {
int index = ArrayUtil.indexOf(expressionList.getExpressions(), element);
if (index >= 0) {
PsiMethod resolved = call.resolveMethod();
if (resolved != null) {
PsiParameterList parameterList = resolved.getParameterList();
if (index >= 0 && index < parameterList.getParametersCount()) {
PsiParameter psiParameter = parameterList.getParameters()[index];
return psiParameter.getType();
}
}
}
}
}
else {
PsiLocalVariable variable = PsiTreeUtil.getParentOfType(element, PsiLocalVariable.class, false);
if (variable != null) {
return variable.getType();
}
}
return null;
}
示例14: getValue
import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
@Override
public Object getValue() {
JTextField text = getComboText();
if (text == null) {
return myBooleanResourceValue == null ? Boolean.toString(myCheckBox.isSelected()) : myBooleanResourceValue;
}
String value = text.getText();
if (value == StringsComboEditor.UNSET || StringUtil.isEmpty(value)) {
return null;
}
if (myIsDimension &&
!value.startsWith(PREFIX_RESOURCE_REF) &&
!value.endsWith(UNIT_DIP) &&
!value.equalsIgnoreCase(VALUE_WRAP_CONTENT) &&
!value.equalsIgnoreCase(VALUE_FILL_PARENT) &&
!value.equalsIgnoreCase(VALUE_MATCH_PARENT)) {
if (value.length() <= 2) {
return value + UNIT_DP;
}
int index = value.length() - 2;
String dimension = value.substring(index);
if (ArrayUtil.indexOf(ResourceRenderer.DIMENSIONS, dimension) == -1) {
return value + UNIT_DP;
}
}
// If it looks like a reference, don't escape it.
if (myIsString &&
(value.startsWith(PREFIX_RESOURCE_REF) || value.startsWith(PREFIX_THEME_REF)) &&
ResourceUrl.parse(value) == null) {
return "\\" + value;
}
return value;
}
示例15: getLanguagesToInject
import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
@Override
public void getLanguagesToInject(@NotNull MultiHostRegistrar registrar, @NotNull PsiElement context) {
final PsiElement contextParent = context.getParent();
if (PyInjectionUtil.getLargestStringLiteral(context) == context && contextParent instanceof PyArgumentList) {
final PyExpression[] args = ((PyArgumentList)contextParent).getArguments();
int index = ArrayUtil.indexOf(args, context);
PyCallExpression call = PsiTreeUtil.getParentOfType(context, PyCallExpression.class);
if (call != null) {
final PyExpression callee = call.getCallee();
if (callee instanceof PyReferenceExpression && canBeRegexpCall(callee)) {
final PsiPolyVariantReference ref = ((PyReferenceExpression)callee).getReference(PyResolveContext.noImplicits());
if (ref != null) {
final PsiElement element = ref.resolve();
if (element != null && ScopeUtil.getScopeOwner(element) instanceof PyFile &&
element.getContainingFile().getName().equals("re.py") && isRegexpMethod(element, index)) {
final Language language = isVerbose(call) ? PythonVerboseRegexpLanguage.INSTANCE : PythonRegexpLanguage.INSTANCE;
registrar.startInjecting(language);
final PyInjectionUtil.InjectionResult result = PyInjectionUtil.registerStringLiteralInjection(context, registrar);
if (result.isInjected()) {
registrar.doneInjecting();
if (!result.isStrict()) {
final PsiFile file = getInjectedFile(registrar);
if (file != null) {
file.putUserData(InjectedLanguageUtil.FRANKENSTEIN_INJECTION, Boolean.TRUE);
}
}
}
}
}
}
}
}
}