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


Java ContainerUtil.getLastItem方法代码示例

本文整理汇总了Java中com.intellij.util.containers.ContainerUtil.getLastItem方法的典型用法代码示例。如果您正苦于以下问题:Java ContainerUtil.getLastItem方法的具体用法?Java ContainerUtil.getLastItem怎么用?Java ContainerUtil.getLastItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.util.containers.ContainerUtil的用法示例。


在下文中一共展示了ContainerUtil.getLastItem方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doUpdateRanges

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
private void doUpdateRanges(int beforeChangedLine1,
                            int beforeChangedLine2,
                            int linesShift,
                            int beforeTotalLines) {
  List<Range> rangesBeforeChange = new ArrayList<Range>();
  List<Range> rangesAfterChange = new ArrayList<Range>();
  List<Range> changedRanges = new ArrayList<Range>();

  sortRanges(beforeChangedLine1, beforeChangedLine2, linesShift, rangesBeforeChange, changedRanges, rangesAfterChange);

  Range firstChangedRange = ContainerUtil.getFirstItem(changedRanges);
  Range lastChangedRange = ContainerUtil.getLastItem(changedRanges);

  if (firstChangedRange != null && firstChangedRange.getLine1() < beforeChangedLine1) {
    beforeChangedLine1 = firstChangedRange.getLine1();
  }
  if (lastChangedRange != null && lastChangedRange.getLine2() > beforeChangedLine2) {
    beforeChangedLine2 = lastChangedRange.getLine2();
  }

  doUpdateRanges(beforeChangedLine1, beforeChangedLine2, linesShift, beforeTotalLines,
                 rangesBeforeChange, changedRanges, rangesAfterChange);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:LineStatusTracker.java

示例2: getChildren

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
@Override
public AnAction[] getChildren(@Nullable AnActionEvent e) {
  ContentManager contentManager = myToolWindow.getContentManager();
  Content selectedContent = contentManager.getSelectedContent();
  JComponent contentComponent = selectedContent != null ? selectedContent.getComponent() : null;
  if (contentComponent == null) return EMPTY_ARRAY;
  List<AnAction> result = ContainerUtil.newSmartList();
  for (final ActionToolbar toolbar : iterateToolbars(contentComponent)) {
    JComponent c = toolbar.getComponent();
    if (c.isVisible() || !c.isValid()) continue;
    if (!result.isEmpty() && !(ContainerUtil.getLastItem(result) instanceof Separator)) {
      result.add(Separator.getInstance());
    }

    List<AnAction> actions = toolbar.getActions(false);
    for (AnAction action : actions) {
      if (action instanceof ToggleAction && !result.contains(action)) {
        result.add(action);
      }
      else if (action instanceof Separator) {
        if (!result.isEmpty() && !(ContainerUtil.getLastItem(result) instanceof Separator)) {
          result.add(Separator.getInstance());
        }
      }
    }
  }
  boolean popup = result.size() > 3;
  setPopup(popup);
  if (!popup && !result.isEmpty()) result.add(Separator.getInstance());
  return result.toArray(new AnAction[result.size()]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:33,代码来源:ToggleToolbarAction.java

示例3: removeParameter

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Override
public void removeParameter(@NotNull final String name) {
  for (Section section : myOriginalDocString.getParameterSections()) {
    final List<SectionField> sectionFields = section.getFields();
    for (SectionField field : sectionFields) {
      final Substring nameSub = ContainerUtil.find(field.getNamesAsSubstrings(), new Condition<Substring>() {
        @Override
        public boolean value(Substring substring) {
          return substring.toString().equals(name);
        }
      });
      if (nameSub != null) {
        if (field.getNamesAsSubstrings().size() == 1) {
          final int endLine = getFieldEndLine(field);
          if (sectionFields.size() == 1) {
            removeLinesAndSpacesAfter(getSectionStartLine(section), endLine + 1);
          }
          else {
            final int startLine = getFieldStartLine(field);
            if (ContainerUtil.getLastItem(sectionFields) == field) {
              removeLines(startLine, endLine + 1);
            }
            else {
              removeLinesAndSpacesAfter(startLine, endLine + 1);
            }
          }
        }
        else {
          final Substring wholeParamName = expandParamNameSubstring(nameSub);
          remove(wholeParamName.getStartOffset(), wholeParamName.getEndOffset());
        }
        break;
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:37,代码来源:SectionBasedDocStringUpdater.java

示例4: parseGenericField

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
protected Pair<SectionField, Integer> parseGenericField(int lineNum, int sectionIndent) {
  final Pair<List<Substring>, Integer> pair = parseIndentedBlock(lineNum, getSectionIndentationThreshold(sectionIndent));
  final Substring firstLine = ContainerUtil.getFirstItem(pair.getFirst());
  final Substring lastLine = ContainerUtil.getLastItem(pair.getFirst());
  if (firstLine != null && lastLine != null) {
    return Pair.create(new SectionField((Substring)null, null, firstLine.union(lastLine).trim()), pair.getSecond());
  }
  return Pair.create(null, pair.getSecond());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:SectionBasedDocString.java

示例5: processDynamicElements

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Override
public void processDynamicElements(@NotNull PsiType qualifierType,
                                   @Nullable PsiClass aClass,
                                   @NotNull PsiScopeProcessor processor,
                                   @NotNull PsiElement place,
                                   @NotNull ResolveState state) {
  if (!(aClass instanceof GroovyScriptClass)) {
    return;
  }

  PsiFile file = aClass.getContainingFile();
  if (file == null || !FileUtilRt.extensionEquals(file.getName(), GradleConstants.EXTENSION)
      || GradleConstants.SETTINGS_FILE_NAME.equals(file.getName())) return;

  List<String> methodInfo = ContainerUtilRt.newArrayList();
  for (GrMethodCall current = PsiTreeUtil.getParentOfType(place, GrMethodCall.class);
       current != null;
       current = PsiTreeUtil.getParentOfType(current, GrMethodCall.class)) {
    GrExpression expression = current.getInvokedExpression();
    if (expression == null) {
      continue;
    }
    String text = expression.getText();
    if (text != null) {
      methodInfo.add(text);
    }
  }

  final String methodCall = ContainerUtil.getLastItem(methodInfo);
  if (methodInfo.size() > 1 && BUILD_PROJECT_SCRIPT_BLOCKS.contains(methodCall)) {
    methodInfo.remove(methodInfo.size() - 1);
  }

  for (GradleMethodContextContributor contributor : GradleMethodContextContributor.EP_NAME.getExtensions()) {
    contributor.process(methodInfo, processor, state, place);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:38,代码来源:GradleScriptContributor.java

示例6: process

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Override
public void process(@NotNull List<String> methodCallInfo,
                    @NotNull PsiScopeProcessor processor,
                    @NotNull ResolveState state,
                    @NotNull PsiElement place) {
  if (methodCallInfo.size() > 2) {
    return;
  }

  if (methodCallInfo.size() == 2 && !BUILD_SCRIPT_BLOCKS.contains(methodCallInfo.get(1))) {
    return;
  }
  if (methodCallInfo.size() > 0) {
    String method = ContainerUtil.getLastItem(methodCallInfo);
    if (method != null && StringUtil.startsWith(method, SOURCE_SETS)) {
      mySourceSetsContributor.process(methodCallInfo, processor, state, place);
      return;
    }
    if (method != null && StringUtil.startsWith(method, DISTRIBUTIONS)) {
      myDistributionsContributor.process(methodCallInfo, processor, state, place);
      return;
    }
  }

  GroovyPsiManager psiManager = GroovyPsiManager.getInstance(place.getProject());
  GradleResolverUtil.processDeclarations(methodCallInfo.size() > 0 ? methodCallInfo.get(0) : null,
                                         psiManager, processor, state, place,
                                         GradleCommonClassNames.GRADLE_API_PROJECT);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:GradleRootContributor.java

示例7: getLastNumber

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Override
public long getLastNumber() {
  // in current implementation we just have one page with all loaded change lists - myListsEngine.getCurrent()
  CommittedChangeList lastLoadedList = ContainerUtil.getLastItem(myListsEngine.getCurrent());

  return lastLoadedList != null ? lastLoadedList.getNumber() : 0;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:ToBeMergedDialog.java

示例8: select

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Nullable
public <T> T select(@NotNull List<T> changes) {
  if (this == FIRST_CHANGE) return ContainerUtil.getFirstItem(changes);
  if (this == LAST_CHANGE) return ContainerUtil.getLastItem(changes);
  throw new IllegalStateException();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:DiffUserDataKeysEx.java

示例9: getStringParameter

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Nullable
protected static String getStringParameter(@NotNull String name, @NotNull QueryStringDecoder urlDecoder) {
  return ContainerUtil.getLastItem(urlDecoder.parameters().get(name));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:RestService.java

示例10: getNamedDomainObject

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Nullable
public String getNamedDomainObject() {
  return hasNamedDomainObjectContainer() ? ContainerUtil.getLastItem(myParameterTypes) : null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:AndroidDslContributor.java


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