Skip to content

Commit 4e9a0e8

Browse files
authored
Merge pull request #5155 from nadment/5154
Add help to perspective #5154
2 parents f4975ef + e1beeaa commit 4e9a0e8

File tree

11 files changed

+40
-8
lines changed

11 files changed

+40
-8
lines changed

plugins/tech/neo4j/src/main/java/org/apache/hop/neo4j/perspective/HopNeo4jPerspective.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@
9292
id = "HopNeo4jPerspective",
9393
name = "Neo4j",
9494
description = "Neo4j Perspective",
95-
image = "neo4j_logo.svg")
95+
image = "neo4j_logo.svg",
96+
documentationUrl = "/hop-gui/perspective-neo4j.html")
9697
@GuiPlugin
9798
public class HopNeo4jPerspective implements IHopPerspective {
9899

ui/src/main/java/org/apache/hop/ui/hopgui/HopGui.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
package org.apache.hop.ui.hopgui;
1919

20+
import static org.apache.hop.core.Const.getDocUrl;
21+
2022
import java.io.FileOutputStream;
2123
import java.io.PrintStream;
2224
import java.nio.file.Files;
@@ -107,6 +109,7 @@
107109
import org.apache.hop.ui.hopgui.file.workflow.HopGuiWorkflowGraph;
108110
import org.apache.hop.ui.hopgui.perspective.EmptyHopPerspective;
109111
import org.apache.hop.ui.hopgui.perspective.HopPerspectiveManager;
112+
import org.apache.hop.ui.hopgui.perspective.HopPerspectivePlugin;
110113
import org.apache.hop.ui.hopgui.perspective.HopPerspectivePluginType;
111114
import org.apache.hop.ui.hopgui.perspective.IHopPerspective;
112115
import org.apache.hop.ui.hopgui.perspective.configuration.ConfigurationPerspective;
@@ -1625,6 +1628,20 @@ public boolean isActivePerspective(IHopPerspective perspective) {
16251628
return false;
16261629
}
16271630

1631+
@GuiKeyboardShortcut(key = SWT.F1)
1632+
@GuiOsxKeyboardShortcut(key = SWT.F1)
1633+
public void help() {
1634+
HopPerspectivePlugin plugin =
1635+
activePerspective.getClass().getAnnotation(HopPerspectivePlugin.class);
1636+
if (plugin != null) {
1637+
try {
1638+
EnvironmentUtils.getInstance().openUrl(getDocUrl(plugin.documentationUrl()));
1639+
} catch (Exception e) {
1640+
new ErrorDialog(shell, "Error", "Error opening URL", e);
1641+
}
1642+
}
1643+
}
1644+
16281645
/**
16291646
* What are the contexts to consider: - the file types registered - the available metadata types
16301647
*

ui/src/main/java/org/apache/hop/ui/hopgui/perspective/HopPerspectivePlugin.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,6 @@
3838
String image() default "";
3939

4040
String category() default "";
41+
42+
String documentationUrl() default "";
4143
}

ui/src/main/java/org/apache/hop/ui/hopgui/perspective/HopPerspectivePluginType.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,9 @@ protected String extractImageFile(HopPerspectivePlugin annotation) {
6262
protected String extractCategory(HopPerspectivePlugin annotation) {
6363
return annotation.category();
6464
}
65+
66+
@Override
67+
protected String extractDocumentationUrl(HopPerspectivePlugin annotation) {
68+
return annotation.documentationUrl();
69+
}
6570
}

ui/src/main/java/org/apache/hop/ui/hopgui/perspective/configuration/ConfigurationPerspective.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@
5151
id = "160-HopConfigurationPerspective",
5252
name = "i18n::ConfigurationPerspective.Name",
5353
description = "i18n::ConfigurationPerspective.Description",
54-
image = "ui/images/gear.svg")
54+
image = "ui/images/gear.svg",
55+
documentationUrl = "/hop-gui/perspective-configuration.html")
5556
@GuiPlugin(description = "i18n::HopConfigurationPerspective.GuiPlugin.Description")
5657
public class ConfigurationPerspective implements IHopPerspective, TabClosable {
5758

ui/src/main/java/org/apache/hop/ui/hopgui/perspective/dataorch/HopDataOrchestrationPerspective.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@
7373
id = "100-HopDataOrchestrationPerspective",
7474
name = "i18n::DataOrchestrationPerspective.Name",
7575
image = "ui/images/data_orch.svg",
76-
description = "i18n::DataOrchestrationPerspective.Description")
76+
description = "i18n::DataOrchestrationPerspective.Description",
77+
documentationUrl = "/hop-gui/perspective-data-orchestration.html")
7778
@GuiPlugin(description = "i18n::DataOrchestrationPerspective.GuiPlugin.Description")
7879
public class HopDataOrchestrationPerspective implements IHopPerspective, TabClosable {
7980

ui/src/main/java/org/apache/hop/ui/hopgui/perspective/execution/ExecutionPerspective.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@
9393
id = "150-HopExecutionPerspective",
9494
name = "i18n::ExecutionPerspective.Name",
9595
description = "i18n::ExecutionPerspective.Description",
96-
image = "ui/images/execution.svg")
96+
image = "ui/images/execution.svg",
97+
documentationUrl = "/hop-gui/perspective-execution-information.html")
9798
@GuiPlugin
9899
public class ExecutionPerspective implements IHopPerspective, TabClosable {
99100

ui/src/main/java/org/apache/hop/ui/hopgui/perspective/explorer/ExplorerPerspective.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@
117117
id = "300-HopExplorerPerspective",
118118
name = "i18n::ExplorerPerspective.Name",
119119
description = "The Hop Explorer Perspective",
120-
image = "ui/images/folder.svg")
120+
image = "ui/images/folder.svg",
121+
documentationUrl = "/hop-gui/perspective-file-explorer.html")
121122
@GuiPlugin(description = "i18n::ExplorerPerspective.GuiPlugin.Description")
122123
@SuppressWarnings("java:S1104")
123124
public class ExplorerPerspective implements IHopPerspective, TabClosable {

ui/src/main/java/org/apache/hop/ui/hopgui/perspective/metadata/MetadataPerspective.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@
9696
id = "200-HopMetadataPerspective",
9797
name = "i18n::MetadataPerspective.Name",
9898
description = "i18n::MetadataPerspective.Description",
99-
image = "ui/images/metadata.svg")
99+
image = "ui/images/metadata.svg",
100+
documentationUrl = "/hop-gui/perspective-metadata.html")
100101
@GuiPlugin(description = "i18n::MetadataPerspective.GuiPlugin.Description")
101102
public class MetadataPerspective implements IHopPerspective, TabClosable {
102103

ui/src/main/java/org/apache/hop/ui/hopgui/perspective/pluginexplorer/HopPluginExplorePerspective.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@
6565
id = "500-HopPluginExplorerPerspective",
6666
name = "i18n::PluginExplorerPerspective.Name",
6767
description = "i18n::PluginExplorerPerspective.Description",
68-
image = "ui/images/plugin.svg")
68+
image = "ui/images/plugin.svg",
69+
documentationUrl = "/hop-gui/perspective-plugin.html")
6970
@GuiPlugin(description = "i18n::PluginExplorerPerspective.GuiPlugin.Description")
7071
public class HopPluginExplorePerspective implements IHopPerspective {
7172
public static final Class<?> PKG = HopPluginExplorePerspective.class; // i18n

0 commit comments

Comments
 (0)