本文整理汇总了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);
}
示例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()]);
}
示例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;
}
}
}
}
示例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());
}
示例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);
}
}
示例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);
}
示例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;
}
示例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();
}
示例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));
}
示例10: getNamedDomainObject
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Nullable
public String getNamedDomainObject() {
return hasNamedDomainObjectContainer() ? ContainerUtil.getLastItem(myParameterTypes) : null;
}