Class IndexLockUtils

java.lang.Object
com._1c.g5.v8.dt.egit.ui.utils.IndexLockUtils

public class IndexLockUtils extends Object
Allows users to remove .git/index.lock on lock failures utils for processing uncaught EGIT/JGIT exceptions
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.eclipse.jgit.errors.LockFailedException
    returns LockFailedException if locked index is the cause of the CoreException
    static org.eclipse.jgit.errors.LockFailedException
    findLockFailedInCoreException(org.eclipse.core.runtime.CoreException exception)
    returns LockFailedException if locked index is the cause of the CoreException
    static String
    Constructs localized message for Index lock errors
    static String
    Constructs localized title for Index lock errors
    static boolean
    hasIndexLock(org.eclipse.jgit.lib.Repository repository)
    Checks if repository has index lock
    static void
    interactIndexLock(org.eclipse.swt.widgets.Shell shell, File indexFile)
    Processes Locked index by notifying user and allowing to remove repository lock
    static void
    interactIndexLockException(org.eclipse.swt.widgets.Shell shell, org.eclipse.jgit.errors.LockFailedException eLockFailed)
    Processes LockFailedException by notifying user and allowing to remove repository lock
    static boolean
    validateRepositoryIndexLock(org.eclipse.swt.widgets.Shell shell, org.eclipse.jgit.lib.Repository repository)
    Checks if repository has index lock and shows a dialog allowing to delete it.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • IndexLockUtils

      public IndexLockUtils()
  • Method Details

    • hasIndexLock

      public static boolean hasIndexLock(org.eclipse.jgit.lib.Repository repository)
      Checks if repository has index lock
      Parameters:
      repository - git repository, cannot be null
      Returns:
      true if repository index is locked, false - otherwise
    • validateRepositoryIndexLock

      public static boolean validateRepositoryIndexLock(org.eclipse.swt.widgets.Shell shell, org.eclipse.jgit.lib.Repository repository)
      Checks if repository has index lock and shows a dialog allowing to delete it. Blocks until the problem is resolved or ignored.
      Parameters:
      shell - parent shell for the dialog, cannot be null
      repository - git repository to check for lock, cannot be null
      Returns:
      false if repository is locked and operation should be aborted, true - if repository is not locked and the operation can be continued
    • interactIndexLockException

      public static void interactIndexLockException(org.eclipse.swt.widgets.Shell shell, org.eclipse.jgit.errors.LockFailedException eLockFailed)
      Processes LockFailedException by notifying user and allowing to remove repository lock
      Parameters:
      shell - parent shell for the dialog, cannot be null
      eLockFailed - JGIT exception with lock failed info to display, cannot be null
    • interactIndexLock

      public static void interactIndexLock(org.eclipse.swt.widgets.Shell shell, File indexFile)
      Processes Locked index by notifying user and allowing to remove repository lock
      Parameters:
      shell - parent shell for the dialog
      indexFile - repository index file path, cannot be null
    • findLockFailedInCoreException

      public static org.eclipse.jgit.errors.LockFailedException findLockFailedInCoreException(org.eclipse.core.runtime.CoreException exception)
      returns LockFailedException if locked index is the cause of the CoreException
      Parameters:
      exception - source exception to search, cannot be null
      Returns:
      LockFailedException cause from the source exception or null if exception was not found
    • findLockFailedCause

      public static org.eclipse.jgit.errors.LockFailedException findLockFailedCause(RuntimeException exception)
      returns LockFailedException if locked index is the cause of the CoreException
      Parameters:
      exception - source exception to search. usually JGitInternalException or RuntimeException, cannot be null
      Returns:
      LockFailedException cause from the source exception or null if LockFailedException not found inside of e
    • getIndexErrorTitle

      public static String getIndexErrorTitle()
      Constructs localized title for Index lock errors
      Returns:
      localized title, never null
    • getIndexErrorMessage

      public static String getIndexErrorMessage(File indexFile)
      Constructs localized message for Index lock errors
      Parameters:
      indexFile - repository index file path, cannot be null
      Returns:
      localized message for Index lock errors