Java Code Examples for com.intellij.util.containers.ContainerUtil#list()
The following examples show how to use
com.intellij.util.containers.ContainerUtil#list() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MergeRequestProcessor.java From consulo with Apache License 2.0 | 6 votes |
@Nonnull protected DefaultActionGroup collectToolbarActions(@Nullable List<AnAction> viewerActions) { DefaultActionGroup group = new DefaultActionGroup(); List<AnAction> navigationActions = ContainerUtil.<AnAction>list(new MyPrevDifferenceAction(), new MyNextDifferenceAction()); DiffUtil.addActionBlock(group, navigationActions); DiffUtil.addActionBlock(group, viewerActions); List<AnAction> requestContextActions = myRequest.getUserData(DiffUserDataKeys.CONTEXT_ACTIONS); DiffUtil.addActionBlock(group, requestContextActions); List<AnAction> contextActions = myContext.getUserData(DiffUserDataKeys.CONTEXT_ACTIONS); DiffUtil.addActionBlock(group, contextActions); return group; }
Example 2
Source File: DiffDrawUtil.java From consulo with Apache License 2.0 | 6 votes |
@Nonnull public List<RangeHighlighter> done() { // 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); highlighter.setLineMarkerRenderer(gutterRenderer); if (type == null || resolved) 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); }
Example 3
Source File: StructureFilteringStrategy.java From consulo with Apache License 2.0 | 6 votes |
@Nonnull private List<FilePath> getFilePathsUnder(@Nonnull ChangesBrowserNode<?> node) { List<FilePath> result = Collections.emptyList(); Object userObject = node.getUserObject(); if (userObject instanceof FilePath) { result = ContainerUtil.list(((FilePath)userObject)); } else if (userObject instanceof Module) { result = Arrays.stream(ModuleRootManager.getInstance((Module)userObject).getContentRoots()) .map(VcsUtil::getFilePath) .collect(Collectors.toList()); } return result; }
Example 4
Source File: CypherPreFormatter.java From jetbrains-plugin-graph-database-support with Apache License 2.0 | 5 votes |
@Override public void run() { if (myDocument != null) { for (AbstractCypherConverter converter : ContainerUtil.list( new KeywordCaseConverter(this, myDocument), new FunctionCaseConverter(this, myDocument), new QuotesConverter(this, myDocument) )) { myDocumentManager.doPostponedOperationsAndUnblockDocument(myDocument); myElement.accept(converter); delta += converter.getDelta(); myDocumentManager.commitDocument(myDocument); } } }
Example 5
Source File: SelectionBasedPsiElementInternalAction.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull protected List<T> getElement(@Nonnull Editor editor, @Nonnull PsiFile file) { final SelectionModel selectionModel = editor.getSelectionModel(); if (selectionModel.hasSelection()) { return ContainerUtil.list(getElementFromSelection(file, selectionModel)); } return getElementAtOffset(editor, file); }
Example 6
Source File: SimpleDiffRequest.java From consulo with Apache License 2.0 | 5 votes |
public SimpleDiffRequest(@javax.annotation.Nullable String title, @Nonnull DiffContent content1, @Nonnull DiffContent content2, @Nonnull DiffContent content3, @javax.annotation.Nullable String title1, @javax.annotation.Nullable String title2, @javax.annotation.Nullable String title3) { this(title, ContainerUtil.list(content1, content2, content3), ContainerUtil.list(title1, title2, title3)); }
Example 7
Source File: SimpleDiffRequest.java From consulo with Apache License 2.0 | 5 votes |
public SimpleDiffRequest(@javax.annotation.Nullable String title, @Nonnull DiffContent content1, @Nonnull DiffContent content2, @javax.annotation.Nullable String title1, @javax.annotation.Nullable String title2) { this(title, ContainerUtil.list(content1, content2), ContainerUtil.list(title1, title2)); }
Example 8
Source File: CacheDiffRequestChainProcessor.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull @Override protected List<AnAction> getNavigationActions() { return ContainerUtil.list( new MyPrevDifferenceAction(), new MyNextDifferenceAction(), new MyPrevChangeAction(), new MyNextChangeAction(), createGoToChangeAction() ); }
Example 9
Source File: DiffRequestProcessor.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull protected List<AnAction> getNavigationActions() { return ContainerUtil.<AnAction>list( new MyPrevDifferenceAction(), new MyNextDifferenceAction(), new MyPrevChangeAction(), new MyNextChangeAction() ); }
Example 10
Source File: PatchDiffRequestFactory.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull public static MergeRequest createMergeRequest(@Nullable Project project, @Nonnull Document document, @Nonnull VirtualFile file, @Nonnull String baseContent, @Nonnull String localContent, @Nonnull String patchedContent, @Nullable Consumer<MergeResult> callback) throws InvalidDiffRequestException { List<String> titles = ContainerUtil.list(null, null, null); List<String> contents = ContainerUtil.list(localContent, baseContent, patchedContent); return createMergeRequest(project, document, file, contents, null, titles, callback); }
Example 11
Source File: DiffSplitter.java From consulo with Apache License 2.0 | 5 votes |
@Override protected Divider createDivider() { return new DividerImpl() { @Override public void setOrientation(boolean isVerticalSplit) { removeAll(); setCursor(Cursor.getPredefinedCursor(Cursor.W_RESIZE_CURSOR)); List<JComponent> actionComponents = ContainerUtil.list(createActionComponent(myTopAction), createActionComponent(myBottomAction)); List<JComponent> syncComponents = DiffUtil.createSyncHeightComponents(actionComponents); GridBag bag = new GridBag(); if (syncComponents.get(0) != null) { add(syncComponents.get(0), bag.nextLine()); add(Box.createVerticalStrut(JBUI.scale(20)), bag.nextLine()); } add(new JLabel(AllIcons.General.SplitGlueH), bag.nextLine()); if (syncComponents.get(1) != null) { add(Box.createVerticalStrut(JBUI.scale(20)), bag.nextLine()); add(syncComponents.get(1), bag.nextLine()); } revalidate(); repaint(); } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); if (myPainter != null) myPainter.paint(g, this); } }; }
Example 12
Source File: MergeUtil.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull public static List<String> notNullizeContentTitles(@Nonnull 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); }
Example 13
Source File: TextMergeViewer.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull private static List<DiffContent> getDiffContents(@Nonnull 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); }
Example 14
Source File: DiffRequestFactoryImpl.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull @Override public MergeRequest createMergeRequestFromFiles(@Nullable Project project, @Nonnull VirtualFile output, @Nonnull 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); }
Example 15
Source File: SelectionBasedPsiElementInternalAction.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull protected List<T> getElementAtOffset(@Nonnull Editor editor, @Nonnull PsiFile file) { return ContainerUtil.list(PsiTreeUtil.findElementOfClassAtOffset(file, editor.getCaretModel().getOffset(), myClass, false)); }
Example 16
Source File: SimpleThreesideDiffViewer.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull @Override protected List<HighlightPolicy> getAvailableSettings() { return ContainerUtil.list(HighlightPolicy.BY_LINE, HighlightPolicy.BY_WORD); }
Example 17
Source File: TextMergeViewer.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull @Override protected List<HighlightPolicy> getAvailableSettings() { return ContainerUtil.list(HighlightPolicy.BY_LINE, HighlightPolicy.BY_WORD); }
Example 18
Source File: DefaultFluidNamespaceProvider.java From idea-php-typo3-plugin with MIT License | 4 votes |
@NotNull @Override public Collection<FluidNamespace> provideForElement(@NotNull PsiElement element) { return ContainerUtil.list(new FluidNamespace("f", "TYPO3/Fluid/ViewHelpers")); }
Example 19
Source File: MultipleFileMergeDialog.java From consulo with Apache License 2.0 | 4 votes |
private void showMergeDialog() { DiffRequestFactory requestFactory = DiffRequestFactory.getInstance(); Collection<VirtualFile> files = myTable.getSelection(); if (!beforeResolve(files)) { return; } for (final VirtualFile file : files) { final MergeData mergeData; try { mergeData = myProvider.loadRevisions(file); } catch (VcsException ex) { Messages.showErrorDialog(myRootPanel, "Error loading revisions to merge: " + ex.getMessage()); break; } if (mergeData.CURRENT == null || mergeData.LAST == null || mergeData.ORIGINAL == null) { Messages.showErrorDialog(myRootPanel, "Error loading revisions to merge"); break; } String leftTitle = myMergeDialogCustomizer.getLeftPanelTitle(file); String baseTitle = myMergeDialogCustomizer.getCenterPanelTitle(file); String rightTitle = myMergeDialogCustomizer.getRightPanelTitle(file, mergeData.LAST_REVISION_NUMBER); String title = myMergeDialogCustomizer.getMergeWindowTitle(file); final List<byte[]> byteContents = ContainerUtil.list(mergeData.CURRENT, mergeData.ORIGINAL, mergeData.LAST); List<String> contentTitles = ContainerUtil.list(leftTitle, baseTitle, rightTitle); Consumer<MergeResult> callback = new Consumer<MergeResult>() { @Override public void consume(final MergeResult result) { Document document = FileDocumentManager.getInstance().getCachedDocument(file); if (document != null) FileDocumentManager.getInstance().saveDocument(document); checkMarkModifiedProject(file); if (result != MergeResult.CANCEL) { ApplicationManager.getApplication().runWriteAction(new Runnable() { @Override public void run() { markFileProcessed(file, getSessionResolution(result)); } }); } } }; MergeRequest request; try { if (myProvider.isBinary(file)) { // respect MIME-types in svn request = requestFactory.createBinaryMergeRequest(myProject, file, byteContents, title, contentTitles, callback); } else { request = requestFactory.createMergeRequest(myProject, file, byteContents, title, contentTitles, callback); } } catch (InvalidDiffRequestException e) { LOG.error(e); Messages.showErrorDialog(myRootPanel, "Can't show merge dialog"); break; } DiffManager.getInstance().showMerge(myProject, request); } updateModelFromFiles(); }
Example 20
Source File: ApplyPatchViewer.java From consulo with Apache License 2.0 | 4 votes |
public ApplyPatchViewer(@Nonnull DiffContext context, @Nonnull ApplyPatchRequest request) { myProject = context.getProject(); myContext = context; myPatchRequest = request; DocumentContent resultContent = request.getResultContent(); DocumentContent patchContent = DiffContentFactory.getInstance().create(new DocumentImpl("", true), resultContent); myResultHolder = TextEditorHolder.create(myProject, resultContent); myPatchHolder = TextEditorHolder.create(myProject, patchContent); myResultEditor = myResultHolder.getEditor(); myPatchEditor = myPatchHolder.getEditor(); if (isReadOnly()) myResultEditor.setViewer(true); myPatchEditor.setViewer(true); DiffUtil.disableBlitting(myResultEditor); DiffUtil.disableBlitting(myPatchEditor); ((EditorMarkupModel)myResultEditor.getMarkupModel()).setErrorStripeVisible(false); myResultEditor.setVerticalScrollbarOrientation(EditorEx.VERTICAL_SCROLLBAR_LEFT); myPatchEditor.getGutterComponentEx().setForceShowRightFreePaintersArea(true); ((EditorMarkupModel)myPatchEditor.getMarkupModel()).setErrorStripeVisible(false); List<TextEditorHolder> holders = ContainerUtil.list(myResultHolder, myPatchHolder); List<EditorEx> editors = ContainerUtil.list(myResultEditor, myPatchEditor); JComponent resultTitle = DiffUtil.createTitle(myPatchRequest.getResultTitle()); JComponent patchTitle = DiffUtil.createTitle(myPatchRequest.getPatchTitle()); List<JComponent> titleComponents = DiffUtil.createSyncHeightComponents(ContainerUtil.list(resultTitle, patchTitle)); myContentPanel = new TwosideContentPanel(holders, titleComponents); myPanel = new SimpleDiffPanel(myContentPanel, this, myContext); myModel = new MyModel(myProject, myResultEditor.getDocument()); myFocusTrackerSupport = new FocusTrackerSupport.Twoside(holders); myFocusTrackerSupport.setCurrentSide(Side.LEFT); myPrevNextDifferenceIterable = new MyPrevNextDifferenceIterable(); myStatusPanel = new MyStatusPanel(); myFoldingModel = new MyFoldingModel(myResultEditor, this); new MyFocusOppositePaneAction().install(myPanel); new TextDiffViewerUtil.EditorActionsPopup(createEditorPopupActions()).install(editors, myPanel); new TextDiffViewerUtil.EditorFontSizeSynchronizer(editors).install(this); myEditorSettingsAction = new SetEditorSettingsAction(getTextSettings(), editors); myEditorSettingsAction.applyDefaults(); if (!isReadOnly()) { DiffUtil.registerAction(new ApplySelectedChangesAction(true), myPanel); DiffUtil.registerAction(new IgnoreSelectedChangesAction(true), myPanel); } ProxyUndoRedoAction.register(myProject, myResultEditor, myContentPanel); }