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


Java ArrayUtil.indexOf方法代码示例

本文整理汇总了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();
}
 
开发者ID:zzz40500,项目名称:ADB-Duang,代码行数:27,代码来源:MyDeviceChooser.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:GrVariableBaseImpl.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:MapBackedFMap.java

示例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]);
        }
      }
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:CenterProperty.java

示例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);
}
 
开发者ID:nvlad,项目名称:yii2support,代码行数:18,代码来源:ClassUtils.java

示例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];
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:ClsRepositoryPsiElement.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:TableLayoutSpanOperation.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:JdkChooserPanel.java

示例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]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:CompressedDictionary.java

示例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();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:RangeBlinker.java

示例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());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:ProcessPopup.java

示例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());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:VirtualDirectoryImpl.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:AndroidAddStringResourceAction.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:35,代码来源:ResourceEditor.java

示例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);
                }
              }
            }
          }
        }
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:34,代码来源:PythonRegexpInjector.java


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