com.intellij.util.PairConsumer Java Examples

The following examples show how to use com.intellij.util.PairConsumer. 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: P4CheckinEnvironment.java    From p4ic4idea with Apache License 2.0 6 votes vote down vote up
@Nullable
//@Override
@Deprecated
public RefreshableOnComponent createAdditionalOptionsPanel(CheckinProjectPanel panel, PairConsumer<Object, Object> additionalDataConsumer) {
    // #52 - we could be able to monitor panel.getCommitMessage(); to ensure
    // that there's a message, and when there isn't, disable the submit
    // button.
    // We can monitor the message (with a thread, disposing of it is
    // a bit of a bother, but it's doable).  However, disabling the button
    // currently requires:
    //  1. Grabbing the owning dialog object of the panel.
    //  2. Using reflection to make the protected "disableOKButton" method
    //     accessible and callable.
    // All of this means that this isn't a very good idea.
    // The panel has a "setWarning" method, but that doesn't do anything.

    return new P4OnCheckinPanel(project, panel, additionalDataConsumer);
}
 
Example #2
Source File: LegacyCompletionContributor.java    From consulo with Apache License 2.0 6 votes vote down vote up
private static void processReference(final CompletionResultSet result,
                                     final int startOffset,
                                     final PairConsumer<PsiReference, CompletionResultSet> consumer,
                                     final PsiReference reference) {
  PsiElement element = reference.getElement();
  final int offsetInElement = startOffset - element.getTextRange().getStartOffset();
  if (!ReferenceRange.containsOffsetInElement(reference, offsetInElement)) {
    return;
  }

  TextRange range = reference.getRangeInElement();
  try {
    final String prefix = element.getText().substring(range.getStartOffset(), offsetInElement);
    consumer.consume(reference, result.withPrefixMatcher(prefix));
  }
  catch (StringIndexOutOfBoundsException e) {
    LOG.error("Reference=" + reference +
              "; element=" + element + " of " + element.getClass() +
              "; range=" + range +
              "; offset=" + offsetInElement,
              e);
  }
}
 
Example #3
Source File: AbstractRefreshablePanel.java    From consulo with Apache License 2.0 6 votes vote down vote up
protected AbstractRefreshablePanel(final Project project, final String loadingTitle, final BackgroundTaskQueue queue) {
  myQueue = queue;
  myTicket = new Ticket();
  myDetailsPanel = new DetailsPanel();
  myDetailsPanel.loading();
  myDetailsPanel.layout();
  
  myDetailsLoader = new GenericDetailsLoader<Ticket, T>(new Consumer<Ticket>() {
    @Override
    public void consume(Ticket ticket) {
      final Loader loader = new Loader(project, loadingTitle, myTicket.copy());
      loader.runSteadily(new Consumer<Task.Backgroundable>() {
        @Override
        public void consume(Task.Backgroundable backgroundable) {
          myQueue.run(backgroundable);
        }
      });
    }
  }, new PairConsumer<Ticket, T>() {
    @Override
    public void consume(Ticket ticket, T t) {
      acceptData(t);
    }
  });
}
 
Example #4
Source File: ApplyPatchChange.java    From consulo with Apache License 2.0 6 votes vote down vote up
private void createStatusHighlighter() {
  int line1 = myPatchDeletionRange.start;
  int line2 = myPatchInsertionRange.end;

  Color color = getStatusColor();
  if (isResolved()) {
    color = ColorUtil.mix(color, myViewer.getPatchEditor().getGutterComponentEx().getBackground(), 0.6f);
  }

  String tooltip = getStatusText();

  EditorEx patchEditor = myViewer.getPatchEditor();
  Document document = patchEditor.getDocument();
  MarkupModelEx markupModel = patchEditor.getMarkupModel();
  TextRange textRange = DiffUtil.getLinesRange(document, line1, line2);

  RangeHighlighter highlighter = markupModel.addRangeHighlighter(textRange.getStartOffset(), textRange.getEndOffset(),
                                                                 HighlighterLayer.LAST, null, HighlighterTargetArea.LINES_IN_RANGE);

  PairConsumer<Editor, MouseEvent> clickHandler = getResultRange() != null ?
                                                  (e, event) -> myViewer.scrollToChange(this, Side.RIGHT, false) :
                                                  null;
  highlighter.setLineMarkerRenderer(LineStatusMarkerRenderer.createRenderer(line1, line2, color, tooltip, clickHandler));

  myHighlighters.add(highlighter);
}
 
