-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Dialogstojavafx #3801
Dialogstojavafx #3801
Changes from 4 commits
67c489e
ad502c4
55a985f
bb66b22
ce6837f
86dfdc3
13500fe
d05d253
f4b84d6
71b17c2
469a834
6b1ef6f
cbb1df3
9e7ff57
5b8b745
9a04aa6
4d1b6e7
74391d4
44bceed
cf82ad3
a43a7de
7d4afe0
3dc6068
43d38db
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 |
---|---|---|
|
@@ -525,7 +525,7 @@ public void update() { | |
|
||
actions.put(Actions.OPEN_URL, new OpenURLAction()); | ||
|
||
actions.put(Actions.MERGE_WITH_FETCHED_ENTRY, new MergeWithFetchedEntryAction(this)); | ||
actions.put(Actions.MERGE_WITH_FETCHED_ENTRY, new MergeWithFetchedEntryAction(this, frame)); | ||
|
||
actions.put(Actions.REPLACE_ALL, (BaseAction) () -> { | ||
final ReplaceStringDialog rsd = new ReplaceStringDialog(frame); | ||
|
@@ -657,7 +657,7 @@ public void update() { | |
actions.put(Actions.REMOVE_FROM_GROUP, new GroupAddRemoveDialog(this, false, false)); | ||
actions.put(Actions.MOVE_TO_GROUP, new GroupAddRemoveDialog(this, true, true)); | ||
|
||
actions.put(Actions.DOWNLOAD_FULL_TEXT, new FindFullTextAction(this)); | ||
actions.put(Actions.DOWNLOAD_FULL_TEXT, new FindFullTextAction(frame, this)); | ||
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. dito |
||
} | ||
|
||
/** | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,6 @@ | |
import java.util.List; | ||
import java.util.Optional; | ||
|
||
import javax.swing.JOptionPane; | ||
import javax.swing.SwingUtilities; | ||
import javax.swing.tree.DefaultMutableTreeNode; | ||
|
||
|
@@ -38,6 +37,7 @@ | |
import org.slf4j.LoggerFactory; | ||
|
||
public class ChangeScanner implements Runnable { | ||
|
||
private static final Logger LOGGER = LoggerFactory.getLogger(ChangeScanner.class); | ||
|
||
private final File file; | ||
|
@@ -94,17 +94,21 @@ public void displayResult(final DisplayResultCallback fup) { | |
}); | ||
|
||
} else { | ||
JOptionPane.showMessageDialog(null, Localization.lang("No actual changes found."), | ||
Localization.lang("External changes"), JOptionPane.INFORMATION_MESSAGE); | ||
frame.getDialogService().showInformationDialogAndWait(Localization.lang("External changes"), | ||
Localization.lang("No actual changes found.")); | ||
|
||
fup.scanResultsResolved(true); | ||
} | ||
} | ||
|
||
private void storeTempDatabase() { | ||
JabRefExecutorService.INSTANCE.execute(() -> { | ||
try { | ||
SavePreferences prefs = SavePreferences.loadForSaveFromPreferences(Globals.prefs).withMakeBackup(false) | ||
.withEncoding(panel.getBibDatabaseContext().getMetaData().getEncoding() | ||
SavePreferences prefs = SavePreferences.loadForSaveFromPreferences(Globals.prefs) | ||
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. The code style settings still seem to be off. The dots are not aligned (if this is not an artifact of the way github displays the code) |
||
.withMakeBackup(false) | ||
.withEncoding(panel.getBibDatabaseContext() | ||
.getMetaData() | ||
.getEncoding() | ||
.orElse(Globals.prefs.getDefaultEncoding())); | ||
|
||
BibDatabaseWriter<SaveSession> databaseWriter = new BibtexDatabaseWriter<>(FileSaveSession::new); | ||
|
@@ -176,6 +180,7 @@ private ChangeViewModel createBibEntryDiff(BibEntryDiff diff) { | |
|
||
@FunctionalInterface | ||
public interface DisplayResultCallback { | ||
|
||
void scanResultsResolved(boolean resolved); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,6 @@ | |
import javax.swing.JComponent; | ||
import javax.swing.JFrame; | ||
import javax.swing.JList; | ||
import javax.swing.JOptionPane; | ||
import javax.swing.JPanel; | ||
import javax.swing.ListSelectionModel; | ||
import javax.swing.event.ListDataEvent; | ||
|
@@ -101,7 +100,7 @@ private void initGui() { | |
List<String> entryTypes = new ArrayList<>(); | ||
entryTypes.addAll(EntryTypes.getAllTypes(bibDatabaseMode)); | ||
|
||
typeComp = new EntryTypeList(entryTypes, bibDatabaseMode); | ||
typeComp = new EntryTypeList(frame, entryTypes, bibDatabaseMode); | ||
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. here also |
||
typeComp.addListSelectionListener(this); | ||
typeComp.addAdditionActionListener(e -> typeComp.selectField(e.getActionCommand())); | ||
typeComp.addDefaultActionListener(new DefaultListener()); | ||
|
@@ -323,14 +322,14 @@ private void deleteType(String name) { | |
|
||
if (type.isPresent() && (type.get() instanceof CustomEntryType)) { | ||
if (!EntryTypes.getStandardType(name, bibDatabaseMode).isPresent()) { | ||
int reply = JOptionPane.showConfirmDialog | ||
(null, Localization.lang("All entries of this " | ||
+ "type will be declared " | ||
+ "typeless. Continue?"), | ||
Localization.lang("Delete custom format") + | ||
" '" + StringUtil.capitalizeFirst(name) + '\'', JOptionPane.YES_NO_OPTION, | ||
JOptionPane.WARNING_MESSAGE); | ||
if (reply != JOptionPane.YES_OPTION) { | ||
|
||
boolean deleteCustomClicked = frame.getDialogService().showConfirmationDialogAndWait(Localization.lang("Delete custom format") + | ||
" '" + StringUtil.capitalizeFirst(name) + '\'', Localization.lang("All entries of this " | ||
+ "type will be declared " | ||
+ "typeless. Continue?"), | ||
Localization.lang("Delete custom format"), Localization.lang("Cancel")); | ||
|
||
if (!deleteCustomClicked) { | ||
return; | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -140,7 +140,9 @@ public void run() { | |
|
||
// Save the database | ||
success = saveDatabase(panel.getBibDatabaseContext().getDatabaseFile().get(), false, | ||
panel.getBibDatabaseContext().getMetaData().getEncoding() | ||
panel.getBibDatabaseContext() | ||
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. Do these restylings happen automatically? If yes, could eclipse be configured differently? Sometimes they are good, sometimes they feel a bit over aggressive (like here, the two-lines solution was fine in my opinion) |
||
.getMetaData() | ||
.getEncoding() | ||
.orElse(Globals.prefs.getDefaultEncoding())); | ||
|
||
panel.updateTimeStamp(); | ||
|
@@ -288,7 +290,8 @@ public void saveAs() throws Exception { | |
FileDialogConfiguration fileDialogConfiguration = new FileDialogConfiguration.Builder() | ||
.addExtensionFilter(FileType.BIBTEX_DB) | ||
.withDefaultExtension(FileType.BIBTEX_DB) | ||
.withInitialDirectory(Globals.prefs.get(JabRefPreferences.WORKING_DIRECTORY)).build(); | ||
.withInitialDirectory(Globals.prefs.get(JabRefPreferences.WORKING_DIRECTORY)) | ||
.build(); | ||
DialogService dialogService = frame.getDialogService(); | ||
Optional<Path> path = dialogService.showFileSaveDialog(fileDialogConfiguration); | ||
if (path.isPresent()) { | ||
|
@@ -428,10 +431,10 @@ private boolean checkExternalModification() { | |
return true; | ||
} else { // User indicated to store anyway. | ||
if (panel.getBibDatabaseContext().getMetaData().isProtected()) { | ||
JOptionPane.showMessageDialog(null, | ||
Localization | ||
.lang("Library is protected. Cannot save until external changes have been reviewed."), | ||
Localization.lang("Protected library"), JOptionPane.ERROR_MESSAGE); | ||
|
||
frame.getDialogService().showErrorDialogAndWait(Localization.lang("Protected library"), | ||
Localization.lang("Library is protected. Cannot save until external changes have been reviewed.")); | ||
|
||
canceled = true; | ||
} else { | ||
panel.markExternalChangesAsResolved(); | ||
|
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.
could you please pass the
DialogService
directly, instead of the frame (makes the dependency clearer).