com.intellij.openapi.util.Couple Java Examples

The following examples show how to use com.intellij.openapi.util.Couple. 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: ChangeNamespaceProcessor.java    From consulo-csharp with Apache License 2.0 6 votes vote down vote up
@Nonnull
@Override
@RequiredReadAction
protected UsageInfo[] findUsages()
{
	List<UsageInfo> result = new ArrayList<>();
	Set<Couple<DotNetNamedElement>> children = CSharpMoveClassesUtil.findTypesAndNamespaces(myDeclaration);

	for(Couple<DotNetNamedElement> couple : children)
	{
		DotNetNamedElement second = couple.getSecond();

		for(PsiReference reference : ReferencesSearch.search(second, CSharpClassesMoveProcessor.mapScope(second)))
		{
			result.add(new CSharpClassesMoveProcessor.MyUsageInfo(reference.getElement(), couple, reference));
		}
	}

	return result.toArray(new UsageInfo[result.size()]);
}
 
Example #2
Source File: TranslationCompilerProjectMonitor.java    From consulo with Apache License 2.0 6 votes vote down vote up
@RequiredReadAction
public void updateCompileOutputInfoFile() {
  Map<String, Couple<String>> map = buildOutputRootsLayout();

  Element root = new Element("list");
  for (Map.Entry<String, Couple<String>> entry : map.entrySet()) {
    Element module = new Element("module");
    root.addContent(module);

    module.setAttribute("name", entry.getKey());

    String first = entry.getValue().getFirst();
    if (first != null) module.setAttribute("output-url", first);

    String second = entry.getValue().getSecond();
    if (second != null) module.setAttribute("test-output-url", second);
  }

  try {
    JDOMUtil.writeDocument(new Document(root), getOutputUrlsFile(), "\n");
  }
  catch (IOException e) {
    LOG.error(e);
  }
}
 
Example #3
Source File: TreeUtil.java    From consulo with Apache License 2.0 6 votes vote down vote up
public static Couple<ASTNode> findTopmostSiblingParents(ASTNode one, ASTNode two) {
  if (one == two) return Couple.of(null, null);

  LinkedList<ASTNode> oneParents = new LinkedList<>();
  while (one != null) {
    oneParents.add(one);
    one = one.getTreeParent();
  }
  LinkedList<ASTNode> twoParents = new LinkedList<>();
  while (two != null) {
    twoParents.add(two);
    two = two.getTreeParent();
  }

  do {
    one = oneParents.pollLast();
    two = twoParents.pollLast();
  }
  while (one == two && one != null);

  return Couple.of(one, two);
}
 
Example #4
Source File: FormatterImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nullable
private static Couple<Block> getBlockAtOffset(@Nullable Block parent, @Nonnull Block block, int offset) {
  TextRange textRange = block.getTextRange();
  int startOffset = textRange.getStartOffset();
  int endOffset = textRange.getEndOffset();
  if (startOffset == offset) {
    return Couple.of(parent, block);
  }
  if (startOffset > offset || endOffset < offset || block.isLeaf()) {
    return null;
  }
  for (Block subBlock : block.getSubBlocks()) {
    Couple<Block> result = getBlockAtOffset(block, subBlock, offset);
    if (result != null) {
      return result;
    }
  }
  return null;
}
 
Example #5
Source File: ByWord.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nonnull
private static Couple<List<Range>> splitIterable2Side(@Nonnull FairDiffIterable changes, int offset) {
  final List<Range> ranges1 = new ArrayList<>();
  final List<Range> ranges2 = new ArrayList<>();
  for (Range ch : changes.iterateUnchanged()) {
    if (ch.end2 <= offset) {
      ranges1.add(new Range(ch.start1, ch.end1, ch.start2, ch.end2));
    }
    else if (ch.start2 >= offset) {
      ranges2.add(new Range(ch.start1, ch.end1, ch.start2 - offset, ch.end2 - offset));
    }
    else {
      int len2 = offset - ch.start2;
      ranges1.add(new Range(ch.start1, ch.start1 + len2, ch.start2, offset));
      ranges2.add(new Range(ch.start1 + len2, ch.end1, 0, ch.end2 - offset));
    }
  }
  return Couple.of(ranges1, ranges2);
}
 