Example #5
Source File: TodoCheckinHandler.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public ReturnResult beforeCheckin(@Nullable CommitExecutor executor, PairConsumer<Object, Object> additionalDataConsumer) {
  if (! myConfiguration.CHECK_NEW_TODO) return ReturnResult.COMMIT;
  if (DumbService.getInstance(myProject).isDumb()) {
    String todoName = VcsBundle.message("before.checkin.new.todo.check.title");
    if (Messages.showOkCancelDialog(myProject,
                                    todoName +
                                    " can't be performed while " + ApplicationNamesInfo.getInstance().getFullProductName() + " updates the indices in background.\n" +
                                    "You can commit the changes without running checks, or you can wait until indices are built.",
                                    todoName + " is not possible right now",
                                    "&Wait", "&Commit", null) == Messages.OK) {
      return ReturnResult.CANCEL;
    }
    return ReturnResult.COMMIT;
  }
  Collection<Change> changes = myCheckinProjectPanel.getSelectedChanges();
  TodoCheckinHandlerWorker worker = new TodoCheckinHandlerWorker(myProject, changes, myTodoFilter, true);

  Ref<Boolean> completed = Ref.create(Boolean.FALSE);
  ProgressManager.getInstance().run(new Task.Modal(myProject, "Looking for New and Edited TODO Items...", true) {
    @Override
    public void run(@Nonnull ProgressIndicator indicator) {
      indicator.setIndeterminate(true);
      worker.execute();
    }

    @Override
    public void onSuccess() {
      completed.set(Boolean.TRUE);
    }
  });
  if (completed.get() && (worker.getAddedOrEditedTodos().isEmpty() && worker.getInChangedTodos().isEmpty() &&
                          worker.getSkipped().isEmpty())) return ReturnResult.COMMIT;
  if (!completed.get()) return ReturnResult.CANCEL;
  return showResults(worker, executor);
}
 
Example #6
Source File: LineMarkersPass.java    From consulo with Apache License 2.0 5 votes vote down vote up
private static void queryLineMarkersForInjected(@Nonnull PsiElement element,
                                                @Nonnull final PsiFile containingFile,
                                                @Nonnull Set<? super PsiFile> visitedInjectedFiles,
                                                @Nonnull final PairConsumer<? super PsiElement, ? super LineMarkerInfo<PsiElement>> consumer) {
  final InjectedLanguageManager manager = InjectedLanguageManager.getInstance(containingFile.getProject());
  if (manager.isInjectedFragment(containingFile)) return;

  InjectedLanguageManager.getInstance(containingFile.getProject()).enumerateEx(element, containingFile, false, (injectedPsi, places) -> {
    if (!visitedInjectedFiles.add(injectedPsi)) return; // there may be several concatenated literals making the one injected file
    final Project project = injectedPsi.getProject();
    Document document = PsiDocumentManager.getInstance(project).getCachedDocument(injectedPsi);
    if (!(document instanceof DocumentWindow)) return;
    List<PsiElement> injElements = CollectHighlightsUtil.getElementsInRange(injectedPsi, 0, injectedPsi.getTextLength());
    final List<LineMarkerProvider> providers = getMarkerProviders(injectedPsi.getLanguage(), project);

    queryProviders(injElements, injectedPsi, providers, (injectedElement, injectedMarker) -> {
      GutterIconRenderer gutterRenderer = injectedMarker.createGutterRenderer();
      TextRange injectedRange = new TextRange(injectedMarker.startOffset, injectedMarker.endOffset);
      List<TextRange> editables = manager.intersectWithAllEditableFragments(injectedPsi, injectedRange);
      for (TextRange editable : editables) {
        TextRange hostRange = manager.injectedToHost(injectedPsi, editable);
        Image icon = gutterRenderer == null ? null : gutterRenderer.getIcon();
        GutterIconNavigationHandler<PsiElement> navigationHandler = injectedMarker.getNavigationHandler();
        LineMarkerInfo<PsiElement> converted =
                new LineMarkerInfo<>(injectedElement, hostRange, icon, injectedMarker.updatePass, e -> injectedMarker.getLineMarkerTooltip(), navigationHandler, GutterIconRenderer.Alignment.RIGHT);
        consumer.consume(injectedElement, converted);
      }
    });
  });
}
 
