本文整理匯總了Java中com.intellij.util.containers.ContainerUtil.list方法的典型用法代碼示例。如果您正苦於以下問題:Java ContainerUtil.list方法的具體用法?Java ContainerUtil.list怎麽用?Java ContainerUtil.list使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.util.containers.ContainerUtil
的用法示例。
在下文中一共展示了ContainerUtil.list方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: doTest
import com.intellij.util.containers.ContainerUtil; //導入方法依賴的package包/類
private void doTest(final String... candidatesNames) {
myFixture.configureByFile(getTestName(false) + ".java");
final AddMethodQualifierFix addMethodQualifierFix = getQuickFix();
if (candidatesNames.length == 0) {
assertNull(addMethodQualifierFix);
return;
}
assertNotNull(addMethodQualifierFix);
final Set<String> actualCandidatesNames = new TreeSet<String>(ContainerUtil.map(addMethodQualifierFix.getCandidates(), new Function<PsiNamedElement, String>() {
@Override
public String fun(final PsiNamedElement psiNamedElement) {
final String name = psiNamedElement.getName();
assertNotNull(name);
return name;
}
}));
final Set<String> expectedCandidatesNames = new TreeSet<String>(ContainerUtil.list(candidatesNames));
assertEquals(expectedCandidatesNames, actualCandidatesNames);
}
示例2: createHighlighter
import com.intellij.util.containers.ContainerUtil; //導入方法依賴的package包/類
@NotNull
public static List<RangeHighlighter> createHighlighter(@NotNull Editor editor, int start, int end, @NotNull TextDiffType type,
boolean ignored, @NotNull HighlighterTargetArea area, boolean resolved) {
TextAttributes attributes = start != end && !resolved ? getTextAttributes(type, editor, ignored) : null;
TextAttributes stripeAttributes = start != end && !resolved ? getStripeTextAttributes(type, editor) : null;
RangeHighlighter highlighter = editor.getMarkupModel()
.addRangeHighlighter(start, end, DEFAULT_LAYER, attributes, area);
installGutterRenderer(highlighter, type, ignored, resolved);
if (stripeAttributes == null) return Collections.singletonList(highlighter);
RangeHighlighter stripeHighlighter = editor.getMarkupModel()
.addRangeHighlighter(start, end, STRIPE_LAYER, stripeAttributes, area);
return ContainerUtil.list(highlighter, stripeHighlighter);
}
示例3: createLineMarker
import com.intellij.util.containers.ContainerUtil; //導入方法依賴的package包/類
@NotNull
public static List<RangeHighlighter> createLineMarker(@NotNull final Editor editor, int line, @NotNull final SeparatorPlacement placement,
@Nullable TextDiffType type, @NotNull LineSeparatorRenderer renderer, boolean applied) {
// We won't use addLineHighlighter as it will fail to add marker into empty document.
//RangeHighlighter highlighter = editor.getMarkupModel().addLineHighlighter(line, HighlighterLayer.SELECTION - 1, null);
int offset = DocumentUtil.getFirstNonSpaceCharOffset(editor.getDocument(), line);
RangeHighlighter highlighter = editor.getMarkupModel()
.addRangeHighlighter(offset, offset, LINE_MARKER_LAYER, null, HighlighterTargetArea.LINES_IN_RANGE);
highlighter.setLineSeparatorPlacement(placement);
highlighter.setLineSeparatorRenderer(renderer);
if (type == null || applied) return Collections.singletonList(highlighter);
TextAttributes stripeAttributes = getStripeTextAttributes(type, editor);
RangeHighlighter stripeHighlighter = editor.getMarkupModel()
.addRangeHighlighter(offset, offset, STRIPE_LAYER, stripeAttributes, HighlighterTargetArea.LINES_IN_RANGE);
return ContainerUtil.list(highlighter, stripeHighlighter);
}
示例4: convertToForthVersion
import com.intellij.util.containers.ContainerUtil; //導入方法依賴的package包/類
@NotNull
public static Element convertToForthVersion(Element state) throws StudyUnrecognizedFormatException {
Element taskManagerElement = state.getChild(MAIN_ELEMENT);
Element courseElement = getChildWithName(taskManagerElement, COURSE).getChild(COURSE_TITLED);
for (Element lesson : getChildList(courseElement, LESSONS)) {
for (Element task : getChildList(lesson, TASK_LIST)) {
Map<String, Element> taskFiles = getChildMap(task, TASK_FILES);
for (Map.Entry<String, Element> entry : taskFiles.entrySet()) {
Element taskFileElement = entry.getValue();
for (Element placeholder : getChildList(taskFileElement, ANSWER_PLACEHOLDERS)) {
Element valueElement = new Element(SUBTASK_INFO);
addChildMap(placeholder, SUBTASK_INFOS, Collections.singletonMap(String.valueOf(0), valueElement));
for (String childName : ContainerUtil.list(HINT, POSSIBLE_ANSWER, SELECTED, STATUS, TASK_TEXT)) {
Element child = getChildWithName(placeholder, childName, true);
if (child == null) {
continue;
}
valueElement.addContent(child.clone());
}
renameElement(getChildWithName(valueElement, TASK_TEXT), PLACEHOLDER_TEXT);
Element hint = getChildWithName(valueElement, HINT);
Element firstHint = new Element(OPTION).setAttribute(VALUE, hint.getAttributeValue(VALUE));
List<Element> newHints = new ArrayList<>();
newHints.add(firstHint);
newHints.addAll(ContainerUtil.map(getChildList(placeholder, ADDITIONAL_HINTS, true), Element::clone));
addChildList(valueElement, "hints", newHints);
}
}
}
}
return state;
}
示例5: createMergeRequestFromFiles
import com.intellij.util.containers.ContainerUtil; //導入方法依賴的package包/類
@NotNull
@Override
public MergeRequest createMergeRequestFromFiles(@Nullable Project project,
@NotNull VirtualFile output,
@NotNull List<VirtualFile> fileContents,
@Nullable Consumer<MergeResult> applyCallback) throws InvalidDiffRequestException {
String title = "Merge " + output.getPresentableUrl();
List<String> titles = ContainerUtil.list("Your Version", "Base Version", "Their Version");
return createMergeRequestFromFiles(project, output, fileContents, title, titles, applyCallback);
}
示例6: notNullizeContentTitles
import com.intellij.util.containers.ContainerUtil; //導入方法依賴的package包/類
@NotNull
public static List<String> notNullizeContentTitles(@NotNull List<String> mergeContentTitles) {
String left = StringUtil.notNullize(ThreeSide.LEFT.select(mergeContentTitles), "Your Version");
String base = StringUtil.notNullize(ThreeSide.BASE.select(mergeContentTitles), "Base Version");
String right = StringUtil.notNullize(ThreeSide.RIGHT.select(mergeContentTitles), "Server Version");
return ContainerUtil.list(left, base, right);
}
示例7: getDiffContents
import com.intellij.util.containers.ContainerUtil; //導入方法依賴的package包/類
@NotNull
private static List<DiffContent> getDiffContents(@NotNull TextMergeRequest mergeRequest) {
List<DocumentContent> contents = mergeRequest.getContents();
final DocumentContent left = ThreeSide.LEFT.select(contents);
final DocumentContent right = ThreeSide.RIGHT.select(contents);
final DocumentContent output = mergeRequest.getOutputContent();
return ContainerUtil.<DiffContent>list(left, output, right);
}
示例8: ThreeDiffSplitter
import com.intellij.util.containers.ContainerUtil; //導入方法依賴的package包/類
public ThreeDiffSplitter(@NotNull List<? extends JComponent> components) {
myDividers = ContainerUtil.list(new Divider(), new Divider());
myContents = components;
addAll(myContents);
addAll(myDividers);
}
示例9: getNavigationActions
import com.intellij.util.containers.ContainerUtil; //導入方法依賴的package包/類
@NotNull
protected List<AnAction> getNavigationActions() {
return ContainerUtil.<AnAction>list(
new MyPrevDifferenceAction(),
new MyNextDifferenceAction(),
new MyPrevChangeAction(),
new MyNextChangeAction()
);
}
示例10: getNavigationActions
import com.intellij.util.containers.ContainerUtil; //導入方法依賴的package包/類
@NotNull
@Override
protected List<AnAction> getNavigationActions() {
return ContainerUtil.list(
new MyPrevDifferenceAction(),
new MyNextDifferenceAction(),
new MyPrevChangeAction(),
new MyNextChangeAction(),
createGoToChangeAction()
);
}
示例11: SimpleDiffRequest
import com.intellij.util.containers.ContainerUtil; //導入方法依賴的package包/類
public SimpleDiffRequest(@Nullable String title,
@NotNull DiffContent content1,
@NotNull DiffContent content2,
@Nullable String title1,
@Nullable String title2) {
this(title, ContainerUtil.list(content1, content2), ContainerUtil.list(title1, title2));
}
示例12: actionPerformed
import com.intellij.util.containers.ContainerUtil; //導入方法依賴的package包/類
public void actionPerformed(AnActionEvent e) {
DataContext context = e.getDataContext();
VirtualFile[] files = CommonDataKeys.VIRTUAL_FILE_ARRAY.getData(context);
if (files == null || files.length != 3){
return;
}
DiffRequestFactory diffRequestFactory = DiffRequestFactory.getInstance();
try {
Project project = CommonDataKeys.PROJECT.getData(context);
String title = DiffBundle.message("merge.files.dialog.title");
List<String> titles = ContainerUtil.list(files[0].getPresentableUrl(),
files[1].getPresentableUrl(),
files[2].getPresentableUrl());
VirtualFile outputFile = files[1];
List<VirtualFile> contents = ContainerUtil.list(files[0], files[1], files[2]);
MergeRequest request = diffRequestFactory.createMergeRequestFromFiles(project, outputFile, contents, title, titles, null);
request.putUserData(DiffUserDataKeys.HELP_ID, "cvs.merge");
DiffManager.getInstance().showMerge(project, request);
}
catch (InvalidDiffRequestException err) {
Messages.showErrorDialog(err.getLocalizedMessage(), DiffBundle.message("merge.files.dialog.title"));
}
}
示例13: getElement
import com.intellij.util.containers.ContainerUtil; //導入方法依賴的package包/類
@NotNull
protected List<T> getElement(@NotNull Editor editor, @NotNull PsiFile file) {
final SelectionModel selectionModel = editor.getSelectionModel();
if (selectionModel.hasSelection()) {
return ContainerUtil.list(getElementFromSelection(file, selectionModel));
}
return getElementAtOffset(editor, file);
}
示例14: getValues
import com.intellij.util.containers.ContainerUtil; //導入方法依賴的package包/類
public Collection<V> getValues() {
return ContainerUtil.list((V[])myUnderlying.getValues());
}
示例15: processCommand
import com.intellij.util.containers.ContainerUtil; //導入方法依賴的package包/類
public void processCommand(@NotNull String[] args, @Nullable String currentDirectory) throws Exception {
Project project = getProject();
List<String> filePaths = Arrays.asList(args).subList(1, args.length);
List<VirtualFile> files = findFiles(filePaths, currentDirectory);
List<VirtualFile> contents = ContainerUtil.list(files.get(0), files.get(2), files.get(1)); // left, base, right
VirtualFile outputFile = files.get(files.size() - 1);
MergeRequest request = DiffRequestFactory.getInstance().createMergeRequestFromFiles(project, outputFile, contents, null);
DiffManagerEx.getInstance().showMergeBuiltin(project, request);
Document document = FileDocumentManager.getInstance().getCachedDocument(outputFile);
if (document != null) FileDocumentManager.getInstance().saveDocument(document);
}