Example #6
Source File: AnnotateActionGroup.java    From consulo with Apache License 2.0 6 votes vote down vote up
public AnnotateActionGroup(@Nonnull List<AnnotationFieldGutter> gutters,
                           @Nonnull EditorGutterComponentEx gutterComponent,
                           @javax.annotation.Nullable Couple<Map<VcsRevisionNumber, Color>> bgColorMap) {
  super("View", true);
  final List<AnAction> actions = new ArrayList<>();
  for (AnnotationFieldGutter g : gutters) {
    if (g.getID() != null) {
      actions.add(new ShowHideAspectAction(g, gutterComponent));
    }
  }
  actions.add(AnSeparator.getInstance());
  if (bgColorMap != null) {
    actions.add(new ShowAnnotationColorsAction(gutterComponent));
  }
  actions.add(new ShowShortenNames(gutterComponent));
  myActions = actions.toArray(new AnAction[actions.size()]);
}
 
Example #7
Source File: CSharpClassesMoveProcessor.java    From consulo-csharp with Apache License 2.0 6 votes vote down vote up
@RequiredReadAction
private void notyfyNamespaces()
{
	for(PsiElement psiElement : myElementsToMove)
	{
		if(psiElement instanceof CSharpFile)
		{
			Set<Couple<DotNetNamedElement>> typesAndNamespaces = CSharpMoveClassesUtil.findTypesAndNamespaces(psiElement);

			for(Couple<DotNetNamedElement> couple : typesAndNamespaces)
			{
				DotNetNamedElement first = couple.getFirst();
				if(first instanceof CSharpNamespaceDeclaration)
				{
					notifyNamespaceChange((CSharpNamespaceDeclaration) first);
				}
			}
		}
	}
}
 
Example #8
Source File: BlockSupportImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nonnull
static ReparseResult reparse(@Nonnull final PsiFile file,
                             @Nonnull FileASTNode oldFileNode,
                             @Nonnull TextRange changedPsiRange,
                             @Nonnull final CharSequence newFileText,
                             @Nonnull final ProgressIndicator indicator,
                             @Nonnull CharSequence lastCommittedText) {
  PsiFileImpl fileImpl = (PsiFileImpl)file;

  final Couple<ASTNode> reparseableRoots = findReparseableRoots(fileImpl, oldFileNode, changedPsiRange, newFileText);
  if (reparseableRoots == null) {
    return makeFullParse(fileImpl, oldFileNode, newFileText, indicator, lastCommittedText);
  }
  ASTNode oldRoot = reparseableRoots.first;
  ASTNode newRoot = reparseableRoots.second;
  DiffLog diffLog = mergeTrees(fileImpl, oldRoot, newRoot, indicator, lastCommittedText);
  return new ReparseResult(diffLog, oldRoot, newRoot);
}
 
Example #9
Source File: TranslationCompilerProjectMonitor.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nonnull
public Map<String, Couple<String>> getLastOutputRootsLayout() {
  File file = getOutputUrlsFile();

  Map<String, Couple<String>> map = new HashMap<>();
  if (file.exists()) {
    try {
      Element root = JDOMUtil.load(file);

      for (Element module : root.getChildren()) {
        String name = module.getAttributeValue("name");
        String outputUrl = module.getAttributeValue("output-url");
        String testOutputUrl = module.getAttributeValue("test-output-url");

        map.put(name, Couple.of(outputUrl, testOutputUrl));
      }
    }
    catch (IOException | JDOMException e) {
      LOG.error(e);
    }
  }

  return map;
}
 
Example #10
Source File: TranslationCompilerProjectMonitor.java    From consulo with Apache License 2.0 6 votes vote down vote up
@RequiredReadAction
public Map<String, Couple<String>> buildOutputRootsLayout() {
  Map<String, Couple<String>> map = new LinkedHashMap<>();

  for (Module module : ModuleManager.getInstance(myProject).getModules()) {
    ModuleCompilerPathsManager moduleCompilerPathsManager = ModuleCompilerPathsManager.getInstance(module);

    final VirtualFile output = moduleCompilerPathsManager.getCompilerOutput(ProductionContentFolderTypeProvider.getInstance());
    final String outputUrl = output == null ? null : output.getUrl();
    final VirtualFile testsOutput = moduleCompilerPathsManager.getCompilerOutput(TestContentFolderTypeProvider.getInstance());
    final String testoutUrl = testsOutput == null ? null : testsOutput.getUrl();
    map.put(module.getName(), Couple.of(outputUrl, testoutUrl));
  }

  return map;
}
 