Example #7
Source File: StepIntersection.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void process(final Iterable<Data> data, final PairConsumer<Data, Area> consumer) {
  myDataIterator = data.iterator();

  if (! myDataIterator.hasNext() || noMoreAreas()) return;
  dataStep();
  initArea();
  while (! noMoreAreas()) {
    final boolean intersects = myAreaRange.intersects(myDataRange);
    if (intersects) {
      consumer.consume(myCurData, myCurArea);
    }
    // take next
    if (! myDataIterator.hasNext() && noMoreAreas()) break;
    if (! myDataIterator.hasNext()) {
      areaStep();
      continue;
    }
    if (noMoreAreas()) {
      dataStep();
      continue;
    }
    if (myDataRange.getEndOffset() < myAreaRange.getEndOffset()) {
      dataStep();
    } else {
      areaStep();
    }
  }
}
 
Example #8
Source File: PsiEquivalenceUtil.java    From consulo with Apache License 2.0 5 votes vote down vote up
private static void addRangeDuplicates(final PsiElement scope,
                                       final PsiElement first,
                                       final PsiElement last,
                                       final PairConsumer<PsiElement, PsiElement> result) {
  final PsiElement[] children = getFilteredChildren(scope, null, true);
  NextChild:
  for (int i = 0; i < children.length;) {
    PsiElement child = children[i];
    if (child != first) {
      int j = i;
      PsiElement next = first;
      do {
        if (!areElementsEquivalent(children[j], next)) break;
        j++;
        if (next == last) {
          result.consume(child, children[j - 1]);
          i = j + 1;
          continue NextChild;
        }
        next = PsiTreeUtil.skipSiblingsForward(next, PsiWhiteSpace.class);
      }
      while (true);

      if (i == j) {
        addRangeDuplicates(child, first, last, result);
      }
    }

    i++;
  }
}
 
Example #9
Source File: PsiEquivalenceUtil.java    From consulo with Apache License 2.0 5 votes vote down vote up
public static void findChildRangeDuplicates(PsiElement first, PsiElement last,
                                            final List<Pair<PsiElement, PsiElement>> result,
                                            PsiElement scope) {
  findChildRangeDuplicates(first, last, scope, new PairConsumer<PsiElement, PsiElement>() {
    @Override
    public void consume(final PsiElement start, final PsiElement end) {
      result.add(new Pair<PsiElement, PsiElement>(start, end));
    }
  });
}
 
Example #10
Source File: StartupUtil.java    From consulo with Apache License 2.0 5 votes vote down vote up
public static void prepareAndStart(String[] args, BiFunction<String, String, ImportantFolderLocker> lockFactory, PairConsumer<Boolean, CommandLineArgs> appStarter) {
  boolean newConfigFolder;
  CommandLineArgs commandLineArgs = CommandLineArgs.parse(args);

  if (commandLineArgs.isShowHelp()) {
    CommandLineArgs.printUsage();
    System.exit(ExitCodes.USAGE_INFO);
  }

  if (commandLineArgs.isShowVersion()) {
    ApplicationInfo infoEx = ApplicationInfo.getInstance();
    System.out.println(infoEx.getFullApplicationName());
    System.exit(ExitCodes.VERSION_INFO);
  }

  AppUIUtil.updateFrameClass();
  newConfigFolder = !new File(ContainerPathManager.get().getConfigPath()).exists();

  ActivationResult result = lockSystemFolders(lockFactory, args);
  if (result == ActivationResult.ACTIVATED) {
    System.exit(0);
  }
  else if (result != ActivationResult.STARTED) {
    System.exit(ExitCodes.INSTANCE_CHECK_FAILED);
  }

  Logger log = Logger.getInstance(StartupUtil.class);
  logStartupInfo(log);
  loadSystemLibraries(log);
  fixProcessEnvironment(log);

  appStarter.consume(newConfigFolder, commandLineArgs);
}
 
