Skip to content

Commit

Permalink
Add link to online help documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
charphi committed Jun 11, 2024
1 parent 80e26b1 commit 0b625ce
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

### Added

- ![UI] Add link to online help documentation [#891](https://github.com/jdemetra/jdemetra-app/issues/891)
- ![OTHER] Add Windows binaries to release [#885](https://github.com/jdemetra/jdemetra-app/issues/885)

### Fixed
Expand Down
48 changes: 48 additions & 0 deletions nbdemetra-ui/src/main/java/internal/BrowseOnlineDocAction.java
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);
}
}

0 comments on commit 0b625ce

Please sign in to comment.