-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
user-specific file directory should show user name #13380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 14 commits
f98f73a
0e9031e
cb04787
0be84ae
9b08e71
80497e2
e1c798a
a4d645f
c8b26d2
75b2c92
a8d24fe
a2052cb
3481df7
b2deaea
42002c5
88dff39
7c3d3ad
b38061e
2fb2e59
e04dfc9
343e8ba
c063060
ebfdbb5
0d44e4d
0741516
9b86cc1
a39ff62
3eb74c4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,6 +102,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv | |
- We added path validation to file directories in library properties dialog. [#11840](https://github.com/JabRef/jabref/issues/11840) | ||
- We now support usage of custom CSL styles in the Open/LibreOffice integration. [#12337](https://github.com/JabRef/jabref/issues/12337) | ||
- We added support for citation-only CSL styles which don't specify bibliography formatting. [#12996](https://github.com/JabRef/jabref/pull/12996) | ||
- We added tooltips to the "User-specific file directory" and "LaTeX file directory" fields of the library properties window. [#12269](https://github.com/JabRef/jabref/issues/12269) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This must be put in the Unreleased section |
||
|
||
### Changed | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ | |
import org.jabref.gui.util.IconValidationDecorator; | ||
import org.jabref.gui.util.ViewModelListCellFactory; | ||
import org.jabref.logic.l10n.Localization; | ||
import org.jabref.logic.os.OS; | ||
import org.jabref.logic.preferences.CliPreferences; | ||
import org.jabref.model.database.BibDatabaseContext; | ||
import org.jabref.model.database.BibDatabaseMode; | ||
|
@@ -41,6 +42,8 @@ public class GeneralPropertiesView extends AbstractPropertiesTabView<GeneralProp | |
@FXML private Tooltip libSpecificFileDirSwitchTooltip; | ||
@FXML private Tooltip userSpecificFileDirSwitchTooltip; | ||
@FXML private Tooltip laTexSpecificFileDirSwitchTooltip; | ||
@FXML private Tooltip userSpecificFileDirectoryTooltip; | ||
@FXML private Tooltip laTexFileDirectoryTooltip; | ||
|
||
private final ControlsFxVisualizer librarySpecificFileDirectoryValidationVisualizer = new ControlsFxVisualizer(); | ||
private final ControlsFxVisualizer userSpecificFileDirectoryValidationVisualizer = new ControlsFxVisualizer(); | ||
|
@@ -108,6 +111,19 @@ public void initialize() { | |
laTexSpecificFileDirSwitchTooltip.setText(isAbsolute ? switchToRelativeText : switchToAbsoluteText); | ||
}); | ||
|
||
String userHost = preferences.getUsername() + "@" + preferences.getHostname(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be part of record, maybe call method "getCanonicalForm()". |
||
String userDir = viewModel.userSpecificFileDirectoryProperty().get(); | ||
if (userDir.isEmpty()) { | ||
userSpecificFileDirectoryTooltip.setText(Localization.lang("User-specific file directory: (not set)")); | ||
} else { | ||
userSpecificFileDirectoryTooltip.setText(Localization.lang("User-specific file directory: %0", userHost)); | ||
} | ||
laTexFileDirectoryTooltip.textProperty().bind( | ||
viewModel.laTexFileDirectoryProperty().map(path -> | ||
Localization.lang(path.isEmpty() ? "Directory for LaTeX files: (not set)" : "Directory for LaTeX files: %0", path) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This won't work this way, I think. You need to put the path.isEmpty check before and then have two separate Locallization.lang(...) calls |
||
) | ||
); | ||
pranav0510s marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Platform.runLater(() -> { | ||
librarySpecificFileDirectoryValidationVisualizer.initVisualization(viewModel.librarySpecificFileDirectoryStatus(), librarySpecificFileDirectory); | ||
userSpecificFileDirectoryValidationVisualizer.initVisualization(viewModel.userSpecificFileDirectoryStatus(), userSpecificFileDirectory); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,38 +28,41 @@ | |
import org.jabref.logic.protectedterms.ProtectedTermsPreferences; | ||
import org.jabref.logic.remote.RemotePreferences; | ||
import org.jabref.logic.search.SearchPreferences; | ||
import org.jabref.logic.util.UserAndHost; | ||
import org.jabref.logic.util.io.AutoLinkPreferences; | ||
import org.jabref.logic.xmp.XmpPreferences; | ||
import org.jabref.model.entry.BibEntryPreferences; | ||
import org.jabref.model.entry.BibEntryTypesManager; | ||
|
||
public interface CliPreferences { | ||
void clear() throws BackingStoreException; | ||
|
||
void clear() throws BackingStoreException; | ||
void deleteKey(String key) throws IllegalArgumentException; | ||
|
||
void flush(); | ||
|
||
void exportPreferences(Path file) throws JabRefException; | ||
|
||
void importPreferences(Path file) throws JabRefException; | ||
|
||
InternalPreferences getInternalPreferences(); | ||
|
||
BibEntryPreferences getBibEntryPreferences(); | ||
UserAndHost getUserAndHost(); | ||
|
||
JournalAbbreviationPreferences getJournalAbbreviationPreferences(); | ||
/** Shortcut for getUserAndHost().getUser() */ | ||
default String getUsername() { | ||
return getUserAndHost().getUser(); | ||
} | ||
|
||
FilePreferences getFilePreferences(); | ||
/** Shortcut for getUserAndHost().getHost() */ | ||
default String getHostname() { | ||
return getUserAndHost().getHost(); | ||
} | ||
|
||
InternalPreferences getInternalPreferences(); | ||
BibEntryPreferences getBibEntryPreferences(); | ||
JournalAbbreviationPreferences getJournalAbbreviationPreferences(); | ||
FilePreferences getFilePreferences(); | ||
FieldPreferences getFieldPreferences(); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it was intentional to have each method separated by an empty line |
||
Map<String, Object> getPreferences(); | ||
|
||
Map<String, Object> getDefaults(); | ||
|
||
LayoutFormatterPreferences getLayoutFormatterPreferences(); | ||
|
||
ImportFormatPreferences getImportFormatPreferences(); | ||
|
||
/** | ||
|
@@ -68,50 +71,27 @@ public interface CliPreferences { | |
SelfContainedSaveConfiguration getSelfContainedExportConfiguration(); | ||
|
||
BibEntryTypesManager getCustomEntryTypesRepository(); | ||
|
||
void storeCustomEntryTypesRepository(BibEntryTypesManager entryTypesManager); | ||
|
||
CleanupPreferences getCleanupPreferences(); | ||
|
||
CleanupPreferences getDefaultCleanupPreset(); | ||
|
||
LibraryPreferences getLibraryPreferences(); | ||
|
||
DOIPreferences getDOIPreferences(); | ||
|
||
OwnerPreferences getOwnerPreferences(); | ||
|
||
TimestampPreferences getTimestampPreferences(); | ||
|
||
RemotePreferences getRemotePreferences(); | ||
|
||
ProxyPreferences getProxyPreferences(); | ||
|
||
SSLPreferences getSSLPreferences(); | ||
|
||
CitationKeyPatternPreferences getCitationKeyPatternPreferences(); | ||
|
||
AutoLinkPreferences getAutoLinkPreferences(); | ||
|
||
ExportPreferences getExportPreferences(); | ||
|
||
ImporterPreferences getImporterPreferences(); | ||
|
||
GrobidPreferences getGrobidPreferences(); | ||
|
||
XmpPreferences getXmpPreferences(); | ||
|
||
NameFormatterPreferences getNameFormatterPreferences(); | ||
|
||
SearchPreferences getSearchPreferences(); | ||
|
||
MrDlibPreferences getMrDlibPreferences(); | ||
|
||
ProtectedTermsPreferences getProtectedTermsPreferences(); | ||
|
||
AiPreferences getAiPreferences(); | ||
|
||
LastFilesOpenedPreferences getLastFilesOpenedPreferences(); | ||
|
||
OpenOfficePreferences getOpenOfficePreferences(JournalAbbreviationRepository journalAbbreviationRepository); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package org.jabref.logic.util; | ||
|
||
import java.util.Objects; | ||
|
||
public class UserAndHost { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can be made a recod There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can i know what do you mean by record? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Google for Java record Or do Ctrl+Shift+F record in Intellij to see other record code. |
||
private final String user; | ||
private final String host; | ||
|
||
public UserAndHost(String user, String host) { | ||
this.user = Objects.requireNonNull(user, "user must not be null"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use JSpecify annotations instead of requireNonNull |
||
this.host = Objects.requireNonNull(host, "host must not be null"); | ||
} | ||
|
||
public String getUser() { | ||
return user; | ||
} | ||
|
||
public String getHost() { | ||
return host; | ||
} | ||
|
||
public String getString() { | ||
return "User: " + user + ", Host: " + host; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was there a need to touch the workflow file?