Example #11
Source File: TreeModelAdapter.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
public static TreeModelListener create(@Nonnull final PairConsumer<? super TreeModelEvent, ? super EventType> consumer) {
  return new TreeModelAdapter() {
    @Override
    protected void process(@Nonnull TreeModelEvent event, @Nonnull EventType type) {
      consumer.consume(event, type);
    }
  };
}
 
Example #12
Source File: QueueProcessor.java    From consulo with Apache License 2.0 5 votes vote down vote up
/**
 * Constructs a QueueProcessor with the given processor and autostart setting.
 * By default QueueProcessor starts processing when it receives the first element. Pass <code>false</code> to alternate its behavior.
 *
 * @param processor processor of queue elements.
 * @param autostart if <code>true</code> (which is by default), the queue will be processed immediately when it receives the first element.
 *                  If <code>false</code>, then it will wait for the {@link #start()} command.
 *                  After QueueProcessor has started once, autostart setting doesn't matter anymore: all other elements will be processed immediately.
 */

public QueueProcessor(@Nonnull PairConsumer<T, Runnable> processor,
                      boolean autostart,
                      @Nonnull ThreadToUse threadToUse,
                      @Nonnull Condition<?> deathCondition) {
  myProcessor = processor;
  myStarted = autostart;
  myThreadToUse = threadToUse;
  myDeathCondition = deathCondition;
}
 
Example #13
Source File: QueueProcessor.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
private static <T> PairConsumer<T, Runnable> wrappingProcessor(@Nonnull final Consumer<T> processor) {
  return new PairConsumer<T, Runnable>() {
    @Override
    public void consume(final T item, Runnable runnable) {
      runSafely(new Runnable() {
        @Override
        public void run() {
          processor.consume(item);
        }
      });
      runnable.run();
    }
  };
}
 
Example #14
Source File: TabLabel.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void doTranslate(PairConsumer<Integer, Integer> consumer) {
  final JBTabsPosition pos = myTabs.getTabsPosition();

  int dX = 0;
  int dXs = 0;
  int dY = 0;
  int dYs = 0;
  int selected = getSelectedOffset();
  int plain = getNonSelectedOffset();

  switch (pos) {
    case bottom:
      dY = -plain;
      dYs = -selected;
      break;
    case left:
      dX = plain;
      dXs = selected;
      break;
    case right:
      dX = -plain;
      dXs = -selected;
      break;
    case top:
      dY = plain;
      dYs = selected;
      break;
  }

  if (!myTabs.isDropTarget(myInfo)) {
    if (myTabs.getSelectedInfo() != myInfo) {
      consumer.consume(dX, dY);
    }
    else {
      consumer.consume(dXs, dYs);
    }
  }
}
 
Example #15
Source File: ImplementMemberChooseObject.java    From consulo-csharp with Apache License 2.0 5 votes vote down vote up
public ImplementMemberChooseObject(T declaration, PairConsumer<PsiElement, StringBuilder> additionalModifiersAppender, PairConsumer<PsiElement, StringBuilder> returnAppender, boolean canGenerateBlock)
{
	super(declaration);
	myAdditionalModifiersAppender = additionalModifiersAppender;
	myReturnAppender = returnAppender;
	myCanGenerateBlock = canGenerateBlock;
}
 
