Verified Owner
Top Inners Fields Constructors Methods
org.jabref.gui.git

public Class GitCommitDialogViewModel

extends AbstractViewModel
Class Inheritance
Annotations
@NullMarked
Imports
java.io.IOException, java.nio.file.Path, java.util.Optional, javafx.beans.property.BooleanProperty, .SimpleBooleanProperty, .SimpleStringProperty, .StringProperty, org.jabref.gui.AbstractViewModel, .DialogService, .StateManager, org.jabref.logic.JabRefException, org.jabref.logic.git.GitHandler, .GitSyncService, org.jabref.logic.git.diff.GitDiffChecker, org.jabref.logic.git.model.PushResult, org.jabref.logic.git.status.GitStatusChecker, .GitStatusSnapshot, org.jabref.logic.git.util.GitExceptionUtil, .GitHandlerRegistry, org.jabref.logic.importer.ImportFormatPreferences, org.jabref.logic.l10n.Localization, org.jabref.logic.util.BackgroundTask, .TaskExecutor, org.jabref.logic.util.strings.StringUtil, org.jabref.model.database.BibDatabaseContext, org.jabref.model.util.FileUpdateMonitor, de.saxsys.mvvmfx.utils.validation.FunctionBasedValidator, de.saxsys.mvvmfx.utils.validation.ValidationMessage, de.saxsys.mvvmfx.utils.validation.ValidationStatus, de.saxsys.mvvmfx.utils.validation.Validator, org.eclipse.jgit.api.errors.GitAPIException, org.jspecify.annotations.NullMarked, org.slf4j.Logger, .LoggerFactory

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static enum
GitCommitDialogViewModel.CommitOutcome

What a finished dialog action actually achieved, so the user can be told the truth about it.

public static record
private static class
private static record
private static record

Field Summary

Modifier and TypeField and Description
private final BooleanProperty
private final StringProperty
private final de.saxsys.mvvmfx.utils.validation.Validator
private final DialogService
private final FileUpdateMonitor
private final GitHandlerRegistry
private final ImportFormatPreferences
private static final Logger
private final StateManager
private final TaskExecutor

Constructor Summary

AccessConstructor and Description
public
GitCommitDialogViewModel(StateManager stateManager, DialogService dialogService, TaskExecutor taskExecutor, GitHandlerRegistry gitHandlerRegistry, ImportFormatPreferences importFormatPreferences, FileUpdateMonitor fileUpdateMonitor)

Method Summary

Modifier and TypeMethod and Description
public BooleanProperty
public void
commit(Runnable onSuccess)

private void
commitAction(Runnable onSuccess, org.jabref.logic.util.BackgroundTask<GitCommitDialogViewModel.CommitOutcome> task)

public void
private org.jabref.logic.util.BackgroundTask<GitCommitDialogViewModel.CommitOutcome>
private boolean
private String
public StringProperty
public de.saxsys.mvvmfx.utils.validation.ValidationStatus
private void
private org.jabref.logic.util.BackgroundTask<GitCommitDialogViewModel.CommitOutcome>
private GitCommitDialogViewModel.DiffDatabases
public org.jabref.logic.util.BackgroundTask<GitCommitDialogViewModel.DiffDatabases>
private void
private GitCommitDialogViewModel.CommitOutcome
private GitCommitDialogViewModel.TrackedFile
private String
private String
private GitCommitDialogViewModel.CommitOutcome
pushTo(GitCommitDialogViewModel.ResolvedRepository repository, boolean committedNow)

private GitCommitDialogViewModel.ResolvedRepository

Field Detail

amendback to summary
private final BooleanProperty amend
commitMessageback to summary
private final StringProperty commitMessage
commitMessageValidatorback to summary
private final de.saxsys.mvvmfx.utils.validation.Validator commitMessageValidator
dialogServiceback to summary
private final DialogService dialogService
fileUpdateMonitorback to summary
private final FileUpdateMonitor fileUpdateMonitor
gitHandlerRegistryback to summary
private final GitHandlerRegistry gitHandlerRegistry
importFormatPreferencesback to summary
private final ImportFormatPreferences importFormatPreferences
LOGGERback to summary
private static final Logger LOGGER
stateManagerback to summary
private final StateManager stateManager
taskExecutorback to summary
private final TaskExecutor taskExecutor

Constructor Detail

