Skip to content

Commit

Permalink
More safely delete files #245
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan-kolb committed Feb 19, 2017
1 parent f4c2071 commit ca095c0
Show file tree
Hide file tree
Showing 20 changed files with 44 additions and 43 deletions.
13 changes: 9 additions & 4 deletions src/main/java/net/sf/jabref/gui/fieldeditors/FileListEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public FileListEditor(JabRefFrame frame, BibDatabaseContext databaseContext, Str

FormBuilder builder = FormBuilder.create()
.layout(new FormLayout
("fill:pref,1dlu,fill:pref,1dlu,fill:pref", "fill:pref,fill:pref"));
("fill:pref,1dlu,fill:pref,1dlu,fill:pref", "fill:pref,fill:pref"));
builder.add(up).xy(1, 1);
builder.add(add).xy(3, 1);
builder.add(auto).xy(5, 1);
Expand Down Expand Up @@ -218,13 +218,18 @@ public void actionPerformed(ActionEvent actionEvent) {
menu.add(moveToFileDir);
moveToFileDir.addActionListener(new MoveFileAction(frame, entryEditor, this, true));

JMenuItem deleteFile = new JMenuItem(Localization.lang("Delete local file"));
JMenuItem deleteFile = new JMenuItem(Localization.lang("Permanently delete local file"));
menu.add(deleteFile);
deleteFile.addActionListener(e -> {
int row = getSelectedRow();

// no selection
if (row != -1) {
if (row == -1) {
return;
}

int userConfirm = JOptionPane.showConfirmDialog(null, Localization.lang("Are you sure you want to delete this file?"), Localization.lang("Warning"), JOptionPane.YES_NO_OPTION);
if (userConfirm == JOptionPane.YES_OPTION) {
FileListEntry entry = tableModel.getEntry(row);
// null if file does not exist
Optional<File> file = FileUtil.expandFilename(databaseContext, entry.link,
Expand Down Expand Up @@ -436,7 +441,7 @@ public void autoSetLinks() {
}
// reset
auto.setEnabled(true);
} , dialog));
}, dialog));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,9 @@
* any more results via addEntry, call entryListComplete() or dispose(), after
* receiving this call).
*/