Example #16
Source File: P4CheckinEnvironment.java    From p4ic4idea with Apache License 2.0 5 votes vote down vote up
P4OnCheckinPanel(@NotNull Project project, @NotNull CheckinProjectPanel panel,
        final PairConsumer<Object, Object> additionalDataConsumer) {
    this.parentPanel = panel;
    this.dataConsumer = additionalDataConsumer;
    this.model = new SubmitModel(project);
    this.panel = new SubmitPanel(model);
    this.root = new WrapperPanel(this.panel.getRoot(), false, false);
    model.setSelectedCurrentChanges(panel.getSelectedChanges());
}
 
Example #17
Source File: XXXAccessorOwnerChooseMember.java    From consulo-csharp with Apache License 2.0 5 votes vote down vote up
public XXXAccessorOwnerChooseMember(CSharpXAccessorOwner declaration,
		PairConsumer<PsiElement, StringBuilder> additionalModifiersAppender,
		PairConsumer<PsiElement, StringBuilder> returnAppender,
		boolean canGenerateBlock)
{
	super(declaration, additionalModifiersAppender, returnAppender, canGenerateBlock);
}
 
Example #18
Source File: MethodChooseMember.java    From consulo-csharp with Apache License 2.0 5 votes vote down vote up
public MethodChooseMember(CSharpMethodDeclaration declaration,
		PairConsumer<PsiElement, StringBuilder> additionalModifiersAppender,
		PairConsumer<PsiElement, StringBuilder> returnAppender,
		boolean canGenerateBlock)
{
	super(declaration, additionalModifiersAppender, returnAppender, canGenerateBlock);
}
 
Example #19
Source File: TFSCheckinEnvironment.java    From azure-devops-intellij with MIT License 4 votes vote down vote up
@Nullable
    public RefreshableOnComponent createAdditionalOptionsPanel(final CheckinProjectPanel checkinProjectPanel,
                                                               PairConsumer<Object, Object> additionalDataConsumer) {
//        boolean isAffected = false;
//        for (File file : checkinProjectPanel.getFiles()) {
//            if (TFSVcs.isUnderTFS(VcsUtil.getFilePath(file), checkinProjectPanel.getProject())) {
//                isAffected = true;
//                break;
//            }
//        }
//        if (!isAffected) {
//            return null;
//        }
//
//        final JComponent panel = new JPanel();
//        panel.setLayout(new BorderLayout(5, 0));
//
//        myVcs.getCheckinData().messageLabel = new BoldLabel() {
//
//            @Override
//            public JToolTip createToolTip() {
//                JToolTip toolTip = new JToolTip() {{
//                    setUI(new MultiLineTooltipUI());
//                }};
//                toolTip.setComponent(this);
//                return toolTip;
//            }
//
//        };
//
//        panel.add(myVcs.getCheckinData().messageLabel, BorderLayout.WEST);
//
//        final JButton configureButton = new JButton("Configure...");
//        panel.add(configureButton, BorderLayout.EAST);
//
//        configureButton.addActionListener(new ActionListener() {
//
//            public void actionPerformed(final ActionEvent event) {
//                CheckinParameters copy = myVcs.getCheckinData().parameters.createCopy();
//
//                CheckinParametersDialog d = new CheckinParametersDialog(checkinProjectPanel.getProject(), copy);
//                if (d.showAndGet()) {
//                    myVcs.getCheckinData().parameters = copy;
//                    updateMessage(myVcs.getCheckinData());
//                }
//            }
//        });
//
//        return new TFSAdditionalOptionsPanel(panel, checkinProjectPanel, configureButton);
        return null;
    }
 
