-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add link to online help documentation
- Loading branch information
Showing
2 changed files
with
49 additions
and
0 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
48 changes: 48 additions & 0 deletions
48
nbdemetra-ui/src/main/java/internal/BrowseOnlineDocAction.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,48 @@ | ||
package internal; | ||
|
||
import ec.nbdemetra.ui.notification.NotifyUtil; | ||
import org.openide.awt.ActionID; | ||
import org.openide.awt.ActionReference; | ||
import org.openide.awt.ActionRegistration; | ||
import org.openide.nodes.Node; | ||
import org.openide.util.HelpCtx; | ||
import org.openide.util.NbBundle; | ||
import org.openide.util.actions.NodeAction; | ||
|
||
import java.awt.*; | ||
import java.io.IOException; | ||
import java.net.URI; | ||
|
||
@ActionID(category = "Help", id = BrowseOnlineDocAction.ID) | ||
@ActionRegistration(displayName = "#BrowseOnlineDocAction", lazy = false) | ||
@ActionReference(path = "Menu/Help", position = 200) | ||
@NbBundle.Messages("BrowseOnlineDocAction=Online Docs") | ||
public final class BrowseOnlineDocAction extends NodeAction { | ||
|
||
// @ClassNameConstant | ||
public static final String ID = "internal.BrowseOnlineDocAction"; | ||
|
||
@Override | ||
public String getName() { | ||
return Bundle.BrowseOnlineDocAction(); | ||
} | ||
|
||
@Override | ||
public HelpCtx getHelpCtx() { | ||
return null; | ||
} | ||
|
||
@Override | ||
protected void performAction(Node[] nodes) { | ||
try { | ||
Desktop.getDesktop().browse(URI.create("https://jdemetra-new-documentation.netlify.app/")); | ||
} catch (IOException ex) { | ||
NotifyUtil.error("Desktop", "Cannot browse uri", ex); | ||
} | ||
} | ||
|
||
@Override | ||
protected boolean enable(Node[] nodes) { | ||
return Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE); | ||
} | ||
} |