GitCommitDialogViewModelback to summary
public GitCommitDialogViewModel(StateManager stateManager, DialogService dialogService, TaskExecutor taskExecutor, GitHandlerRegistry gitHandlerRegistry, ImportFormatPreferences importFormatPreferences, FileUpdateMonitor fileUpdateMonitor)

Method Detail

amendPropertyback to summary
public BooleanProperty amendProperty()
commitback to summary
public void commit(Runnable onSuccess)
commitActionback to summary
private void commitAction(Runnable onSuccess, org.jabref.logic.util.BackgroundTask<GitCommitDialogViewModel.CommitOutcome> task)
commitAndPushback to summary
public void commitAndPush(Runnable onSuccess)
commitAndPushTaskback to summary
private org.jabref.logic.util.BackgroundTask<GitCommitDialogViewModel.CommitOutcome> commitAndPushTask()
commitCurrentback to summary
private boolean commitCurrent(GitCommitDialogViewModel.ResolvedRepository repository) throws GitAPIException, IOException
commitMessageOrDefaultback to summary
private String commitMessageOrDefault()
commitMessagePropertyback to summary
public StringProperty commitMessageProperty()
commitMessageValidationback to summary
public de.saxsys.mvvmfx.utils.validation.ValidationStatus commitMessageValidation()
commitOnback to summary
private void commitOn(GitCommitDialogViewModel.ResolvedRepository repository) throws org.jabref.logic.JabRefException, GitAPIException, IOException
commitTaskback to summary
private org.jabref.logic.util.BackgroundTask<GitCommitDialogViewModel.CommitOutcome> commitTask()
computeDiffDatabasesback to summary
private GitCommitDialogViewModel.DiffDatabases computeDiffDatabases() throws org.jabref.logic.JabRefException, IOException
diffTaskback to summary
public org.jabref.logic.util.BackgroundTask<GitCommitDialogViewModel.DiffDatabases> diffTask()
doCommitback to summary
private void doCommit() throws org.jabref.logic.JabRefException, GitAPIException, IOException
doCommitAndPushback to summary
private GitCommitDialogViewModel.CommitOutcome doCommitAndPush() throws org.jabref.logic.JabRefException, GitAPIException, IOException
getTrackedBibFileback to summary
private GitCommitDialogViewModel.TrackedFile getTrackedBibFile() throws org.jabref.logic.JabRefException
localizedFailureMessageback to summary
private String localizedFailureMessage(Throwable throwable)
messageForback to summary
private String messageFor(GitCommitDialogViewModel.CommitOutcome outcome)
pushToback to summary
private GitCommitDialogViewModel.CommitOutcome pushTo(GitCommitDialogViewModel.ResolvedRepository repository, boolean committedNow) throws PushFailedException
resolveRepositoryback to summary
private GitCommitDialogViewModel.ResolvedRepository resolveRepository() throws org.jabref.logic.JabRefException
org.jabref.gui.git back to summary

private final Enum GitCommitDialogViewModel.CommitOutcome

extends Enum<GitCommitDialogViewModel.CommitOutcome>
Class Inheritance

What a finished dialog action actually achieved, so the user can be told the truth about it.

Field Summary

