////
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
  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.
////
:imagesdir: ../assets/images

= File Explorer Perspective

Icon: image:icons/folder.svg[width="24px"]

Keyboard shortcut: `CTRL-Shift-E`

== Description

The file explorer perspective is where you'll perform a lot of your file operation.
This perspective contains handlers for the most common file types known to Hop.
These are obviously hwf (workflows) and hpl (pipelines), but also JSON, CSV, TXT, XML, Markdown, SVG, Log and SAS 7 BDAT files.
The File Explorer perspective is also where you'll manage version control for your projects through xref:hop-gui/hop-gui-git.adoc[Git integration].

TIP: Even though fully functional, the editor for most file types in the File Explorer is rather basic.
Expect these to evolve in the next Hop releases, or check the http://hop.apache.org/community/contribution-guides/code-contribution-guide/[code contribution guide] if you'd like to help us improve Hop by contributing file editors.


== File operations

The file operations are available through a number of toolbar options:

image::hop-gui/perspective-explorer-toolbar-items.png[File explorer toolbar items]

* Open selected file: Use the right arrow or double-click to open a selected file. You can also open a file simply by double-clicking it. If this is a workflow or pipeline it will be opened in the xref:hop-gui/perspective-data-orchestration.adoc[Data Orchestation] perspective. In all other cases the file will be opened in a new tab.
* Create folder: Add a new folder.
* Delete: Remove a selected file or folder.
* Rename: Rename a file or folder.
* Refresh: Refresh the file list.
* Show or hide files: Show or hide files or directories.

== Git integration

=== Description

If the git plugin (folder `plugins/misc/git`) is installed, the file explorer will look for a `.git/config` file in the project home folder.  It this exists the explorer perspective will start to color code the files listed:

* red: the file has not been added to git (un-staged).
* blue: the file has been changed (staged).
* gray: the file is ignored by git.

=== Git

==== Git info

The "Git Info" icon in the toolbar will be enabled if there is information regarding the file or folder that is selected.  If you click on it, you'll be able to all sorts of information regarding the git history in a new tab:

image::hop-gui/perspective-explorer-git-info-panel.png[Git information shown in a tab]

Below the revision history you can see the revisions of a file.  If you select a revision you'll be able to not only see the text differences between two revisions but also use the "Visual diff" button on the right-hand side of the tab.  If you select the "visual diff" option the GUI will switch to the data orchestration perspective where 2 new tabs will be opened with the pipeline or workflow state before and after the change.

image::hop-gui/perspective-explorer-git-visual-diff-example.png[Git visual diff example]

Small information icons will be added to the various transforms, actions and hops to indicate if they were changes, deleted or added.

=== Right-click menu options
The right-click menu in Apache Hop Git integration offers several useful options to help manage your files and Git operations directly from the interface. Here’s a breakdown of each option:

* Create folder: Create a new folder within the selected directory. This is useful for organizing workflows, pipelines, and other project resources.
* Open: Opens the selected file or folder. For workflows and pipelines, it launches them in the Data Orchestration perspective, while other file types will open in a new tab.
* Rename: Allows you to change the name of the selected file or folder, helping you keep your project files organized and clearly labeled.
* Copy name: Copies the name of the selected file or folder to your clipboard, making it easy to paste and reference elsewhere.
* Copy path: Copies the full path of the selected file or folder to your clipboard, useful for quick navigation or sharing the location with others.
* Git Info: Displays detailed information about the Git status of the selected file, including any recent changes.
* Git Add: Stages the selected file(s) for commit, meaning the changes are prepared for inclusion in your next Git commit.
* Git Revert: Reverts any changes made to the selected file, restoring it to the last committed state. This is helpful when you need to undo accidental modifications.
* Git Commit: Opens a dialog for committing staged changes to your local Git repository. You can add a descriptive commit message summarizing your updates.
* Delete: Removes the selected file or folder from your project. Make sure to use this carefully, as it permanently deletes the item from your directory.

image::hop-gui/hop-gui-file-explorer-right-menu.png[git right-click menu options in the explorer perspective]

==== Git operations

Here are the basic git operations that are supported:

* Git Add: stage the file to include it in a commit.
* Git Commit: commit changes to origin.
* Git Revert: checkout file or folder to revert changes.
* Git Push: push changes.
* Git Pull: pull changes.

You can access these operations from the toolbar above the file explorer tree:

image::hop-gui/perspective-explorer-git-toolbar-operations.png[git toolbar items in the explorer perspective]

