Search in sources :

Example 11 with FileDialogConfiguration

use of org.jabref.gui.util.FileDialogConfiguration in project jabref by JabRef.

the class ManageJournalAbbreviationsViewModel method addNewFile.

/**
     * This method shall be used to add a new journal abbreviation file to the
     * set of journal abbreviation files. It basically just calls the
     * {@link #openFile(Path)}} method
     */
public void addNewFile() {
    FileDialogConfiguration fileDialogConfiguration = new FileDialogConfiguration.Builder().addExtensionFilter(FileExtensions.TXT).build();
    dialogService.showFileSaveDialog(fileDialogConfiguration).ifPresent(this::openFile);
}
Also used : FileDialogConfiguration(org.jabref.gui.util.FileDialogConfiguration)

Example 12 with FileDialogConfiguration

use of org.jabref.gui.util.FileDialogConfiguration in project jabref by JabRef.

the class ManageJournalAbbreviationsViewModel method openFile.

public void openFile() {
    FileDialogConfiguration fileDialogConfiguration = new FileDialogConfiguration.Builder().addExtensionFilter(FileExtensions.TXT).build();
    dialogService.showFileOpenDialog(fileDialogConfiguration).ifPresent(this::openFile);
}
Also used : FileDialogConfiguration(org.jabref.gui.util.FileDialogConfiguration)

Example 13 with FileDialogConfiguration

use of org.jabref.gui.util.FileDialogConfiguration in project jabref by JabRef.

the class ConnectToSharedDatabaseDialog method showFileChooser.

private void showFileChooser() {
    FileDialogConfiguration fileDialogConfiguration = new FileDialogConfiguration.Builder().addExtensionFilter(FileExtensions.BIBTEX_DB).withDefaultExtension(FileExtensions.BIBTEX_DB).withInitialDirectory(Globals.prefs.get(JabRefPreferences.WORKING_DIRECTORY)).build();
    DialogService ds = new FXDialogService();
    Optional<Path> path = DefaultTaskExecutor.runInJavaFXThread(() -> ds.showFileOpenDialog(fileDialogConfiguration));
    path.ifPresent(p -> fileLocationField.setText(p.toString()));
}
Also used : FXDialogService(org.jabref.gui.FXDialogService) Path(java.nio.file.Path) FXDialogService(org.jabref.gui.FXDialogService) DialogService(org.jabref.gui.DialogService) FileDialogConfiguration(org.jabref.gui.util.FileDialogConfiguration)

Aggregations

FileDialogConfiguration (org.jabref.gui.util.FileDialogConfiguration)13 DialogService (org.jabref.gui.DialogService)10 FXDialogService (org.jabref.gui.FXDialogService)10 Path (java.nio.file.Path)9 FormBuilder (com.jgoodies.forms.builder.FormBuilder)5 FormLayout (com.jgoodies.forms.layout.FormLayout)5 JButton (javax.swing.JButton)5 JTextField (javax.swing.JTextField)4 ButtonBarBuilder (com.jgoodies.forms.builder.ButtonBarBuilder)3 ActionEvent (java.awt.event.ActionEvent)3 JPanel (javax.swing.JPanel)3 IOException (java.io.IOException)2 List (java.util.List)2 AbstractAction (javax.swing.AbstractAction)2 Action (javax.swing.Action)2 Log (org.apache.commons.logging.Log)2 LogFactory (org.apache.commons.logging.LogFactory)2 Globals (org.jabref.Globals)2 BasePanel (org.jabref.gui.BasePanel)2 DefaultTaskExecutor (org.jabref.gui.util.DefaultTaskExecutor)2