Example #20
Source File: VirtualDirectoryImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
public void createAndAddChildren(@Nonnull List<? extends ChildInfo> added, boolean markAllChildrenLoaded, @Nonnull PairConsumer<? super VirtualFile, ? super ChildInfo> fileCreated) {
  if (added.size() <= 1) {
    //noinspection ForLoopReplaceableByForEach
    for (int i = 0; i < added.size(); i++) {
      ChildInfo info = added.get(i);
      assert info.getId() > 0 : info;
      FileAttributes attributes = info.getFileAttributes();
      boolean isEmptyDirectory = info.getChildren() != null && info.getChildren().length == 0;
      VirtualFileSystemEntry file;
      synchronized (myData) {
        file = createChild(info.getId(), info.getNameId(), getFileSystem(), attributes, isEmptyDirectory);
      }
      addChild(file);
      fileCreated.consume(file, info);
    }
    if (markAllChildrenLoaded) {
      setChildrenLoaded();
    }
    return;
  }
  // optimization: when there are many children, it's cheaper to
  // merge sorted added and existing lists just like in merge sort
  final boolean caseSensitive = getFileSystem().isCaseSensitive();
  Comparator<ChildInfo> pairComparator = (p1, p2) -> compareNames(p1.getName(), p2.getName(), caseSensitive);
  added.sort(pairComparator);

  synchronized (myData) {
    int[] oldIds = myData.myChildrenIds;
    TIntArrayList mergedIds = new TIntArrayList(oldIds.length + added.size());
    //noinspection ForLoopReplaceableByForEach
    for (int i = 0; i < added.size(); i++) {
      ChildInfo info = added.get(i);
      assert info.getId() > 0 : info;
      FileAttributes attributes = info.getFileAttributes();
      boolean isEmptyDirectory = info.getChildren() != null && info.getChildren().length == 0;
      myData.removeAdoptedName(info.getName());
      VirtualFileSystemEntry file = createChild(info.getId(), info.getNameId(), getFileSystem(), attributes, isEmptyDirectory);
      fileCreated.consume(file, info);
    }
    List<ChildInfo> existingChildren = new AbstractList<ChildInfo>() {
      @Override
      public ChildInfo get(int index) {
        int id = oldIds[index];
        int nameId = mySegment.vfsData.getNameId(id);
        return new ChildInfoImpl(id, nameId, null, null, null/*irrelevant here*/);
      }

      @Override
      public int size() {
        return oldIds.length;
      }
    };
    ContainerUtil.processSortedListsInOrder(added, existingChildren, pairComparator, true, nextInfo -> mergedIds.add(nextInfo.getId()));
    myData.myChildrenIds = mergedIds.toNativeArray();

    if (markAllChildrenLoaded) {
      setChildrenLoaded();
    }
    assertConsistency(caseSensitive, added);
  }
}
 
Example #21
Source File: TodoCheckinHandlerWorker.java    From consulo with Apache License 2.0 4 votes vote down vote up
private void checkEditedFragment(TodoItem newTodoItem) {
  if (myBeforeFile == null) {
    myBeforeFile = ApplicationManager.getApplication().runReadAction(new Computable<PsiFile>() {
      @Override
      public PsiFile compute() {
        return myPsiFileFactory.createFileFromText("old" + myAfterFile.getName(), myAfterFile.getFileType(), myBeforeContent);
      }
    });
  }
  if (myOldItems == null)  {
    final Collection<IndexPatternOccurrence> all =
            LightIndexPatternSearch.SEARCH.createQuery(new IndexPatternSearch.SearchParameters(myBeforeFile, TodoIndexPatternProvider
                    .getInstance())).findAll();

    final TodoItemsCreator todoItemsCreator = new TodoItemsCreator();
    myOldItems = new ArrayList<TodoItem>();
    if (all.isEmpty()) {
      myAcceptor.addedOrEdited(newTodoItem);
      return;
    }
    for (IndexPatternOccurrence occurrence : all) {
      myOldItems.add(todoItemsCreator.createTodo(occurrence));
    }
    applyFilterAndRemoveDuplicates(myOldItems, myTodoFilter);
  }
  if (myOldTodoTexts == null) {
    final StepIntersection<LineFragment, TodoItem> intersection = new StepIntersection<LineFragment, TodoItem>(
            LineFragmentConvertor.getInstance(), TodoItemConvertor.getInstance(), myOldItems, new Getter<String>() {
      @Override
      public String get() {
        return myBeforeContent;
      }
    });
    myOldTodoTexts = new HashSet<String>();
    intersection.process(Collections.singletonList(myCurrentLineFragment), new PairConsumer<LineFragment, TodoItem>() {
      @Override
      public void consume(LineFragment lineFragment, TodoItem todoItem) {
        myOldTodoTexts.add(getTodoText(todoItem, myBeforeContent));
      }
    });
  }
  final String text = getTodoText(newTodoItem, myAfterContent);
  if (! myOldTodoTexts.contains(text)) {
    myAcceptor.addedOrEdited(newTodoItem);
  } else {
    myAcceptor.inChanged(newTodoItem);
  }
}
 
