Package com._1c.g5.v8.dt.egit.ui.utils
Class IndexLockUtils
java.lang.Object
com._1c.g5.v8.dt.egit.ui.utils.IndexLockUtils
Allows users to remove .git/index.lock on lock failures
utils for processing uncaught EGIT/JGIT exceptions
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.eclipse.jgit.errors.LockFailedExceptionfindLockFailedCause(RuntimeException exception) returns LockFailedException if locked index is the cause of the CoreExceptionstatic org.eclipse.jgit.errors.LockFailedExceptionfindLockFailedInCoreException(org.eclipse.core.runtime.CoreException exception) returns LockFailedException if locked index is the cause of the CoreExceptionstatic StringgetIndexErrorMessage(File indexFile) Constructs localized message for Index lock errorsstatic StringConstructs localized title for Index lock errorsstatic booleanhasIndexLock(org.eclipse.jgit.lib.Repository repository) Checks if repository has index lockstatic voidinteractIndexLock(org.eclipse.swt.widgets.Shell shell, File indexFile) Processes Locked index by notifying user and allowing to remove repository lockstatic voidinteractIndexLockException(org.eclipse.swt.widgets.Shell shell, org.eclipse.jgit.errors.LockFailedException eLockFailed) Processes LockFailedException by notifying user and allowing to remove repository lockstatic booleanvalidateRepositoryIndexLock(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.
-
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 benull- 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 benullrepository- git repository to check for lock, cannot benull- 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 benulleLockFailed- JGIT exception with lock failed info to display, cannot benull
-
interactIndexLock
Processes Locked index by notifying user and allowing to remove repository lock- Parameters:
shell- parent shell for the dialogindexFile- repository index file path, cannot benull
-
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 benull- Returns:
- LockFailedException cause from the source exception
or
nullif 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 benull- Returns:
- LockFailedException cause from the source exception
or
nullif LockFailedException not found inside of e
-
getIndexErrorTitle
Constructs localized title for Index lock errors- Returns:
- localized title, never
null
-
getIndexErrorMessage
Constructs localized message for Index lock errors- Parameters:
indexFile- repository index file path, cannot benull- Returns:
- localized message for Index lock errors
-