Example #11
Source File: LambdaBlockStatementCanReplacedByExpressionInspection.java    From consulo-csharp with Apache License 2.0 6 votes vote down vote up
@Override
@RequiredReadAction
public void invoke(@Nonnull Project project, @Nonnull PsiFile psiFile, @Nonnull PsiElement lambdaTemp, @Nonnull PsiElement unused)
{
	CSharpLambdaExpressionImpl expression = (CSharpLambdaExpressionImpl) lambdaTemp;

	Couple<PsiElement> removingInfo = getRemovingInfo(expression);
	if(removingInfo == null)
	{
		return;
	}

	PsiElement newBody = removingInfo.getSecond();

	PsiElement copied = newBody.copy();

	removingInfo.getFirst().replace(copied);
}
 
Example #12
Source File: OperatorEvaluator.java    From consulo-csharp with Apache License 2.0 6 votes vote down vote up
@Nullable
public static Object calcBinary(IElementType elementType, Object p1, Object p2)
{
	Couple<Class> key = Couple.<Class>of(p1.getClass(), p2.getClass());

	Map<IElementType, PairFunction<Object, Object, Object>> map = ourOperators.get(key);
	if(map == null)
	{
		return null;
	}

	PairFunction<Object, Object, Object> function = map.get(elementType);
	if(function == null)
	{
		return null;
	}
	return function.fun(p1, p2);
}
 
Example #13
Source File: VisualStudioTfvcClient.java    From azure-devops-intellij with MIT License 6 votes vote down vote up
/**
 * @return a pair of stdout and stderr.
 */
static Couple<List<String>> executeClientAndGetOutput(
        @NotNull Path clientPath,
        @Nullable Path workingDirectory,
        @NotNull List<String> arguments) throws IOException, InterruptedException {
    ourLogger.info("Executing VS client: " + clientPath + ", args: " + StringUtils.join(arguments, ','));
    List<String> command = new ArrayList<>(arguments.size() + 1);
    command.add(clientPath.toString());
    command.addAll(arguments);

    Process client = new ProcessBuilder()
            .command(command)
            .directory(workingDirectory == null ? null : workingDirectory.toFile())
            .start();

    List<String> output = readLines(client.getInputStream(), "stdout");
    List<String> errors = readLines(client.getErrorStream(), "stderr");

    int exitCode = client.waitFor();
    ourLogger.info("VS client exit code: " + exitCode);

    return Couple.of(output, errors);
}
 
Example #14
Source File: WholeLeftWindowWrapper.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
@Nonnull
@RequiredUIAccess
protected Layout buildRootLayout() {
  TwoComponentSplitLayout layout = TwoComponentSplitLayout.create(SplitLayoutPosition.HORIZONTAL);
  layout.setProportion(30);

  Couple<Component> compoents = createComponents();

  layout.setFirstComponent(compoents.getFirst());

  DockLayout baseRoot = DockLayout.create();
  baseRoot.center(compoents.getSecond());
  baseRoot.bottom(buildButtonsLayout());

  layout.setSecondComponent(baseRoot);
  return layout;
}
 
Example #15
Source File: ProtoFoldingBuilder.java    From protobuf-jetbrains-plugin with Apache License 2.0 6 votes vote down vote up
private static void collectDescriptorsRecursively(@NotNull ASTNode node,
                                                  @NotNull Document document,
                                                  @NotNull List<FoldingDescriptor> descriptors) {
    final IElementType type = node.getElementType();
    if (type == token(COMMENT)
            && spanMultipleLines(node, document)) {
        descriptors.add(new FoldingDescriptor(node, node.getTextRange()));
    }
    if (type == token(LINE_COMMENT)) {
        final Couple<PsiElement> commentRange = expandLineCommentsRange(node.getPsi());
        final int startOffset = commentRange.getFirst().getTextRange().getStartOffset();
        final int endOffset = commentRange.getSecond().getTextRange().getEndOffset();
        if (document.getLineNumber(startOffset) != document.getLineNumber(endOffset)) {
            descriptors.add(new FoldingDescriptor(node, new TextRange(startOffset, endOffset)));
        }
    }
    if (PROVIDERS.keySet().contains(type)
            && spanMultipleLines(node, document)) {
        descriptors.add(new FoldingDescriptor(node, node.getTextRange()));
    }
    for (ASTNode child : node.getChildren(null)) {
        collectDescriptorsRecursively(child, document, descriptors);
    }
}
 
Example #16
Source File: OclCommenter.java    From reasonml-idea-plugin with MIT License 6 votes vote down vote up
@NotNull
@Override
public Collection<? extends Couple<TextRange>> getCommentRangesToDelete(@NotNull CharSequence text) {
    Collection<Couple<TextRange>> ranges = new ArrayList<>();

    // should use nearest after all pairs (* *)

    int start = getNearest((String) text);
    TextRange prefixRange = expandRange(text, start, start + 2);

    int end = ((String) text).lastIndexOf("*)");
    TextRange suffixRange = expandRange(text, end, end + 2);

    ranges.add(Couple.of(prefixRange, suffixRange));
    return ranges;
}
 
Example #17
Source File: IdentifierHighlighterPass.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
private static Couple<Collection<TextRange>> getUsages(@Nonnull PsiElement target, PsiElement psiElement, boolean withDeclarations, boolean detectAccess) {
  List<TextRange> readRanges = new ArrayList<>();
  List<TextRange> writeRanges = new ArrayList<>();
  final ReadWriteAccessDetector detector = detectAccess ? ReadWriteAccessDetector.findDetector(target) : null;
  final FindUsagesManager findUsagesManager = ((FindManagerImpl)FindManager.getInstance(target.getProject())).getFindUsagesManager();
  final FindUsagesHandler findUsagesHandler = findUsagesManager.getFindUsagesHandler(target, true);
  final LocalSearchScope scope = new LocalSearchScope(psiElement);
  Collection<PsiReference> refs = findUsagesHandler != null
                                  ? findUsagesHandler.findReferencesToHighlight(target, scope)
                                  : ReferencesSearch.search(target, scope).findAll();
  for (PsiReference psiReference : refs) {
    if (psiReference == null) {
      LOG.error("Null reference returned, findUsagesHandler=" + findUsagesHandler + "; target=" + target + " of " + target.getClass());
      continue;
    }
    List<TextRange> destination;
    if (detector == null || detector.getReferenceAccess(target, psiReference) == ReadWriteAccessDetector.Access.Read) {
      destination = readRanges;
    }
    else {
      destination = writeRanges;
    }
    HighlightUsagesHandler.collectRangesToHighlight(psiReference, destination);
  }

  if (withDeclarations) {
    final TextRange declRange = HighlightUsagesHandler.getNameIdentifierRange(psiElement.getContainingFile(), target);
    if (declRange != null) {
      if (detector != null && detector.isDeclarationWriteAccess(target)) {
        writeRanges.add(declRange);
      }
      else {
        readRanges.add(declRange);
      }
    }
  }

  return Couple.<Collection<TextRange>>of(readRanges, writeRanges);
}
 
Example #18
Source File: ExtensionListenerByLayerListenerInvoker.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Inject
public ExtensionListenerByLayerListenerInvoker(@Nonnull Project project) {
  project.getMessageBus().connect().subscribe(ProjectTopics.MODULE_LAYERS, new ModuleRootLayerListener.Adapter() {
    @Override
    public void currentLayerChanged(@Nonnull final Module module,
                                    @Nonnull final String oldName,
                                    @Nonnull final ModuleRootLayer oldLayer,
                                    @Nonnull final String newName,
                                    @Nonnull final ModuleRootLayer newLayer) {

      final List<Couple<ModuleExtension>> list = new ArrayList<Couple<ModuleExtension>>();
      for (ModuleExtensionProviderEP providerEP : ModuleExtensionProviders.getProviders()) {
        MutableModuleExtension oldExtension = oldLayer.getExtensionWithoutCheck(providerEP.getKey());
        MutableModuleExtension newExtension = newLayer.getExtensionWithoutCheck(providerEP.getKey());

        if(oldExtension == null || newExtension == null) {
          continue;
        }

        if(oldExtension.isModified(newExtension)) {
          list.add(Couple.<ModuleExtension>of(oldExtension, newExtension));
        }
      }

      ApplicationManager.getApplication().invokeLater(new Runnable() {
        @Override
        public void run() {
          ModuleExtensionChangeListener moduleExtensionChangeListener = project.getMessageBus().syncPublisher(ModuleExtension.CHANGE_TOPIC);

          for (Couple<ModuleExtension> couple : list) {
            moduleExtensionChangeListener.beforeExtensionChanged(couple.getFirst(), couple.getSecond());
          }
        }
      }, ModalityState.NON_MODAL);
    }
  });
}
 
Example #19
Source File: RemoteRevisionsCache.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void invalidate(final UpdatedFiles updatedFiles) {
  final Map<String, RemoteDifferenceStrategy> strategyMap;
  synchronized (myLock) {
    strategyMap = new HashMap<>(myKinds);
  }
  final Collection<String> newForTree = new LinkedList<>();
  final Collection<String> newForUsual = new LinkedList<>();
  UpdateFilesHelper.iterateAffectedFiles(updatedFiles, new Consumer<Couple<String>>() {
    public void consume(final Couple<String> pair) {
      final String vcsName = pair.getSecond();
      RemoteDifferenceStrategy strategy = strategyMap.get(vcsName);
      if (strategy == null) {
        final AbstractVcs vcs = myVcsManager.findVcsByName(vcsName);
        if (vcs == null) return;
        strategy = vcs.getRemoteDifferenceStrategy();
      }
      if (RemoteDifferenceStrategy.ASK_TREE_PROVIDER.equals(strategy)) {
        newForTree.add(pair.getFirst());
      } else {
        newForUsual.add(pair.getFirst());
      }
    }
  });

  myRemoteRevisionsStateCache.invalidate(newForTree);
  myRemoteRevisionsNumbersCache.invalidate(newForUsual);
}
 
Example #20
Source File: BaseStructureConfigurableNoDaemon.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
@Override
public Couple<JComponent> createSplitterComponents() {
  reInitWholePanelIfNeeded();

  updateSelectionFromTree();

  return Couple.of(mySplitter.getFirstComponent(), mySplitter.getSecondComponent());
}
 
Example #21
Source File: ChangeListWorker.java    From consulo with Apache License 2.0 5 votes vote down vote up
protected void processInChange(Couple<String> key, Change change) {
  final LocalChangeList list = myInternalMap.get(key);
  if (list != null) {
    myIncludedListsCopies.put(list.getName(), list);
    myValidChanges.add(change);
  }
}
 
Example #22
Source File: StateStorageManagerImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
@Override
public Couple<Collection<VfsFileBasedStorage>> getCachedFileStateStorages(@Nonnull Collection<String> changed, @Nonnull Collection<String> deleted) {
  myStorageLock.lock();
  try {
    return Couple.of(getCachedFileStorages(changed), getCachedFileStorages(deleted));
  }
  finally {
    myStorageLock.unlock();
  }
}
 
Example #23
Source File: UpdateFilesHelper.java    From consulo with Apache License 2.0 5 votes vote down vote up
public static void iterateAffectedFiles(final UpdatedFiles updatedFiles, final Consumer<Couple<String>> callback) {
  final List<FileGroup> groups = updatedFiles.getTopLevelGroups();
  for (FileGroup group : groups) {
    iterateGroup(group, callback);

    // for changed on server
    for (FileGroup childGroup : group.getChildren()) {
      iterateGroup(childGroup, callback);
    }
  }
}
 