Example #22
Source File: SubmitModel.java    From p4ic4idea with Apache License 2.0 4 votes vote down vote up
public void saveState(@NotNull PairConsumer<Object, Object> dataConsumer) {
    dataConsumer.consume("jobIds", jobs);
    dataConsumer.consume("jobStatus", status);
}
 
Example #23
Source File: ModuleExtensionSdkBoxBuilder.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
@UsedInPlugin
public ModuleExtensionSdkBoxBuilder<T> postConsumer(@Nonnull PairConsumer<Sdk, Sdk> consumer) {
  myPostConsumer = consumer;
  return this;
}
 
Example #24
Source File: GenericDetailsLoader.java    From consulo with Apache License 2.0 4 votes vote down vote up
public void setCacheConsumer(final PairConsumer<Id, Data>  cacheConsumer) {
  myValueConsumer.setCacheConsumer(cacheConsumer);
}
 
Example #25
Source File: GenericDetailsLoader.java    From consulo with Apache License 2.0 4 votes vote down vote up
/**
 * @param loader - is called in AWT. Should call {@link #take} with data when ready. Also in AWT
 * @param valueConsumer - is called in AWT. passive, just benefits from details loading
 */
public GenericDetailsLoader(final Consumer<Id> loader, final PairConsumer<Id, Data> valueConsumer) {
  myLoader = loader;
  myValueConsumer = new ValueConsumer<Id, Data>(valueConsumer);
  myCurrentlySelected = new AtomicReference<Id>(null);
}
 
Example #26
Source File: ValueConsumer.java    From consulo with Apache License 2.0 4 votes vote down vote up
public void setCacheConsumer(PairConsumer<Id, Data> cacheConsumer) {
  myCacheConsumer = cacheConsumer;
}
 
Example #27
Source File: ValueConsumer.java    From consulo with Apache License 2.0 4 votes vote down vote up
protected ValueConsumer(PairConsumer<Id, Data> consumer) {
  myConsumer = consumer;
}
 
Example #28
Source File: CheckinEnvironment.java    From consulo with Apache License 2.0 4 votes vote down vote up
@javax.annotation.Nullable
RefreshableOnComponent createAdditionalOptionsPanel(CheckinProjectPanel panel, PairConsumer<Object, Object> additionalDataConsumer);
 
Example #29
Source File: PsiEquivalenceUtil.java    From consulo with Apache License 2.0 4 votes vote down vote up
public static void findChildRangeDuplicates(PsiElement first, PsiElement last, PsiElement scope,
                                            PairConsumer<PsiElement, PsiElement> consumer) {
  LOG.assertTrue(first.getParent() == last.getParent());
  LOG.assertTrue(!(first instanceof PsiWhiteSpace) && !(last instanceof PsiWhiteSpace));
  addRangeDuplicates(scope, first, last, consumer);
}
 
Example #30
Source File: CheckinHandler.java    From consulo with Apache License 2.0 2 votes vote down vote up
/**
 * Performs the before check-in processing when a custom commit executor is used. The method can use the
 * {@link com.intellij.openapi.vcs.CheckinProjectPanel} instance passed to
 * {@link BaseCheckinHandlerFactory#createHandler(com.intellij.openapi.vcs.CheckinProjectPanel, CommitContext)} to
 * get information about the files to be checked in.
 *
 * @param executor the commit executor, or null if the standard commit operation is executed.
 * @param additionalDataConsumer
 * @return the code indicating whether the check-in operation should be performed or aborted.
 */
public ReturnResult beforeCheckin(@Nullable CommitExecutor executor, PairConsumer<Object, Object> additionalDataConsumer) {
  return beforeCheckin();
}