You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hop.apache.org by ha...@apache.org on 2020/11/08 22:10:59 UTC

[incubator-hop] branch master updated: HOP-3129 IPerspective return Control not Composite (#353)

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 58bb365  HOP-3129 IPerspective return Control not Composite (#353)
58bb365 is described below

commit 58bb365cfd7ea56a23044f6bc017642ccb0e98dd
Author: Nicolas Adment <39...@users.noreply.github.com>
AuthorDate: Sun Nov 8 23:10:52 2020 +0100

    HOP-3129 IPerspective return Control not Composite (#353)
    
    - HopDataOrchestrationPerspective.addWorkflow don't need Composite param
    - HopDataOrchestrationPerspective.addPipeline don't need Composite param
---
 .../java/org/apache/hop/git/HopGitPerspective.java |  6 ++--
 .../main/java/org/apache/hop/ui/hopgui/HopGui.java |  4 +--
 .../hopgui/file/pipeline/HopPipelineFileType.java  |  4 +--
 .../hopgui/file/workflow/HopWorkflowFileType.java  |  4 +--
 .../ui/hopgui/perspective/EmptyHopPerspective.java |  4 +--
 .../hop/ui/hopgui/perspective/IHopPerspective.java |  5 ++--
 .../dataorch/HopDataOrchestrationPerspective.java  | 35 +++-------------------
 .../HopPluginExplorePerspective.java               | 10 ++-----
 .../perspective/search/HopSearchPerspective.java   | 30 +------------------
 .../ui/hopgui/search/HopGuiPipelineSearchable.java |  2 +-
 .../ui/hopgui/search/HopGuiWorkflowSearchable.java |  2 +-
 11 files changed, 24 insertions(+), 82 deletions(-)

diff --git a/plugins/misc/git/src/main/java/org/apache/hop/git/HopGitPerspective.java b/plugins/misc/git/src/main/java/org/apache/hop/git/HopGitPerspective.java
index 77ebf52..b6775e2 100644
--- a/plugins/misc/git/src/main/java/org/apache/hop/git/HopGitPerspective.java
+++ b/plugins/misc/git/src/main/java/org/apache/hop/git/HopGitPerspective.java
@@ -862,7 +862,7 @@ public class HopGitPerspective implements IHopPerspective {
     return false;
   }
 
-  @Override public Composite getComposite() {
+  @Override public Control getControl() {
     return perspectiveComposite;
   }
 
@@ -994,7 +994,7 @@ public class HopGitPerspective implements IHopPerspective {
             //
             PipelineMeta pipelineMeta = new PipelineMeta( xmlStream, hopGui.getMetadataProvider(), true, hopGui.getVariables() );
             meta = pipelineMeta;
-            IHopFileTypeHandler typeHandler = doPerspective.addPipeline( doPerspective.getComposite(), hopGui, pipelineMeta, pipelineFileType );
+            IHopFileTypeHandler typeHandler = doPerspective.addPipeline( hopGui, pipelineMeta, pipelineFileType );
             typeHandlers.add( typeHandler );
           }
           if ( workflowFileType.isHandledBy( filePath, false ) ) {
@@ -1003,7 +1003,7 @@ public class HopGitPerspective implements IHopPerspective {
             WorkflowMeta workflowMeta = new WorkflowMeta( xmlStream, hopGui.getMetadataProvider() );
             meta = workflowMeta;
             workflowMeta.initializeVariablesFrom( hopGui.getVariables() );
-            IHopFileTypeHandler typeHandler = doPerspective.addWorkflow( doPerspective.getComposite(), hopGui, workflowMeta, workflowFileType );
+            IHopFileTypeHandler typeHandler = doPerspective.addWorkflow( hopGui, workflowMeta, workflowFileType );
             typeHandlers.add( typeHandler );
           }
           if ( meta != null && !isOnlyWIP() ) {
diff --git a/ui/src/main/java/org/apache/hop/ui/hopgui/HopGui.java b/ui/src/main/java/org/apache/hop/ui/hopgui/HopGui.java
index c43df2d..2da9b72 100644
--- a/ui/src/main/java/org/apache/hop/ui/hopgui/HopGui.java
+++ b/ui/src/main/java/org/apache/hop/ui/hopgui/HopGui.java
@@ -1067,10 +1067,10 @@ public class HopGui implements IActionContextHandlersProvider, ISearchableProvid
 			
     activePerspective = perspective;
     
-    // Move perspective composite on top 
+    // Move perspective control on top 
     //
     StackLayout layout = (StackLayout) mainPerspectivesComposite.getLayout();
-    layout.topControl = perspective.getComposite();
+    layout.topControl = perspective.getControl();
     mainPerspectivesComposite.layout();
     
     // Select toolbar item 
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 2e137f2..bdd4fa2 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
@@ -126,7 +126,7 @@ public class HopPipelineFileType<T extends PipelineMeta> extends HopFileTypeBase
 
       // Show it in the perspective
       //
-      IHopFileTypeHandler typeHandler = perspective.addPipeline( perspective.getTabFolder(), hopGui, pipelineMeta, this );
+      IHopFileTypeHandler typeHandler = perspective.addPipeline( hopGui, pipelineMeta, this );
 
       // Keep track of open...
       //
@@ -160,7 +160,7 @@ public class HopPipelineFileType<T extends PipelineMeta> extends HopFileTypeBase
 
       // Show it in the perspective
       //
-      return perspective.addPipeline( perspective.getTabFolder(), hopGui, pipelineMeta, this );
+      return perspective.addPipeline( hopGui, pipelineMeta, this );
     } catch ( Exception e ) {
       throw new HopException( "Error creating new pipeline", e );
     }
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 208fd35..dd4e20f 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
@@ -134,7 +134,7 @@ public class HopWorkflowFileType<T extends WorkflowMeta> extends HopFileTypeBase
 
       // Show it in the perspective
       //
-      return perspective.addWorkflow( perspective.getTabFolder(), hopGui, workflowMeta, this );
+      return perspective.addWorkflow( hopGui, workflowMeta, this );
     } catch ( Exception e ) {
       throw new HopException( "Error opening workflow file '" + filename + "'", e );
     }
@@ -159,7 +159,7 @@ public class HopWorkflowFileType<T extends WorkflowMeta> extends HopFileTypeBase
 
       // Show it in the perspective
       //
-      return perspective.addWorkflow( perspective.getTabFolder(), hopGui, workflowMeta, this );
+      return perspective.addWorkflow( hopGui, workflowMeta, this );
     } catch ( Exception e ) {
       throw new HopException( "Error creating new workflow", e );
     }
diff --git a/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/EmptyHopPerspective.java b/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/EmptyHopPerspective.java
index 29d8ac6..fb37988 100644
--- a/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/EmptyHopPerspective.java
+++ b/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/EmptyHopPerspective.java
@@ -28,8 +28,8 @@ import org.apache.hop.ui.hopgui.context.IGuiContextHandler;
 import org.apache.hop.ui.hopgui.file.IHopFileTypeHandler;
 import org.apache.hop.ui.hopgui.file.IHopFileType;
 import org.apache.hop.ui.hopgui.file.empty.EmptyHopFileTypeHandler;
-import org.eclipse.swt.layout.FormData;
 import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
 
 import java.util.ArrayList;
 import java.util.Collections;
@@ -85,7 +85,7 @@ public class EmptyHopPerspective implements IHopPerspective {
   @Override public void initialize( HopGui hopGui, Composite parent ) {
   }
 
-  @Override public Composite getComposite() {
+  @Override public Control getControl() {
     return null;
   }
 
diff --git a/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/IHopPerspective.java b/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/IHopPerspective.java
index f4643a4..7c460ba 100644
--- a/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/IHopPerspective.java
+++ b/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/IHopPerspective.java
@@ -29,6 +29,7 @@ import org.apache.hop.ui.hopgui.file.IHopFileType;
 import org.apache.hop.ui.hopgui.file.IHopFileTypeHandler;
 import org.eclipse.swt.layout.FormData;
 import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
 
 import java.util.List;
 
@@ -100,9 +101,9 @@ public interface IHopPerspective extends IActionContextHandlersProvider {
   boolean hasNavigationNextFile();
 
   /**
-   * @return The composite of this perspective
+   * @return The control of this perspective
    */
-  Composite getComposite();
+  Control getControl();
 
   /**
    * Remove this file type handler from the perspective
diff --git a/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/dataorch/HopDataOrchestrationPerspective.java b/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/dataorch/HopDataOrchestrationPerspective.java
index b0e0c1d..12d046c 100644
--- a/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/dataorch/HopDataOrchestrationPerspective.java
+++ b/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/dataorch/HopDataOrchestrationPerspective.java
@@ -64,6 +64,7 @@ import org.eclipse.swt.layout.FormAttachment;
 import org.eclipse.swt.layout.FormData;
 import org.eclipse.swt.layout.FormLayout;
 import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.Event;
 import org.eclipse.swt.widgets.Menu;
 import org.eclipse.swt.widgets.MenuItem;
@@ -342,7 +343,7 @@ public class HopDataOrchestrationPerspective implements IHopPerspective {
    * @param pipelineMeta
    * @return
    */
-  public IHopFileTypeHandler addPipeline( Composite parent, HopGui hopGui, PipelineMeta pipelineMeta, HopPipelineFileType pipelineFile ) throws HopException {
+  public IHopFileTypeHandler addPipeline( HopGui hopGui, PipelineMeta pipelineMeta, HopPipelineFileType pipelineFile ) throws HopException {
     CTabItem tabItem = new CTabItem( tabFolder, SWT.CLOSE );
     tabItem.setImage( GuiResource.getInstance().getImageToolbarPipeline() );
     HopGuiPipelineGraph pipelineGraph = new HopGuiPipelineGraph( tabFolder, hopGui, tabItem, this, pipelineMeta, pipelineFile );
@@ -390,7 +391,7 @@ public class HopDataOrchestrationPerspective implements IHopPerspective {
    * @param workflowMeta
    * @return The file type handler
    */
-  public IHopFileTypeHandler addWorkflow( Composite parent, HopGui hopGui, WorkflowMeta workflowMeta, HopWorkflowFileType workflowFile ) throws HopException {
+  public IHopFileTypeHandler addWorkflow( HopGui hopGui, WorkflowMeta workflowMeta, HopWorkflowFileType workflowFile ) throws HopException {
     CTabItem tabItem = new CTabItem( tabFolder, SWT.CLOSE );
     tabItem.setImage( GuiResource.getInstance().getImageToolbarWorkflow() );
     HopGuiWorkflowGraph jobGraph = new HopGuiWorkflowGraph( tabFolder, hopGui, tabItem, this, workflowMeta, workflowFile );
@@ -657,39 +658,11 @@ public class HopDataOrchestrationPerspective implements IHopPerspective {
     this.hopGui = hopGui;
   }
 
-  /**
-   * Gets parent
-   *
-   * @return value of parent
-   */
-  public Composite getParent() {
-    return parent;
-  }
-
-  /**
-   * @param parent The parent to set
-   */
-  public void setParent( Composite parent ) {
-    this.parent = parent;
-  }
-
-  /**
-   * Gets composite
-   *
-   * @return value of composite
-   */
-  @Override public Composite getComposite() {
+  @Override public Control getControl() {
     return composite;
   }
 
   /**
-   * @param composite The composite to set
-   */
-  public void setComposite( Composite composite ) {
-    this.composite = composite;
-  }
-
-  /**
    * Gets tabFolder
    *
    * @return value of tabFolder
diff --git a/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/pluginexplorer/HopPluginExplorePerspective.java b/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/pluginexplorer/HopPluginExplorePerspective.java
index 7057d25..fb2ff77 100644
--- a/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/pluginexplorer/HopPluginExplorePerspective.java
+++ b/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/pluginexplorer/HopPluginExplorePerspective.java
@@ -53,6 +53,7 @@ import org.eclipse.swt.layout.FormAttachment;
 import org.eclipse.swt.layout.FormData;
 import org.eclipse.swt.layout.FormLayout;
 import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Table;
 import org.eclipse.swt.widgets.TableItem;
@@ -286,14 +287,9 @@ public class HopPluginExplorePerspective implements IHopPerspective {
 	public boolean hasNavigationNextFile() {
 		return false;
 	}
-
-	/**
-	 * Gets composite
-	 *
-	 * @return value of composite
-	 */
+	
 	@Override
-	public Composite getComposite() {
+	public Control getControl() {
 		return composite;
 	}
 
diff --git a/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/search/HopSearchPerspective.java b/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/search/HopSearchPerspective.java
index b3f8e54..e1adbfe 100644
--- a/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/search/HopSearchPerspective.java
+++ b/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/search/HopSearchPerspective.java
@@ -466,38 +466,10 @@ public class HopSearchPerspective implements IHopPerspective {
     this.hopGui = hopGui;
   }
 
-  /**
-   * Gets parent
-   *
-   * @return value of parent
-   */
-  public Composite getParent() {
-    return parent;
-  }
-
-  /**
-   * @param parent The parent to set
-   */
-  public void setParent( Composite parent ) {
-    this.parent = parent;
-  }
-
-  /**
-   * Gets composite
-   *
-   * @return value of composite
-   */
-  @Override public Composite getComposite() {
+  @Override public Control getControl() {
     return composite;
   }
 
-  /**
-   * @param composite The composite to set
-   */
-  public void setComposite( Composite composite ) {
-    this.composite = composite;
-  }
-
   @Override public List<IGuiContextHandler> getContextHandlers() {
     List<IGuiContextHandler> handlers = new ArrayList<>();
     return handlers;
diff --git a/ui/src/main/java/org/apache/hop/ui/hopgui/search/HopGuiPipelineSearchable.java b/ui/src/main/java/org/apache/hop/ui/hopgui/search/HopGuiPipelineSearchable.java
index 1a1d8f9..9142586 100644
--- a/ui/src/main/java/org/apache/hop/ui/hopgui/search/HopGuiPipelineSearchable.java
+++ b/ui/src/main/java/org/apache/hop/ui/hopgui/search/HopGuiPipelineSearchable.java
@@ -80,7 +80,7 @@ public class HopGuiPipelineSearchable implements ISearchable<PipelineMeta> {
         perspective.switchToTab( tabItemHandlerWithFilename );
         pipelineGraph = (HopGuiPipelineGraph) tabItemHandlerWithFilename.getTypeHandler();
       } else {
-        pipelineGraph = (HopGuiPipelineGraph) perspective.addPipeline( perspective.getComposite(), HopGui.getInstance(), pipelineMeta, perspective.getPipelineFileType() );
+        pipelineGraph = (HopGuiPipelineGraph) perspective.addPipeline( HopGui.getInstance(), pipelineMeta, perspective.getPipelineFileType() );
       }
 
       // Optionally select and open the matching transform component
diff --git a/ui/src/main/java/org/apache/hop/ui/hopgui/search/HopGuiWorkflowSearchable.java b/ui/src/main/java/org/apache/hop/ui/hopgui/search/HopGuiWorkflowSearchable.java
index 98dc980..9d8547e 100644
--- a/ui/src/main/java/org/apache/hop/ui/hopgui/search/HopGuiWorkflowSearchable.java
+++ b/ui/src/main/java/org/apache/hop/ui/hopgui/search/HopGuiWorkflowSearchable.java
@@ -80,7 +80,7 @@ public class HopGuiWorkflowSearchable implements ISearchable<WorkflowMeta> {
         perspective.switchToTab( tabItemHandlerWithFilename );
         workflowGraph = (HopGuiWorkflowGraph) tabItemHandlerWithFilename.getTypeHandler();
       } else {
-        workflowGraph = (HopGuiWorkflowGraph) perspective.addWorkflow( perspective.getComposite(), HopGui.getInstance(), workflowMeta, perspective.getWorkflowFileType() );
+        workflowGraph = (HopGuiWorkflowGraph) perspective.addWorkflow( HopGui.getInstance(), workflowMeta, perspective.getWorkflowFileType() );
       }
 
       // Select and open the found action?