public class ImportInspectionDialog extends JDialog implements ImportInspector, OutputPrinter {

private static final Log LOGGER = LogFactory.getLog(ImportInspectionDialog.class);

private BasePanel panel;
private final JabRefFrame frame;
private final BibDatabaseContext bibDatabaseContext;
Expand Down Expand Up @@ -181,7 +180,6 @@ public class ImportInspectionDialog extends JDialog implements ImportInspector,
private static final int URL_COL = 3;
private static final int PAD = 4;


/**
* Creates a dialog that displays the given list of fields in the table. The
* dialog allows another process to add entries dynamically while the dialog
Expand Down Expand Up @@ -339,7 +337,6 @@ public void actionPerformed(ActionEvent e) {
InputMap im = contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_DIALOG), "close");
am.put("close", closeAction);

}

/* (non-Javadoc)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
import org.apache.commons.logging.LogFactory;

public class ACMPortalFetcher implements PreviewEntryFetcher {

private static final Log LOGGER = LogFactory.getLog(ACMPortalFetcher.class);

private final HtmlToLatexFormatter htmlToLatexFormatter = new HtmlToLatexFormatter();
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/l10n/JabRef_da.properties
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,8 @@ Delete_strings=Slet_strenge

Deleted=Slettet

Delete_local_file=

Permanently_delete_local_file=
Are_you_sure_you_want_to_delete_this_file?=
Delimit_fields_with_semicolon,_ex.=Afgræns_felter_med_semikolon,_f.eks.

Descending=Faldende
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/l10n/JabRef_de.properties
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,8 @@ Delete_strings=Strings_löschen

Deleted=Gelöscht

Delete_local_file=Lösche_lokale_Datei

Permanently_delete_local_file=Lösche_lokale_Datei
Are_you_sure_you_want_to_delete_this_file?=
Delimit_fields_with_semicolon,_ex.=Felder_mit_Semikolon_abgrenzen,_z.B.

Descending=Absteigend
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/l10n/JabRef_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,8 @@ Delete_strings=Delete_strings

Deleted=Deleted

Delete_local_file=Delete_local_file

Permanently_delete_local_file=Permanently_delete_local_file
Are_you_sure_you_want_to_delete_this_file?=Are_you_sure_you_want_to_delete_this_file?
Delimit_fields_with_semicolon,_ex.=Delimit_fields_with_semicolon,_ex.

Descending=Descending
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/l10n/JabRef_es.properties
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,8 @@ Delete_strings=Borrar_cadenas

Deleted=Borrado

Delete_local_file=Eliminar_archivo_local

Permanently_delete_local_file=Eliminar_archivo_local
Are_you_sure_you_want_to_delete_this_file?=
Delimit_fields_with_semicolon,_ex.=Delimitar_campos_con_punto_y_coma

Descending=Descendiente
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/l10n/JabRef_fa.properties
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,8 @@ Delete_strings=

Deleted=

Delete_local_file=

Permanently_delete_local_file=
Are_you_sure_you_want_to_delete_this_file?=
Delimit_fields_with_semicolon,_ex.=

Descending=
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/l10n/JabRef_fr.properties
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,8 @@ Delete_strings=Supprimer_les_chaînes

Deleted=Supprimé

Delete_local_file=Supprimer_le_fichier_local

Permanently_delete_local_file=Supprimer_le_fichier_local
Are_you_sure_you_want_to_delete_this_file?=
Delimit_fields_with_semicolon,_ex.=Délimiter_les_champs_par_des_points-virgules,_ex.

Descending=Descendant
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/l10n/JabRef_in.properties
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,8 @@ Delete_strings=Hapus_string

Deleted=Dihapus

Delete_local_file=Hapus_berkas_lokal

Permanently_delete_local_file=Hapus_berkas_lokal
Are_you_sure_you_want_to_delete_this_file?=
Delimit_fields_with_semicolon,_ex.=Batas_bidang_dengan_titik_koma,_misal,

Descending=Urutan_menurun
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/l10n/JabRef_it.properties
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,8 @@ Delete_strings=Cancella_stringhe

Deleted=Cancellato

Delete_local_file=Cancella_file_locale

Permanently_delete_local_file=Cancella_file_locale
Are_you_sure_you_want_to_delete_this_file?=
Delimit_fields_with_semicolon,_ex.=Campi_delimitati_da_punto_e_virgola,_ex.

Descending=Discendente
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/l10n/JabRef_ja.properties
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,8 @@ Delete_strings=文字列を削除

Deleted=削除しました\:

Delete_local_file=ローカルファイルを削除

Permanently_delete_local_file=ローカルファイルを削除
Are_you_sure_you_want_to_delete_this_file?=
Delimit_fields_with_semicolon,_ex.=各フィールドをセミコロンで区切ってください。例

Descending=降順
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/l10n/JabRef_nl.properties
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,8 @@ Delete_strings=Verwijder_constanten

Deleted=Verwijderd

Delete_local_file=

Permanently_delete_local_file=
Are_you_sure_you_want_to_delete_this_file?=
Delimit_fields_with_semicolon,_ex.=Scheid_velden_met_puntkomma,_bv.

Descending=Afdalend
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/l10n/JabRef_no.properties
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,8 @@ Delete_strings=Slett_strenger

Deleted=Slettet

Delete_local_file=

Permanently_delete_local_file=
Are_you_sure_you_want_to_delete_this_file?=
Delimit_fields_with_semicolon,_ex.=Avgrens_felter_med_semikolon,_f.eks.

Descending=Synkende
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/l10n/JabRef_pt_BR.properties
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,8 @@ Delete_strings=Remover_strings

Deleted=Removido

Delete_local_file=Remover_arquivo_local

Permanently_delete_local_file=Remover_arquivo_local
Are_you_sure_you_want_to_delete_this_file?=
Delimit_fields_with_semicolon,_ex.=Delimitar_campos_com_ponto_e_vírgula,_ex.

Descending=Descendente
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/l10n/JabRef_ru.properties
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,8 @@ Delete_strings=Удалить_строки

Deleted=Удалено

Delete_local_file=Удалить_локальный_файл

Permanently_delete_local_file=Удалить_локальный_файл
Are_you_sure_you_want_to_delete_this_file?=
Delimit_fields_with_semicolon,_ex.=Разделитель_для_полей\:_точка_с_запятой,_напр.\:

Descending=В_порядке_убывания
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/l10n/JabRef_sv.properties
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,8 @@ Delete_strings=Radera_strängar

Deleted=Raderade

Delete_local_file=Radera_lokal_fil

Permanently_delete_local_file=Radera_lokal_fil
Are_you_sure_you_want_to_delete_this_file?=
Delimit_fields_with_semicolon,_ex.=Avgränsa_fält_med_semikolon,_t.ex.

Descending=Fallande
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/l10n/JabRef_tr.properties
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,8 @@ Delete_strings=Dizgeleri_sil

Deleted=Silindi

Delete_local_file=Yerel_dosyayı_sil

Permanently_delete_local_file=Yerel_dosyayı_sil
Are_you_sure_you_want_to_delete_this_file?=
Delimit_fields_with_semicolon,_ex.=Alanları_ör._noktalı_virgülle_sınırlandır

Descending=Azalan
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/l10n/JabRef_vi.properties
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,8 @@ Delete_strings=Xóa_chuỗi

Deleted=Bị_xóa

Delete_local_file=Xóa_bỏ_tập_tin_cục_bộ

Permanently_delete_local_file=Xóa_bỏ_tập_tin_cục_bộ
Are_you_sure_you_want_to_delete_this_file?=
Delimit_fields_with_semicolon,_ex.=Phân_cách_các_dữ_liệu_bằng,_ví_dụ_như,_dấu_chấm_phẩy.

Descending=Giảm_dần
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/l10n/JabRef_zh.properties
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,8 @@ Delete_strings=删除简写字串

Deleted=已删除

Delete_local_file=删除本地文件

Permanently_delete_local_file=删除本地文件
Are_you_sure_you_want_to_delete_this_file?=
Delimit_fields_with_semicolon,_ex.=使用分号分隔域,例如

Descending=降序
Expand Down

0 comments on commit ca095c0

Please sign in to comment.