This is an automated email from the ASF dual-hosted git repository.
hansva 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 b0ed3a6 HOP-2134 (#366)
b0ed3a6 is described below
commit b0ed3a6eba8b7d3e0fbd15fc278f04a342e1f6a6
Author: Matt Casters <[email protected]>
AuthorDate: Tue Nov 10 15:18:01 2020 +0100
HOP-2134 (#366)
* HOP-2134 : Add support for ordered categories for context actions, expose
in context dialog (+ a bit of code cleanup)
* Add header to file
Co-authored-by: Hans Van Akelyen <[email protected]>
---
.../org/apache/hop/www/StopHopServerServlet.java | 137 ------
engine/src/main/resources/hop-servlets.xml | 6 -
.../apache/hop/ui/core/dialog/ContextDialog.java | 89 ++--
.../hop/ui/core/dialog/SimpleMessageDialog.java | 140 ------
.../hop/ui/core/metadata/MetadataManager.java | 5 +-
.../hop/ui/hopgui/context/GuiContextHandler.java | 51 ++-
.../hop/ui/hopgui/context/GuiContextUtil.java | 45 +-
.../hop/ui/hopgui/context/IGuiContextHandler.java | 5 +
.../context/metadata/MetadataContextHandler.java | 6 +
.../ui/hopgui/delegates/HopGuiContextDelegate.java | 6 +-
.../hopgui/file/pipeline/HopGuiPipelineGraph.java | 2 +-
.../hopgui/file/pipeline/HopPipelineFileType.java | 29 +-
.../hopgui/file/workflow/HopGuiWorkflowGraph.java | 2 +-
.../hopgui/file/workflow/HopWorkflowFileType.java | 47 +-
.../transform/common/CommonTransformDialog.java | 486 ---------------------
.../transform/common/CommonTransformMeta.java | 35 --
.../common/GetFieldsSampleDataDialog.java | 13 +-
.../actions/pipeline/ActionPipelineDialog.java | 12 +-
18 files changed, 183 insertions(+), 933 deletions(-)
diff --git a/engine/src/main/java/org/apache/hop/www/StopHopServerServlet.java
b/engine/src/main/java/org/apache/hop/www/StopHopServerServlet.java
deleted file mode 100644
index 34c082d..0000000
--- a/engine/src/main/java/org/apache/hop/www/StopHopServerServlet.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*!
- * HITACHI VANTARA PROPRIETARY AND CONFIDENTIAL
- *
- * Copyright 2002 - 2017 Hitachi Vantara. All rights reserved.
- *
- * NOTICE: All information including source code contained herein is, and
- * remains the sole property of Hitachi Vantara and its licensors. The
intellectual
- * and technical concepts contained herein are proprietary and confidential
- * to, and are trade secrets of Hitachi Vantara and may be covered by U.S. and
foreign
- * patents, or patents in process, and are protected by trade secret and
- * copyright laws. The receipt or possession of this source code and/or related
- * information does not convey or imply any rights to reproduce, disclose or
- * distribute its contents, or to manufacture, use, or sell anything that it
- * may describe, in whole or in part. Any reproduction, modification,
distribution,
- * or public display of this information without the express written
authorization
- * from Hitachi Vantara is strictly prohibited and in violation of applicable
laws and
- * international treaties. Access to the source code contained herein is
strictly
- * prohibited to anyone except those individuals and entities who have executed
- * confidentiality and non-disclosure agreements or other agreements with
Hitachi Vantara,
- * explicitly covering such access.
- */
-
-package org.apache.hop.www;
-
-import org.apache.hop.core.Const;
-import org.apache.hop.core.annotations.HopServerServlet;
-import org.apache.hop.core.util.ExecutorUtil;
-import org.apache.hop.core.xml.XmlHandler;
-import org.apache.hop.i18n.BaseMessages;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.PrintStream;
-
-@HopServerServlet( id = "StopHopServerServlet", name = "StopHopServerServlet" )
-public class StopHopServerServlet extends BaseHttpServlet implements
IHopServerPlugin {
-
- private static final Class<?> PKG = StopHopServerServlet.class;
-
- private static final long serialVersionUID = -5459379367791045161L;
- public static final String CONTEXT_PATH = "/hop/stopHopServer";
- public static final String REQUEST_ACCEPTED = "request_accepted";
- private final DelayedExecutor delayedExecutor;
-
- public StopHopServerServlet() {
- this( new DelayedExecutor() );
- }
-
- public StopHopServerServlet( DelayedExecutor delayedExecutor ) {
- this.delayedExecutor = delayedExecutor;
- }
-
- @Override
- public String getService() {
- return CONTEXT_PATH + " (" + toString() + ")";
- }
-
- @Override
- public void doGet( HttpServletRequest request, HttpServletResponse response
) throws IOException {
- if ( isJettyMode() && !request.getContextPath().startsWith( CONTEXT_PATH )
) {
- return;
- }
-
- if ( log.isDebug() ) {
- logDebug( BaseMessages.getString( PKG,
"StopHopServerServlet.shutdownRequest" ) );
- }
-
- response.setStatus( HttpServletResponse.SC_OK );
- boolean useXML = "Y".equalsIgnoreCase( request.getParameter( "xml" ) );
-
- if ( useXML ) {
- response.setContentType( "text/xml" );
- response.setCharacterEncoding( Const.XML_ENCODING );
- } else {
- response.setContentType( "text/html" );
- }
-
- PrintStream out = new PrintStream( response.getOutputStream() );
- final HopServer hopServer = HopServerSingleton.getHopServer();
- if ( useXML ) {
- out.print( XmlHandler.getXmlHeader( Const.XML_ENCODING ) );
- out.print( XmlHandler.addTagValue( REQUEST_ACCEPTED, hopServer != null )
);
- out.flush();
- } else {
- out.println( "<HTML>" );
- out.println(
- "<HEAD><TITLE>" + BaseMessages.getString( PKG,
"StopHopServerServlet.shutdownRequest" ) + "</TITLE></HEAD>" );
- out.println( "<BODY>" );
- out.println( "<H1>" + BaseMessages.getString( PKG,
"StopHopServerServlet.status.label" ) + "</H1>" );
- out.println( "<p>" );
- if ( hopServer != null ) {
- out.println( BaseMessages.getString( PKG,
"StopHopServerServlet.shutdownRequest.status.ok" ) );
- } else {
- out.println( BaseMessages.getString( PKG,
"StopHopServerServlet.shutdownRequest.status.notFound" ) );
- }
- out.println( "</p>" );
- out.println( "</BODY>" );
- out.println( "</HTML>" );
- out.flush();
- }
- if ( hopServer != null ) {
- delayedExecutor.execute( () -> {
- hopServer.getWebServer().stopServer();
- exitJVM( 0 );
- }, 1000 );
- }
- }
-
- @Override
- public String toString() {
- return BaseMessages.getString( PKG, "StopHopServerServlet.description" );
- }
-
- @Override
- public String getContextPath() {
- return CONTEXT_PATH;
- }
-
- public static class DelayedExecutor {
- public void execute( final Runnable runnable, final long delay ) {
- ExecutorUtil.getExecutor().execute( () -> {
- try {
- Thread.sleep( delay );
- } catch ( InterruptedException e ) {
- // Ignore
- }
- runnable.run();
- } );
- }
- }
-
- private static final void exitJVM( int status ) {
- System.exit( status );
- }
-}
-
diff --git a/engine/src/main/resources/hop-servlets.xml
b/engine/src/main/resources/hop-servlets.xml
index 98f6584..78478b3 100644
--- a/engine/src/main/resources/hop-servlets.xml
+++ b/engine/src/main/resources/hop-servlets.xml
@@ -95,12 +95,6 @@
<classname>org.apache.hop.www.RegisterPackageServlet</classname>
</servlet>
- <servlet id="stopHopServer">
- <description>Stop Hop Server</description>
- <classname>org.apache.hop.www.StopHopServerServlet</classname>
- </servlet>
-
-
<!-- Easier remote execution ... -->
<servlet id="addExport">
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 6812365..a83ad16 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
@@ -25,6 +25,7 @@ package org.apache.hop.ui.core.dialog;
import org.apache.commons.lang.StringUtils;
import org.apache.hop.core.Const;
import org.apache.hop.core.SwtUniversalImage;
+import org.apache.hop.core.config.HopConfig;
import org.apache.hop.core.gui.AreaOwner;
import org.apache.hop.core.gui.Point;
import org.apache.hop.core.gui.Rectangle;
@@ -32,11 +33,14 @@ import org.apache.hop.core.gui.plugin.GuiPlugin;
import org.apache.hop.core.gui.plugin.action.GuiAction;
import org.apache.hop.core.gui.plugin.toolbar.GuiToolbarElement;
import org.apache.hop.core.gui.plugin.toolbar.GuiToolbarElementType;
+import org.apache.hop.core.logging.LogChannel;
+import org.apache.hop.history.AuditManager;
+import org.apache.hop.history.AuditState;
import org.apache.hop.ui.core.PropsUi;
import org.apache.hop.ui.core.gui.GuiResource;
import org.apache.hop.ui.core.gui.GuiToolbarWidgets;
+import org.apache.hop.ui.core.gui.HopNamespace;
import org.apache.hop.ui.core.gui.WindowProperty;
-import org.apache.hop.ui.hopgui.shared.AuditManagerGuiUtil;
import org.apache.hop.ui.pipeline.transform.BaseTransformDialog;
import org.apache.hop.ui.util.SwtSvgImageUtil;
import org.eclipse.swt.SWT;
@@ -70,7 +74,9 @@ import org.eclipse.swt.widgets.ToolItem;
import java.util.ArrayList;
import java.util.Comparator;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.Objects;
@GuiPlugin
@@ -83,10 +89,13 @@ public class ContextDialog extends Dialog {
public static final String TOOLBAR_ITEM_EXPAND_ALL =
"ContextDialog-Toolbar-10020-ExpandAll";
public static final String TOOLBAR_ITEM_ENABLE_CATEGORIES =
"ContextDialog-Toolbar-10030-EnableCategories";
- public static final String AUDIT_TYPE_TOOLBAR_SHOW_CATEGORIES =
"ContextDialog-Toolbar-ShowCategories";
+ public static final String AUDIT_TYPE_TOOLBAR_SHOW_CATEGORIES =
"ContextDialogShowCategories";
+ public static final String AUDIT_TYPE_CONTEXT_DIALOG = "ContextDialog";
+ public static final String AUDIT_NAME_CATEGORY_STATES = "CategoryStates";
private Point location;
private List<GuiAction> actions;
+ private String contextId;
private PropsUi props;
private Shell shell;
private Text wSearch;
@@ -280,12 +289,14 @@ public class ContextDialog extends Dialog {
}
}
- public ContextDialog( Shell parent, String title, Point location,
List<GuiAction> actions ) {
+ public ContextDialog( Shell parent, String title, Point location,
List<GuiAction> actions, String contextId ) {
super( parent );
this.setText( title );
this.location = location;
this.actions = actions;
+ this.contextId = contextId;
+
props = PropsUi.getInstance();
shiftClicked = false;
@@ -422,6 +433,7 @@ public class ContextDialog extends Dialog {
//
shell.addListener( SWT.Resize, event -> updateVerticalBar() );
shell.addListener( SWT.Deactivate, event -> onFocusLost() );
+ shell.addListener( SWT.Close, event -> storeDialogSettings() );
wSearch.addModifyListener( event -> onModifySearch() );
@@ -522,33 +534,60 @@ public class ContextDialog extends Dialog {
private void recallToolbarSettings() {
Button categoriesCheckBox = getCategoriesCheckBox();
- if (categoriesCheckBox!=null) {
- String strUseCategories = AuditManagerGuiUtil.getLastUsedValue(
AUDIT_TYPE_TOOLBAR_SHOW_CATEGORIES );
- categoriesCheckBox.setSelection( "Y".equalsIgnoreCase(
Const.NVL(strUseCategories, "Y" )) );
+ if ( categoriesCheckBox != null ) {
+ String strUseCategories = HopConfig.getGuiProperty(
AUDIT_TYPE_TOOLBAR_SHOW_CATEGORIES );
+ categoriesCheckBox.setSelection( "Y".equalsIgnoreCase( Const.NVL(
strUseCategories, "Y" ) ) );
+ }
+
+ AuditState auditState = AuditManager.retrieveState( LogChannel.UI,
HopNamespace.getNamespace(), AUDIT_TYPE_CONTEXT_DIALOG,
AUDIT_NAME_CATEGORY_STATES );
+ if (auditState!=null) {
+ Map<String, Object> states = auditState.getStateMap();
+ for ( CategoryAndOrder category : categories ) {
+ Object expanded = states.get( category.getCategory() );
+ if ( expanded == null ) {
+ category.setCollapsed( false );
+ } else {
+ category.setCollapsed( "N".equalsIgnoreCase( expanded.toString() ) );
+ }
+ }
}
}
- private void storeToolbarSettings() {
+ private void storeDialogSettings() {
+ // Save the shell size and location in case the position isn't a mouse
click
+ //
+ if ( location == null ) {
+ props.setScreen( new WindowProperty( shell ) );
+ }
+
Button categoriesCheckBox = getCategoriesCheckBox();
if ( categoriesCheckBox != null ) {
- AuditManagerGuiUtil.addLastUsedValue(
AUDIT_TYPE_TOOLBAR_SHOW_CATEGORIES, categoriesCheckBox.getSelection() ? "Y" :
"N" );
+
+ HopConfig.setGuiProperty( AUDIT_TYPE_TOOLBAR_SHOW_CATEGORIES,
categoriesCheckBox.getSelection() ? "Y" : "N" );
+ try {
+ HopConfig.getInstance().saveToFile();
+ } catch ( Exception e ) {
+ new ErrorDialog( shell, "Error", "Error saving GUI options to
hop-config.json", e );
+ }
+ }
+
+ // Store the category states: expanded or not
+ //
+ Map<String, Object> states = new HashMap<>();
+ for ( CategoryAndOrder category : categories ) {
+ states.put( category.getCategory(), category.isCollapsed() ? "N" : "Y" );
}
+ AuditManager.storeState( LogChannel.UI, HopNamespace.getNamespace(),
AUDIT_TYPE_CONTEXT_DIALOG, AUDIT_NAME_CATEGORY_STATES, states );
}
- public boolean isDisposed() {
+ public boolean isDisposed() {
return shell.isDisposed();
}
public void dispose() {
- // Save the shell size and location in case the position isn't a mouse
click
- //
- if ( location == null ) {
- props.setScreen( new WindowProperty( shell ) );
- }
-
// Store the toolbar settings
- storeToolbarSettings();
+ storeDialogSettings();
// Close the dialog window
shell.close();
@@ -569,7 +608,7 @@ public class ContextDialog extends Dialog {
image = "ui/images/CollapseAll.svg"
)
public void collapseAll() {
- for (CategoryAndOrder category : categories) {
+ for ( CategoryAndOrder category : categories ) {
category.setCollapsed( true );
}
wCanvas.redraw();
@@ -582,7 +621,7 @@ public class ContextDialog extends Dialog {
image = "ui/images/ExpandAll.svg"
)
public void expandAll() {
- for (CategoryAndOrder category : categories) {
+ for ( CategoryAndOrder category : categories ) {
category.setCollapsed( false );
}
wCanvas.redraw();
@@ -603,7 +642,7 @@ public class ContextDialog extends Dialog {
private Button getCategoriesCheckBox() {
ToolItem checkboxItem = toolBarWidgets.findToolItem(
TOOLBAR_ITEM_ENABLE_CATEGORIES );
- if (checkboxItem==null) {
+ if ( checkboxItem == null ) {
return null;
}
return (Button) checkboxItem.getControl();
@@ -631,10 +670,10 @@ public class ContextDialog extends Dialog {
boolean useCategories;
Button categoriesCheckBox = getCategoriesCheckBox();
- if (categoriesCheckBox==null) {
- useCategories=true;
+ if ( categoriesCheckBox == null ) {
+ useCategories = true;
} else {
- useCategories = categoriesCheckBox.getSelection();
+ useCategories = categoriesCheckBox.getSelection();
}
useCategories &= !categories.isEmpty();
updateToolbar();
@@ -684,7 +723,7 @@ public class ContextDialog extends Dialog {
firstShownItem = null;
while ( ( useCategories && categoryNr < categories.size() ) ||
- ( !useCategories || categories.isEmpty() ) && (categoryNr == 0 ) )
{
+ ( !useCategories || categories.isEmpty() ) && ( categoryNr == 0 ) ) {
CategoryAndOrder categoryAndOrder;
if ( !useCategories || categories.isEmpty() ) {
@@ -719,7 +758,7 @@ public class ContextDialog extends Dialog {
gc.setForeground( GuiResource.getInstance().getColorBlack() );
gc.setFont( itemsFont );
- if ( categoryAndOrder==null || !categoryAndOrder.isCollapsed() ) {
+ if ( categoryAndOrder == null || !categoryAndOrder.isCollapsed() ) {
// Paint the action items
//
@@ -811,7 +850,7 @@ public class ContextDialog extends Dialog {
private void updateToolbar() {
Button categoriesCheckBox = getCategoriesCheckBox();
- boolean categoriesEnabled = categoriesCheckBox!=null &&
categoriesCheckBox.getSelection();
+ boolean categoriesEnabled = categoriesCheckBox != null &&
categoriesCheckBox.getSelection();
toolBarWidgets.enableToolbarItem( TOOLBAR_ITEM_COLLAPSE_ALL,
categoriesEnabled );
toolBarWidgets.enableToolbarItem( TOOLBAR_ITEM_EXPAND_ALL,
categoriesEnabled );
}
diff --git
a/ui/src/main/java/org/apache/hop/ui/core/dialog/SimpleMessageDialog.java
b/ui/src/main/java/org/apache/hop/ui/core/dialog/SimpleMessageDialog.java
deleted file mode 100644
index 0e34443..0000000
--- a/ui/src/main/java/org/apache/hop/ui/core/dialog/SimpleMessageDialog.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*!
- * HITACHI VANTARA PROPRIETARY AND CONFIDENTIAL
- *
- * Copyright 2018 Hitachi Vantara. All rights reserved.
- *
- * NOTICE: All information including source code contained herein is, and
- * remains the sole property of Hitachi Vantara and its licensors. The
intellectual
- * and technical concepts contained herein are proprietary and confidential
- * to, and are trade secrets of Hitachi Vantara and may be covered by U.S. and
foreign
- * patents, or patents in process, and are protected by trade secret and
- * copyright laws. The receipt or possession of this source code and/or related
- * information does not convey or imply any rights to reproduce, disclose or
- * distribute its contents, or to manufacture, use, or sell anything that it
- * may describe, in whole or in part. Any reproduction, modification,
distribution,
- * or public display of this information without the express written
authorization
- * from Hitachi Vantara is strictly prohibited and in violation of applicable
laws and
- * international treaties. Access to the source code contained herein is
strictly
- * prohibited to anyone except those individuals and entities who have executed
- * confidentiality and non-disclosure agreements or other agreements with
Hitachi Vantara,
- * explicitly covering such access.
- */
-
-package org.apache.hop.ui.core.dialog;
-
-import org.apache.hop.i18n.BaseMessages;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Shell;
-
-import java.lang.reflect.Field;
-
-/**
- * A simple message dialog containing a title, icon, message and a single
button (OK by default) that closes the dialog.
- * The dialog width can be specified and the height is auto-adjusted based on
the width.
- */
-public class SimpleMessageDialog extends MessageDialog {
-
- protected static Class<?> PKG = SimpleMessageDialog.class;
-
- public static final int BUTTON_WIDTH = 65;
- public static final int DEFULT_WIDTH = 450;
-
- private int width;
- private int buttonWidth;
-
- /**
- * Creates a new dialog with the button label set to "Ok", dialog width set
to {@link #DEFULT_WIDTH} and button width
- * set to {@link #BUTTON_WIDTH}
- *
- * @param parentShell the parent {@link Shell}
- * @param title the dialog title
- * @param message the dialog message
- * @param dialogType the dialog type ({@link MessageDialog#INFORMATION},
{@link MessageDialog#WARNING}, {@link
- * MessageDialog#ERROR} etc...)
- */
- public SimpleMessageDialog( final Shell parentShell, final String title,
final String message,
- final int dialogType ) {
- this( parentShell, title, message, dialogType, BaseMessages.getString(
PKG, "System.Button.OK" ),
- DEFULT_WIDTH, BUTTON_WIDTH );
- }
-
- /**
- * Creates a new dialog with the button label set to {@code
closeButtonLabel}, dialog width set to {@link
- * #DEFULT_WIDTH} and button width set to {@link #BUTTON_WIDTH}
- *
- * @param parentShell the parent {@link Shell}
- * @param title the dialog title
- * @param message the dialog message
- * @param dialogType the dialog type ({@link MessageDialog#INFORMATION},
{@link MessageDialog#WARNING}, {@link
- * MessageDialog#ERROR} etc...)
- * @param buttonLabel the label for the close dialog
- */
- public SimpleMessageDialog( final Shell parentShell, final String title,
final String message,
- final int dialogType, final String buttonLabel )
{
- this( parentShell, title, message, dialogType, buttonLabel, DEFULT_WIDTH,
BUTTON_WIDTH );
- }
-
- /**
- * Creates a new dialog with the specified title, message, dialogType and
width.
- *
- * @param parentShell the parent {@link Shell}
- * @param title the dialog title
- * @param message the dialog message
- * @param dialogType the dialog type ({@link MessageDialog#INFORMATION},
{@link MessageDialog#WARNING}, {@link
- * MessageDialog#ERROR} etc...)
- * @param buttonLabel the button label
- * @param width dialog width
- * @param buttonWidth button width
- */
- public SimpleMessageDialog( final Shell parentShell, final String title,
final String message, final int dialogType,
- final String buttonLabel, final int width, final
int buttonWidth ) {
- super( parentShell, title, null, message, dialogType, new String[] {
buttonLabel }, 0 );
- this.width = width;
- this.buttonWidth = buttonWidth;
- }
-
- /**
- * Overridden to auto-size the shell according to the selected width.
- */
- @Override
- protected void constrainShellSize() {
- super.constrainShellSize();
- try {
- // the shell property within the Windows class is private - need to
access it via reflection
- final Field shellField = Window.class.getDeclaredField( "shell" );
- shellField.setAccessible( true );
- final Shell thisShell = (Shell) shellField.get( this );
- thisShell.pack();
- final int height = thisShell.computeSize( width, SWT.DEFAULT ).y;
- thisShell.setBounds( thisShell.getBounds().x, thisShell.getBounds().y,
width + 4, height + 2 );
- } catch ( final Exception e ) {
- // nothing to do
- }
- }
-
- /**
- * Overridden to make the shell background white.
- *
- * @param shell
- */
- @Override
- protected void configureShell( Shell shell ) {
- super.configureShell( shell );
- shell.setBackground( shell.getDisplay().getSystemColor( SWT.COLOR_WHITE )
);
- shell.setBackgroundMode( SWT.INHERIT_FORCE );
- }
-
- /**
- * Overridden to give the button the desired width.
- */
- @Override
- public void create() {
- super.create();
- final Button button = getButton( 0 );
- final int newX = button.getBounds().x + button.getBounds().width -
buttonWidth;
- button.setBounds( newX, button.getBounds().y, buttonWidth,
button.getBounds().height );
- }
-}
diff --git
a/ui/src/main/java/org/apache/hop/ui/core/metadata/MetadataManager.java
b/ui/src/main/java/org/apache/hop/ui/core/metadata/MetadataManager.java
index 3a893ea..699d9d2 100644
--- a/ui/src/main/java/org/apache/hop/ui/core/metadata/MetadataManager.java
+++ b/ui/src/main/java/org/apache/hop/ui/core/metadata/MetadataManager.java
@@ -36,6 +36,7 @@ import org.apache.hop.metadata.api.IHopMetadataSerializer;
import org.apache.hop.metadata.util.HopMetadataUtil;
import org.apache.hop.ui.core.dialog.ErrorDialog;
import org.apache.hop.ui.hopgui.HopGui;
+import org.apache.hop.ui.hopgui.context.GuiContextHandler;
import org.apache.hop.ui.hopgui.context.GuiContextUtil;
import org.apache.hop.ui.hopgui.dialog.MetadataExplorerDialog;
import org.eclipse.swt.SWT;
@@ -96,7 +97,7 @@ public class MetadataManager<T extends IHopMetadata> {
action.setClassLoader( getClassLoader() );
actions.add( action );
}
- return GuiContextUtil.handleActionSelection( hopGui.getShell(), "Select
the " + hopMetadata.name() + " to edit", actions );
+ return GuiContextUtil.handleActionSelection( hopGui.getShell(), "Select
the " + hopMetadata.name() + " to edit", new GuiContextHandler(
"HopGuiMetadataContext", actions ) );
} catch ( Exception e ) {
new ErrorDialog( hopGui.getShell(), "Error", "Error editing metadata", e
);
@@ -125,7 +126,7 @@ public class MetadataManager<T extends IHopMetadata> {
action.setClassLoader( getClassLoader() );
actions.add( action );
}
- return GuiContextUtil.handleActionSelection( hopGui.getShell(), "Select
the " + hopMetadata.name() + " to delete after confirmation", actions );
+ return GuiContextUtil.handleActionSelection( hopGui.getShell(), "Select
the " + hopMetadata.name() + " to delete after confirmation", new
GuiContextHandler( "HopGuiMetadaContext", actions ) );
} catch ( Exception e ) {
new ErrorDialog( hopGui.getShell(), "Error", "Error deleting metadata",
e );
diff --git
a/ui/src/main/java/org/apache/hop/ui/hopgui/context/GuiContextHandler.java
b/ui/src/main/java/org/apache/hop/ui/hopgui/context/GuiContextHandler.java
index b3e1632..d1fcf37 100644
--- a/ui/src/main/java/org/apache/hop/ui/hopgui/context/GuiContextHandler.java
+++ b/ui/src/main/java/org/apache/hop/ui/hopgui/context/GuiContextHandler.java
@@ -1,41 +1,50 @@
-/*!
******************************************************************************
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
- * Hop : The Hop Orchestration Platform
- *
- * http://www.project-hop.org
- *
-
*******************************************************************************
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
-
******************************************************************************/
+ */
package org.apache.hop.ui.hopgui.context;
import org.apache.hop.core.gui.plugin.action.GuiAction;
-import java.util.ArrayList;
import java.util.List;
-/**
- * This class handles actions for a certain context.
- * For example, the main HopGui dialog registers a bunch of context handlers
for MetaStore objects, asks the various perspectives, ...
- */
public class GuiContextHandler implements IGuiContextHandler {
+
+ private String contextId;
private List<GuiAction> supportedActions;
- public GuiContextHandler() {
- supportedActions = new ArrayList<>();
+ public GuiContextHandler( String contextId, List<GuiAction> supportedActions
) {
+ this.contextId = contextId;
+ this.supportedActions = supportedActions;
+ }
+
+ /**
+ * Gets contextId
+ *
+ * @return value of contextId
+ */
+ @Override public String getContextId() {
+ return contextId;
+ }
+
+ /**
+ * @param contextId The contextId to set
+ */
+ public void setContextId( String contextId ) {
+ this.contextId = contextId;
}
/**
diff --git
a/ui/src/main/java/org/apache/hop/ui/hopgui/context/GuiContextUtil.java
b/ui/src/main/java/org/apache/hop/ui/hopgui/context/GuiContextUtil.java
index 0757ac1..fdf9921 100644
--- a/ui/src/main/java/org/apache/hop/ui/hopgui/context/GuiContextUtil.java
+++ b/ui/src/main/java/org/apache/hop/ui/hopgui/context/GuiContextUtil.java
@@ -42,8 +42,8 @@ public class GuiContextUtil {
private static final Map<String, ContextDialog> shellDialogMap = new
HashMap<>();
- public static final List<GuiAction> getContextActions(
IActionContextHandlersProvider provider, GuiActionType actionType ) {
- return GuiContextUtil.filterHandlerActions( provider.getContextHandlers(),
actionType );
+ public static final List<GuiAction> getContextActions(
IActionContextHandlersProvider provider, GuiActionType actionType, String
contextId ) {
+ return GuiContextUtil.filterHandlerActions( provider.getContextHandlers(),
actionType, contextId );
}
/**
@@ -70,7 +70,7 @@ public class GuiContextUtil {
* @param actionType
* @return
*/
- public static final List<GuiAction> filterHandlerActions(
List<IGuiContextHandler> handlers, GuiActionType actionType ) {
+ public static final List<GuiAction> filterHandlerActions(
List<IGuiContextHandler> handlers, GuiActionType actionType, String contextId )
{
List<GuiAction> filtered = new ArrayList<>();
for ( IGuiContextHandler handler : handlers ) {
filtered.addAll( filterActions( handler.getSupportedActions(),
actionType ) );
@@ -78,40 +78,41 @@ public class GuiContextUtil {
return filtered;
}
- public static final void handleActionSelection( Shell parent, String
message, IActionContextHandlersProvider provider, GuiActionType actionType ) {
- handleActionSelection( parent, message, null, provider, actionType );
+ public static final void handleActionSelection( Shell parent, String
message, IActionContextHandlersProvider provider, GuiActionType actionType,
String contextId ) {
+ handleActionSelection( parent, message, null, provider, actionType,
contextId );
}
- public static final void handleActionSelection( Shell parent, String
message, Point clickLocation, IActionContextHandlersProvider provider,
GuiActionType actionType ) {
- handleActionSelection( parent, message, clickLocation, provider,
actionType, false );
+ public static final void handleActionSelection( Shell parent, String
message, Point clickLocation, IActionContextHandlersProvider provider,
GuiActionType actionType, String contextId ) {
+ handleActionSelection( parent, message, clickLocation, provider,
actionType, contextId, false );
}
- public static final void handleActionSelection( Shell parent, String
message, Point clickLocation, IActionContextHandlersProvider provider,
GuiActionType actionType, boolean sortByName ) {
+ public static final void handleActionSelection( Shell parent, String
message, Point clickLocation, IActionContextHandlersProvider provider,
GuiActionType actionType, String contextId, boolean sortByName ) {
// Get the list of create actions in the Hop UI context...
//
- List<GuiAction> actions = GuiContextUtil.getContextActions( provider,
actionType );
+ List<GuiAction> actions = GuiContextUtil.getContextActions( provider,
actionType, contextId );
if ( actions.isEmpty() ) {
return;
}
- if (sortByName) {
+ if ( sortByName ) {
Collections.sort( actions, Comparator.comparing( GuiAction::getName ) );
}
- handleActionSelection( parent, message, clickLocation, actions );
+ handleActionSelection( parent, message, clickLocation, new
GuiContextHandler( contextId, actions ) );
}
- public static boolean handleActionSelection( Shell parent, String message,
List<GuiAction> actions ) {
- return handleActionSelection( parent, message, null, actions );
+ public static boolean handleActionSelection( Shell parent, String message,
IGuiContextHandler contextHandler ) {
+ return handleActionSelection( parent, message, null, contextHandler );
}
- /**
- * @param parent
- * @param message
- * @param clickLocation
- * @param actions
- * @return true if the action dialog lost focus
- */
- public synchronized static boolean handleActionSelection( Shell parent,
String message, Point clickLocation, List<GuiAction> actions ) {
+ /**
+ * @param parent
+ * @param message
+ * @param clickLocation
+ * @param contextHandler
+ * @return true if the action dialog lost focus
+ */
+ public synchronized static boolean handleActionSelection( Shell parent,
String message, Point clickLocation, IGuiContextHandler contextHandler ) {
+ List<GuiAction> actions = contextHandler.getSupportedActions();
if ( actions.isEmpty() ) {
return false;
}
@@ -133,7 +134,7 @@ public class GuiContextUtil {
fileTypes.add( action.getType().name() + " - " + action.getName() +
" : " + action.getTooltip() );
}
- contextDialog = new ContextDialog( parent, message, clickLocation,
actions );
+ contextDialog = new ContextDialog( parent, message, clickLocation,
actions, contextHandler.getContextId() );
shellDialogMap.put( parent.getText(), contextDialog );
GuiAction selectedAction = contextDialog.open();
shellDialogMap.remove( parent.getText() );
diff --git
a/ui/src/main/java/org/apache/hop/ui/hopgui/context/IGuiContextHandler.java
b/ui/src/main/java/org/apache/hop/ui/hopgui/context/IGuiContextHandler.java
index 3e33b94..1e552af 100644
--- a/ui/src/main/java/org/apache/hop/ui/hopgui/context/IGuiContextHandler.java
+++ b/ui/src/main/java/org/apache/hop/ui/hopgui/context/IGuiContextHandler.java
@@ -35,4 +35,9 @@ public interface IGuiContextHandler {
* @return Get a list of all the supported actions by this context handler
*/
List<GuiAction> getSupportedActions();
+
+ /**
+ * @return The name of the context handler
+ */
+ String getContextId();
}
diff --git
a/ui/src/main/java/org/apache/hop/ui/hopgui/context/metadata/MetadataContextHandler.java
b/ui/src/main/java/org/apache/hop/ui/hopgui/context/metadata/MetadataContextHandler.java
index 4f31840..87d636a 100644
---
a/ui/src/main/java/org/apache/hop/ui/hopgui/context/metadata/MetadataContextHandler.java
+++
b/ui/src/main/java/org/apache/hop/ui/hopgui/context/metadata/MetadataContextHandler.java
@@ -37,6 +37,8 @@ import java.util.List;
public class MetadataContextHandler implements IGuiContextHandler {
+ public static final String CONTEXT_ID = "HopGuiMetadataContext";
+
private HopGui hopGui;
private IHopMetadataProvider metadataProvider;
private Class<? extends IHopMetadata> metadataObjectClass;
@@ -52,6 +54,10 @@ public class MetadataContextHandler implements
IGuiContextHandler {
metadataManager.setClassLoader( metadataObjectClass.getClassLoader() );
}
+ @Override public String getContextId() {
+ return CONTEXT_ID;
+ }
+
@Override public List<GuiAction> getSupportedActions() {
HopMetadata hopMetadata = HopMetadataUtil.getHopMetadataAnnotation(
metadataObjectClass );
diff --git
a/ui/src/main/java/org/apache/hop/ui/hopgui/delegates/HopGuiContextDelegate.java
b/ui/src/main/java/org/apache/hop/ui/hopgui/delegates/HopGuiContextDelegate.java
index d134d7b..873c693 100644
---
a/ui/src/main/java/org/apache/hop/ui/hopgui/delegates/HopGuiContextDelegate.java
+++
b/ui/src/main/java/org/apache/hop/ui/hopgui/delegates/HopGuiContextDelegate.java
@@ -43,7 +43,7 @@ public class HopGuiContextDelegate {
int x = 50 + hopGui.getShell().getLocation().x;
int y = 50 + hopGui.getShell().getLocation().y;
- GuiContextUtil.handleActionSelection( hopGui.getShell(), "Select the item
to create", new Point( x, y ), hopGui, GuiActionType.Create, true );
+ GuiContextUtil.handleActionSelection( hopGui.getShell(), "Select the item
to create", new Point( x, y ), hopGui, GuiActionType.Create, "FileNew", true );
}
/**
@@ -51,7 +51,7 @@ public class HopGuiContextDelegate {
*/
public void fileMetadataEdit() {
- GuiContextUtil.handleActionSelection( hopGui.getShell(), "Select the
element type to edit...", new Point( 0, 0 ), hopGui, GuiActionType.Modify, true
);
+ GuiContextUtil.handleActionSelection( hopGui.getShell(), "Select the
element type to edit...", new Point( 0, 0 ), hopGui, GuiActionType.Modify,
"FileMetadataEdit", true );
}
/**
@@ -59,7 +59,7 @@ public class HopGuiContextDelegate {
*/
public void fileMetadataDelete() {
- GuiContextUtil.handleActionSelection( hopGui.getShell(), "Select the
element type to delete...", new Point( 0, 0 ), hopGui, GuiActionType.Delete,
true );
+ GuiContextUtil.handleActionSelection( hopGui.getShell(), "Select the
element type to delete...", new Point( 0, 0 ), hopGui, GuiActionType.Delete,
"FileMetadataDelete", true );
}
/**
diff --git
a/ui/src/main/java/org/apache/hop/ui/hopgui/file/pipeline/HopGuiPipelineGraph.java
b/ui/src/main/java/org/apache/hop/ui/hopgui/file/pipeline/HopGuiPipelineGraph.java
index 72d7e32..199b86d 100644
---
a/ui/src/main/java/org/apache/hop/ui/hopgui/file/pipeline/HopGuiPipelineGraph.java
+++
b/ui/src/main/java/org/apache/hop/ui/hopgui/file/pipeline/HopGuiPipelineGraph.java
@@ -1065,7 +1065,7 @@ public class HopGuiPipelineGraph extends
HopGuiAbstractGraph
// Show the context dialog
//
- GuiContextUtil.handleActionSelection( parent, message, new Point(
p.x, p.y ), contextHandler.getSupportedActions() );
+ avoidContextDialog = GuiContextUtil.handleActionSelection( parent,
message, new Point( p.x, p.y ), contextHandler );
}
}
diff --git
a/ui/src/main/java/org/apache/hop/ui/hopgui/file/pipeline/HopPipelineFileType.java
b/ui/src/main/java/org/apache/hop/ui/hopgui/file/pipeline/HopPipelineFileType.java
index bdd4fa2..c942609 100644
---
a/ui/src/main/java/org/apache/hop/ui/hopgui/file/pipeline/HopPipelineFileType.java
+++
b/ui/src/main/java/org/apache/hop/ui/hopgui/file/pipeline/HopPipelineFileType.java
@@ -35,6 +35,7 @@ import org.apache.hop.pipeline.PipelineMeta;
import org.apache.hop.ui.core.dialog.ErrorDialog;
import org.apache.hop.ui.core.gui.HopNamespace;
import org.apache.hop.ui.hopgui.HopGui;
+import org.apache.hop.ui.hopgui.context.GuiContextHandler;
import org.apache.hop.ui.hopgui.context.IGuiContextHandler;
import org.apache.hop.ui.hopgui.file.HopFileTypeBase;
import org.apache.hop.ui.hopgui.file.HopFileTypePlugin;
@@ -46,6 +47,7 @@ import org.w3c.dom.Document;
import org.w3c.dom.Node;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import java.util.Properties;
@@ -191,22 +193,17 @@ public class HopPipelineFileType<T extends PipelineMeta>
extends HopFileTypeBase
HopGui hopGui = HopGui.getInstance();
List<IGuiContextHandler> handlers = new ArrayList<>();
- handlers.add( () -> {
- List<GuiAction> actions = new ArrayList<>();
-
- GuiAction newAction = new GuiAction( ACTION_ID_NEW_PIPELINE,
GuiActionType.Create, "Pipeline", "Creates a new pipeline. Process your data
using a network of transforms running in parallel",
- BasePropertyHandler.getProperty( "Pipeline_image" ),
- ( shiftClicked, controlClicked, parameters ) -> {
- try {
- HopPipelineFileType.this.newFile( hopGui, hopGui.getVariables() );
- } catch ( Exception e ) {
- new ErrorDialog( hopGui.getShell(), "Error", "Error creating new
pipeline", e );
- }
- } );
- actions.add( newAction );
-
- return actions;
- } );
+
+ GuiAction newAction = new GuiAction( ACTION_ID_NEW_PIPELINE,
GuiActionType.Create, "Pipeline", "Creates a new pipeline. Process your data
using a network of transforms running in parallel",
+ BasePropertyHandler.getProperty( "Pipeline_image" ),
+ ( shiftClicked, controlClicked, parameters ) -> {
+ try {
+ HopPipelineFileType.this.newFile( hopGui, hopGui.getVariables() );
+ } catch ( Exception e ) {
+ new ErrorDialog( hopGui.getShell(), "Error", "Error creating new
pipeline", e );
+ }
+ } );
+ handlers.add( new GuiContextHandler( ACTION_ID_NEW_PIPELINE,
Arrays.asList(newAction) ) );
return handlers;
}
}
diff --git
a/ui/src/main/java/org/apache/hop/ui/hopgui/file/workflow/HopGuiWorkflowGraph.java
b/ui/src/main/java/org/apache/hop/ui/hopgui/file/workflow/HopGuiWorkflowGraph.java
index 574ab05..e463e88 100644
---
a/ui/src/main/java/org/apache/hop/ui/hopgui/file/workflow/HopGuiWorkflowGraph.java
+++
b/ui/src/main/java/org/apache/hop/ui/hopgui/file/workflow/HopGuiWorkflowGraph.java
@@ -908,7 +908,7 @@ public class HopGuiWorkflowGraph extends HopGuiAbstractGraph
// Show the context dialog
//
- GuiContextUtil.handleActionSelection( parent, message, new Point(
p.x, p.y ), contextHandler.getSupportedActions() );
+ ignoreNextClick = GuiContextUtil.handleActionSelection( parent,
message, new Point( p.x, p.y ), contextHandler );
}
}
}
diff --git
a/ui/src/main/java/org/apache/hop/ui/hopgui/file/workflow/HopWorkflowFileType.java
b/ui/src/main/java/org/apache/hop/ui/hopgui/file/workflow/HopWorkflowFileType.java
index dd4e20f..b63231f 100644
---
a/ui/src/main/java/org/apache/hop/ui/hopgui/file/workflow/HopWorkflowFileType.java
+++
b/ui/src/main/java/org/apache/hop/ui/hopgui/file/workflow/HopWorkflowFileType.java
@@ -31,21 +31,23 @@ import org.apache.hop.core.variables.IVariables;
import org.apache.hop.core.xml.XmlHandler;
import org.apache.hop.history.AuditManager;
import org.apache.hop.laf.BasePropertyHandler;
-import org.apache.hop.ui.hopgui.perspective.TabItemHandler;
-import org.apache.hop.workflow.WorkflowMeta;
import org.apache.hop.ui.core.dialog.ErrorDialog;
import org.apache.hop.ui.core.gui.HopNamespace;
import org.apache.hop.ui.hopgui.HopGui;
+import org.apache.hop.ui.hopgui.context.GuiContextHandler;
import org.apache.hop.ui.hopgui.context.IGuiContextHandler;
import org.apache.hop.ui.hopgui.file.HopFileTypeBase;
+import org.apache.hop.ui.hopgui.file.HopFileTypePlugin;
import org.apache.hop.ui.hopgui.file.IHopFileType;
import org.apache.hop.ui.hopgui.file.IHopFileTypeHandler;
-import org.apache.hop.ui.hopgui.file.HopFileTypePlugin;
+import org.apache.hop.ui.hopgui.perspective.TabItemHandler;
import
org.apache.hop.ui.hopgui.perspective.dataorch.HopDataOrchestrationPerspective;
+import org.apache.hop.workflow.WorkflowMeta;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import java.util.Properties;
@@ -63,9 +65,9 @@ public class HopWorkflowFileType<T extends WorkflowMeta>
extends HopFileTypeBase
@Override public String getName() {
return WORKFLOW_FILE_TYPE_DESCRIPTION;
}
-
+
@Override public String getDefaultFileExtension() {
- return ".hwf";
+ return ".hwf";
}
@Override public String[] getFilterExtensions() {
@@ -108,7 +110,7 @@ public class HopWorkflowFileType<T extends WorkflowMeta>
extends HopFileTypeBase
// Other file types we might allow to open more than once but not
workflows for now.
//
TabItemHandler tabItemHandlerWithFilename =
perspective.findTabItemHandlerWithFilename( filename );
- if (tabItemHandlerWithFilename!=null) {
+ if ( tabItemHandlerWithFilename != null ) {
// Same file so we can simply switch to it.
// This will prevent confusion.
//
@@ -127,7 +129,7 @@ public class HopWorkflowFileType<T extends WorkflowMeta>
extends HopFileTypeBase
// Keep track of open...
//
AuditManager.registerEvent( HopNamespace.getNamespace(), "file",
filename, "open" );
-
+
// Inform those that want to know about it that we loaded a pipeline
//
ExtensionPointHandler.callExtensionPoint( hopGui.getLog(),
"WorkflowAfterOpen", workflowMeta );
@@ -183,29 +185,26 @@ public class HopWorkflowFileType<T extends WorkflowMeta>
extends HopFileTypeBase
return metaObject instanceof WorkflowMeta;
}
- public static final String ACTION_ID_NEW_PIPELINE = "NewWorkflow";
+ public static final String ACTION_ID_NEW_WORKFLOW = "NewWorkflow";
@Override public List<IGuiContextHandler> getContextHandlers() {
HopGui hopGui = HopGui.getInstance();
List<IGuiContextHandler> handlers = new ArrayList<>();
- handlers.add( () -> {
- List<GuiAction> actions = new ArrayList<>();
-
- GuiAction newAction = new GuiAction( ACTION_ID_NEW_PIPELINE,
GuiActionType.Create, "Workflow", "Creates a workflow: a sequential set of
actions where a path is followed based on the outcome of executions and
conditions.",
- BasePropertyHandler.getProperty( "Workflow_image" ),
- ( shiftClicked, controlClicked, parameters ) -> {
- try {
- HopWorkflowFileType.this.newFile( hopGui, hopGui.getVariables() );
- } catch ( Exception e ) {
- new ErrorDialog( hopGui.getShell(), "Error", "Error creating new
workflow", e );
- }
- } );
- actions.add( newAction );
-
- return actions;
- } );
+
+ GuiAction newAction = new GuiAction( ACTION_ID_NEW_WORKFLOW,
GuiActionType.Create, "Workflow",
+ "Creates a workflow: a sequential set of actions where a path is
followed based on the outcome of executions and conditions.",
+ BasePropertyHandler.getProperty( "Workflow_image" ),
+ ( shiftClicked, controlClicked, parameters ) -> {
+ try {
+ HopWorkflowFileType.this.newFile( hopGui, hopGui.getVariables() );
+ } catch ( Exception e ) {
+ new ErrorDialog( hopGui.getShell(), "Error", "Error creating new
workflow", e );
+ }
+ } );
+ handlers.add( new GuiContextHandler( ACTION_ID_NEW_WORKFLOW,
Arrays.asList( newAction ) ) );
+
return handlers;
}
}
diff --git
a/ui/src/main/java/org/apache/hop/ui/pipeline/transform/common/CommonTransformDialog.java
b/ui/src/main/java/org/apache/hop/ui/pipeline/transform/common/CommonTransformDialog.java
deleted file mode 100644
index 3a18754..0000000
---
a/ui/src/main/java/org/apache/hop/ui/pipeline/transform/common/CommonTransformDialog.java
+++ /dev/null
@@ -1,486 +0,0 @@
-/*!
- * HITACHI VANTARA PROPRIETARY AND CONFIDENTIAL
- *
- * Copyright 2018 Hitachi Vantara. All rights reserved.
- *
- * NOTICE: All information including source code contained herein is, and
- * remains the sole property of Hitachi Vantara and its licensors. The
intellectual
- * and technical concepts contained herein are proprietary and confidential
- * to, and are trade secrets of Hitachi Vantara and may be covered by U.S. and
foreign
- * patents, or patents in process, and are protected by trade secret and
- * copyright laws. The receipt or possession of this source code and/or related
- * information does not convey or imply any rights to reproduce, disclose or
- * distribute its contents, or to manufacture, use, or sell anything that it
- * may describe, in whole or in part. Any reproduction, modification,
distribution,
- * or public display of this information without the express written
authorization
- * from Hitachi Vantara is strictly prohibited and in violation of applicable
laws and
- * international treaties. Access to the source code contained herein is
strictly
- * prohibited to anyone except those individuals and entities who have executed
- * confidentiality and non-disclosure agreements or other agreements with
Hitachi Vantara,
- * explicitly covering such access.
- */
-
-package org.apache.hop.ui.pipeline.transform.common;
-
-import org.apache.commons.lang.StringUtils;
-import org.apache.hop.core.Const;
-import org.apache.hop.core.Props;
-import org.apache.hop.core.plugins.IPlugin;
-import org.apache.hop.core.plugins.PluginRegistry;
-import org.apache.hop.core.plugins.TransformPluginType;
-import org.apache.hop.i18n.BaseMessages;
-import org.apache.hop.pipeline.PipelineMeta;
-import org.apache.hop.pipeline.Pipeline;
-import org.apache.hop.pipeline.PipelinePreviewFactory;
-import org.apache.hop.pipeline.transform.ITransform;
-import org.apache.hop.pipeline.transform.ITransformDialog;
-import org.apache.hop.pipeline.transform.ITransformMeta;
-import org.apache.hop.ui.core.ConstUi;
-import org.apache.hop.ui.core.FormDataBuilder;
-import org.apache.hop.ui.core.dialog.BaseDialog;
-import org.apache.hop.ui.core.dialog.EnterNumberDialog;
-import org.apache.hop.ui.core.dialog.PreviewRowsDialog;
-import org.apache.hop.ui.core.dialog.SimpleMessageDialog;
-import org.apache.hop.ui.core.gui.GuiResource;
-import org.apache.hop.ui.pipeline.dialog.PipelinePreviewProgressDialog;
-import org.apache.hop.ui.pipeline.transform.BaseTransformDialog;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CTabFolder;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.ShellAdapter;
-import org.eclipse.swt.events.ShellEvent;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-
-import java.util.List;
-
-/**
- * A common implementation of the {@link BaseTransformDialog} that creates
many of the common UI components.
- *
- * @param <TransformMetaType>
- */
-public abstract class CommonTransformDialog<TransformMetaType extends
CommonTransformMeta> extends BaseTransformDialog implements
- ITransformDialog {
-
- protected static final int MARGIN_SIZE = BaseDialog.MARGIN_SIZE;
- protected static final int LABEL_SPACING = BaseDialog.LABEL_SPACING;
- protected static final int ELEMENT_SPACING = BaseDialog.ELEMENT_SPACING;
- protected static final int MEDIUM_FIELD = BaseDialog.MEDIUM_FIELD;
- protected static final int MEDIUM_SMALL_FIELD =
BaseDialog.MEDIUM_SMALL_FIELD;
- protected static final int SMALL_FIELD = BaseDialog.SMALL_FIELD;
- protected static final int SHELL_WIDTH_OFFSET =
BaseDialog.SHELL_WIDTH_OFFSET;
- protected static final int VAR_ICON_WIDTH = BaseDialog.VAR_ICON_WIDTH;
- protected static final int VAR_ICON_HEIGHT = BaseDialog.VAR_ICON_HEIGHT;
-
- private static final int SHELL_WIDTH = 610;
-
- private static final Class<?> PKG = ITransform.class;
-
- protected final TransformMetaType meta;
-
- protected Label footerSpacer;
- protected Label headerSpacer;
-
- protected ModifyListener lsMod;
-
- protected CTabFolder m_wTabFolder;
-
- public CommonTransformDialog( Shell parent, Object meta, PipelineMeta tr,
String sname ) {
- super( parent, (ITransformMeta) meta, tr, sname );
- this.meta = (TransformMetaType) meta;
- }
-
- private void initListeners() {
- // define the listener for the ok button
- lsOk = e -> ok();
-
- // define the listener for the cancel button
- lsCancel = e -> cancel();
-
- // define the listener adapter for default widget selection
- lsDef = new SelectionAdapter() {
- @Override
- public void widgetDefaultSelected( SelectionEvent e ) {
- ok();
- }
- };
-
- // define the listener for the meta changes
- lsMod = e -> meta.setChanged();
-
- // define a listener for the "preview" action
- lsPreview = e -> preview();
-
- initListenersImpl();
- }
-
- /**
- * Can be overridden to initialize additional listeners.
- */
- protected void initListenersImpl() {
- // override
- }
-
- private Display prepareLayout() {
-
- // Prep the parent shell and the dialog shell
- final Shell parent = getParent();
- final Display display = parent.getDisplay();
-
- shell = new Shell( parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX |
SWT.MIN );
- props.setLook( shell );
- setShellImage( shell, meta );
- // Detect X or ALT-F4 or something that kills this window...
- shell.addShellListener( new ShellAdapter() {
- @Override
- public void shellClosed( ShellEvent e ) {
- cancel();
- }
- } );
-
- changed = meta.hasChanged();
-
- final FormLayout formLayout = new FormLayout();
- formLayout.marginWidth = BaseDialog.MARGIN_SIZE;
- formLayout.marginHeight = BaseDialog.MARGIN_SIZE;
-
- shell.setLayout( formLayout );
- shell.setText( getTitle() );
- return display;
- }
-
- public String open() {
-
- final Display display = prepareLayout();
- initListeners();
-
- buildHeader();
- buildBody();
- buildFooter();
-
- open( display );
-
- return transformName;
- }
-
- private void open( final Display display ) {
- shell.pack();
- final int height = shell.computeSize( SHELL_WIDTH, SWT.DEFAULT ).y;
- // for some reason the actual width and minimum width are smaller than
what is requested - add the
- // SHELL_WIDTH_OFFSET to get the desired size
- shell.setMinimumSize( SHELL_WIDTH + BaseDialog.SHELL_WIDTH_OFFSET, height
);
- shell.setSize( SHELL_WIDTH + BaseDialog.SHELL_WIDTH_OFFSET, height );
-
- getData( meta );
- meta.setChanged( changed );
-
- shell.open();
- while ( !shell.isDisposed() ) {
- if ( !display.readAndDispatch() ) {
- display.sleep();
- }
- }
- }
-
- private void buildHeader() {
-
- buildPreHeader();
-
- // Transform icon
- final Label wicon = new Label( shell, SWT.RIGHT );
- wicon.setImage( getImage() );
- wicon.setLayoutData( new FormDataBuilder().top( 0,
-BaseDialog.LABEL_SPACING ).right( 100, 0 ).result() );
- props.setLook( wicon );
-
- // Transform name label
- wlTransformName = new Label( shell, SWT.RIGHT );
- wlTransformName.setText( BaseMessages.getString( PKG,
"CommonTransformDialog.TransformName.Label" ) ); //$NON-NLS-1$
- props.setLook( wlTransformName );
- fdlTransformName = new FormDataBuilder().left( 0, 0 ).top( 0,
-BaseDialog.LABEL_SPACING ).result();
- wlTransformName.setLayoutData( fdlTransformName );
-
- // Transform name field
- wTransformName = new Text( shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
- wTransformName.setText( transformName );
- props.setLook( wTransformName );
- wTransformName.addModifyListener( lsMod );
- wTransformName.addSelectionListener( lsDef );
- fdTransformName = new FormDataBuilder().width( BaseDialog.MEDIUM_FIELD
).left( 0, 0 ).top(
- wlTransformName, BaseDialog.LABEL_SPACING ).result();
- wTransformName.setLayoutData( fdTransformName );
-
- // horizontal separator between transform name and tabs
- headerSpacer = new Label( shell, SWT.HORIZONTAL | SWT.SEPARATOR );
- props.setLook( headerSpacer );
- headerSpacer.setLayoutData( new FormDataBuilder().left().right( 100, 0
).top(
- wTransformName, BaseDialog.MARGIN_SIZE ).width( SHELL_WIDTH - 2 * (
BaseDialog.MARGIN_SIZE ) ).result() );
-
- buildPostHeader();
- }
-
- /**
- * Called at the top of {@link #buildHeader()}, can be overridden to build
additional "header" elements.
- */
- protected void buildPreHeader() {
- // override
- }
-
- /**
- * Called at the bottom of {@link #buildHeader()}, can be overridden to
build additional "header" elements.
- */
- protected void buildPostHeader() {
- // override
- }
-
- protected abstract void buildBody();
-
- private void buildFooter() {
-
- buildPreFooter();
-
- buildCancelButton();
- buildOkButton();
-
- footerSpacer = new Label( shell, SWT.HORIZONTAL | SWT.SEPARATOR );
- footerSpacer.setLayoutData( new FormDataBuilder().left().bottom(
- wCancel, -BaseDialog.MARGIN_SIZE ).right( 100, 0 ).result() );
-
- buildPostFooter();
- }
-
- /**
- * Called at the top of {@link #buildFooter()}, can be overridden to build
additional "footer" elements.
- */
- protected void buildPreFooter() {
- // override
- }
-
- /**
- * Called at the bottom of {@link #buildFooter()}, can be overridden to
build additional "footer" elements.
- */
- protected void buildPostFooter() {
- // override
- }
-
- protected Button buildPreviewButton() {
-
- wPreview = new Button( shell, SWT.PUSH | SWT.CENTER );
- updatePreviewButtonStatus();
- wPreview.setText( BaseMessages.getString( PKG, "System.Button.Preview" )
); //$NON-NLS-1$
- wPreview.pack();
- props.setLook( wPreview );
- wPreview.setLayoutData( new FormDataBuilder().bottom().left( 50, -(
wPreview.getBounds().width / 2 ) ).result() );
- wPreview.addListener( SWT.Selection, lsPreview );
- return wPreview;
- }
-
- protected Button buildGetFieldsButton( final Composite parent, final
SelectionAdapter listener ) {
- // get fields button
- wGet = new Button( parent, SWT.PUSH );
- updateGetFieldsButtonStatus();
- wGet.setText( BaseMessages.getString( PKG,
"CommonTransformDialog.Button.GetFields" ) ); //$NON-NLS-1$
- props.setLook( wGet );
- wGet.setLayoutData( new FormDataBuilder().right( 100, 0 ).bottom( 100, 0
).result() );
- wGet.addSelectionListener( listener );
- return wGet;
- }
-
- protected Button buildCancelButton() {
-
- wCancel = new Button( shell, SWT.PUSH );
- wCancel.setText( BaseMessages.getString( PKG, "System.Button.Cancel" ) );
//$NON-NLS-1$
- wCancel.setLayoutData( new FormDataBuilder().bottom().right( 100, 0
).result() );
- wCancel.addListener( SWT.Selection, lsCancel );
- return wCancel;
- }
-
- protected Button buildOkButton() {
-
- wOk = new Button( shell, SWT.PUSH );
- wOk.setText( BaseMessages.getString( PKG, "System.Button.OK" ) );
//$NON-NLS-1$
- wOk.setLayoutData( new FormDataBuilder().bottom().right(
- wCancel, Const.isOSX() ? 0 : -BaseDialog.LABEL_SPACING ).result() );
- wOk.addListener( SWT.Selection, lsOk );
- return wOk;
- }
-
- /**
- * To be overridden by a preview-capable dialog, returns true by default.
- *
- * @return true by default
- */
- protected boolean fieldsExist() {
- return true;
- }
-
- private void preview() {
-
- // given that the preview button is disabled in the absence of fields,
this should never occur, but we check, for
- // good measure
- if ( !fieldsExist() ) {
- openNoFieldsDialog();
- return;
- }
-
- // Create the XML meta transform
- final TransformMetaType populatedMeta = (TransformMetaType)
getPopulatedMeta();
-
- final PipelineMeta previewMeta =
PipelinePreviewFactory.generatePreviewPipeline( pipelineMeta,
pipelineMeta.getMetadataProvider(),
- populatedMeta, wTransformName.getText() );
-
- final EnterNumberDialog numberDialog = new EnterNumberDialog( shell,
- props.getDefaultPreviewSize(), BaseMessages.getString( PKG,
- "CommonTransformDialog.PreviewSize.DialogTitle" ), //$NON-NLS-1$
- BaseMessages.getString( PKG,
"CommonTransformDialog.PreviewSize.DialogMessage" ) ); //$NON-NLS-1$
- final int previewSize = numberDialog.open();
- if ( previewSize > 0 ) {
- final PipelinePreviewProgressDialog progressDialog = new
PipelinePreviewProgressDialog(
- shell, previewMeta, new String[] { wTransformName.getText() },
- new int[] { previewSize } );
- progressDialog.open( false );
-
- final Pipeline pipeline = progressDialog.getPipeline();
- final String loggingText = progressDialog.getLoggingText();
-
- if ( !progressDialog.isCancelled() ) {
- if ( pipeline.getResult() != null ) {
- if ( pipeline.getResult().getNrErrors() > 0 ) {
- openPreviewError();
- // there are errors - return
- return;
- }
- }
- }
-
- final List previewRows = progressDialog.getPreviewRows(
wTransformName.getText() );
- if ( previewRows == null || previewRows.size() == 0 ) {
- openNoRowsToPreviewError();
- } else {
- final PreviewRowsDialog prd = new PreviewRowsDialog( shell,
pipelineMeta, SWT.NONE,
- wTransformName.getText(), progressDialog.getPreviewRowsMeta(
wTransformName
- .getText() ), previewRows,
- loggingText );
- prd.open();
- }
- }
- }
-
- /**
- * To be overridden by a preview-capable transform dialog.
- */
- protected void updatePreviewButtonStatus() {
- // no-op
- }
-
- /**
- * Can be overridden by the implementing class, if the "Get fields" button
is to be enabled only under certain
- * conditions.
- */
- protected void updateGetFieldsButtonStatus() {
- // override
- }
-
- protected void ok() {
- if ( StringUtils.isEmpty( wTransformName.getText().trim() ) ) {
- return;
- }
- transformName = wTransformName.getText();
- populateMeta( meta );
- dispose();
- }
-
- protected void cancel() {
- transformName = null;
- meta.setChanged( changed );
- dispose();
- }
-
- protected Image getImage() {
- final IPlugin plugin =
- PluginRegistry.getInstance().getPlugin( TransformPluginType.class,
transformMeta.getTransform() );
- final String id = plugin.getIds()[ 0 ];
- if ( id != null ) {
- return GuiResource.getInstance().getImagesTransforms().get( id
).getAsBitmapForSize( shell.getDisplay(),
- ConstUi.LARGE_ICON_SIZE, ConstUi.LARGE_ICON_SIZE );
- }
- return null;
- }
-
- /**
- * Returns a new instance of {@link TransformMetaType} that is populated
according to dialog selection.
- *
- * @return a new instance of {@link TransformMetaType} that is populated
according to dialog selection
- */
- protected abstract TransformMetaType getPopulatedMeta();
-
- /**
- * Creates a new instance of {@link TransformMetaType} and populates it with
provided data from the dialog.
- *
- * @param meta a new instance of {@link TransformMetaType}
- */
- protected abstract void populateMeta( final TransformMetaType meta );
-
- protected abstract String getTitle();
-
- /**
- * Copy information from the {@link TransformMetaType} meta to the dialog
fields.
- */
- public abstract void getData( final TransformMetaType meta );
-
- protected CTabFolder buildTabFolder() {
- m_wTabFolder = new CTabFolder( shell, SWT.BORDER );
- props.setLook( m_wTabFolder, Props.WIDGET_STYLE_TAB );
- m_wTabFolder.setSimple( false );
- return m_wTabFolder;
- }
-
- protected void layoutTabFolder() {
- m_wTabFolder.setSelection( 0 );
- m_wTabFolder.setLayoutData( new FormDataBuilder().left().top(
- headerSpacer, BaseDialog.MARGIN_SIZE ).right( 100, 0 ).bottom( new
FormAttachment(
- footerSpacer, -BaseDialog.MARGIN_SIZE ) ).result() );
- }
-
- protected void openDialog( final String title, final String message, final
int dialogType ) {
- final Dialog dialog = new SimpleMessageDialog( shell, title, message,
dialogType );
- dialog.open();
- }
-
- protected void openPreviewError() {
- openDialog( BaseMessages.getString( PKG,
"CommonTransformDialog.ErrorMessage.PreviewError.Title" ), //$NON-NLS-1$
- BaseMessages.getString( PKG,
"CommonTransformDialog.ErrorMessage.PreviewError.Message" ), //$NON-NLS-1$
- MessageDialog.ERROR );
- }
-
- protected void openNoRowsToPreviewError() {
- openDialog( BaseMessages.getString( PKG,
"CommonTransformDialog.WarningMessage.NoPreview.Title" ), //$NON-NLS-1$
- BaseMessages.getString( PKG,
"CommonTransformDialog.WarningMessage.NoPreview.Message" ), //$NON-NLS-1$
- MessageDialog.WARNING );
- }
-
- protected void openNoFieldsDialog() {
- openDialog( BaseMessages.getString( PKG,
"CommonTransformDialog.WarningMessage.GetFieldsNoFields.Title" ), //$NON-NLS-1$
- BaseMessages.getString( PKG,
"CommonTransformDialog.WarningMessage.GetFieldsNoFields.Message" ),
//$NON-NLS-1$
- MessageDialog.WARNING );
- }
-
- protected void openFieldsErrorDialog() {
- openDialog( BaseMessages.getString( PKG,
"CommonTransformDialog.ErrorMessage.GetFieldsError.Title" ), //$NON-NLS-1$
- BaseMessages.getString( PKG,
"CommonTransformDialog.ErrorMessage.GetFieldsError.Message" ), //$NON-NLS-1$
- MessageDialog.ERROR );
- }
-}
diff --git
a/ui/src/main/java/org/apache/hop/ui/pipeline/transform/common/CommonTransformMeta.java
b/ui/src/main/java/org/apache/hop/ui/pipeline/transform/common/CommonTransformMeta.java
deleted file mode 100644
index 237bb66..0000000
---
a/ui/src/main/java/org/apache/hop/ui/pipeline/transform/common/CommonTransformMeta.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*!
- * HITACHI VANTARA PROPRIETARY AND CONFIDENTIAL
- *
- * Copyright 2018 Hitachi Vantara. All rights reserved.
- *
- * NOTICE: All information including source code contained herein is, and
- * remains the sole property of Hitachi Vantara and its licensors. The
intellectual
- * and technical concepts contained herein are proprietary and confidential
- * to, and are trade secrets of Hitachi Vantara and may be covered by U.S. and
foreign
- * patents, or patents in process, and are protected by trade secret and
- * copyright laws. The receipt or possession of this source code and/or related
- * information does not convey or imply any rights to reproduce, disclose or
- * distribute its contents, or to manufacture, use, or sell anything that it
- * may describe, in whole or in part. Any reproduction, modification,
distribution,
- * or public display of this information without the express written
authorization
- * from Hitachi Vantara is strictly prohibited and in violation of applicable
laws and
- * international treaties. Access to the source code contained herein is
strictly
- * prohibited to anyone except those individuals and entities who have executed
- * confidentiality and non-disclosure agreements or other agreements with
Hitachi Vantara,
- * explicitly covering such access.
- */
-
-package org.apache.hop.ui.pipeline.transform.common;
-
-import org.apache.hop.pipeline.transform.BaseTransformMeta;
-import org.apache.hop.pipeline.transform.ITransform;
-import org.apache.hop.pipeline.transform.ITransformData;
-import org.apache.hop.pipeline.transform.ITransformMeta;
-
-/**
- * A convenience implementation of {@link BaseTransformMeta} that implements
{@link ITransformMeta}
- */
-public abstract class CommonTransformMeta extends BaseTransformMeta implements
ITransformMeta<ITransform, ITransformData> {
-
-}
diff --git
a/ui/src/main/java/org/apache/hop/ui/pipeline/transform/common/GetFieldsSampleDataDialog.java
b/ui/src/main/java/org/apache/hop/ui/pipeline/transform/common/GetFieldsSampleDataDialog.java
index b62bdf1..0f45506 100644
---
a/ui/src/main/java/org/apache/hop/ui/pipeline/transform/common/GetFieldsSampleDataDialog.java
+++
b/ui/src/main/java/org/apache/hop/ui/pipeline/transform/common/GetFieldsSampleDataDialog.java
@@ -26,9 +26,6 @@ import org.apache.commons.lang.StringUtils;
import org.apache.hop.i18n.BaseMessages;
import org.apache.hop.ui.core.dialog.EnterNumberDialog;
import org.apache.hop.ui.core.dialog.EnterTextDialog;
-import org.apache.hop.ui.core.dialog.SimpleMessageDialog;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
@@ -85,10 +82,12 @@ public class GetFieldsSampleDataDialog extends
EnterNumberDialog {
etd.setModal();
etd.open();
} else {
- final Dialog errorDlg = new SimpleMessageDialog(
parentDialog.getShell(),
- BaseMessages.getString( PKG, "System.Dialog.Error.Title" ),
- BaseMessages.getString( PKG,
"GetFieldsSampleDataDialog.ScanResults.Error.Message" ), MessageDialog.ERROR );
- errorDlg.open();
+
+ MessageBox box = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
+ box.setText( BaseMessages.getString( PKG,
"System.Dialog.Error.Title" ) );
+ box.setMessage( BaseMessages.getString( PKG,
"GetFieldsSampleDataDialog.ScanResults.Error.Message" ) );
+ box.open();
+
}
}
}
diff --git
a/ui/src/main/java/org/apache/hop/ui/workflow/actions/pipeline/ActionPipelineDialog.java
b/ui/src/main/java/org/apache/hop/ui/workflow/actions/pipeline/ActionPipelineDialog.java
index c240042..ccdf1ac 100644
---
a/ui/src/main/java/org/apache/hop/ui/workflow/actions/pipeline/ActionPipelineDialog.java
+++
b/ui/src/main/java/org/apache/hop/ui/workflow/actions/pipeline/ActionPipelineDialog.java
@@ -36,7 +36,6 @@ import
org.apache.hop.pipeline.config.PipelineRunConfiguration;
import org.apache.hop.ui.core.ConstUi;
import org.apache.hop.ui.core.dialog.BaseDialog;
import org.apache.hop.ui.core.dialog.ErrorDialog;
-import org.apache.hop.ui.core.dialog.SimpleMessageDialog;
import org.apache.hop.ui.core.gui.WindowProperty;
import org.apache.hop.ui.hopgui.HopGui;
import org.apache.hop.ui.hopgui.file.pipeline.HopPipelineFileType;
@@ -48,8 +47,6 @@ import org.apache.hop.workflow.action.ActionBase;
import org.apache.hop.workflow.action.IAction;
import org.apache.hop.workflow.action.IActionDialog;
import org.apache.hop.workflow.actions.pipeline.ActionPipeline;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
@@ -59,6 +56,7 @@ import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.TableItem;
@@ -389,10 +387,10 @@ public class ActionPipelineDialog extends
ActionBaseDialog implements IActionDia
protected void ok() {
if (Utils.isEmpty(wName.getText())) {
- final Dialog dialog = new SimpleMessageDialog(shell,
- BaseMessages.getString(PKG,
"System.TransformActionNameMissing.Title"),
- BaseMessages.getString(PKG,
"System.ActionNameMissing.Msg"), MessageDialog.ERROR);
- dialog.open();
+ MessageBox box = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR );
+ box.setText( BaseMessages.getString(PKG,
"System.TransformActionNameMissing.Title") );
+ box.setMessage( BaseMessages.getString(PKG,
"System.ActionNameMissing.Msg") );
+ box.open();
return;
}
action.setName(wName.getText());