-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move edit mode switch to file tab to make it more prominent and a fil…
…e based thing in the future
- Loading branch information
1 parent
25164ea
commit 63e2249
Showing
21 changed files
with
96 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
src/main/java/net/sf/jabref/gui/actions/EditModeAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package net.sf.jabref.gui.actions; | ||
|
||
import net.sf.jabref.Globals; | ||
import net.sf.jabref.JabRefPreferences; | ||
import net.sf.jabref.logic.l10n.Localization; | ||
|
||
import javax.swing.*; | ||
import java.awt.event.ActionEvent; | ||
|
||
public class EditModeAction extends AbstractAction { | ||
public EditModeAction() { | ||
putValue(Action.NAME, Localization.lang("Switch_to_%0_mode", getOppositeMode())); | ||
} | ||
|
||
@Override | ||
public void actionPerformed(ActionEvent evt) { | ||
if(isBiblatexMode()) { | ||
// to BibteX | ||
Globals.prefs.putBoolean(JabRefPreferences.BIBLATEX_MODE, false); | ||
} else { | ||
// to Biblatex | ||
Globals.prefs.putBoolean(JabRefPreferences.BIBLATEX_MODE, true); | ||
} | ||
// update menu label | ||
putValue(Action.NAME, Localization.lang("Switch_to_%0_mode", getOppositeMode())); | ||
// TODO: enable this change per file and without GUI restart | ||
JOptionPane.showMessageDialog(null, | ||
Localization.lang("You have toggled an edit mode switch.").concat(" ") | ||
.concat("You must restart JabRef for this change to come into effect."), | ||
Localization.lang("Switch edit mode"), JOptionPane.WARNING_MESSAGE); | ||
} | ||
|
||
private boolean isBiblatexMode() { | ||
return Globals.prefs.getBoolean(JabRefPreferences.BIBLATEX_MODE); | ||
} | ||
|
||
private String getOppositeMode() { | ||
String mode = isBiblatexMode() ? "BibTeX" : "Biblatex"; | ||
return mode; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.