Modifier and TypeField and Description
public static final GitCommitDialogViewModel.CommitOutcome
public static final GitCommitDialogViewModel.CommitOutcome
public static final GitCommitDialogViewModel.CommitOutcome
public static final GitCommitDialogViewModel.CommitOutcome

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static GitCommitDialogViewModel.CommitOutcome
public static GitCommitDialogViewModel.CommitOutcome[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

COMMITTEDback to summary
public static final GitCommitDialogViewModel.CommitOutcome COMMITTED
COMMITTED_AND_PUSHEDback to summary
public static final GitCommitDialogViewModel.CommitOutcome COMMITTED_AND_PUSHED
NOTHING_TO_PUSHback to summary
public static final GitCommitDialogViewModel.CommitOutcome NOTHING_TO_PUSH
PUSHEDback to summary
public static final GitCommitDialogViewModel.CommitOutcome PUSHED

Constructor Detail

CommitOutcomeback to summary
private CommitOutcome()

Method Detail

valueOfback to summary
public static GitCommitDialogViewModel.CommitOutcome valueOf(String name)
valuesback to summary
public static GitCommitDialogViewModel.CommitOutcome[] values()
org.jabref.gui.git back to summary

public final Record GitCommitDialogViewModel.DiffDatabases

extends Record
Class Inheritance
Record Components
headDatabase:BibDatabaseContext 
workingTreeDatabase:BibDatabaseContext 

Field Summary

Modifier and TypeField and Description
private final BibDatabaseContext
headDatabase

Record Component accessed by headDatabase().

private final BibDatabaseContext
workingTreeDatabase

Record Component accessed by workingTreeDatabase().

Constructor Summary

AccessConstructor and Description
public
DiffDatabases(BibDatabaseContext headDatabase, BibDatabaseContext workingTreeDatabase)

Method Summary

Modifier and TypeMethod and Description
public final boolean
equals(Object o)

Implements abstract java.lang.Record.equals.

Indicates whether some other object is "equal to" this one.

public final int
hashCode()

Implements abstract java.lang.Record.hashCode.

Returns a hash code value for the record.

public BibDatabaseContext
headDatabase()

Record Component getter of headDatabase.

public final String
toString()

Implements abstract java.lang.Record.toString.

Returns a string representation of the record.

public BibDatabaseContext
workingTreeDatabase()

Record Component getter of workingTreeDatabase.

Field Detail

headDatabaseback to summary
private final BibDatabaseContext headDatabase

Record Component accessed by headDatabase().

workingTreeDatabaseback to summary
private final BibDatabaseContext workingTreeDatabase

Record Component accessed by workingTreeDatabase().

Constructor Detail

DiffDatabasesback to summary
public DiffDatabases(BibDatabaseContext headDatabase, BibDatabaseContext workingTreeDatabase)

Method Detail

equalsback to summary
public final boolean equals(Object o)

Implements abstract java.lang.Record.equals.

Doc from java.lang.Record.equals.

Indicates whether some other object is "equal to" this one. In addition to the general contract of Object.equals, record classes must further obey the invariant that when a record instance is "copied" by passing the result of the record component accessor methods to the canonical constructor, as follows:

    R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
hashCodeback to summary
public final int hashCode()

Implements abstract java.lang.Record.hashCode.

Doc from java.lang.Record.hashCode.

Returns a hash code value for the record. Obeys the general contract of Object.hashCode. For records, hashing behavior is constrained by the refined contract of Record.equals, so that any two records created from the same components must have the same hash code.

headDatabaseback to summary
public BibDatabaseContext headDatabase()

Record Component getter of headDatabase.

toStringback to summary
public final String toString()

Implements abstract java.lang.Record.toString.

Doc from java.lang.Record.toString.

Returns a string representation of the record. In accordance with the general contract of Object#toString(), the toString method returns a string that "textually represents" this record. The result should be a concise but informative representation that is easy for a person to read.

In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves.

workingTreeDatabaseback to summary
public BibDatabaseContext workingTreeDatabase()

Record Component getter of workingTreeDatabase.

org.jabref.gui.git back to summary

private Class GitCommitDialogViewModel.PushFailedException

extends JabRefException
Class Inheritance

Constructor Summary

AccessConstructor and Description
pack-priv
PushFailedException(Throwable cause, boolean committedNow)

Claiming "the commit was saved" is only honest when this attempt actually created one: the push may also fail with nothing newly committed (e.g. retrying after a failed push).

Method Summary

Modifier and TypeMethod and Description
private static String

Constructor Detail

PushFailedExceptionback to summary
pack-priv PushFailedException(Throwable cause, boolean committedNow)

Claiming "the commit was saved" is only honest when this attempt actually created one: the push may also fail with nothing newly committed (e.g. retrying after a failed push).

Method Detail

causeMessageback to summary
private static String causeMessage(Throwable cause)
org.jabref.gui.git back to summary

private final Record GitCommitDialogViewModel.ResolvedRepository

extends Record
Class Inheritance
Record Components
database:BibDatabaseContext 
bibFilePath:Path 
gitHandler:GitHandler 

Field Summary

Modifier and TypeField and Description
private final Path
bibFilePath

Record Component accessed by bibFilePath().

private final BibDatabaseContext
database

Record Component accessed by database().

private final GitHandler
gitHandler

Record Component accessed by gitHandler().

Constructor Summary

AccessConstructor and Description
private
ResolvedRepository(BibDatabaseContext database, Path bibFilePath, GitHandler gitHandler)

Method Summary

Modifier and TypeMethod and Description
public Path
bibFilePath()

Record Component getter of bibFilePath.

public BibDatabaseContext
database()

Record Component getter of database.

public final boolean
equals(Object o)

Implements abstract java.lang.Record.equals.

Indicates whether some other object is "equal to" this one.

public GitHandler
gitHandler()

Record Component getter of gitHandler.

public final int
hashCode()

Implements abstract java.lang.Record.hashCode.

Returns a hash code value for the record.

public final String
toString()

Implements abstract java.lang.Record.toString.

Returns a string representation of the record.

Field Detail

bibFilePathback to summary
private final Path bibFilePath

Record Component accessed by bibFilePath().

databaseback to summary
private final BibDatabaseContext database

Record Component accessed by database().

gitHandlerback to summary
private final GitHandler gitHandler

Record Component accessed by gitHandler().

Constructor Detail

ResolvedRepositoryback to summary
private ResolvedRepository(BibDatabaseContext database, Path bibFilePath, GitHandler gitHandler)

Method Detail

bibFilePathback to summary
public Path bibFilePath()

Record Component getter of bibFilePath.

databaseback to summary
public BibDatabaseContext database()

Record Component getter of database.

equalsback to summary
public final boolean equals(Object o)

Implements abstract java.lang.Record.equals.

Doc from java.lang.Record.equals.

Indicates whether some other object is "equal to" this one. In addition to the general contract of Object.equals, record classes must further obey the invariant that when a record instance is "copied" by passing the result of the record component accessor methods to the canonical constructor, as follows:

    R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
gitHandlerback to summary
public GitHandler gitHandler()

Record Component getter of gitHandler.

hashCodeback to summary
public final int hashCode()

Implements abstract java.lang.Record.hashCode.

Doc from java.lang.Record.hashCode.

Returns a hash code value for the record. Obeys the general contract of Object.hashCode. For records, hashing behavior is constrained by the refined contract of Record.equals, so that any two records created from the same components must have the same hash code.

toStringback to summary
public final String toString()

Implements abstract java.lang.Record.toString.

Doc from java.lang.Record.toString.

Returns a string representation of the record. In accordance with the general contract of Object#toString(), the toString method returns a string that "textually represents" this record. The result should be a concise but informative representation that is easy for a person to read.

In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves.

org.jabref.gui.git back to summary

private final Record GitCommitDialogViewModel.TrackedFile

extends Record
Class Inheritance
Record Components
gitHandler:GitHandler 
bibFilePath:Path 

Field Summary

Modifier and TypeField and Description
private final Path
bibFilePath

Record Component accessed by bibFilePath().

private final GitHandler
gitHandler

Record Component accessed by gitHandler().

Constructor Summary

AccessConstructor and Description
private
TrackedFile(GitHandler gitHandler, Path bibFilePath)

Method Summary

Modifier and TypeMethod and Description
public Path
bibFilePath()

Record Component getter of bibFilePath.

public final boolean
equals(Object o)

Implements abstract java.lang.Record.equals.

Indicates whether some other object is "equal to" this one.

public GitHandler
gitHandler()

Record Component getter of gitHandler.

public final int
hashCode()

Implements abstract java.lang.Record.hashCode.

Returns a hash code value for the record.

public final String
toString()

Implements abstract java.lang.Record.toString.

Returns a string representation of the record.

Field Detail

bibFilePathback to summary
private final Path bibFilePath

Record Component accessed by bibFilePath().

gitHandlerback to summary
private final GitHandler gitHandler

Record Component accessed by gitHandler().

Constructor Detail

TrackedFileback to summary
private TrackedFile(GitHandler gitHandler, Path bibFilePath)

Method Detail

bibFilePathback to summary
public Path bibFilePath()

Record Component getter of bibFilePath.

equalsback to summary
public final boolean equals(Object o)

Implements abstract java.lang.Record.equals.

Doc from java.lang.Record.equals.

Indicates whether some other object is "equal to" this one. In addition to the general contract of Object.equals, record classes must further obey the invariant that when a record instance is "copied" by passing the result of the record component accessor methods to the canonical constructor, as follows:

    R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
gitHandlerback to summary
public GitHandler gitHandler()

Record Component getter of gitHandler.

hashCodeback to summary
public final int hashCode()

Implements abstract java.lang.Record.hashCode.

Doc from java.lang.Record.hashCode.

Returns a hash code value for the record. Obeys the general contract of Object.hashCode. For records, hashing behavior is constrained by the refined contract of Record.equals, so that any two records created from the same components must have the same hash code.

toStringback to summary
public final String toString()

Implements abstract java.lang.Record.toString.

Doc from java.lang.Record.toString.

Returns a string representation of the record. In accordance with the general contract of Object#toString(), the toString method returns a string that "textually represents" this record. The result should be a concise but informative representation that is easy for a person to read.

In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves.