private void setupReloadButton() {
    Project project = myEditorComponent.getProject();
    VirtualFile directory = myEditorComponent.getExistingRootDirectory();
    if (myEditorComponent.isNewLibrary() || project == null || directory == null) return;

    LibraryEditor editor = myEditorComponent.getLibraryEditor();
    if (!(editor instanceof ExistingLibraryEditor)) return;

    Library library = ((ExistingLibraryEditor)editor).getLibrary();
    if (!(library instanceof LibraryEx)) return;

    String toolTipText = JavaUiBundle.message("button.reload.description", directory.getPath());
    myReloadButton.setVisible(true);
    myReloadButton.setToolTipText(toolTipText);
    myReloadButton.addActionListener(e -> reloadLibraryDirectory(project, (LibraryEx)library));
  }
private void setupReloadButton()