This is an automated email from the ASF dual-hosted git repository.
mcasters pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-hop.git
The following commit(s) were added to refs/heads/master by this push:
new ed83baf HOP-2208 : Make ContextDialog more friendly for plugins
new 0e77b31 Merge pull request #399 from mattcasters/master
ed83baf is described below
commit ed83baf5dba9a8e136a8eb741ed85f6f7edca25b
Author: Matt Casters <[email protected]>
AuthorDate: Thu Nov 19 13:02:16 2020 +0100
HOP-2208 : Make ContextDialog more friendly for plugins
---
.../apache/hop/ui/core/dialog/ContextDialog.java | 33 ++++++++++++++++++++--
1 file changed, 31 insertions(+), 2 deletions(-)
diff --git a/ui/src/main/java/org/apache/hop/ui/core/dialog/ContextDialog.java
b/ui/src/main/java/org/apache/hop/ui/core/dialog/ContextDialog.java
index be498e5..05571d1 100644
--- a/ui/src/main/java/org/apache/hop/ui/core/dialog/ContextDialog.java
+++ b/ui/src/main/java/org/apache/hop/ui/core/dialog/ContextDialog.java
@@ -140,6 +140,8 @@ public class ContextDialog extends Dialog {
private ToolBar toolBar;
private GuiToolbarWidgets toolBarWidgets;
+ private static ContextDialog activeInstance;
+
private enum OwnerType {
CATEGORY,
ITEM,
@@ -508,9 +510,16 @@ public class ContextDialog extends Dialog {
} );
wCanvas.addKeyListener( keyAdapter );
- // Show the dialog now
+ // Layout all the widgets in the shell.
//
shell.layout();
+
+ // Set the active instance.
+ //
+ activeInstance = this;
+
+ // Show the dialog now
+ //
shell.open();
// Filter all actions by default
@@ -529,9 +538,20 @@ public class ContextDialog extends Dialog {
}
}
+ activeInstance = null;
+
return selectedAction;
}
+ /**
+ * Gets the currently active instance
+ *
+ * @return The currently active instance or null if the dialog is not
showing.
+ */
+ public static ContextDialog getInstance() {
+ return activeInstance;
+ }
+
private void recallToolbarSettings() {
Button categoriesCheckBox = getCategoriesCheckBox();
if ( categoriesCheckBox != null ) {
@@ -899,7 +919,16 @@ public class ContextDialog extends Dialog {
wCanvas.redraw();
}
- private void filter( String text ) {
+ /**
+ * Gets the search text widget
+ *
+ * @return the search text widget
+ */
+ public Text getSearchTextWidget() {
+ return wSearch;
+ }
+
+ public void filter( String text ) {
if ( text == null ) {
text = "";