-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d3ff7bb
commit c8b48e4
Showing
238 changed files
with
324 additions
and
18,416 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
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
97 changes: 97 additions & 0 deletions
97
src/main/java/net/sf/jabref/gui/help/OnlineHelpAction.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,97 @@ | ||
/* Copyright (C) 2003-2015 JabRef contributors. | ||
This program is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation; either version 2 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License along | ||
with this program; if not, write to the Free Software Foundation, Inc., | ||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
*/ | ||
package net.sf.jabref.gui.help; | ||
|
||
import net.sf.jabref.Globals; | ||
import net.sf.jabref.JabRef; | ||
import net.sf.jabref.JabRefPreferences; | ||
import net.sf.jabref.gui.IconTheme; | ||
import net.sf.jabref.gui.actions.MnemonicAwareAction; | ||
import net.sf.jabref.gui.desktop.JabRefDesktop; | ||
import net.sf.jabref.logic.l10n.Localization; | ||
import org.apache.commons.logging.Log; | ||
import org.apache.commons.logging.LogFactory; | ||
|
||
import javax.swing.*; | ||
import java.awt.*; | ||
import java.awt.event.ActionEvent; | ||
import java.io.IOException; | ||
|
||
/** | ||
* This Action keeps a reference to a URL. When activated, it shows the help | ||
* Dialog unless it is already visible, and shows the URL in it. | ||
*/ | ||
public class OnlineHelpAction extends MnemonicAwareAction { | ||
private static final Log LOGGER = LogFactory.getLog(OnlineHelpAction.class); | ||
|
||
private String urlPart; | ||
|
||
public OnlineHelpAction(String title, String tooltip, String urlPart, KeyStroke key) { | ||
super(IconTheme.JabRefIcon.HELP.getSmallIcon()); | ||
this.urlPart = urlPart; | ||
putValue(Action.NAME, title); | ||
putValue(Action.SHORT_DESCRIPTION, tooltip); | ||
putValue(Action.ACCELERATOR_KEY, key); | ||
} | ||
|
||
public OnlineHelpAction(String title, String tooltip, String urlPart, Icon icon) { | ||
super(icon); | ||
this.urlPart = urlPart; | ||
putValue(Action.NAME, title); | ||
putValue(Action.SHORT_DESCRIPTION, tooltip); | ||
} | ||
|
||
public OnlineHelpAction(String urlPart, Icon icon) { | ||
this(Localization.lang("Help"), Localization.lang("Help"), urlPart, icon); | ||
} | ||
|
||
public OnlineHelpAction(String title, String tooltip, String urlPart) { | ||
super(IconTheme.JabRefIcon.HELP.getSmallIcon()); | ||
this.urlPart = urlPart; | ||
putValue(Action.NAME, title); | ||
putValue(Action.SHORT_DESCRIPTION, tooltip); | ||
} | ||
|
||
public OnlineHelpAction(String urlPart) { | ||
this(Localization.lang("Help"), Localization.lang("Help"), urlPart); | ||
} | ||
|
||
public OnlineHelpAction(String tooltip, String urlPart) { | ||
this(Localization.lang("Help"), tooltip, urlPart); | ||
} | ||
|
||
public JButton getIconButton() { | ||
JButton hlp = new JButton(this); | ||
hlp.setText(null); | ||
hlp.setPreferredSize(new Dimension(24, 24)); | ||
hlp.setToolTipText(getValue(Action.SHORT_DESCRIPTION).toString()); | ||
return hlp; | ||
} | ||
|
||
public void setHelpFile(String urlPart) { | ||
this.urlPart = urlPart; | ||
} | ||
|
||
@Override | ||
public void actionPerformed(ActionEvent e) { | ||
try { | ||
JabRefDesktop.openBrowser("http://help.jabref.org/" + Globals.prefs.get(JabRefPreferences.LANGUAGE) + "/" + urlPart); | ||
} catch (IOException ex) { | ||
LOGGER.warn("Could not open browser", ex); | ||
JabRef.jrf.getCurrentBasePanel().output(Localization.lang("Could not open browser.")); | ||
} | ||
} | ||
} |
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.