Example #24
Source File: CoreJarFileSystem.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
protected Couple<String> splitPath(@Nonnull String path) {
  int separator = path.indexOf("!/");
  if (separator < 0) {
    throw new IllegalArgumentException("Path in JarFileSystem must contain a separator: " + path);
  }
  String localPath = path.substring(0, separator);
  String pathInJar = path.substring(separator + 2);
  return Couple.of(localPath, pathInJar);
}
 
Example #25
Source File: UriUtil.java    From consulo with Apache License 2.0 5 votes vote down vote up
/**
 * Splits the url into 2 parts: the scheme ("http", for instance) and the rest of the URL. <br/>
 * Scheme separator is not included neither to the scheme part, nor to the url part. <br/>
 * The scheme can be absent, in which case empty string is written to the first item of the Pair.
 */
@Nonnull
public static Couple<String> splitScheme(@Nonnull String url) {
  ArrayList<String> list = Lists.newArrayList(Splitter.on(URLUtil.SCHEME_SEPARATOR).limit(2).split(url));
  if (list.size() == 1) {
    return Couple.of("", list.get(0));
  }
  return Couple.of(list.get(0), list.get(1));
}
 
Example #26
Source File: EditorPainter.java    From consulo with Apache License 2.0 5 votes vote down vote up
private void paintVirtualSelectionIfNecessary(int visualLine, int columnStart, float xStart, int y) {
  Couple<Integer> selectionRange = myVirtualSelectionMap.get(visualLine);
  if (selectionRange == null || selectionRange.second <= columnStart) return;
  float startX = selectionRange.first <= columnStart ? xStart : (float)myView.visualPositionToXY(new VisualPosition(visualLine, selectionRange.first)).getX();
  float endX = (float)Math.min(myClip.x + myClip.width, myView.visualPositionToXY(new VisualPosition(visualLine, selectionRange.second)).getX());
  paintBackground(myEditor.getColorsScheme().getColor(EditorColors.SELECTION_BACKGROUND_COLOR), startX, y, endX - startX);
}
 
Example #27
Source File: EditorEmptyTextPainter.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void paintEmptyText(@Nonnull final JComponent splitters, @Nonnull Graphics g) {
  UISettings.setupAntialiasing(g);
  g.setColor(new JBColor(Gray._80, Gray._160));
  g.setFont(JBUI.Fonts.label(16f));
  UIUtil.TextPainter painter = new UIUtil.TextPainter().withLineSpacing(1.8f);
  advertiseActions(splitters, painter);
  painter.draw(g, (width, height) -> {
    Dimension s = splitters.getSize();
    int w = (s.width - width) / 2;
    int h = (int)(s.height * heightRatio());
    return Couple.of(w, h);
  });
}
 
Example #28
Source File: IdeStatusBarImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void setInfo(@Nullable final String s, @Nullable final String requestor) {
  UIUtil.invokeLaterIfNeeded(() -> {
    if (myInfoAndProgressPanel != null) {
      Couple<String> pair = myInfoAndProgressPanel.setText(s, requestor);
      myInfo = pair.first;
      myRequestor = pair.second;
    }
  });
}
 
Example #29
Source File: MatcherConstructor.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nullable
public static Matcher createMatcher(@Nonnull String matcher) {
  Couple<String> pair = extract(matcher);
  if (pair == null) {
    return null;
  }

  StringMatcher methodNameMatcher = StringMatcherBuilder.create(pair.first);
  if (methodNameMatcher == null) {
    return null;
  }
  ParamMatcher paramMatcher = pair.second.isEmpty() ? paramNames -> true : createParametersMatcher(pair.second);

  return paramMatcher != null ? new Matcher(methodNameMatcher, paramMatcher) : null;
}
 
Example #30
Source File: SelectedDependenciesTableModel.java    From intellij-spring-assistant with MIT License 5 votes vote down vote up
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
    boolean hasFocus, int row, int column) {
  InplaceButton inplaceButton = new InplaceButton(
      new IconButton("Click to delete", DeleteContentFolder, DeleteContentFolderRollover),
      e -> {
      });
  Couple<Color> colors = UIUtil.getCellColors(table, isSelected, row, column);
  setForeground(colors.getFirst());
  setBackground(colors.getSecond());
  setEnabled(true);
  inplaceButton.setOpaque(false);
  return inplaceButton;
}