From a9e058a3f6169a7eb802b7a2bf6259f2ab212c02 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Fri, 5 Apr 2024 08:31:41 -0500 Subject: [PATCH] Merge changes from master (#173) * Merge changes from master * Use last release for version 3.99 --- .github/workflows/ant.yml | 312 ++++++++- .github/workflows/daily-build.yml | 25 +- .github/workflows/release-files.yml | 58 +- .github/workflows/release.yml | 61 +- .github/workflows/tarball.yml | 62 +- build.properties | 12 +- build.xml | 29 +- docs/Build_HDFView.txt | 4 +- docs/RELEASE.txt | 4 +- src/org.hdfgroup.hdfview/hdf/HDFVersions.java | 24 +- .../hdf/view/DataView/DataView.java | 6 +- .../hdf/view/DataView/DataViewManager.java | 6 +- .../hdf/view/DefaultFileFilter.java | 88 ++- .../hdf/view/HDFView.java | 17 +- .../hdf/view/HelpView/HelpView.java | 11 +- .../hdf/view/ImageView/ImageView.java | 36 +- .../view/TableView/DataProviderFactory.java | 4 +- .../view/TableView/DefaultBaseTableView.java | 124 +++- .../hdf/view/TableView/TableView.java | 32 +- src/org.hdfgroup.hdfview/hdf/view/Tools.java | 16 +- .../hdf/view/TreeView/TreeView.java | 8 + .../hdf/view/ViewProperties.java | 614 ++++++++++++++---- .../hdf/view/dialog/DataOptionDialog.java | 40 +- .../hdf/view/dialog/MathConversionDialog.java | 6 +- .../hdf/view/dialog/NewDataObjectDialog.java | 12 +- .../hdf/view/dialog/NewImageDialog.java | 8 +- .../hdf/view/dialog/NewLinkDialog.java | 18 +- .../view/dialog/NewScalarAttributeDialog.java | 6 +- .../view/dialog/NewStringAttributeDialog.java | 6 +- .../view/dialog/UserOptionsGeneralPage.java | 39 +- .../hdf/view/dialog/UserOptionsHDFPage.java | 263 +++++--- .../hdf/object/Attribute.java | 11 +- .../hdf/object/DataFormat.java | 5 +- .../hdf/object/Dataset.java | 16 + .../hdf/object/FileFormat.java | 40 +- src/org.hdfgroup.object/hdf/object/Group.java | 12 +- .../hdf/object/ScalarDS.java | 2 + .../hdf/object/fits/FitsFile.java | 2 + .../hdf/object/h5/H5Datatype.java | 13 +- .../hdf/object/h5/H5File.java | 32 +- .../hdf/object/h5/H5Plugins.java | 122 ++++ .../hdf/object/h5/H5ReferenceType.java | 6 +- .../hdf/object/nc2/NC2File.java | 2 + .../hdf/object/nc2/NC2Group.java | 4 + 44 files changed, 1701 insertions(+), 517 deletions(-) create mode 100644 src/org.hdfgroup.object/hdf/object/h5/H5Plugins.java diff --git a/.github/workflows/ant.yml b/.github/workflows/ant.yml index e43d23ab..395c9d60 100644 --- a/.github/workflows/ant.yml +++ b/.github/workflows/ant.yml @@ -12,10 +12,20 @@ on: description: "The hdf5 base name of the binaries" required: true type: string + snap_name: + description: 'The version name of the binaries' + type: string + required: false + default: HDFView-3.3.99 file_base: description: "The common base name of the source tarballs" required: true type: string + use_environ: + description: 'Environment to locate files' + type: string + required: true + default: snapshots permissions: contents: read @@ -36,17 +46,26 @@ jobs: distribution: 'temurin' - name: Enable Developer Command Prompt - uses: ilammy/msvc-dev-cmd@v1.12.1 + uses: ilammy/msvc-dev-cmd@v1.13.0 - name: Get hdf4 release + uses: dsaltares/fetch-gh-release-asset@master + with: + repo: 'HDFGroup/hdf4' + version: 'hdf4.3.0' + file: '${{ inputs.use_hdf }}-win-vs2022_cl.zip' + if: ${{ (inputs.use_environ == 'release') }} + + - name: Get hdf4 snapshot uses: dsaltares/fetch-gh-release-asset@master with: repo: 'HDFGroup/hdf4' version: 'tags/snapshot' - file: '${{ inputs.use_hdf }}-win_vs2022.zip' + file: '${{ inputs.use_hdf }}-win-vs2022_cl.zip' + if: ${{ (inputs.use_environ == 'snapshots') }} - name: Uncompress gh binary (Win) - run: 7z x ${{ github.workspace }}/${{ inputs.use_hdf }}-win_vs2022.zip + run: 7z x ${{ github.workspace }}/${{ inputs.use_hdf }}-win-vs2022_cl.zip - name: Uncompress hdf4 binary (Win) working-directory: ${{ github.workspace }}/hdf4 @@ -56,7 +75,7 @@ jobs: - name: List files for the space (Win) run: | ls -l ${{ github.workspace }}/hdf4 - ls ${{ runner.workspace }}/hdfview + #ls ${{ runner.workspace }}/hdfview - name: create hdf4 location (Win) working-directory: ${{ github.workspace }}/hdf4 @@ -76,14 +95,23 @@ jobs: shell: bash - name: Get hdf5 release + uses: dsaltares/fetch-gh-release-asset@master + with: + repo: 'HDFGroup/hdf5' + version: 'hdf5-1.14.4' + file: '${{ inputs.use_hdf5 }}-win-vs2022_cl.zip' + if: ${{ (inputs.use_environ == 'release') }} + + - name: Get hdf5 snapshot uses: dsaltares/fetch-gh-release-asset@master with: repo: 'HDFGroup/hdf5' version: 'tags/snapshot-1.14' - file: '${{ inputs.use_hdf5 }}-win_vs2022.zip' + file: '${{ inputs.use_hdf5 }}-win-vs2022_cl.zip' + if: ${{ (inputs.use_environ == 'snapshots') }} - name: Uncompress gh binary (Win) - run: 7z x ${{ github.workspace }}/${{ inputs.use_hdf5 }}-win_vs2022.zip + run: 7z x ${{ github.workspace }}/${{ inputs.use_hdf5 }}-win-vs2022_cl.zip - name: Uncompress hdf5 binary (Win) working-directory: ${{ github.workspace }}/hdf5 @@ -93,7 +121,7 @@ jobs: - name: List files for the space (Win) run: | ls -l ${{ github.workspace }}/hdf5 - ls ${{ runner.workspace }}/hdfview + #ls ${{ runner.workspace }}/hdfview - name: create hdf5 location (Win) working-directory: ${{ github.workspace }}/hdf5 @@ -122,11 +150,18 @@ jobs: run: | FILE_NAME_BASE=$(echo "${{ inputs.file_base }}") echo "FILE_BASE=$FILE_NAME_BASE" >> $GITHUB_OUTPUT + if [[ '${{ inputs.use_environ }}' == 'release' ]] + then + SOURCE_NAME_BASE=$(echo "${{ inputs.snap_name }}") + else + SOURCE_NAME_BASE=$(echo "hdfsrc") + fi + echo "SOURCE_BASE=$SOURCE_NAME_BASE" >> $GITHUB_OUTPUT shell: bash # Get files created by release script - name: Get zip-tarball (Windows) - uses: actions/download-artifact@v3 + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 with: name: zip-tarball path: ${{ github.workspace }} @@ -151,23 +186,40 @@ jobs: HDFLIBS: ${{ steps.set-hdflib-name.outputs.HDFLIB_ENV }} HDF5LIBS: ${{ steps.set-hdf5lib-name.outputs.HDF5LIB_ENV }} run: | - cd "${{ runner.workspace }}/hdfview/hdfsrc" ant -noinput -buildfile build.xml binaryPackage shell: bash + - name: Rename snapshot binary base name + id: ren-basename + if: ${{ (inputs.use_environ == 'snapshots') }} + run: | + cd build/dist + mv ${{ inputs.snap_name }}-win64.zip ${{ steps.set-file-base.outputs.FILE_BASE }}-win64.zip + shell: bash + - name: List files for the space (Windows) run: | + Get-ChildItem -Path ${{ github.workspace }}/build/dist Get-ChildItem -Path ${{ github.workspace }} - Get-ChildItem -Path ${{ github.workspace }}/hdfsrc/build shell: pwsh # Save files created by ctest script - name: Save published binary (Win) - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: zip-win-vs2022-binary - path: ${{ github.workspace }}/hdfsrc/build/dist/${{ steps.set-file-base.outputs.FILE_BASE }}-win64.zip + path: ${{ github.workspace }}/build/dist/${{ steps.set-file-base.outputs.FILE_BASE }}-win64.zip if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` + if: ${{ (inputs.use_environ == 'snapshots') }} + + # Save release files created by ctest script + - name: Save published release binary (Win) + uses: actions/upload-artifact@v4 + with: + name: zip-win-vs2022-binary + path: ${{ github.workspace }}/build/dist/${{ inputs.snap_name }}-win64.zip + if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` + if: ${{ (inputs.use_environ == 'release') }} - name: Test with Ant env: @@ -190,11 +242,20 @@ jobs: distribution: 'temurin' - name: Get hdf4 release + uses: dsaltares/fetch-gh-release-asset@master + with: + repo: 'HDFGroup/hdf4' + version: 'hdf4.3.0' + file: '${{ inputs.use_hdf }}-ubuntu-2204_gcc.tar.gz' + if: ${{ (inputs.use_environ == 'release') }} + + - name: Get hdf4 snapshot uses: dsaltares/fetch-gh-release-asset@master with: repo: 'HDFGroup/hdf4' version: 'tags/snapshot' - file: '${{ inputs.use_hdf }}-ubuntu-2204.tar.gz' + file: '${{ inputs.use_hdf }}-ubuntu-2204_gcc.tar.gz' + if: ${{ (inputs.use_environ == 'snapshots') }} - name: List files for the space (Linux) run: | @@ -202,7 +263,7 @@ jobs: ls ${{ runner.workspace }} - name: Uncompress gh binary (Linux) - run: tar -zxvf ${{ github.workspace }}/${{ inputs.use_hdf }}-ubuntu-2204.tar.gz + run: tar -zxvf ${{ github.workspace }}/${{ inputs.use_hdf }}-ubuntu-2204_gcc.tar.gz - name: Uncompress hdf4 binary (Linux) run: | @@ -216,12 +277,21 @@ jobs: FILE_NAME_HDF=$(ls ${{ github.workspace }}/hdf4/HDF_Group/HDF) echo "HDFLIB_ENV=$HDFDIR$FILE_NAME_HDF" >> $GITHUB_OUTPUT + - name: Get hdf5 release + uses: dsaltares/fetch-gh-release-asset@master + with: + repo: 'HDFGroup/hdf5' + version: 'hdf5-1.14.4' + file: '${{ inputs.use_hdf5 }}-ubuntu-2204_gcc.tar.gz' + if: ${{ (inputs.use_environ == 'release') }} + - name: Get hdf5 release uses: dsaltares/fetch-gh-release-asset@master with: repo: 'HDFGroup/hdf5' version: 'tags/snapshot-1.14' - file: '${{ inputs.use_hdf5 }}-ubuntu-2204.tar.gz' + file: '${{ inputs.use_hdf5 }}-ubuntu-2204_gcc.tar.gz' + if: ${{ (inputs.use_environ == 'snapshots') }} - name: List files for the space (Linux) run: | @@ -229,7 +299,7 @@ jobs: ls ${{ runner.workspace }} - name: Uncompress gh binary (Linux) - run: tar -zxvf ${{ github.workspace }}/${{ inputs.use_hdf5 }}-ubuntu-2204.tar.gz + run: tar -zxvf ${{ github.workspace }}/${{ inputs.use_hdf5 }}-ubuntu-2204_gcc.tar.gz - name: Uncompress hdf5 binary (Linux) run: | @@ -253,7 +323,28 @@ jobs: run: | FILE_NAME_BASE=$(echo "${{ inputs.file_base }}") echo "FILE_BASE=$FILE_NAME_BASE" >> $GITHUB_OUTPUT - shell: bash + if [[ '${{ inputs.use_environ }}' == 'release' ]] + then + SOURCE_NAME_BASE=$(echo "${{ inputs.snap_name }}") + else + SOURCE_NAME_BASE=$(echo "hdfsrc") + fi + echo "SOURCE_BASE=$SOURCE_NAME_BASE" >> $GITHUB_OUTPUT + + # Get files created by release script + - name: Get tgz-tarball (Linux) + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 + with: + name: tgz-tarball + path: ${{ github.workspace }} + + - name: List files for the space (Linux) + run: | + ls -l ${{ github.workspace }} + ls ${{ runner.workspace }} + + - name: Uncompress source (Linux) + run: tar -zxvf ${{ github.workspace }}/${{ steps.set-file-base.outputs.FILE_BASE }}.tar.gz - name: Build with Ant env: @@ -261,18 +352,198 @@ jobs: HDF5LIBS: ${{ steps.set-hdf5lib-name.outputs.HDF5LIB_ENV }} run: ant -noinput -buildfile build.xml binaryPackage + - name: Rename snapshot binary base name + id: ren-basename + if: ${{ (inputs.use_environ == 'snapshots') }} + run: | + cd build/dist + mv ${{ inputs.snap_name }}-Linux-x86_64.tar.gz ${{ steps.set-file-base.outputs.FILE_BASE }}-Linux-x86_64.tar.gz + shell: bash + - name: List files in the space (Linux) run: | - ls ${{ github.workspace }} + ls ${{ github.workspace }}/build/dist ls -l ${{ runner.workspace }} # Save files created by ctest script - - name: Save published binary (Linux) - uses: actions/upload-artifact@v3 + - name: Save published snapshot binary (Linux) + uses: actions/upload-artifact@v4 with: name: tgz-ubuntu-2204-binary path: ${{ github.workspace }}/build/dist/${{ steps.set-file-base.outputs.FILE_BASE }}-Linux-x86_64.tar.gz if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` + if: ${{ (inputs.use_environ == 'snapshots') }} + + - name: Save published release binary (Linux) + uses: actions/upload-artifact@v4 + with: + name: tgz-ubuntu-2204-binary + path: ${{ github.workspace }}/build/dist/${{ inputs.snap_name }}-Linux-x86_64.tar.gz + if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` + if: ${{ (inputs.use_environ == 'release') }} + + - name: Test with Ant + env: + HDFLIBS: ${{ steps.set-hdflib-name.outputs.HDFLIB_ENV }} + HDF5LIBS: ${{ steps.set-hdf5lib-name.outputs.HDF5LIB_ENV }} + run: ant -noinput -buildfile build.xml junit + + build_and_test_mac: + # mac (osx12) w/ clang + ant + # + name: "mac clang CMake" + runs-on: macos-13 + if: false + steps: + - uses: actions/checkout@v3 + + - name: Set up JDK 19 + uses: actions/setup-java@v3 + with: + java-version: '19' + distribution: 'temurin' + + - name: Get hdf4 release + uses: dsaltares/fetch-gh-release-asset@master + with: + repo: 'HDFGroup/hdf4' + version: 'hdf4.3.0' + file: '${{ inputs.use_hdf }}-osx12.tar.gz' + if: ${{ (inputs.use_environ == 'release') }} + + - name: Get hdf4 snapshot + uses: dsaltares/fetch-gh-release-asset@master + with: + repo: 'HDFGroup/hdf4' + version: 'tags/snapshot' + file: '${{ inputs.use_hdf }}-osx12.tar.gz' + if: ${{ (inputs.use_environ == 'snapshots') }} + + - name: List files for the space (mac) + run: | + ls -l ${{ github.workspace }} + ls ${{ runner.workspace }} + + - name: Uncompress gh binary (mac) + run: tar -zxvf ${{ github.workspace }}/${{ inputs.use_hdf }}-osx12.tar.gz + + - name: Uncompress hdf4 binary (mac) + run: | + cd "${{ github.workspace }}/hdf4" + tar -zxvf ${{ github.workspace }}/hdf4/HDF-*-Darwin.tar.gz --strip-components 1 + + - name: set hdflib name + id: set-hdflib-name + run: | + HDFDIR=${{ github.workspace }}/hdf4/HDF_Group/HDF/ + FILE_NAME_HDF=$(ls ${{ github.workspace }}/hdf4/HDF_Group/HDF) + echo "HDFLIB_ENV=$HDFDIR$FILE_NAME_HDF" >> $GITHUB_OUTPUT + + - name: Get hdf5 release + uses: dsaltares/fetch-gh-release-asset@master + with: + repo: 'HDFGroup/hdf5' + version: 'hdf5-1.14.4' + file: '${{ inputs.use_hdf5 }}-osx12.tar.gz' + if: ${{ (inputs.use_environ == 'release') }} + + - name: Get hdf5 snapshot + uses: dsaltares/fetch-gh-release-asset@master + with: + repo: 'HDFGroup/hdf5' + version: 'tags/snapshot-1.14' + file: '${{ inputs.use_hdf5 }}-osx12.tar.gz' + if: ${{ (inputs.use_environ == 'snapshots') }} + + - name: List files for the space (mac) + run: | + ls -l ${{ github.workspace }} + ls ${{ runner.workspace }} + + - name: Uncompress gh binary (mac) + run: tar -zxvf ${{ github.workspace }}/${{ inputs.use_hdf5 }}-osx12.tar.gz + + - name: Uncompress hdf5 binary (mac) + run: | + cd "${{ github.workspace }}/hdf5" + tar -zxvf ${{ github.workspace }}/hdf5/HDF5-*-Darwin.tar.gz --strip-components 1 + + - name: set hdf5lib name + id: set-hdf5lib-name + run: | + HDF5DIR=${{ github.workspace }}/hdf5/HDF_Group/HDF5/ + FILE_NAME_HDF5=$(ls ${{ github.workspace }}/hdf5/HDF_Group/HDF5) + echo "HDF5LIB_ENV=$HDF5DIR$FILE_NAME_HDF5" >> $GITHUB_OUTPUT + + - name: List files for the binaries (mac) + run: | + ls -l ${{ github.workspace }}/hdf4/HDF_Group/HDF + ls -l ${{ github.workspace }}/hdf5/HDF_Group/HDF5 + + - name: Set file base name (mac) + id: set-file-base + run: | + FILE_NAME_BASE=$(echo "${{ inputs.file_base }}") + echo "FILE_BASE=$FILE_NAME_BASE" >> $GITHUB_OUTPUT + if [[ '${{ inputs.use_environ }}' == 'release' ]] + then + SOURCE_NAME_BASE=$(echo "${{ inputs.snap_name }}") + else + SOURCE_NAME_BASE=$(echo "hdfsrc") + fi + echo "SOURCE_BASE=$SOURCE_NAME_BASE" >> $GITHUB_OUTPUT + + # Get files created by release script + - name: Get tgz-tarball (mac) + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 + with: + name: tgz-tarball + path: ${{ github.workspace }} + + - name: List files for the space (mac) + run: | + ls -l ${{ github.workspace }} + ls ${{ runner.workspace }} + + - name: Uncompress source (mac) + run: tar -zxvf ${{ github.workspace }}/${{ steps.set-file-base.outputs.FILE_BASE }}.tar.gz + + - name: Build with Ant + env: + HDFLIBS: ${{ steps.set-hdflib-name.outputs.HDFLIB_ENV }} + HDF5LIBS: ${{ steps.set-hdf5lib-name.outputs.HDF5LIB_ENV }} + run: ant -Dsign_state=NOSIGN -noinput -buildfile build.xml binaryPackage + + - name: Rename snapshot binary base name + id: ren-basename + if: ${{ (inputs.use_environ == 'snapshots') }} + run: | + cd build/dist + mv ${{ inputs.snap_name }}-Darwin.tar.gz ${{ steps.set-file-base.outputs.FILE_BASE }}-Darwin.tar.gz + shell: bash + + - name: List files in the space (mac) + run: | + ls ${{ github.workspace }}/build/dist + ls -l ${{ runner.workspace }} + + # Save files created by ctest script + - name: Save published snapshot binary (mac) + uses: actions/upload-artifact@v4 + with: + name: tgz-osx12-binary + path: ${{ github.workspace }}/build/dist/${{ steps.set-file-base.outputs.FILE_BASE }}-Darwin.tar.gz + if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` + if: ${{ (inputs.use_environ == 'snapshots') }} + + # Save release files created by ctest script + - name: Save published release binary (mac) + uses: actions/upload-artifact@v4 + with: + name: tgz-osx12-binary + path: ${{ github.workspace }}/build/dist/${{ inputs.snap_name }}-Darwin.tar.gz + if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` + if: ${{ (inputs.use_environ == 'release') }} - name: Test with Ant env: @@ -280,3 +551,4 @@ jobs: HDF5LIBS: ${{ steps.set-hdf5lib-name.outputs.HDF5LIB_ENV }} run: ant -noinput -buildfile build.xml junit + diff --git a/.github/workflows/daily-build.yml b/.github/workflows/daily-build.yml index c947341a..6b3fff2c 100644 --- a/.github/workflows/daily-build.yml +++ b/.github/workflows/daily-build.yml @@ -8,13 +8,6 @@ on: type: string required: false default: check - use_environ: - description: 'Environment to locate files' - type: string - required: true - default: snapshots -# push: -# branches: [ "master" ] pull_request: branches: [ "master" ] @@ -30,17 +23,11 @@ jobs: hdf4-name: ${{ steps.gethdf4base.outputs.HDF4_NAME_BASE }} hdf5-name: ${{ steps.gethdf5base.outputs.HDF5_NAME_BASE }} run-ignore: ${{ steps.getinputs.outputs.INPUTS_IGNORE }} - run-environ: ${{ steps.getinputs.outputs.INPUTS_ENVIRON }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4.1.1 - name: Get hdf4 release base name -# uses: robinraju/release-downloader@v1.8 -# with: -# repository: "HDFGroup/hdf4" -# tag: "snapshot" -# fileName: "last-file.txt" uses: dsaltares/fetch-gh-release-asset@master with: repo: 'HDFGroup/hdf4' @@ -81,7 +68,8 @@ jobs: uses: ./.github/workflows/tarball.yml with: use_ignore: ${{ needs.get-base-names.outputs.run-ignore }} - use_environ: ${{ needs.get-base-names.outputs.run-environ }} + use_tag: snapshot + use_environ: snapshots call-workflow-ant: needs: [get-base-names, call-workflow-tarball] @@ -90,7 +78,7 @@ jobs: file_base: ${{ needs.call-workflow-tarball.outputs.file_base }} use_hdf: ${{ needs.get-base-names.outputs.hdf4-name }} use_hdf5: ${{ needs.get-base-names.outputs.hdf5-name }} - if: ${{ ((needs.get-base-names.outputs.run-environ == 'snapshots') && ((needs.call-workflow-tarball.outputs.has_changes == 'true') || (needs.get-base-names.outputs.run-ignore == 'ignore'))) }} + use_environ: snapshots call-workflow-release: needs: [get-base-names, call-workflow-tarball, call-workflow-ant] @@ -101,7 +89,6 @@ jobs: file_base: ${{ needs.call-workflow-tarball.outputs.file_base }} file_branch: ${{ needs.call-workflow-tarball.outputs.file_branch }} file_sha: ${{ needs.call-workflow-tarball.outputs.file_sha }} - use_tag: snapshot-3 - use_environ: ${{ needs.get-base-names.outputs.run-environ }} - if: ${{ ((needs.get-base-names.outputs.run-environ == 'snapshots') && ((needs.call-workflow-tarball.outputs.has_changes == 'true') || (needs.get-base-names.outputs.run-ignore == 'ignore'))) }} + use_environ: snapshots + if: ${{ ((needs.call-workflow-tarball.outputs.has_changes == 'true') || (needs.get-base-names.outputs.run-ignore == 'ignore')) }} diff --git a/.github/workflows/release-files.yml b/.github/workflows/release-files.yml index 68f57cf0..36114641 100644 --- a/.github/workflows/release-files.yml +++ b/.github/workflows/release-files.yml @@ -6,13 +6,14 @@ on: inputs: use_tag: description: 'Release version tag' - required: false type: string - default: snapshot + required: false + default: HDFView-3.3.99 use_environ: description: 'Environment to locate files' - required: true type: string + required: true + default: snapshots file_base: description: "The common base name of the source tarballs" required: true @@ -39,14 +40,16 @@ jobs: steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - name: Get Sources - uses: actions/checkout@v3 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: fetch-depth: 0 - - run: | + - name: Get Commit + if: ${{ (inputs.use_environ == 'snapshots') }} + run: | git checkout ${{ inputs.file_sha }} - - uses: rickstaa/action-create-tag@v1 + - uses: rickstaa/action-create-tag@a1c7777fcb2fee4f19b0f283ba888afa11678b72 # v1.7.2 id: "tag_create" with: commit_sha: ${{ inputs.file_sha }} @@ -74,20 +77,20 @@ jobs: # Get files created by tarball script - name: Get tgz-tarball (Linux) - uses: actions/download-artifact@v3 + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 with: name: tgz-tarball path: ${{ github.workspace }} - name: Get zip-tarball (Windows) - uses: actions/download-artifact@v3 + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 with: name: zip-tarball path: ${{ github.workspace }} # Get files created by cmake-ctest script - name: Get published binary (Windows) - uses: actions/download-artifact@v3 + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 with: name: zip-win-vs2022-binary path: ${{ github.workspace }} @@ -99,19 +102,41 @@ jobs: # path: ${{ github.workspace }} - name: Get published binary (Linux) - uses: actions/download-artifact@v3 + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 with: name: tgz-ubuntu-2204-binary path: ${{ github.workspace }} + - name: List files for the space + run: | + ls -l ${{ github.workspace }} + ls ${{ runner.workspace }}/hdfview + + - name: Create sha256 sums for files + run: | + sha256sum ${{ steps.get-file-base.outputs.FILE_BASE }}.tar.gz > sha256sums.txt + sha256sum ${{ steps.get-file-base.outputs.FILE_BASE }}.zip >> sha256sums.txt + sha256sum ${{ steps.get-file-base.outputs.FILE_BASE }}-Linux-x86_64.tar.gz >> sha256sums.txt + sha256sum ${{ steps.get-file-base.outputs.FILE_BASE }}-win64.zip >> sha256sums.txt + - name: Store snapshot name run: | echo "${{ steps.get-file-base.outputs.FILE_BASE }}" > ./last-file.txt +# - name: Get NEWSLETTER +# uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1 +# with: +# name: NEWSLETTER +# path: ${{ github.workspace }} +# +# - name: Create description file +# run: | +# cat ${{ github.workspace }}/NEWSLETTER.txt > description.txt + - name: PreRelease tag id: create_prerelease if: ${{ (inputs.use_environ == 'snapshots') }} - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1 with: tag_name: "${{ inputs.use_tag }}" prerelease: true @@ -119,23 +144,22 @@ jobs: last-file.txt ${{ steps.get-file-base.outputs.FILE_BASE }}.tar.gz ${{ steps.get-file-base.outputs.FILE_BASE }}.zip - ${{ steps.get-file-base.outputs.FILE_BASE }}-ubuntu-2204.tar.gz - ${{ steps.get-file-base.outputs.FILE_BASE }}-win_vs2022.zip + ${{ steps.get-file-base.outputs.FILE_BASE }}-Linux-x86_64.tar.gz + ${{ steps.get-file-base.outputs.FILE_BASE }}-win64.zip if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` - name: Release tag id: create_release if: ${{ (inputs.use_environ == 'release') }} - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1 with: tag_name: "${{ inputs.use_tag }}" prerelease: false - #body_path: ${{ github.workspace }}-CHANGELOG.txt files: | ${{ steps.get-file-base.outputs.FILE_BASE }}.tar.gz ${{ steps.get-file-base.outputs.FILE_BASE }}.zip - ${{ steps.get-file-base.outputs.FILE_BASE }}-ubuntu-2204.tar.gz - ${{ steps.get-file-base.outputs.FILE_BASE }}-win_vs2022.zip + ${{ steps.get-file-base.outputs.FILE_BASE }}-Linux-x86_64.tar.gz + ${{ steps.get-file-base.outputs.FILE_BASE }}-win64.zip if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` - name: List files for the space (Linux) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f42f49cc..11e4b977 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,7 +17,7 @@ on: description: 'HDF5 Release version tag' type: string required: false - default: snapshot + default: snapshot-1.14 permissions: contents: read @@ -43,67 +43,32 @@ jobs: echo "RELEASE4_TAG=$TAG4" >> $GITHUB_OUTPUT echo "RELEASE5_TAG=$TAG5" >> $GITHUB_OUTPUT - create-files-ant: + call-workflow-tarball: needs: log-the-inputs - runs-on: ubuntu-latest - outputs: - file_base: ${{ steps.set-file-base.outputs.FILE_BASE }} - steps: - - name: Set file base name - id: set-file-base - run: | - FILE_NAME_BASE=$(echo "${{ needs.log-the-inputs.outputs.rel_tag }}") - echo "FILE_BASE=$FILE_NAME_BASE" >> $GITHUB_OUTPUT - shell: bash - - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - name: Get Sources - uses: actions/checkout@v3 - with: - path: hdfsrc - - - name: Zip Folder - run: | - zip -r ${{ steps.set-file-base.outputs.FILE_BASE }}.zip ./hdfsrc - tar -zcvf ${{ steps.set-file-base.outputs.FILE_BASE }}.tar.gz ./hdfsrc - - - name: List files in the repository - run: | - ls -l ${{ github.workspace }} - ls $GITHUB_WORKSPACE - - # Save files created by release script - - name: Save tgz-tarball - uses: actions/upload-artifact@v3 - with: - name: tgz-tarball - path: ${{ steps.set-file-base.outputs.FILE_BASE }}.tar.gz - if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` - - - name: Save zip-tarball - uses: actions/upload-artifact@v3 - with: - name: zip-tarball - path: ${{ steps.set-file-base.outputs.FILE_BASE }}.zip - if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` + uses: ./.github/workflows/tarball.yml + with: + use_tag: ${{ needs.log-the-inputs.outputs.rel_tag }} + use_environ: release call-workflow-ant: - needs: [log-the-inputs, create-files-ant] + needs: [log-the-inputs, call-workflow-tarball] uses: ./.github/workflows/ant.yml with: use_hdf: ${{ needs.log-the-inputs.outputs.rel4_tag }} use_hdf5: ${{ needs.log-the-inputs.outputs.rel5_tag }} file_base: ${{ needs.create-files-ant.outputs.file_base }} + snap_name: hdfview-${{ needs.call-workflow-tarball.outputs.source_base }} + use_environ: release call-workflow-release: - needs: [log-the-inputs, create-files-ant, call-workflow-ant] + needs: [log-the-inputs, call-workflow-tarball, call-workflow-ant] permissions: contents: write # In order to allow tag creation uses: ./.github/workflows/release-files.yml with: - file_base: ${{ needs.create-files-ant.outputs.file_base }} - file_branch: ${{ needs.log-the-inputs.outputs.rel_tag }} - file_sha: ${{ needs.log-the-inputs.outputs.rel_tag }} + file_base: ${{ needs.call-workflow-tarball.outputs.file_base }} + file_branch: ${{ needs.call-workflow-tarball.outputs.file_branch }} + file_sha: ${{ needs.call-workflow-tarball.outputs.file_sha }} use_tag: ${{ needs.log-the-inputs.outputs.rel_tag }} use_environ: release diff --git a/.github/workflows/tarball.yml b/.github/workflows/tarball.yml index 837e380f..8cae03f3 100644 --- a/.github/workflows/tarball.yml +++ b/.github/workflows/tarball.yml @@ -9,6 +9,11 @@ on: type: string required: false default: check + use_tag: + description: 'Release version tag' + type: string + required: false + default: snapshot use_environ: description: 'Environment to locate files' type: string @@ -18,6 +23,9 @@ on: has_changes: description: "Whether there were changes the previous day" value: ${{ jobs.check_commits.outputs.has_changes }} + source_base: + description: "The common version name of the binaries" + value: ${{ jobs.create_tarball.outputs.source_base }} file_base: description: "The common base name of the source tarballs" value: ${{ jobs.create_tarball.outputs.file_base }} @@ -42,6 +50,8 @@ jobs: branch_ref: ${{ steps.get-branch-name.outputs.BRANCH_REF }} branch_sha: ${{ steps.get-branch-sha.outputs.BRANCH_SHA }} steps: + - uses: actions/checkout@v4.1.1 + - name: Get branch name id: get-branch-name env: @@ -80,10 +90,11 @@ jobs: if: ${{ ((inputs.use_environ == 'snapshots') && ((needs.check_commits.outputs.has_changes == 'true') || (inputs.use_ignore == 'ignore'))) || (inputs.use_environ == 'release') }} outputs: file_base: ${{ steps.set-file-base.outputs.FILE_BASE }} + source_base: ${{ steps.version.outputs.TAG_VERSION }} steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - name: Get Sources - uses: actions/checkout@v3 + uses: actions/checkout@v4.1.1 with: path: hdfsrc @@ -91,16 +102,22 @@ jobs: id: version run: | cd "$GITHUB_WORKSPACE/hdfsrc" - echo "TAG_VERSION=3.3.99" >> $GITHUB_OUTPUT + VERSION_BASE=$(echo cat VERSION | sed -r "s/.*-([0-9]+\.[0-9]+\.[0-9]+).*/\1/") + echo "TAG_VERSION=$VERSION_BASE" >> $GITHUB_OUTPUT - name: Set file base name id: set-file-base run: | - if [[ '${{ inputs.use_environ }}' == 'snapshots' && '${{ needs.check_commits.outputs.has_changes }}' == 'true' ]] + if [[ '${{ inputs.use_environ }}' == 'snapshots' ]] then - FILE_NAME_BASE=$(echo "HDFView-${{ needs.check_commits.outputs.branch_ref }}-${{ needs.check_commits.outputs.branch_sha }}") + FILE_NAME_BASE=$(echo "hdfview-${{ needs.check_commits.outputs.branch_ref }}-${{ needs.check_commits.outputs.branch_sha }}") else - FILE_NAME_BASE=$(echo "HDFView-${{ steps.version.outputs.TAG_VERSION }}") + if [[ '${{ inputs.use_tag }}' == 'snapshot' ]] + then + FILE_NAME_BASE=$(echo "snapshot") + else + FILE_NAME_BASE=$(echo "hdfview-${{ steps.version.outputs.TAG_VERSION }}") + fi fi echo "FILE_BASE=$FILE_NAME_BASE" >> $GITHUB_OUTPUT shell: bash @@ -108,15 +125,33 @@ jobs: - name: List files in the repository run: | ls -l ${{ github.workspace }} - ls $GITHUB_WORKSPACE + ls $GITHUB_WORKSPACE/hdfsrc - - name: Create source file (tgz and zip) - id: create-files + - name: Create snapshot source file (tgz and zip) + id: create-snapshot-files + if: ${{ (inputs.use_environ == 'release') }} + run: | + mv hdfsrc ${{ steps.set-file-base.outputs.FILE_BASE }} + zip -r ${{ steps.set-file-base.outputs.FILE_BASE }}.zip ./${{ steps.set-file-base.outputs.FILE_BASE }} + tar -zcvf ${{ steps.set-file-base.outputs.FILE_BASE }}.tar.gz ./${{ steps.set-file-base.outputs.FILE_BASE }} + shell: bash + + - name: Create release source file (tgz and zip) + id: create-release-files + if: ${{ (inputs.use_environ == 'snapshots') }} run: | zip -r ${{ steps.set-file-base.outputs.FILE_BASE }}.zip ./hdfsrc tar -zcvf ${{ steps.set-file-base.outputs.FILE_BASE }}.tar.gz ./hdfsrc shell: bash + - name: Rename release file base name + id: ren-basename + if: ${{ (inputs.use_environ == 'release') && (inputs.use_tag == 'snapshot') }} + run: | + mv hdfview-${{ steps.version.outputs.TAG_VERSION }}.tar.gz ${{ inputs.use_tag }}.tar.gz + mv hdfview-${{ steps.version.outputs.TAG_VERSION }}.zip ${{ inputs.use_tag }}.zip + shell: bash + - name: List files in the repository run: | ls -l ${{ github.workspace }} @@ -124,15 +159,22 @@ jobs: # Save files created by release script - name: Save tgz-tarball - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: tgz-tarball path: ${{ steps.set-file-base.outputs.FILE_BASE }}.tar.gz if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` - name: Save zip-tarball - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: zip-tarball path: ${{ steps.set-file-base.outputs.FILE_BASE }}.zip if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` + +# - name: Save NEWSLETTER +# uses: actions/upload-artifact@v4 +# with: +# name: NEWSLETTER +# path: ./hdfsrc/release_docs/NEWSLETTER.txt +# if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` diff --git a/build.properties b/build.properties index 6ff1e1f9..fcc9b8ec 100644 --- a/build.properties +++ b/build.properties @@ -8,9 +8,9 @@ # Example: # ant -Dbuild.debug=false -hdf.lib.dir = /home/byrn/HDF_Projects/temp/HDF_Group/HDF/4.2.17/lib -hdf5.lib.dir = /home/byrn/HDF_Projects/temp/HDF_Group/HDF5/1.14.3/lib -hdf5.plugin.dir = /home/byrn/HDF_Projects/temp/HDF_Group/HDF5/1.14.3/lib/plugin +hdf.lib.dir = ${env.HDFLIBS}/lib +hdf5.lib.dir = ${env.HDF5LIBS}/lib +hdf5.plugin.dir = ${env.HDF5LIBS}/lib/plugin # Whether to compile the HDFView source files with Java debugging information build.debug = true @@ -28,10 +28,10 @@ install.mac.jre = ${env.OSX_JRE_HOME} jre.dir.name = ${env.OSX_JRE_NAME} # On Windows use PATH, on linux use LD_LIBRARY_PATH -platform.hdf.lib = ${env.LD_LIBRARY_PATH} +platform.hdf.lib = ${env.HDFVARNAME} -# UsersGuide in repo docs folder -userguide.dir = ./docs/UsersGuide +# Needs to be set to /web/trunk/products/java SVN checkout directory for packageDocumentation to work +userguide.dir = ${env.HDF-Java-Web} # Set to match root directory where Wix bin directory is located wix.dir = ${env.WIX}/bin diff --git a/build.xml b/build.xml index beacf8d4..a5e4c1ca 100644 --- a/build.xml +++ b/build.xml @@ -15,6 +15,10 @@ + + + + @@ -1186,7 +1190,6 @@ - @@ -1226,10 +1229,10 @@ - + - + @@ -1276,11 +1279,11 @@ - + - + @@ -2016,7 +2019,7 @@ MAC NOTARY FOR JPACKAGE ================================================================= --> - + @@ -2046,7 +2049,7 @@ notarize-app:${retUUID} - + @@ -2075,7 +2078,7 @@ notarize-info:${logInfo} - + @@ -2105,7 +2108,7 @@ notarize-app:${retUUID} - + @@ -2132,7 +2135,7 @@ notarize-app:${retUUID} - + @@ -2162,7 +2165,7 @@ - + @@ -2179,7 +2182,7 @@ - + @@ -2208,7 +2211,7 @@ - + diff --git a/docs/Build_HDFView.txt b/docs/Build_HDFView.txt index c5376ae8..9c0128c0 100644 --- a/docs/Build_HDFView.txt +++ b/docs/Build_HDFView.txt @@ -37,7 +37,7 @@ For example, #hdf.lib.dir = ${env.HDFLIBS}/lib #hdf5.lib.dir = ${env.HDF5LIBS}/lib - hdf.lib.dir = //HDF_Group/HDF/4.2.X/lib + hdf.lib.dir = //HDF_Group/HDF/4.3.X/lib hdf5.lib.dir = //HDF_Group/HDF5/1.14.X/lib From the top HDFView source code directory run: //ant run @@ -45,7 +45,7 @@ From the top HDFView source code directory run: //ant ru From the top HDFView source code directory run: //ant binaryPackage Go into the build/dist directory that gets created to find the HDFView distribution. -For example, HDFView-3.3.0-Linux_64.tar.gz. +For example, HDFView-3.3.99-Linux_64.tar.gz. Uncompress the HDFView binary and bring up HDFView by executing the bin/HDFView command. diff --git a/docs/RELEASE.txt b/docs/RELEASE.txt index 41099cf2..be8512e4 100644 --- a/docs/RELEASE.txt +++ b/docs/RELEASE.txt @@ -4,7 +4,7 @@ The current HDFView products can be downloaded at: HDF Libraries ============================================================================= -This release was built and tested with HDF 4.2.x and HDF5 1.14.x. +This release was built and tested with HDF 4.3.x and HDF5 1.14.x. Windows ONLY: HDFView built with VS 2015 will require that the Visual C++ Redistributable Packages be installed on your machine. @@ -21,7 +21,7 @@ newest jpackage for distribution. Major Enhancements ============================================================================== - * + * Add User Option for editing the plugin path ***** Previous fixes ***** * GH #121 Updated all icons with transparency diff --git a/src/org.hdfgroup.hdfview/hdf/HDFVersions.java b/src/org.hdfgroup.hdfview/hdf/HDFVersions.java index 021bd6bc..8d3fd250 100644 --- a/src/org.hdfgroup.hdfview/hdf/HDFVersions.java +++ b/src/org.hdfgroup.hdfview/hdf/HDFVersions.java @@ -21,15 +21,31 @@ public class HDFVersions { } } - /** @return the property to track the current versions of java */ + /** + * Get the property to track the current versions of java + * + * @return the property to track the current versions of java + */ public static String getPropertyVersionJava() { return props.getProperty("JAVA_VERSION"); } - /** @return the property to track the current versions of hdf4 */ + /** + * Get the property to track the current versions of hdf4 + * + * @return the property to track the current versions of hdf4 + */ public static String getPropertyVersionHDF4() { return props.getProperty("HDF4_VERSION"); } - /** @return the property to track the current versions of hdf5 */ + /** + * Get the property to track the current versions of hdf5 + * + * @return the property to track the current versions of hdf5 + */ public static String getPropertyVersionHDF5() { return props.getProperty("HDF5_VERSION"); } - /** @return the property to track the current versions of hdfview */ + /** + * Get the property to track the current versions of hdfview + * + * @return the property to track the current versions of hdfview + */ public static String getPropertyVersionView() { return props.getProperty("HDFVIEW_VERSION"); } } diff --git a/src/org.hdfgroup.hdfview/hdf/view/DataView/DataView.java b/src/org.hdfgroup.hdfview/hdf/view/DataView/DataView.java index f7ee47a0..9628c416 100644 --- a/src/org.hdfgroup.hdfview/hdf/view/DataView/DataView.java +++ b/src/org.hdfgroup.hdfview/hdf/view/DataView/DataView.java @@ -32,6 +32,10 @@ public abstract interface DataView { /** The image view type */ public static final int DATAVIEW_IMAGE = 2; - /** @return the data object displayed in this data viewer */ + /** + * Get the data object displayed in this data viewer + * + * @return the data object displayed in this data viewer + */ public abstract HObject getDataObject(); } diff --git a/src/org.hdfgroup.hdfview/hdf/view/DataView/DataViewManager.java b/src/org.hdfgroup.hdfview/hdf/view/DataView/DataViewManager.java index af4d55c9..6444db42 100644 --- a/src/org.hdfgroup.hdfview/hdf/view/DataView/DataViewManager.java +++ b/src/org.hdfgroup.hdfview/hdf/view/DataView/DataViewManager.java @@ -67,7 +67,11 @@ public abstract interface DataViewManager { */ public abstract void showError(String errMsg); - /** @return the current TreeView */ + /** + * Get the current TreeView + * + * @return the current TreeView + */ public abstract TreeView getTreeView(); /** diff --git a/src/org.hdfgroup.hdfview/hdf/view/DefaultFileFilter.java b/src/org.hdfgroup.hdfview/hdf/view/DefaultFileFilter.java index 9e8f07c0..7c5c220d 100644 --- a/src/org.hdfgroup.hdfview/hdf/view/DefaultFileFilter.java +++ b/src/org.hdfgroup.hdfview/hdf/view/DefaultFileFilter.java @@ -112,6 +112,8 @@ public DefaultFileFilter(String[] filters, String description) } /** + * Get the file extensions associated with this DefaultFileFilter + * * @return the file extensions associated with this DefaultFileFilter */ public String getExtensions() @@ -160,8 +162,10 @@ public void addExtension(String extension) } /** - * @return the human readable description of this filter. For example: - * "JPEG and GIF Image Files (*.jpg, *.gif)" + * Get the human readable description of this filter. For example: "JPEG and GIF Image Files (*.jpg, + * *.gif)" + * + * @return the human readable description of this filter. */ public String getDescription() { @@ -220,15 +224,19 @@ public void setExtensionListInDescription(boolean b) } /** - * @return whether the extension list (.jpg, .gif, etc) should show up in - * the human readable description. + * Check if the extension list (.jpg, .gif, etc) should show up in the human readable description. * - * Only relevent if a description was provided in the constructor or using - * setDescription(); + * @return whether the extension list (.jpg, .gif, etc) should show up in the human readable description. + * + * Only relevent if a description was provided in the constructor or using setDescription(); */ public boolean isExtensionListInDescription() { return useExtensionsInDescription; } - /** @return a file filter for HDF4/5 file. */ + /** + * Get the file filter for HDF4/5 file + * + * @return a file filter for HDF4/5 file. + */ public static DefaultFileFilter getFileFilter() { // update extensions @@ -242,7 +250,11 @@ public static DefaultFileFilter getFileFilter() return filter; } - /** @return a file filter for NetCDF3 file. */ + /** + * Get a file filter for NetCDF3 file + * + * @return a file filter for NetCDF3 file. + */ public static DefaultFileFilter getFileFilterNetCDF3() { DefaultFileFilter filter = new DefaultFileFilter(); @@ -252,7 +264,11 @@ public static DefaultFileFilter getFileFilterNetCDF3() return filter; } - /** @return a file filter for HDF4 file. */ + /** + * Get a file filter for HDF4 file + * + * @return a file filter for HDF4 file. + */ public static DefaultFileFilter getFileFilterHDF4() { DefaultFileFilter filter = new DefaultFileFilter(); @@ -264,7 +280,11 @@ public static DefaultFileFilter getFileFilterHDF4() return filter; } - /** @return a file filter for HDF5 file. */ + /** + * Get a file filter for HDF5 file + * + * @return a file filter for HDF5 file. + */ public static DefaultFileFilter getFileFilterHDF5() { DefaultFileFilter filter = new DefaultFileFilter(); @@ -275,7 +295,11 @@ public static DefaultFileFilter getFileFilterHDF5() return filter; } - /** @return a file filter for JPEG image files. */ + /** + * Get a file filter for JPEG image files + * + * @return a file filter for JPEG image files. + */ public static DefaultFileFilter getFileFilterJPEG() { DefaultFileFilter filter = new DefaultFileFilter(); @@ -290,7 +314,11 @@ public static DefaultFileFilter getFileFilterJPEG() return filter; } - /** @return a file filter for TIFF image files. */ + /** + * Get a file filter for TIFF image files + * + * @return a file filter for TIFF image files. + */ public static DefaultFileFilter getFileFilterTIFF() { DefaultFileFilter filter = new DefaultFileFilter(); @@ -301,7 +329,11 @@ public static DefaultFileFilter getFileFilterTIFF() return filter; } - /** @return a file filter for PNG image files. */ + /** + * Get a file filter for PNG image files + * + * @return a file filter for PNG image files. + */ public static DefaultFileFilter getFileFilterPNG() { DefaultFileFilter filter = new DefaultFileFilter(); @@ -311,7 +343,11 @@ public static DefaultFileFilter getFileFilterPNG() return filter; } - /** @return a file filter for BMP image files. */ + /** + * Get a file filter for BMP image files + * + * @return a file filter for BMP image files. + */ public static DefaultFileFilter getFileFilterBMP() { DefaultFileFilter filter = new DefaultFileFilter(); @@ -322,7 +358,11 @@ public static DefaultFileFilter getFileFilterBMP() return filter; } - /** @return a file filter for GIF image files. */ + /** + * Get a file filter for GIF image files + * + * @return a file filter for GIF image files. + */ public static DefaultFileFilter getFileFilterGIF() { DefaultFileFilter filter = new DefaultFileFilter(); @@ -332,7 +372,11 @@ public static DefaultFileFilter getFileFilterGIF() return filter; } - /** @return a file filter for GIF, JPEG, BMP, or PNG image files. */ + /** + * Get a file filter for GIF, JPEG, BMP, or PNG image files + * + * @return a file filter for GIF, JPEG, BMP, or PNG image files. + */ public static DefaultFileFilter getImageFileFilter() { DefaultFileFilter filter = new DefaultFileFilter(); @@ -351,7 +395,11 @@ public static DefaultFileFilter getImageFileFilter() return filter; } - /** @return a file filter for text file. */ + /** + * Get a file filter for text file + * + * @return a file filter for text file. + */ public static DefaultFileFilter getFileFilterText() { DefaultFileFilter filter = new DefaultFileFilter(); @@ -362,7 +410,11 @@ public static DefaultFileFilter getFileFilterText() return filter; } - /** @return a file filter for binary file. */ + /** + * Get a file filter for binary file + * + * @return a file filter for binary file. + */ public static DefaultFileFilter getFileFilterBinary() { DefaultFileFilter filter = new DefaultFileFilter(); diff --git a/src/org.hdfgroup.hdfview/hdf/view/HDFView.java b/src/org.hdfgroup.hdfview/hdf/view/HDFView.java index 7d1ff53d..c8a841b6 100644 --- a/src/org.hdfgroup.hdfview/hdf/view/HDFView.java +++ b/src/org.hdfgroup.hdfview/hdf/view/HDFView.java @@ -295,7 +295,7 @@ public HDFView(String root, String start_dir) } if (FileFormat.getFileFormat(FileFormat.FILE_TYPE_HDF5) != null) - H5.H5PLappend(ViewProperties.getPluginDir()); + ViewProperties.loadPluginPaths(); treeViews = ViewProperties.getTreeViewList(); metaDataViews = ViewProperties.getMetaDataViewList(); @@ -937,9 +937,6 @@ public void widgetSelected(SelectionEvent e) // currentDir until isWorkDirChanged() is fixed currentDir = ViewProperties.getWorkDir(); - if (FileFormat.getFileFormat(FileFormat.FILE_TYPE_HDF5) != null) - H5.H5PLappend(ViewProperties.getPluginDir()); - // if (userOptionDialog.isFontChanged()) { Font font = null; @@ -1381,26 +1378,36 @@ public void drop(DropTargetEvent e) } /** + * Get a list of treeview implementations. + * * @return a list of treeview implementations. */ public static final List getListOfTreeViews() { return treeViews; } /** + * Get a list of imageview implementations. + * * @return a list of imageview implementations. */ public static final List getListOfImageViews() { return imageViews; } /** + * Get a list of tableview implementations. + * * @return a list of tableview implementations. */ public static final List getListOfTableViews() { return tableViews; } /** + * Get a list of metaDataview implementations. + * * @return a list of metaDataview implementations. */ public static final List getListOfMetaDataViews() { return metaDataViews; } /** + * Get a list of paletteview implementations. + * * @return a list of paletteview implementations. */ public static final List getListOfPaletteViews() { return paletteViews; } @@ -1412,6 +1419,8 @@ public TreeView getTreeView() } /** + * Get the combobox associated with a URL entry. + * * @return the combobox associated with a URL entry. */ public Combo getUrlBar() { return urlBar; } diff --git a/src/org.hdfgroup.hdfview/hdf/view/HelpView/HelpView.java b/src/org.hdfgroup.hdfview/hdf/view/HelpView/HelpView.java index 309aeb5e..01c8ef59 100644 --- a/src/org.hdfgroup.hdfview/hdf/view/HelpView/HelpView.java +++ b/src/org.hdfgroup.hdfview/hdf/view/HelpView/HelpView.java @@ -26,11 +26,16 @@ public abstract interface HelpView { public abstract void show(); /** - * @return the HelpView's label, which is displayed in the HDFView - * help menu. + * Get the HelpView's label, which is displayed in the HDFView help menu. + * + * @return the HelpView's label */ public abstract String getLabel(); - /** @return the action command for this HelpView. */ + /** + * Get the action command for this HelpView. + * + * @return the action command for this HelpView. + */ public abstract String getActionCommand(); } diff --git a/src/org.hdfgroup.hdfview/hdf/view/ImageView/ImageView.java b/src/org.hdfgroup.hdfview/hdf/view/ImageView/ImageView.java index 1514a53d..e646c2f8 100644 --- a/src/org.hdfgroup.hdfview/hdf/view/ImageView/ImageView.java +++ b/src/org.hdfgroup.hdfview/hdf/view/ImageView/ImageView.java @@ -33,16 +33,32 @@ public abstract interface ImageView extends DataView { */ public abstract Rectangle getSelectedArea(); - /** @return true if the image is a truecolor image. */ + /** + * Check if the image is a truecolor image. + * + * @return true if the image is a truecolor image. + */ public abstract boolean isTrueColor(); - /** @return true if the image interlace is plane interlace. */ + /** + * Check if the image interlace is plane interlace. + * + * @return true if the image interlace is plane interlace. + */ public abstract boolean isPlaneInterlace(); - /** @return array of selected data */ + /** + * Get the array of selected data + * + * @return array of selected data + */ public abstract Object getSelectedData(); - /** @return the image displayed in this imageView */ + /** + * Get the image displayed in this imageView + * + * @return the image displayed in this imageView + */ public abstract Image getImage(); /** @@ -52,7 +68,11 @@ public abstract interface ImageView extends DataView { */ public abstract void setImage(Image img); - /** @return the palette of the image */ + /** + * Get the palette of the image + * + * @return the palette of the image + */ public abstract byte[][] getPalette(); /** @@ -62,6 +82,10 @@ public abstract interface ImageView extends DataView { */ public abstract void setPalette(byte[][] palette); - /** @return the byte array of the image data */ + /** + * Get the byte array of the image data + * + * @return the byte array of the image data + */ public abstract byte[] getImageByteData(); } diff --git a/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java b/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java index 420e7ba5..71ede170 100644 --- a/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java +++ b/src/org.hdfgroup.hdfview/hdf/view/TableView/DataProviderFactory.java @@ -565,7 +565,9 @@ public int getRowCount() public final void setIsValueChanged(boolean isChanged) { isValueChanged = isChanged; } /** - * @return if the datavalue has chaged + * Check if the datavalue has changed + * + * @return if the datavalue has changed */ public final boolean getIsValueChanged() { return isValueChanged; } diff --git a/src/org.hdfgroup.hdfview/hdf/view/TableView/DefaultBaseTableView.java b/src/org.hdfgroup.hdfview/hdf/view/TableView/DefaultBaseTableView.java index a746b91e..f1cd867e 100644 --- a/src/org.hdfgroup.hdfview/hdf/view/TableView/DefaultBaseTableView.java +++ b/src/org.hdfgroup.hdfview/hdf/view/TableView/DefaultBaseTableView.java @@ -1268,13 +1268,23 @@ public int getSelectedColumnCount() return selectionLayer.getSelectedColumnPositions().length; } - /** @return the selection layer */ + /** + * Get the selection layer + * + * @return the selection layer + */ public SelectionLayer getSelectionLayer() { return selectionLayer; } - /** @return the data layer */ + /** + * Get the data layer + * + * @return the data layer + */ public DataLayer getDataLayer() { return dataLayer; } - /** refresh the data table */ + /** + * refresh the data table + */ @Override public void refreshDataTable() { @@ -1640,6 +1650,110 @@ else if (delName.equalsIgnoreCase(ViewProperties.DELIMITER_SEMI_COLON)) viewer.showStatus("Data saved to: " + fname); } + /** Save data as text (from TextView). */ + // private void saveAsTextTextView() throws Exception { + // FileDialog fChooser = new FileDialog(shell, SWT.SAVE); + // fChooser.setText("Save Current Data To Text File --- " + dataset.getName()); + // fChooser.setFilterPath(dataset.getFileFormat().getParent()); + // + // DefaultFileFilter filter = DefaultFileFilter.getFileFilterText(); + // fChooser.setFilterExtensions(new String[] {"*", filter.getExtensions()}); + // fChooser.setFilterNames(new String[] {"All Files", filter.getDescription()}); + // fChooser.setFilterIndex(1); + // + // // fchooser.changeToParentDirectory(); + // fChooser.setFileName(dataset.getName() + ".txt"); + // fChooser.setOverwrite(true); + // + // String filename = fChooser.open(); + // + // (filename == null) return; + // + // File chosenFile = new File(filename); + // + // // check if the file is in use + // String fname = chosenFile.getAbsolutePath(); + // List fileList = viewer.getTreeView().getCurrentFiles(); + // (fileList != null) { + // FileFormat theFile = null; + // Iterator iterator = fileList.iterator(); + // while (iterator.hasNext()) { + // theFile = iterator.next(); + // (theFile.getFilePath().equals(fname)) { + // Tools.showError(shell, "Save", "Unable to save data to file \"" + fname + // + "\". \nThe file is being used."); + // return; + // } + // } + // } + // + // PrintWriter out = new PrintWriter(new BufferedWriter(new + // FileWriter(chosenFile))); + // + // int rows = text.length; + // (int i = 0; i < rows; i++) { + // out.print(text[i].trim()); + // out.println(); + // out.println(); + // } + // + // out.flush(); + // out.close(); + // + // viewer.showStatus("Data saved to: " + fname); + // + // try { + // RandomAccessFile rf = new RandomAccessFile(chosenFile, "r"); + // long size = rf.length(); + // rf.close(); + // viewer.showStatus("File size (bytes): " + size); + // } + // catch (Exception ex) { + // log.debug("raf file size:", ex); + // } + // } + + // print the table (from TextView) + // private void print() { + // // StreamPrintServiceFactory[] spsf = StreamPrintServiceFactory + // // .lookupStreamPrintServiceFactories(null, null); + // // (int i = 0; i < spsf.length; i++) { + // // System.out.println(spsf[i]); + // // } + // // DocFlavor[] docFlavors = spsf[0].getSupportedDocFlavors(); + // // (int i = 0; i < docFlavors.length; i++) { + // // System.out.println(docFlavors[i]); + // // } + // + // // TODO: windows url + // // Get a text DocFlavor + // InputStream is = null; + // try { + // is = new BufferedInputStream(new java.io.FileInputStream( + // "e:\\temp\\t.html")); + // } + // catch (Exception ex) { + // log.debug("Get a text DocFlavor:", ex); + // } + // DocFlavor flavor = DocFlavor.STRING.TEXT_HTML; + // + // // Get all available print services + // PrintService[] services = PrintServiceLookup.lookupPrintServices(null, + // null); + // + // // Print it + // try { + // // Print this job on the first print server + // DocPrintJob job = services[0].createPrintJob(); + // Doc doc = new SimpleDoc(is, flavor, null); + // + // job.print(doc, null); + // } + // catch (Exception ex) { + // log.debug("print(): failure: ", ex); + // } + // } + /** * Save data as binary. * @@ -2717,7 +2831,7 @@ public void open() colButton = new Button(content, SWT.RADIO); colButton.setFont(curFont); colButton.setText("Column"); - colButton.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, false, false)); + colButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); colButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) @@ -2730,7 +2844,7 @@ public void widgetSelected(SelectionEvent e) rowButton = new Button(content, SWT.RADIO); rowButton.setFont(curFont); rowButton.setText("Row"); - rowButton.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, false, false)); + rowButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); rowButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) diff --git a/src/org.hdfgroup.hdfview/hdf/view/TableView/TableView.java b/src/org.hdfgroup.hdfview/hdf/view/TableView/TableView.java index 1cd3cafc..12d85ebb 100644 --- a/src/org.hdfgroup.hdfview/hdf/view/TableView/TableView.java +++ b/src/org.hdfgroup.hdfview/hdf/view/TableView/TableView.java @@ -24,21 +24,41 @@ * @version 2.4 9/6/2007 */ public abstract interface TableView extends DataView { - /** @return the table */ + /** + * Get the table + * + * @return the table + */ public abstract Object getTable(); - /** @return array of selected data */ + /** + * Get the array of selected data + * + * @return array of selected data + */ public abstract Object getSelectedData(); - /** @return array of selected column count */ + /** + * Get the array of selected column count + * + * @return array of selected column count + */ public abstract int getSelectedColumnCount(); - /** @return array of selected row count */ + /** + * Get the array of selected row count + * + * @return array of selected row count + */ public abstract int getSelectedRowCount(); - /** Write the change of a dataset into file. */ + /** + * Write the change of a dataset into file. + */ public abstract void updateValueInFile(); - /** refresh the data table. */ + /** + * refresh the data table. + */ public abstract void refreshDataTable(); } diff --git a/src/org.hdfgroup.hdfview/hdf/view/Tools.java b/src/org.hdfgroup.hdfview/hdf/view/Tools.java index b4f240d6..ec36ad4c 100644 --- a/src/org.hdfgroup.hdfview/hdf/view/Tools.java +++ b/src/org.hdfgroup.hdfview/hdf/view/Tools.java @@ -77,21 +77,21 @@ public final class Tools { private static final Logger log = LoggerFactory.getLogger(Tools.class); - /** */ + /** Maximum value or int8 */ public static final long MAX_INT8 = 127; - /** */ + /** Maximum value or unsigned int8 */ public static final long MAX_UINT8 = 255; - /** */ + /** Maximum value or int16 */ public static final long MAX_INT16 = 32767; - /** */ + /** Maximum value or unsigned int16 */ public static final long MAX_UINT16 = 65535; - /** */ + /** Maximum value or int32 */ public static final long MAX_INT32 = 2147483647; - /** */ + /** Maximum value or unsigned int32 */ public static final long MAX_UINT32 = 4294967295L; - /** */ + /** Maximum value or int64 */ public static final long MAX_INT64 = 9223372036854775807L; - /** */ + /** Maximum value or unsigned int64 */ public static final BigInteger MAX_UINT64 = new BigInteger("18446744073709551615"); private static final int FLOAT_BUFFER_SIZE = 524288; diff --git a/src/org.hdfgroup.hdfview/hdf/view/TreeView/TreeView.java b/src/org.hdfgroup.hdfview/hdf/view/TreeView/TreeView.java index d87bd350..283f925b 100644 --- a/src/org.hdfgroup.hdfview/hdf/view/TreeView/TreeView.java +++ b/src/org.hdfgroup.hdfview/hdf/view/TreeView/TreeView.java @@ -123,6 +123,8 @@ public abstract interface TreeView { public abstract FileFormat getSelectedFile(); /** + * Get the current selected object in the tree + * * @return the current selected object in the tree. */ public abstract HObject getCurrentObject(); @@ -153,16 +155,22 @@ public abstract interface TreeView { public abstract TreeItem addObject(HObject newObject, Group parentGroup); /** + * Get the Tree which holds the file structure + * * @return the Tree which holds the file structure. */ public abstract Tree getTree(); /** + * Get the list of currently open files + * * @return the list of currently open files. */ public abstract List getCurrentFiles(); /** + * Get the tree item that contains the given data object. + * * @param obj the object to find * * @return the tree item that contains the given data object. diff --git a/src/org.hdfgroup.hdfview/hdf/view/ViewProperties.java b/src/org.hdfgroup.hdfview/hdf/view/ViewProperties.java index f8a4dd9d..3867953b 100644 --- a/src/org.hdfgroup.hdfview/hdf/view/ViewProperties.java +++ b/src/org.hdfgroup.hdfview/hdf/view/ViewProperties.java @@ -29,6 +29,7 @@ import hdf.HDFVersions; import hdf.object.FileFormat; +import hdf.object.h5.H5Plugins; import hdf.view.ImageView.ImageViewFactory; import hdf.view.MetaDataView.MetaDataViewFactory; import hdf.view.PaletteView.PaletteViewFactory; @@ -123,15 +124,15 @@ public class ViewProperties extends PreferenceStore { * Used to create different DataViews for a given HObject. */ public static enum DataViewType { - /** */ + /** table type */ TABLE, - /** */ + /** image type */ IMAGE, - /** */ + /** palette type */ PALETTE, - /** */ + /** metadata type */ METADATA, - /** */ + /** treeview type */ TREEVIEW } @@ -139,27 +140,27 @@ public static enum DataViewType { * Property keys control how the data is displayed. */ public static enum DATA_VIEW_KEY { - /** */ + /** data is char */ CHAR, - /** */ + /** data is converted to byte */ CONVERTBYTE, - /** */ + /** data is transposed */ TRANSPOSED, - /** */ + /** data is read only */ READONLY, - /** */ + /** data is object */ OBJECT, - /** */ + /** data is bitmask */ BITMASK, - /** */ + /** data is bitmask op */ BITMASKOP, - /** */ + /** data is border */ BORDER, - /** */ + /** data is info */ INFO, - /** */ + /** data is index based 1 */ INDEXBASE1, - /** */ + /** data is view name */ VIEW_NAME } @@ -167,9 +168,9 @@ public static enum DATA_VIEW_KEY { * Property keys control how the data is displayed. */ public static enum BITMASK_OP { - /** */ + /** use bitmask and */ AND, - /** */ + /** use bitmask extract */ EXTRACT } @@ -206,9 +207,6 @@ public static enum BITMASK_OP { /** default starting file directory */ private static String workDir = System.getProperty("user.dir"); - /** default plugin directory */ - private static String pluginDir = System.getProperty("user.dir") + "/plugin"; - /** default HDF file extensions */ private static String fileExt = "hdf, h4, hdf4, h5, hdf5, he2, he5"; @@ -250,6 +248,9 @@ public static enum BITMASK_OP { /** a list of palette files */ private static ArrayList paletteList = new ArrayList<>(5); + /** a list of plugin paths */ + private static ArrayList pluginPathList = new ArrayList<>(5); + /** flag to indicate if enum data is converted to strings */ private static boolean convertEnum = true; @@ -326,8 +327,6 @@ public ViewProperties(String viewRoot, String viewStart) setUsersGuide(rootDir + usersGuide); - setPluginDir(rootDir + "/plugin"); - setDefault("users.guide", viewRoot + "/UsersGuide/index.html"); setDefault("image.contrast", false); setDefault("image.showvalues", false); @@ -550,160 +549,368 @@ else if (PaletteViewFactory.class.isAssignableFrom(theClass)) { return extClassLoader; } - /** @return the Folder Close Icon */ + /** + * Get the Folder Close Icon + * + * @return the Folder Close Icon + */ public static Image getFoldercloseIcon() { return foldercloseIcon; } - /** @return the Folder Close with Attribute Icon */ + /** + * Get the Folder Close with Attribute Icon + * + * @return the Folder Close with Attribute Icon + */ public static Image getFoldercloseIconA() { return foldercloseIconA; } - /** @return the Folder Open Icon */ + /** + * Get the Folder Open Icon + * + * @return the Folder Open Icon + */ public static Image getFolderopenIcon() { return folderopenIcon; } - /** @return the Folder Open with Attribute Icon */ + /** + * Get the Folder Open with Attribute Icon + * + * @return the Folder Open with Attribute Icon + */ public static Image getFolderopenIconA() { return folderopenIconA; } - /** @return the HDF Icon */ + /** + * Get the HDF Icon + * + * @return the HDF Icon + */ public static Image getHdfIcon() { return hdfIcons[1]; } - /** @return the HDF Icons */ + /** + * Get the HDF Icons + * + * @return the HDF Icons + */ public static Image[] getHdfIcons() { return hdfIcons; } - /** @return the HDF4 Icon */ + /** + * Get the HDF4 Icon + * + * @return the HDF4 Icon + */ public static Image getH4Icon() { return h4Icon; } - /** @return the read-only HDF4 Icon */ + /** + * Get the read-only HDF4 Icon + * + * @return the read-only HDF4 Icon + */ public static Image getH4IconR() { return h4IconR; } - /** @return the HDF5 Icon */ + /** + * Get the HDF5 Icon + * + * @return the HDF5 Icon + */ public static Image getH5Icon() { return h5Icon; } - /** @return the read-only HDF5 Icon */ + /** + * Get the read-only HDF5 Icon + * + * @return the read-only HDF5 Icon + */ public static Image getH5IconR() { return h5IconR; } - /** @return the netcdf Icon */ + /** + * Get the netcdf Icon + * + * @return the netcdf Icon + */ public static Image getNC3Icon() { return ncIcon; } - /** @return the read-only netcdf Icon */ + /** + * Get the read-only netcdf Icon + * + * @return the read-only netcdf Icon + */ public static Image getNC3IconR() { return ncIconR; } - /** @return the Dataset Icon */ + /** + * Get the Dataset Icon + * + * @return the Dataset Icon + */ public static Image getDatasetIcon() { return datasetIcon; } - /** @return the Dataset with Attribute Icon */ + /** + * Get the Dataset with Attribute Icon + * + * @return the Dataset with Attribute Icon + */ public static Image getDatasetIconA() { return datasetIconA; } - /** @return the Datatype Icon */ + /** + * Get the Datatype Icon + * + * @return the Datatype Icon + */ public static Image getDatatypeIcon() { return datatypeIcon; } - /** @return the Datatype with Attribute Icon */ + /** + * Get the Datatype with Attribute Icon + * + * @return the Datatype with Attribute Icon + */ public static Image getDatatypeIconA() { return datatypeIconA; } - /** @return the Link Icon */ + /** + * Get the Link Icon + * + * @return the Link Icon + */ public static Image getLinkIcon() { return linkIcon; } - /** @return the File Open Icon */ + /** + * Get the File Open Icon + * + * @return the File Open Icon + */ public static Image getFileopenIcon() { return fileopenIcon; } - /** @return the File Save Icon */ + /** + * Get the File Save Icon + * + * @return the File Save Icon + */ public static Image getFilesaveIcon() { return filesaveIcon; } - /** @return the File New Icon */ + /** + * Get the File New Icon + * + * @return the File New Icon + */ public static Image getFilenewIcon() { return filenewIcon; } - /** @return the File Close Icon */ + /** + * Get the File Close Icon + * + * @return the File Close Icon + */ public static Image getFilecloseIcon() { return filecloseIcon; } - /** @return the Palette Icon */ + /** + * Get the Palette Icon + * + * @return the Palette Icon + */ public static Image getPaletteIcon() { return paletteIcon; } - /** @return the Bright Icon */ + /** + * Get the Bright Icon + * + * @return the Bright Icon + */ public static Image getBrightIcon() { return brightIcon; } - /** @return the Autocontrast Icon */ + /** + * Get the Autocontrast Icon + * + * @return the Autocontrast Icon + */ public static Image getAutocontrastIcon() { return autocontrastIcon; } - /** @return the Image Icon */ + /** + * Get the Image Icon + * + * @return the Image Icon + */ public static Image getImageIcon() { return imageIcon; } - /** @return the Table Icon */ + /** + * Get the Table Icon + * + * @return the Table Icon + */ public static Image getTableIcon() { return tableIcon; } - /** @return the Text Icon */ + /** + * Get the Text Icon + * + * @return the Text Icon + */ public static Image getTextIcon() { return textIcon; } - /** @return the Image with Attribute Icon */ + /** + * Get the Image with Attribute Icon + * + * @return the Image with Attribute Icon + */ public static Image getImageIconA() { return imageIconA; } - /** @return the Table with Attribute Icon */ + /** + * Get the Table with Attribute Icon + * + * @return the Table with Attribute Icon + */ public static Image getTableIconA() { return tableIconA; } - /** @return the Text with Attribute Icon */ + /** + * Get the Text with Attribute Icon + * + * @return the Text with Attribute Icon + **/ public static Image getTextIconA() { return textIconA; } - /** @return the Zoom In Icon */ + /** + * Get the Zoom In Icon + * + * @return the Zoom In Icon + */ public static Image getZoominIcon() { return zoominIcon; } - /** @return the Zoom Out Icon */ + /** + * Get the Zoom Out Icon + * + * @return the Zoom Out Icon + */ public static Image getZoomoutIcon() { return zoomoutIcon; } - /** @return the Blank Icon */ + /** + * Get the Blank Icon + * + * @return the Blank Icon + */ public static Image getBlankIcon() { return blankIcon; } - /** @return the Help Icon */ + /** + * Get the Help Icon + * + * @return the Help Icon + */ public static Image getHelpIcon() { return helpIcon; } - /** @return the Copy Icon */ + /** + * Get the Copy Icon + * + * @return the Copy Icon + */ public static Image getCopyIcon() { return copyIcon; } - /** @return the Cut Icon */ + /** + * Get the Cut Icon + * + * @return the Cut Icon + */ public static Image getCutIcon() { return cutIcon; } - /** @return the Paste Icon */ + /** + * Getthe Paste Icon + * + * @return the Paste Icon + */ public static Image getPasteIcon() { return pasteIcon; } - /** @return the HDFView Icon */ + /** + * Get the HDFView Icon + * + * @return the HDFView Icon + */ public static Image getHDFViewIcon() { return hdfviewIcon; } - /** @return the Large HDF Icon */ + /** + * Get the Large HDF Icon + * + * @return the Large HDF Icon + */ public static Image getLargeHdfIcon() { return hdfIcons[2]; } - /** @return the Previous Icon */ + /** + * Get the Previous Icon + * + * @return the Previous Icon + */ public static Image getPreviousIcon() { return previousIcon; } - /** @return the Next Icon */ + /** + * Get the Next Icon + * + * @return the Next Icon + */ public static Image getNextIcon() { return nextIcon; } - /** @return the First Icon */ + /** + * Get the First Icon + * + * @return the First Icon + */ public static Image getFirstIcon() { return firstIcon; } - /** @return the Last Icon */ + /** + * Get the Last Icon + * + * @return the Last Icon + */ public static Image getLastIcon() { return lastIcon; } - /** @return the Chart Icon */ + /** + * Get the Chart Icon + * + * @return the Chart Icon + */ public static Image getChartIcon() { return chartIcon; } - /** @return the Animation Icon */ + /** + * Get the Animation Icon + * + * @return the Animation Icon + */ public static Image getAnimationIcon() { return animationIcon; } - /** @return the Apps Icon */ + /** + * Get the Apps Icon + * + * @return the Apps Icon + */ public static Image getAppsIcon() { return iconAPPS; } - /** @return the Url Icon */ + /** + * Get the Url Icon + * + * @return the Url Icon + */ public static Image getUrlIcon() { return iconURL; } - /** @return the Video Icon */ + /** + * Get the Video Icon + * + * @return the Video Icon + */ public static Image getVideoIcon() { return iconVIDEO; } - /** @return the Xls Icon */ + /** + * Get the Xls Icon + * + * @return the Xls Icon + */ public static Image getXlsIcon() { return iconXLS; } - /** @return the Pdf Icon */ + /** + * Get the Pdf Icon + * + * @return the Pdf Icon + */ public static Image getPdfIcon() { return iconPDF; } - /** @return the Audio Icon */ + /** + * Get the Audio Icon + * + * @return the Audio Icon + */ public static Image getAudioIcon() { return iconAUDIO; } - /** @return the Question Icon */ + /** + * Get the Question Icon + * + * @return the Question Icon + */ public static Image getQuestionIcon() { return questionIcon; } /** Load the Icons */ @@ -1360,10 +1567,6 @@ public void load() throws IOException if (!isDefault("work.dir")) setWorkDir(propVal); - propVal = getString("plugin.dir"); - if (!isDefault("plugin.dir")) - setPluginDir(propVal); - propVal = getString("file.extension"); if (!isDefault("file.extension")) { setFileExtension(propVal); @@ -1445,9 +1648,6 @@ public void save() throws IOException if (workDir != null) setValue("work.dir", workDir); - if (pluginDir != null) - setValue("plugin.dir", pluginDir); - if (fileExt != null) setValue("file.extension", fileExt); @@ -1550,13 +1750,25 @@ else if (isReadSWMR) super.save(); } - /** @return the name of the user property file */ + /** + * Get the name of the user property file + * + * @return the name of the user property file + */ public static String getPropertyFile() { return propertyFile; } - /** @return the root directory where the HDFView is installed. */ + /** + * Get the root directory where the HDFView is installed. + * + * @return the root directory where the HDFView is installed. + */ public static String getViewRoot() { return rootDir; } - /** @return the default work directory, where the open file starts. */ + /** + * Get the default work directory, where the open file starts. + * + * @return the default work directory, where the open file starts. + */ public static String getWorkDir() { String workPath = workDir; @@ -1572,41 +1784,53 @@ public static String getWorkDir() return workPath; } - /** @return the default plugin directory. */ - public static String getPluginDir() - { - String pluginPath = pluginDir; - log.trace("getPluginDir: pluginDir={}", pluginDir); - if (pluginPath == null) { - pluginPath = System.getProperty("hdfview.plugindir"); - log.trace("getPluginDir: hdfview.plugindir={}", pluginPath); - if (pluginPath == null) { - pluginPath = System.getProperty("user.dir") + "/plugin"; - } - } - log.trace("getPluginDir: final pluginPath={}", pluginPath); - return pluginPath; - } - - /** @return the maximum number of the most recent file */ + /** + * Get the maximum number of the most recent file + * + * @return the maximum number of the most recent file + */ public static int getMaxRecentFiles() { return MAX_RECENT_FILES; } - /** @return the path of the HDFView users guide */ + /** + * Get the path of the HDFView users guide + * + * @return the path of the HDFView users guide + */ public static String getUsersGuide() { return usersGuide; }; - /** @return the delimiter of data values */ + /** + * Get the delimiter of data values + * + * @return the delimiter of data values + */ public static String getDataDelimiter() { return delimiter; } - /** @return the image origin */ + /** + * Get the image origin + * + * @return the image origin + */ public static String getImageOrigin() { return origin; } - /** @return the default index type for display */ + /** + * Get the default index type for display + * + * @return the default index type for display + */ public static String getIndexType() { return indexType; } - /** @return the default index order for display */ + /** + * Get the default index order for display + * + * @return the default index order for display + */ public static String getIndexOrder() { return indexOrder; } - /** @return the timer refresh size */ + /** + * Get the timer refresh size + * + * @return the timer refresh size + */ public static int getTimerRefresh() { return timerRefresh; } /** @@ -1617,13 +1841,25 @@ public static String getPluginDir() */ public static void setTimerRefresh(int trefresh) { timerRefresh = trefresh; } - /** @return the font size */ + /** + * Get the font size + * + * @return the font size + */ public static int getFontSize() { return fontSize; } - /** @return the font type */ + /** + * Get the font type + * + * @return the font type + */ public static String getFontType() { return fontType; } - /** @return the file extensions of supported file formats */ + /** + * Get the file extensions of supported file formats + * + * @return the file extensions of supported file formats + */ public static String getFileExtension() { return fileExt; } /** @@ -1654,34 +1890,81 @@ public static void setFontType(String ftype) } } - /** @return the path of the H5toH5 converter */ + /** + * Get the path of the H5toH5 converter + * + * @return the path of the H5toH5 converter + */ public static String getH4toH5() { return h4toh5; } - /** @return the list of most recent files */ + /** + * Get the list of most recent files + * + * @return the list of most recent files + */ public static List getMRF() { return recentFiles; } - /** @return the list of palette files */ + /** + * Get the list of palette files + * + * @return the list of palette files + */ public static List getPaletteList() { return paletteList; } - /** @return the SRB account list */ + /** + * Get the plugin path list + * + * @return the plugin path list + */ + public static String[] getPluginPaths() { return pluginPathList.toArray(new String[0]); } + + /** + * Get the SRB account list + * + * @return the SRB account list + */ public static List getSrbAccount() { return srbAccountList; } - /** @return a list of treeview modules */ + /** + * Get a list of treeview modules + * + * @return a list of treeview modules + */ public static List getTreeViewList() { return moduleListTreeView; } - /** @return a list of metadataview modules */ + /** + * Get a list of metadataview modules + * + * @return a list of metadataview modules + */ public static List getMetaDataViewList() { return moduleListMetaDataView; } - /** @return a list of tableview modules */ + /** + * Get a list of tableview modules + * + * @return a list of tableview modules + */ public static List getTableViewList() { return moduleListTableView; } - /** @return a list of imageview modules */ + /** + * Get a list of imageview modules + * + * @return a list of imageview modules + */ public static List getImageViewList() { return moduleListImageView; } - /** @return a list of paletteview modules */ + /** + * Get a list of paletteview modules + * + * @return a list of paletteview modules + */ public static List getPaletteViewList() { return moduleListPaletteView; } - /** @return a list of helpview modules */ + /** + * Get a list of helpview modules + * + * @return a list of helpview modules + */ public static List getHelpViewList() { return moduleListHelpView; } /** @@ -1731,14 +2014,80 @@ public static void setWorkDir(String wDir) } /** - * set the path of the default plugin directory + * Load the paths of the default plugin directories + * + * @return the array of paths + */ + public static String[] loadPluginPaths() + { + try { + log.trace("ViewProperties:loadPluginPaths"); + pluginPathList = H5Plugins.getPluginPaths(); + } + catch (Exception err) { + } + return getPluginPaths(); + } + + /** + * Inserts the plugin path. + * + * @param pluginPath The plugin path. + * @param pathIndex The index to insert the plugin path. + */ + public static void insertPluginPath(String pluginPath, int pathIndex) + { + try { + H5Plugins.insertPluginPath(pluginPath, pathIndex); + pluginPathList = H5Plugins.getPluginPaths(); + } + catch (Exception err) { + } + } + + /** + * Prepends the plugin path. * - * @param plDir the default plugin directory + * @param pluginPath The plugin path. */ - public static void setPluginDir(String plDir) + public static void prependPluginPath(String pluginPath) { - log.trace("ViewProperties:setPluginDir plDir={}", plDir); - pluginDir = plDir; + try { + H5Plugins.prependPluginPath(pluginPath); + pluginPathList = H5Plugins.getPluginPaths(); + } + catch (Exception err) { + } + } + + /** + * Appends the plugin path. + * + * @param pluginPath The plugin path. + */ + public static void appendPluginPath(String pluginPath) + { + try { + H5Plugins.appendPluginPath(pluginPath); + pluginPathList = H5Plugins.getPluginPaths(); + } + catch (Exception err) { + } + } + + /** + * Removes the plugin path. + * + * @param pathIndex The index to remove the plugin path. + */ + public static void deletePluginPath(int pathIndex) + { + try { + H5Plugins.deletePluginPath(pathIndex); + pluginPathList = H5Plugins.getPluginPaths(); + } + catch (Exception err) { + } } /** @@ -1927,7 +2276,9 @@ public static int getMaxMembers() public static void setLateLib(String vers) { LateLib = vers; } /** - * @return the convertEnum + * Check if the enum value is to be converted + * + * @return true if the enum value is to be converted */ public static boolean isConvertEnum() { return convertEnum; } @@ -1939,13 +2290,16 @@ public static int getMaxMembers() public static boolean showRegRefValues() { return showRegRefValues; } /** - * @return the isIndexBase1 + * Check if the data index starts at 1 + * + * @return true if the data index starts at 1 */ public static boolean isIndexBase1() { return isIndexBase1; } /** - * @param convertEnum - * the convertEnum to set + * Set enum data to be converted + * + * @param convertEnum true to set enum data conversion */ public static void setConvertEnum(boolean convertEnum) { ViewProperties.convertEnum = convertEnum; } diff --git a/src/org.hdfgroup.hdfview/hdf/view/dialog/DataOptionDialog.java b/src/org.hdfgroup.hdfview/hdf/view/dialog/DataOptionDialog.java index 3d0bcf6f..f5b8d6e9 100644 --- a/src/org.hdfgroup.hdfview/hdf/view/dialog/DataOptionDialog.java +++ b/src/org.hdfgroup.hdfview/hdf/view/dialog/DataOptionDialog.java @@ -700,13 +700,23 @@ private void setBitmask() } } - /** @return true if the display option is image. */ + /** + * Check if the display option is image + * + * @return true if the display option is image. + */ public boolean isImageDisplay() { return isImageDisplay; } - /** @return true if the index starts with 0. */ + /** + * Check if the index starts with 0 + * + * @return true if the index starts with 0. + */ public boolean isIndexBase1() { return isIndexBase1; } /** + * Get the bitmask value + * * @return the bitmask. */ public BitSet getBitmask() @@ -730,27 +740,39 @@ public BitSet getBitmask() return bitmask; } - /** @return the name of the selected dataview */ + /** + * Get the name of the datatview + * + * @return the name of the selected dataview + */ public String getDataViewName() { return dataViewName; } /** + * Check if the data should display as characters * * @return true if display the data as characters; otherwise, display as numbers. */ public boolean isDisplayTypeChar() { return isDisplayTypeChar; } /** + * Check if only the bitmask should be applied + * * @return if it only apply bitmask. */ public boolean isApplyBitmaskOnly() { return isApplyBitmaskOnly; } /** + * Check if the data in 2D table is to be transposed * * @return true if transpose the data in 2D table; otherwise, do not transpose the data. */ public boolean isTransposed() { return isTransposed; } - /** @return true if the data selection is cancelled. */ + /** + * Check if the data selection is cancelled + * + * @return true if the data selection is cancelled. + */ public boolean isCancelled() { return isSelectionCancelled; } private void createScalarDSContents() @@ -791,7 +813,7 @@ public void widgetSelected(SelectionEvent e) charCheckbox.setFont(curFont); charCheckbox.setText("Show As &Char"); charCheckbox.setSelection(false); - charCheckbox.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, false, false)); + charCheckbox.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); if (dataObject.getDatatype().isChar() || (dataObject.getDatatype().isInteger() && dataObject.getDatatype().getDatatypeSize() == 1)) { @@ -918,12 +940,12 @@ public void widgetSelected(SelectionEvent e) base0Button = new Button(indexBaseGroup, SWT.RADIO); base0Button.setFont(curFont); base0Button.setText("0-based"); - base0Button.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, false)); + base0Button.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); base1Button = new Button(indexBaseGroup, SWT.RADIO); base1Button.setFont(curFont); base1Button.setText("1-based"); - base1Button.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, false)); + base1Button.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); if (ViewProperties.isIndexBase1()) { base0Button.setSelection(false); @@ -944,7 +966,7 @@ public void widgetSelected(SelectionEvent e) extractBitButton = new Button(bitmaskGroup, SWT.CHECK); extractBitButton.setFont(curFont); extractBitButton.setText("Show &Value of Selected Bits"); - extractBitButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.FILL, false, false)); + extractBitButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); extractBitButton.setSelection(false); extractBitButton.addSelectionListener(new SelectionAdapter() { @Override @@ -1019,7 +1041,7 @@ public void widgetSelected(SelectionEvent e) applyBitmaskButton = new Button(bitmaskGroup, SWT.CHECK); applyBitmaskButton.setFont(curFont); applyBitmaskButton.setText("&Apply Bitmask"); - applyBitmaskButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.FILL, false, false)); + applyBitmaskButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); applyBitmaskButton.setSelection(false); applyBitmaskButton.addSelectionListener(new SelectionAdapter() { @Override diff --git a/src/org.hdfgroup.hdfview/hdf/view/dialog/MathConversionDialog.java b/src/org.hdfgroup.hdfview/hdf/view/dialog/MathConversionDialog.java index 0658277c..910c635b 100644 --- a/src/org.hdfgroup.hdfview/hdf/view/dialog/MathConversionDialog.java +++ b/src/org.hdfgroup.hdfview/hdf/view/dialog/MathConversionDialog.java @@ -429,6 +429,10 @@ else if (x > b) { return y; } - /** @return true if the data is successfully converted. */ + /** + * Check if the data is successfully converted. + * + * @return true if the data is successfully converted. + */ public boolean isConverted() { return isConverted; } } diff --git a/src/org.hdfgroup.hdfview/hdf/view/dialog/NewDataObjectDialog.java b/src/org.hdfgroup.hdfview/hdf/view/dialog/NewDataObjectDialog.java index f7c33fed..82e0964b 100644 --- a/src/org.hdfgroup.hdfview/hdf/view/dialog/NewDataObjectDialog.java +++ b/src/org.hdfgroup.hdfview/hdf/view/dialog/NewDataObjectDialog.java @@ -539,9 +539,17 @@ else if (isEnum && isH5) { return datatype; } - /** @return the new object created. */ + /** + * Get the new object created. + * + * @return the new object created. + */ public HObject getObject() { return newObject; } - /** @return the parent group of the new dataset. */ + /** + * Get the parent group of the new dataset. + * + * @return the parent group of the new dataset. + */ public Group getParentGroup() { return (Group)parentObj; } } diff --git a/src/org.hdfgroup.hdfview/hdf/view/dialog/NewImageDialog.java b/src/org.hdfgroup.hdfview/hdf/view/dialog/NewImageDialog.java index 15dc2fc6..83a2036f 100644 --- a/src/org.hdfgroup.hdfview/hdf/view/dialog/NewImageDialog.java +++ b/src/org.hdfgroup.hdfview/hdf/view/dialog/NewImageDialog.java @@ -168,7 +168,7 @@ public void widgetSelected(SelectionEvent e) checkIndex = new Button(typeComposite, SWT.RADIO); checkIndex.setFont(curFont); checkIndex.setText("Indexed colormap"); - checkIndex.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, false)); + checkIndex.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); checkIndex.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) @@ -183,7 +183,7 @@ public void widgetSelected(SelectionEvent e) checkTrueColor = new Button(typeComposite, SWT.RADIO); checkTrueColor.setFont(curFont); checkTrueColor.setText("24-bit truecolor"); - checkTrueColor.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, false)); + checkTrueColor.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); checkTrueColor.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) @@ -204,12 +204,12 @@ public void widgetSelected(SelectionEvent e) checkInterlacePixel = new Button(layoutComposite, SWT.RADIO); checkInterlacePixel.setFont(curFont); checkInterlacePixel.setText("Pixel interlace"); - checkInterlacePixel.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, false)); + checkInterlacePixel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); checkInterlacePlane = new Button(layoutComposite, SWT.RADIO); checkInterlacePlane.setFont(curFont); checkInterlacePlane.setText("Plane interlace"); - checkInterlacePlane.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, false)); + checkInterlacePlane.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); // Create Ok/Cancel button region Composite buttonComposite = new Composite(shell, SWT.NONE); diff --git a/src/org.hdfgroup.hdfview/hdf/view/dialog/NewLinkDialog.java b/src/org.hdfgroup.hdfview/hdf/view/dialog/NewLinkDialog.java index 2c2dc72a..4058fc66 100644 --- a/src/org.hdfgroup.hdfview/hdf/view/dialog/NewLinkDialog.java +++ b/src/org.hdfgroup.hdfview/hdf/view/dialog/NewLinkDialog.java @@ -222,7 +222,7 @@ public void widgetSelected(SelectionEvent e) hardLink = new Button(typeComposite, SWT.RADIO); hardLink.setFont(curFont); hardLink.setText("Hard Link"); - hardLink.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, false)); + hardLink.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); hardLink.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) @@ -244,7 +244,7 @@ public void widgetSelected(SelectionEvent e) softLink = new Button(typeComposite, SWT.RADIO); softLink.setFont(curFont); softLink.setText("Soft Link"); - softLink.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, false)); + softLink.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); softLink.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) @@ -265,7 +265,7 @@ public void widgetSelected(SelectionEvent e) externalLink = new Button(typeComposite, SWT.RADIO); externalLink.setFont(curFont); externalLink.setText("External Link"); - externalLink.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, false)); + externalLink.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); externalLink.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) @@ -830,9 +830,17 @@ private void getTargetFileObjs() } } - /** @return the new dataset created. */ + /** + * Get the new dataset created. + * + * @return the new dataset created. + */ public HObject getObject() { return newObject; } - /** @return the parent group of the new dataset. */ + /** + * Get the parent group of the new dataset. + * + * @return the parent group of the new dataset. + */ public Group getParentGroup() { return parentGroup; } } diff --git a/src/org.hdfgroup.hdfview/hdf/view/dialog/NewScalarAttributeDialog.java b/src/org.hdfgroup.hdfview/hdf/view/dialog/NewScalarAttributeDialog.java index 78c14836..52088de2 100644 --- a/src/org.hdfgroup.hdfview/hdf/view/dialog/NewScalarAttributeDialog.java +++ b/src/org.hdfgroup.hdfview/hdf/view/dialog/NewScalarAttributeDialog.java @@ -483,6 +483,10 @@ public void widgetSelected(SelectionEvent e) } } - /** @return the new attribute created. */ + /** + * Get the new attribute created. + * + * @return the new attribute created. + */ public Attribute getAttribute() { return (Attribute)newObject; } } diff --git a/src/org.hdfgroup.hdfview/hdf/view/dialog/NewStringAttributeDialog.java b/src/org.hdfgroup.hdfview/hdf/view/dialog/NewStringAttributeDialog.java index faee0fae..144820e9 100644 --- a/src/org.hdfgroup.hdfview/hdf/view/dialog/NewStringAttributeDialog.java +++ b/src/org.hdfgroup.hdfview/hdf/view/dialog/NewStringAttributeDialog.java @@ -763,6 +763,10 @@ public void widgetSelected(SelectionEvent e) } } - /** @return the new attribute created. */ + /** + * Get the new attribute created. + * + * @return the new attribute created. + */ public Attribute getAttribute() { return (Attribute)newObject; } } diff --git a/src/org.hdfgroup.hdfview/hdf/view/dialog/UserOptionsGeneralPage.java b/src/org.hdfgroup.hdfview/hdf/view/dialog/UserOptionsGeneralPage.java index 1ecb68c5..97010020 100644 --- a/src/org.hdfgroup.hdfview/hdf/view/dialog/UserOptionsGeneralPage.java +++ b/src/org.hdfgroup.hdfview/hdf/view/dialog/UserOptionsGeneralPage.java @@ -356,7 +356,7 @@ protected Control createContents(Composite parent) org.eclipse.swt.widgets.Group workingDirectoryGroup = new org.eclipse.swt.widgets.Group(composite, SWT.NONE); - workingDirectoryGroup.setLayout(new GridLayout(3, false)); + workingDirectoryGroup.setLayout(new GridLayout(4, false)); workingDirectoryGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); workingDirectoryGroup.setFont(curFont); workingDirectoryGroup.setText("Default Working Directory"); @@ -364,7 +364,7 @@ protected Control createContents(Composite parent) checkCurrentUserDir = new Button(workingDirectoryGroup, SWT.CHECK); checkCurrentUserDir.setFont(curFont); checkCurrentUserDir.setText("\"User Work\" or"); - checkCurrentUserDir.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); + checkCurrentUserDir.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1)); checkCurrentUserDir.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) @@ -380,7 +380,7 @@ public void widgetSelected(SelectionEvent e) checkUserHomeDir = new Button(workingDirectoryGroup, SWT.CHECK); checkUserHomeDir.setFont(curFont); checkUserHomeDir.setText("\"User Home\" or"); - checkUserHomeDir.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); + checkUserHomeDir.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1)); checkUserHomeDir.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) @@ -395,12 +395,12 @@ public void widgetSelected(SelectionEvent e) workField = new Text(workingDirectoryGroup, SWT.SINGLE | SWT.BORDER); workField.setFont(curFont); - workField.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); + workField.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 3, 1)); currentDirButton = new Button(workingDirectoryGroup, SWT.PUSH); currentDirButton.setFont(curFont); currentDirButton.setText("Browse..."); - currentDirButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); + currentDirButton.setLayoutData(new GridData(SWT.END, SWT.FILL, false, false)); currentDirButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) @@ -466,23 +466,23 @@ public void widgetSelected(SelectionEvent e) org.eclipse.swt.widgets.Group fileAccessModeGroup = new org.eclipse.swt.widgets.Group(composite, SWT.NONE); fileAccessModeGroup.setLayout(new GridLayout(2, true)); - fileAccessModeGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); + fileAccessModeGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); fileAccessModeGroup.setFont(curFont); fileAccessModeGroup.setText("Default File Access Mode"); checkReadOnly = new Button(fileAccessModeGroup, SWT.RADIO); checkReadOnly.setFont(curFont); checkReadOnly.setText("Read Only"); - checkReadOnly.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, false, false)); + checkReadOnly.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); rwButton = new Button(fileAccessModeGroup, SWT.RADIO); rwButton.setFont(curFont); rwButton.setText("Read/Write"); - rwButton.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, false, false)); + rwButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); org.eclipse.swt.widgets.Group textFontGroup = new org.eclipse.swt.widgets.Group(composite, SWT.NONE); textFontGroup.setLayout(new GridLayout(4, false)); - textFontGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); + textFontGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); textFontGroup.setFont(curFont); textFontGroup.setText("Text Font"); @@ -495,7 +495,7 @@ public void widgetSelected(SelectionEvent e) fontSizeChoice = new Combo(textFontGroup, SWT.SINGLE | SWT.READ_ONLY); fontSizeChoice.setFont(curFont); fontSizeChoice.setItems(fontSizeChoices); - fontSizeChoice.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); + fontSizeChoice.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); label = new Label(textFontGroup, SWT.RIGHT); label.setFont(curFont); @@ -506,15 +506,16 @@ public void widgetSelected(SelectionEvent e) fontTypeChoice = new Combo(textFontGroup, SWT.SINGLE | SWT.READ_ONLY); fontTypeChoice.setFont(curFont); fontTypeChoice.setItems(fontNames); - fontTypeChoice.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); + fontTypeChoice.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); org.eclipse.swt.widgets.Group imageGroup = new org.eclipse.swt.widgets.Group(composite, SWT.NONE); - imageGroup.setLayout(new GridLayout(5, false)); - imageGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); + imageGroup.setLayout(new GridLayout(6, false)); + imageGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); imageGroup.setFont(curFont); imageGroup.setText("Image"); helpButton = new Button(imageGroup, SWT.PUSH); + helpButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); helpButton.setImage(ViewProperties.getHelpIcon()); helpButton.setToolTipText("Help on Auto Contrast"); helpButton.addSelectionListener(new SelectionAdapter() { @@ -556,12 +557,14 @@ public void widgetSelected(SelectionEvent e) checkAutoContrast = new Button(imageGroup, SWT.CHECK); checkAutoContrast.setFont(curFont); checkAutoContrast.setText("Autogain Image Contrast"); - checkAutoContrast.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); + checkAutoContrast.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); checkShowValues = new Button(imageGroup, SWT.CHECK); checkShowValues.setFont(curFont); checkShowValues.setText("Show Values"); - checkShowValues.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); + checkShowValues.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); + + label = new Label(imageGroup, SWT.NONE); label = new Label(imageGroup, SWT.RIGHT); label.setFont(curFont); @@ -569,11 +572,11 @@ public void widgetSelected(SelectionEvent e) imageOriginChoice = new Combo(imageGroup, SWT.SINGLE | SWT.READ_ONLY); imageOriginChoice.setFont(curFont); - imageOriginChoice.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); + imageOriginChoice.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); org.eclipse.swt.widgets.Group dataGroup = new org.eclipse.swt.widgets.Group(composite, SWT.NONE); dataGroup.setLayout(new GridLayout(4, false)); - dataGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); + dataGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); dataGroup.setFont(curFont); dataGroup.setText("Data"); @@ -606,7 +609,7 @@ public void widgetSelected(SelectionEvent e) org.eclipse.swt.widgets.Group objectsGroup = new org.eclipse.swt.widgets.Group(composite, SWT.NONE); objectsGroup.setLayout(new GridLayout(5, true)); - objectsGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); + objectsGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); objectsGroup.setFont(curFont); objectsGroup.setText("Objects to Open"); diff --git a/src/org.hdfgroup.hdfview/hdf/view/dialog/UserOptionsHDFPage.java b/src/org.hdfgroup.hdfview/hdf/view/dialog/UserOptionsHDFPage.java index 43b6921f..cae29b7d 100644 --- a/src/org.hdfgroup.hdfview/hdf/view/dialog/UserOptionsHDFPage.java +++ b/src/org.hdfgroup.hdfview/hdf/view/dialog/UserOptionsHDFPage.java @@ -24,6 +24,8 @@ import org.slf4j.LoggerFactory; import org.eclipse.swt.SWT; +import org.eclipse.swt.events.KeyAdapter; +import org.eclipse.swt.events.KeyEvent; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Font; @@ -46,7 +48,9 @@ public class UserOptionsHDFPage extends UserOptionsDefaultPage { private static final Logger log = LoggerFactory.getLogger(UserOptionsHDFPage.class); - private Text fileExtField, pluginField; + private Text fileExtField; + private Combo pluginCombo; + private Button clearTextButton, deleteTextButton, insertTextButton; private Button checkConvertEnum, checkShowRegRefValues, helpButton; private Button checkNativeOrder, checkDecOrder, checkIncOrder; private Button checkIndexName, checkIndexCreateOrder; @@ -54,8 +58,7 @@ public class UserOptionsHDFPage extends UserOptionsDefaultPage { early114LibVersion, earlyLateLibVersion; private Button lateLibVersion, late18LibVersion, late110LibVersion, late112LibVersion, late114LibVersion, lateLateLibVersion; - private Button checkCurrentUserDir, checkUserHomeDir; - private Button currentDirButton, userHomeButton; + private Button pluginDirButton; /** Default early libversion for files */ private static String earlyLibVers; @@ -70,8 +73,12 @@ public class UserOptionsHDFPage extends UserOptionsDefaultPage { private static String indexOrder; /** Path to plugins */ - private String pluginDir; - private boolean isPluginDirChanged; + private String pluginDir = null; + private int pluginDirIndex = -1; + private boolean isPluginListChanged = false; + + /** a list of plugin paths */ + private static String[] pluginPathList; /** * Configuration page for HDF-specific application settings. @@ -79,7 +86,7 @@ public class UserOptionsHDFPage extends UserOptionsDefaultPage { public UserOptionsHDFPage() { super("HDF Settings"); - isPluginDirChanged = false; + isPluginListChanged = false; } /** @@ -170,20 +177,6 @@ else if (checkNativeOrder.getSelection()) if (checkShowRegRefValues != null) ViewProperties.setShowRegRefValue(checkShowRegRefValues.getSelection()); - if (pluginField != null) { - String pluginPath = pluginField.getText(); - if (checkCurrentUserDir.getSelection()) - pluginPath = System.getProperty("user.dir"); - else if (checkUserHomeDir.getSelection()) - pluginPath = System.getProperty("user.home"); - - if ((pluginPath != null) && (pluginPath.length() > 0)) { - pluginPath = pluginPath.trim(); - isPluginDirChanged = !pluginPath.equals(ViewProperties.getPluginDir()); - ViewProperties.setPluginDir(pluginPath); - } - } - return true; } @@ -192,7 +185,7 @@ else if (checkUserHomeDir.getSelection()) * * @return true if the plugin directory changed. */ - public boolean isPluginDirChanged() { return isPluginDirChanged; } + public boolean isPluginListChanged() { return isPluginListChanged; } /** * Loads all stored values in the FieldEditors. @@ -201,6 +194,14 @@ protected void load() { getPreferenceStore(); + try { + curFont = new Font(Display.getCurrent(), ViewProperties.getFontType(), + ViewProperties.getFontSize(), SWT.NORMAL); + } + catch (Exception ex) { + curFont = null; + } + fileExtField.setText(ViewProperties.getFileExtension()); earlyLibVers = ViewProperties.getEarlyLib(); @@ -233,29 +234,13 @@ protected void load() checkDecOrder.setSelection(indexOrder.compareTo("H5_ITER_DEC") == 0); checkNativeOrder.setSelection(indexOrder.compareTo("H5_ITER_NATIVE") == 0); - pluginDir = ViewProperties.getPluginDir(); - if (pluginDir == null) - pluginDir = rootDir; - - pluginField.setText(pluginDir); - - if (pluginDir.equals(System.getProperty("user.dir"))) { - checkCurrentUserDir.setSelection(true); - checkUserHomeDir.setSelection(false); - pluginField.setEnabled(false); - } - else if (pluginDir.equals(System.getProperty("user.home"))) { - checkCurrentUserDir.setSelection(false); - checkUserHomeDir.setSelection(true); - pluginField.setEnabled(false); - } - else { - checkCurrentUserDir.setSelection(false); - checkUserHomeDir.setSelection(false); - pluginField.setEnabled(true); - } - - log.trace("UserOptionsHDFlPage: pluginDir={}", pluginDir); + pluginPathList = ViewProperties.loadPluginPaths(); + pluginCombo.setItems(pluginPathList); + pluginCombo.setVisibleItemCount(pluginPathList.length); + pluginCombo.setText(""); + pluginCombo.deselectAll(); + pluginDirIndex = -1; + pluginDir = null; } /** @@ -270,11 +255,11 @@ protected Control createContents(Composite parent) { shell = parent.getShell(); Composite composite = new Composite(parent, SWT.NONE); - composite.setLayout(new GridLayout(1, false)); + composite.setLayout(new GridLayout()); org.eclipse.swt.widgets.Group fileExtensionGroup = new org.eclipse.swt.widgets.Group(composite, SWT.NONE); - fileExtensionGroup.setLayout(new GridLayout(2, true)); + fileExtensionGroup.setLayout(new GridLayout(2, false)); fileExtensionGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); fileExtensionGroup.setFont(curFont); fileExtensionGroup.setText("File Extensions"); @@ -284,13 +269,13 @@ protected Control createContents(Composite parent) label.setText("Extensions: "); fileExtField = new Text(fileExtensionGroup, SWT.SINGLE | SWT.BORDER); - fileExtField.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); + fileExtField.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); fileExtField.setFont(curFont); org.eclipse.swt.widgets.Group defaultLibVersionGroup = new org.eclipse.swt.widgets.Group(composite, SWT.NONE); defaultLibVersionGroup.setLayout(new GridLayout()); - defaultLibVersionGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); + defaultLibVersionGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); defaultLibVersionGroup.setFont(curFont); defaultLibVersionGroup.setText("Default Lib Version"); @@ -304,32 +289,32 @@ protected Control createContents(Composite parent) earlyLibVersion = new Button(earlyLibVersionGroup, SWT.RADIO); earlyLibVersion.setFont(curFont); earlyLibVersion.setText("Earliest"); - earlyLibVersion.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, false)); + earlyLibVersion.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); early18LibVersion = new Button(earlyLibVersionGroup, SWT.RADIO); early18LibVersion.setFont(curFont); early18LibVersion.setText("v18"); - early18LibVersion.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, false)); + early18LibVersion.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); early110LibVersion = new Button(earlyLibVersionGroup, SWT.RADIO); early110LibVersion.setFont(curFont); early110LibVersion.setText("v110"); - early110LibVersion.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, false)); + early110LibVersion.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); early112LibVersion = new Button(earlyLibVersionGroup, SWT.RADIO); early112LibVersion.setFont(curFont); early112LibVersion.setText("v112"); - early112LibVersion.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, false)); + early112LibVersion.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); early114LibVersion = new Button(earlyLibVersionGroup, SWT.RADIO); early114LibVersion.setFont(curFont); early114LibVersion.setText("v114"); - early114LibVersion.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, false)); + early114LibVersion.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); earlyLateLibVersion = new Button(earlyLibVersionGroup, SWT.RADIO); earlyLateLibVersion.setFont(curFont); earlyLateLibVersion.setText("Latest"); - earlyLateLibVersion.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, false)); + earlyLateLibVersion.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); org.eclipse.swt.widgets.Group lateLibVersionGroup = new org.eclipse.swt.widgets.Group(defaultLibVersionGroup, SWT.NONE); @@ -341,36 +326,36 @@ protected Control createContents(Composite parent) lateLibVersion = new Button(lateLibVersionGroup, SWT.RADIO); lateLibVersion.setFont(curFont); lateLibVersion.setText("Earliest"); - lateLibVersion.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, false)); + lateLibVersion.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); late18LibVersion = new Button(lateLibVersionGroup, SWT.RADIO); late18LibVersion.setFont(curFont); late18LibVersion.setText("v18"); - late18LibVersion.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, false)); + late18LibVersion.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); late110LibVersion = new Button(lateLibVersionGroup, SWT.RADIO); late110LibVersion.setFont(curFont); late110LibVersion.setText("v110"); - late110LibVersion.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, false)); + late110LibVersion.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); late112LibVersion = new Button(lateLibVersionGroup, SWT.RADIO); late112LibVersion.setFont(curFont); late112LibVersion.setText("v112"); - late112LibVersion.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, false)); + late112LibVersion.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); late114LibVersion = new Button(lateLibVersionGroup, SWT.RADIO); late114LibVersion.setFont(curFont); late114LibVersion.setText("v114"); - late114LibVersion.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, false)); + late114LibVersion.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); lateLateLibVersion = new Button(lateLibVersionGroup, SWT.RADIO); lateLateLibVersion.setFont(curFont); lateLateLibVersion.setText("Latest"); - lateLateLibVersion.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, false)); + lateLateLibVersion.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); org.eclipse.swt.widgets.Group dataGroup = new org.eclipse.swt.widgets.Group(composite, SWT.NONE); dataGroup.setLayout(new GridLayout(4, false)); - dataGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); + dataGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); dataGroup.setFont(curFont); dataGroup.setText("Data"); @@ -394,17 +379,17 @@ public void widgetSelected(SelectionEvent e) checkConvertEnum = new Button(dataGroup, SWT.CHECK); checkConvertEnum.setFont(curFont); checkConvertEnum.setText("Convert Enum"); - checkConvertEnum.setLayoutData(new GridData(SWT.BEGINNING, SWT.FILL, false, false)); + checkConvertEnum.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); checkShowRegRefValues = new Button(dataGroup, SWT.CHECK); checkShowRegRefValues.setFont(curFont); checkShowRegRefValues.setText("Show RegRef Values"); - checkShowRegRefValues.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); + checkShowRegRefValues.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); org.eclipse.swt.widgets.Group displayIndexingGroup = new org.eclipse.swt.widgets.Group(composite, SWT.NONE); displayIndexingGroup.setLayout(new GridLayout()); - displayIndexingGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); + displayIndexingGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); displayIndexingGroup.setFont(curFont); displayIndexingGroup.setText("Display Indexing Options"); @@ -418,99 +403,165 @@ public void widgetSelected(SelectionEvent e) checkIndexName = new Button(indexingTypeGroup, SWT.RADIO); checkIndexName.setFont(curFont); checkIndexName.setText("By Name"); - checkIndexName.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, false)); + checkIndexName.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); checkIndexCreateOrder = new Button(indexingTypeGroup, SWT.RADIO); checkIndexCreateOrder.setFont(curFont); checkIndexCreateOrder.setText("By Creation Order"); - checkIndexCreateOrder.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, false)); + checkIndexCreateOrder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); org.eclipse.swt.widgets.Group indexingOrderGroup = new org.eclipse.swt.widgets.Group(displayIndexingGroup, SWT.NONE); indexingOrderGroup.setLayout(new GridLayout(3, true)); - indexingOrderGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); + indexingOrderGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); indexingOrderGroup.setFont(curFont); indexingOrderGroup.setText("Indexing Order"); checkIncOrder = new Button(indexingOrderGroup, SWT.RADIO); checkIncOrder.setFont(curFont); checkIncOrder.setText("Increments"); - checkIncOrder.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, false)); + checkIncOrder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); checkDecOrder = new Button(indexingOrderGroup, SWT.RADIO); checkDecOrder.setFont(curFont); checkDecOrder.setText("Decrements"); - checkDecOrder.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, false)); + checkDecOrder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); checkNativeOrder = new Button(indexingOrderGroup, SWT.RADIO); checkNativeOrder.setFont(curFont); checkNativeOrder.setText("Native"); - checkNativeOrder.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, false)); + checkNativeOrder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); org.eclipse.swt.widgets.Group pluginDirectoryGroup = new org.eclipse.swt.widgets.Group(composite, SWT.NONE); pluginDirectoryGroup.setLayout(new GridLayout(3, false)); pluginDirectoryGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); pluginDirectoryGroup.setFont(curFont); - pluginDirectoryGroup.setText("Default Plugin Directory (*/plugin)"); - - checkCurrentUserDir = new Button(pluginDirectoryGroup, SWT.CHECK); - checkCurrentUserDir.setFont(curFont); - checkCurrentUserDir.setText("\"User Work\" or"); - checkCurrentUserDir.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); - checkCurrentUserDir.addSelectionListener(new SelectionAdapter() { + pluginDirectoryGroup.setText("Plugin Paths"); + + pluginPathList = ViewProperties.loadPluginPaths(); + pluginCombo = new Combo(pluginDirectoryGroup, SWT.BORDER | SWT.SINGLE); + pluginCombo.setFont(curFont); + pluginCombo.setItems(pluginPathList); + pluginCombo.setVisibleItemCount(pluginPathList.length); + pluginCombo.deselectAll(); + pluginCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1)); + pluginCombo.addKeyListener(new KeyAdapter() { @Override - public void widgetSelected(SelectionEvent e) + public void keyPressed(KeyEvent e) { - boolean isCheckCurrentUserDirSelected = checkCurrentUserDir.getSelection(); - if (isCheckCurrentUserDirSelected) - checkUserHomeDir.setSelection(false); - pluginField.setEnabled(!isCheckCurrentUserDirSelected); - currentDirButton.setEnabled(!isCheckCurrentUserDirSelected); + if (e.keyCode == SWT.CR) { + String dirname = pluginCombo.getText(); + if (dirname == null || dirname.length() < 1 || dirname.equals(pluginDir)) + return; + pluginCombo.setText(dirname); + } } }); - - checkUserHomeDir = new Button(pluginDirectoryGroup, SWT.CHECK); - checkUserHomeDir.setFont(curFont); - checkUserHomeDir.setText("\"User Home\" or"); - checkUserHomeDir.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); - checkUserHomeDir.addSelectionListener(new SelectionAdapter() { + pluginCombo.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - boolean isCheckUserHomeDirSelected = checkUserHomeDir.getSelection(); - if (isCheckUserHomeDirSelected) - checkCurrentUserDir.setSelection(false); - pluginField.setEnabled(!isCheckUserHomeDirSelected); - currentDirButton.setEnabled(!isCheckUserHomeDirSelected); + pluginDirIndex = pluginCombo.getSelectionIndex(); + pluginDir = pluginCombo.getItem(pluginDirIndex); } }); - pluginField = new Text(pluginDirectoryGroup, SWT.SINGLE | SWT.BORDER); - pluginField.setFont(curFont); - pluginField.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); - - currentDirButton = new Button(pluginDirectoryGroup, SWT.PUSH); - currentDirButton.setFont(curFont); - currentDirButton.setText("Browse..."); - currentDirButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); - currentDirButton.addSelectionListener(new SelectionAdapter() { + pluginDirButton = new Button(pluginDirectoryGroup, SWT.PUSH); + pluginDirButton.setFont(curFont); + pluginDirButton.setText("Browse..."); + pluginDirButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.FILL, false, false)); + pluginDirButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { final DirectoryDialog dChooser = new DirectoryDialog(shell); - dChooser.setFilterPath(pluginDir); - dChooser.setText("Select a Base Directory"); + dChooser.setFilterPath(System.getProperty("user.dir")); + dChooser.setText("Select a Directory"); String dir = dChooser.open(); if (dir == null) return; - pluginField.setText(dir + "/plugin"); + pluginCombo.setText(dir); } }); + insertTextButton = new Button(pluginDirectoryGroup, SWT.PUSH); + insertTextButton.setFont(curFont); + insertTextButton.setToolTipText("Append current selection"); + insertTextButton.setText("Add Path"); + insertTextButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); + insertTextButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) + { + String dirname = pluginCombo.getText(); + if (dirname == null || dirname.length() < 1) { + return; + } + ViewProperties.appendPluginPath(dirname); + pluginPathList = ViewProperties.loadPluginPaths(); + pluginCombo.setItems(pluginPathList); + pluginCombo.setVisibleItemCount(pluginPathList.length); + pluginCombo.setText(""); + pluginCombo.deselectAll(); + pluginDirIndex = -1; + pluginDir = null; + } + }); + + deleteTextButton = new Button(pluginDirectoryGroup, SWT.PUSH); + deleteTextButton.setFont(curFont); + deleteTextButton.setToolTipText("Remove current selection"); + deleteTextButton.setText("Remove Path"); + deleteTextButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); + deleteTextButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) + { + String dirname = pluginCombo.getText(); + if (dirname == null || dirname.length() < 1) { + return; + } + String[] items = pluginCombo.getItems(); + for (int idx = 0; idx < items.length; idx++) { + if (items[idx].equals(dirname)) { + pluginDirIndex = idx; + } + } + ViewProperties.deletePluginPath(pluginDirIndex); + pluginPathList = ViewProperties.loadPluginPaths(); + pluginCombo.setItems(pluginPathList); + pluginCombo.setVisibleItemCount(pluginPathList.length); + pluginCombo.setText(""); + pluginCombo.deselectAll(); + pluginDirIndex = -1; + pluginDir = null; + } + }); + + clearTextButton = new Button(pluginDirectoryGroup, SWT.PUSH); + clearTextButton.setFont(curFont); + clearTextButton.setToolTipText("Clear current selection"); + clearTextButton.setText("Clear Path Text"); + clearTextButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); + clearTextButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) + { + pluginCombo.setText(""); + pluginCombo.deselectAll(); + pluginDirIndex = -1; + pluginDir = null; + } + }); + + // shell.pack(); + + log.info("UserOptionsHDFPage: plugin combobox created"); + load(); return composite; } diff --git a/src/org.hdfgroup.object/hdf/object/Attribute.java b/src/org.hdfgroup.object/hdf/object/Attribute.java index 8bb937a4..c7c32c1e 100644 --- a/src/org.hdfgroup.object/hdf/object/Attribute.java +++ b/src/org.hdfgroup.object/hdf/object/Attribute.java @@ -123,11 +123,15 @@ public interface Attribute { int getAttributePlane(); /** + * Check if attribute's dataspace is a NULL + * * @return true if the dataspace is a NULL; otherwise, returns false. */ boolean isAttributeNULL(); /** + * Check if attribute is a single scalar point + * * @return true if the data is a single scalar point; otherwise, returns false. */ boolean isAttributeScalar(); @@ -135,11 +139,10 @@ public interface Attribute { /** * Not for public use in the future. * - * setData() is not safe to use because it changes memory buffer - * of the dataset object. Dataset operations such as write/read - * will fail if the buffer type or size is changed. + * setAttributeData() is not safe to use because it changes memory buffer of the dataset object. Dataset + * operations such as write/read will fail if the buffer type or size is changed. * - * @param d the object data -must be an array of Objects + * @param d the object data -must be an array of Objects */ void setAttributeData(Object d); diff --git a/src/org.hdfgroup.object/hdf/object/DataFormat.java b/src/org.hdfgroup.object/hdf/object/DataFormat.java index 271b572b..9b53954e 100644 --- a/src/org.hdfgroup.object/hdf/object/DataFormat.java +++ b/src/org.hdfgroup.object/hdf/object/DataFormat.java @@ -47,10 +47,11 @@ public interface DataFormat { Object getData() throws Exception, OutOfMemoryError; /** + * setData() is not safe to use because it changes memory buffer of the dataset object. Dataset operations + * such as write/read will fail if the buffer type or size is changed. * * - * @param data - * the data to write. + * @param data the data to write. */ void setData(Object data); diff --git a/src/org.hdfgroup.object/hdf/object/Dataset.java b/src/org.hdfgroup.object/hdf/object/Dataset.java index faacdd76..8b5d09f1 100644 --- a/src/org.hdfgroup.object/hdf/object/Dataset.java +++ b/src/org.hdfgroup.object/hdf/object/Dataset.java @@ -1375,11 +1375,15 @@ public final Class getOriginalClass() } /** + * Check if dataset's dataspace is a NULL + * * @return true if the dataspace is a NULL; otherwise, returns false. */ public boolean isNULL() { return isNULL; } /** + * Check if dataset is a single scalar point + * * @return true if the data is a single scalar point; otherwise, returns false. */ public boolean isScalar() { return isScalar; } @@ -1479,6 +1483,18 @@ public String toString(String delimiter, int maxItems) return toString(theData, getDatatype(), delimiter, n); } + /** + * Returns a string representation of the dataset object. + * + * @param theData The Object data + * @param theType The type of the data in the Object + * @param delimiter The delimiter used to separate individual data points. It can be a comma, semicolon, + * tab or + * space. For example, toString(",") will separate data by commas. + * @param count The maximum number of Array values to return + * + * @return the string representation of the dataset object. + */ protected String toString(Object theData, Datatype theType, String delimiter, int count) { log.trace("toString: is_enum={} is_unsigned={} Array.getLength={}", theType.isEnum(), diff --git a/src/org.hdfgroup.object/hdf/object/FileFormat.java b/src/org.hdfgroup.object/hdf/object/FileFormat.java index b04bd284..541dd920 100644 --- a/src/org.hdfgroup.object/hdf/object/FileFormat.java +++ b/src/org.hdfgroup.object/hdf/object/FileFormat.java @@ -2064,13 +2064,13 @@ public String getLibBoundsDescription() throws Exception } /** - * @return the int value of the index type value. + * Get the value of the index type value. * - * @param strtype - * The name of the index type. + * @param strtype The name of the index type. * - * @throws Exception - * The exceptions thrown vary depending on the implementing class. + * @return the int value of the index type value. + * + * @throws Exception The exceptions thrown vary depending on the implementing class. */ public static int getIndexTypeValue(String strtype) throws Exception { @@ -2079,13 +2079,13 @@ public static int getIndexTypeValue(String strtype) throws Exception } /** - * @return the int value of the index type. + * Get the value of the index type. * - * @param strtype - * The name of the index type. + * @param strtype The name of the index type. * - * @throws Exception - * The exceptions thrown vary depending on the implementing class. + * @return the int value of the index type. + * + * @throws Exception The exceptions thrown vary depending on the implementing class. */ public int getIndexType(String strtype) throws Exception { @@ -2109,13 +2109,13 @@ public void setIndexType(int indexType) throws Exception } /** - * @return the int value of the index order value. + * Get the value of the index order value. * - * @param strorder - * The name of the index order. + * @param strorder The name of the index order. * - * @throws Exception - * The exceptions thrown vary depending on the implementing class. + * @return the int value of the index order value. + * + * @throws Exception The exceptions thrown vary depending on the implementing class. */ public static int getIndexOrderValue(String strorder) throws Exception { @@ -2124,13 +2124,13 @@ public static int getIndexOrderValue(String strorder) throws Exception } /** - * @return the int value of the index order. + * Get the value of the index order. * - * @param strorder - * The name of the index order. + * @param strorder The name of the index order. * - * @throws Exception - * The exceptions thrown vary depending on the implementing class. + * @return the int value of the index order. + * + * @throws Exception The exceptions thrown vary depending on the implementing class. */ public int getIndexOrder(String strorder) throws Exception { diff --git a/src/org.hdfgroup.object/hdf/object/Group.java b/src/org.hdfgroup.object/hdf/object/Group.java index 21add336..4ee4e990 100644 --- a/src/org.hdfgroup.object/hdf/object/Group.java +++ b/src/org.hdfgroup.object/hdf/object/Group.java @@ -207,6 +207,8 @@ public List getMemberList() } /** + * Get the members of this Group in breadth-first order. + * * @return the members of this Group in breadth-first order. */ public List breadthFirstMemberList() @@ -229,6 +231,8 @@ public List breadthFirstMemberList() } /** + * Get the members of this Group in depth-first order. + * * @return the members of this Group in depth-first order. */ public List depthFirstMemberList() @@ -288,7 +292,11 @@ public void setName(String newName) throws Exception } } - /** @return the parent group. */ + /** + * Get the parent group. + * + * @return the parent group. + */ public final Group getParent() { return parent; } /** @@ -317,7 +325,9 @@ public void setName(String newName) throws Exception /** * Get the HObject at the specified index in this Group's member list. + * * @param idx The index of the HObject to get. + * * @return The HObject at the specified index. */ public HObject getMember(int idx) diff --git a/src/org.hdfgroup.object/hdf/object/ScalarDS.java b/src/org.hdfgroup.object/hdf/object/ScalarDS.java index cf6d2db7..cb6a59d6 100644 --- a/src/org.hdfgroup.object/hdf/object/ScalarDS.java +++ b/src/org.hdfgroup.object/hdf/object/ScalarDS.java @@ -394,6 +394,8 @@ public void addFilteredImageValue(Number x) public List getFilteredImageValues() { return filteredImageValues; } /** + * Check if this dataset is a true color image. + * * @return true if this dataset is a true color image. * */ diff --git a/src/org.hdfgroup.object/hdf/object/fits/FitsFile.java b/src/org.hdfgroup.object/hdf/object/fits/FitsFile.java index 1a503b6c..8ad3c94d 100644 --- a/src/org.hdfgroup.object/hdf/object/fits/FitsFile.java +++ b/src/org.hdfgroup.object/hdf/object/fits/FitsFile.java @@ -271,6 +271,8 @@ public HObject getRootObject() } /** + * Get the Fits file. + * * @return the Fits file. */ public Fits getFitsFile() { return fitsFile; } diff --git a/src/org.hdfgroup.object/hdf/object/h5/H5Datatype.java b/src/org.hdfgroup.object/hdf/object/h5/H5Datatype.java index 655a8a8f..96bb7c3b 100644 --- a/src/org.hdfgroup.object/hdf/object/h5/H5Datatype.java +++ b/src/org.hdfgroup.object/hdf/object/h5/H5Datatype.java @@ -1167,8 +1167,10 @@ else if (nativeClass == HDF5Constants.H5T_OPAQUE) { } /** - * @param tid - * the datatype identification disk. + * Get the memory datatype identifier from the datatype file identifier. + * + * @param tid the datatype file identification. + * * @return the memory datatype identifier if successful, and negative otherwise. */ public static long toNative(long tid) @@ -2457,10 +2459,9 @@ else if (HDF5Constants.H5S_SEL_HYPERSLABS == region_type) { /** * Gets the dataset reference type for a 1.10 reference. * - * @param container - * the dataset/attribute with the reference - * @param refarr - * the reference datatype data to be checked. + * @param container the dataset/attribute with the reference + * @param obj_type the dataset/attribute object type + * @param refarr the reference datatype data to be checked. * * @return the dataset reference type. */ diff --git a/src/org.hdfgroup.object/hdf/object/h5/H5File.java b/src/org.hdfgroup.object/hdf/object/h5/H5File.java index 83e63eae..a0f42a6f 100644 --- a/src/org.hdfgroup.object/hdf/object/h5/H5File.java +++ b/src/org.hdfgroup.object/hdf/object/h5/H5File.java @@ -3154,10 +3154,11 @@ public static void renameObject(HObject obj, String newPath, String newName) thr } /** + * Get the value of the index type value. + * * @return the int value of the index type value. * - * @param strtype - * The name of the index type. + * @param strtype The name of the index type. */ public static int getIndexTypeValue(String strtype) { @@ -3171,10 +3172,11 @@ public static int getIndexTypeValue(String strtype) } /** + * Get the value of the index order. + * * @return the int value of the index order. * - * @param strorder - * The name of the index order. + * @param strorder The name of the index order. */ public static int getIndexOrderValue(String strorder) { @@ -3191,10 +3193,11 @@ public static int getIndexOrderValue(String strorder) @Override /** + * Get the value of the index type. + * * @return the int value of the index type. * - * @param strtype - * The name of the index type. + * @param strtype The name of the index type. */ public int getIndexType(String strtype) { @@ -3208,7 +3211,11 @@ public int getIndexType(String strtype) return getIndexType(); } - /** @return the current value of the index type. */ + /** + * Get the current value of the index type. + * + * @return the current value of the index type. + */ public int getIndexType() { return indexType; } @Override @@ -3225,10 +3232,11 @@ public void setIndexType(int indexType) @Override /** + * Get the value of the index order value. + * * @return the int value of the index order value. * - * @param strorder - * The name of the index order. + * @param strorder The name of the index order. */ public int getIndexOrder(String strorder) { @@ -3246,7 +3254,11 @@ public int getIndexOrder(String strorder) return getIndexOrder(); } - /** @return the current value of the index order. */ + /** + * Get the current value of the index order. + * + * @return the current value of the index order. + */ public int getIndexOrder() { return indexOrder; } @Override diff --git a/src/org.hdfgroup.object/hdf/object/h5/H5Plugins.java b/src/org.hdfgroup.object/hdf/object/h5/H5Plugins.java new file mode 100644 index 00000000..0b74ee93 --- /dev/null +++ b/src/org.hdfgroup.object/hdf/object/h5/H5Plugins.java @@ -0,0 +1,122 @@ +/***************************************************************************** + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of the HDF Java Products distribution. * + * The full copyright notice, including terms governing use, modification, * + * and redistribution, is contained in the COPYING file, which can be found * + * at the root of the source code distribution tree, * + * or in https://www.hdfgroup.org/licenses. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + ****************************************************************************/ + +package hdf.object.h5; + +import java.util.ArrayList; +import java.util.List; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.exceptions.HDF5Exception; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** HDF5 plugin utility class */ +public final class H5Plugins { + + private static final Logger log = LoggerFactory.getLogger(H5Plugins.class); + + private static long totalPaths; + + /** + * Creates a list of plugin paths for HDFView. + * + */ + public H5Plugins() + { + totalPaths = H5.H5PLsize(); // initial number of paths + } + + /** + * Get the total number of paths for the HDF5 library. + * + * @return total number of plugin paths + * + * @throws HDF5Exception If there is an error at the HDF5 library level. + */ + public static final long getTotalPluginPaths() throws HDF5Exception + { + totalPaths = H5.H5PLsize(); + + log.trace("getTotalPluginPaths(): total plugin paths {}", totalPaths); + + return totalPaths; + } + + /** + * Get the list of paths for the HDF5 library. + * + * @return list of plugin paths + * + * @throws HDF5Exception If there is an error at the HDF5 library level. + */ + public static final ArrayList getPluginPaths() throws HDF5Exception + { + ArrayList pathList = new ArrayList<>(5); + totalPaths = H5.H5PLsize(); + log.trace("getPluginPaths(): total plugin paths {}", totalPaths); + for (int indx = 0; indx < totalPaths; indx++) + pathList.add(H5.H5PLget(indx)); + + return pathList; + } + + /** + * Replaces the plugin path. + * + * @param pluginPath The plugin path. + * @param pathIndex The index to replace the plugin path. + */ + public static void replacePluginPath(String pluginPath, int pathIndex) throws HDF5Exception + { + H5.H5PLreplace(pluginPath, pathIndex); + } + + /** + * Inserts the plugin path. + * + * @param pluginPath The plugin path. + * @param pathIndex The index to insert the plugin path. + */ + public static void insertPluginPath(String pluginPath, int pathIndex) throws HDF5Exception + { + H5.H5PLinsert(pluginPath, pathIndex); + } + + /** + * Removes the plugin path. + * + * @param pathIndex The index to remove the plugin path. + */ + public static void deletePluginPath(int pathIndex) throws HDF5Exception { H5.H5PLremove(pathIndex); } + + /** + * Prepend the plugin path. + * + * @param pluginPath The plugin path. + */ + public static void prependPluginPath(String pluginPath) throws HDF5Exception + { + H5.H5PLprepend(pluginPath); + } + + /** + * Append the plugin path. + * + * @param pluginPath The plugin path. + */ + public static void appendPluginPath(String pluginPath) throws HDF5Exception { H5.H5PLappend(pluginPath); } +} diff --git a/src/org.hdfgroup.object/hdf/object/h5/H5ReferenceType.java b/src/org.hdfgroup.object/hdf/object/h5/H5ReferenceType.java index f9a08a89..16a30387 100644 --- a/src/org.hdfgroup.object/hdf/object/h5/H5ReferenceType.java +++ b/src/org.hdfgroup.object/hdf/object/h5/H5ReferenceType.java @@ -1056,10 +1056,10 @@ public static class H5ReferenceData { public long typeSize; /** - * Copy the individual reference array for further processing + * Copy the individual reference array for further processing * - * @param theArray - * the reference datatype data to be copied. + * @param theArray the reference datatype data to be copied. + * @param theTypeSize the size of the type for the array */ H5ReferenceData(byte[] theArray, long theTypeSize) { diff --git a/src/org.hdfgroup.object/hdf/object/nc2/NC2File.java b/src/org.hdfgroup.object/hdf/object/nc2/NC2File.java index 8b890a9c..22fbf381 100644 --- a/src/org.hdfgroup.object/hdf/object/nc2/NC2File.java +++ b/src/org.hdfgroup.object/hdf/object/nc2/NC2File.java @@ -229,6 +229,8 @@ public HObject getRootObject() } /** + * Get the NetCDF file. + * * @return the NetCDF file. */ public NetcdfFile getNetcdfFile() { return ncFile; } diff --git a/src/org.hdfgroup.object/hdf/object/nc2/NC2Group.java b/src/org.hdfgroup.object/hdf/object/nc2/NC2Group.java index 6a5b64d8..174e57cb 100644 --- a/src/org.hdfgroup.object/hdf/object/nc2/NC2Group.java +++ b/src/org.hdfgroup.object/hdf/object/nc2/NC2Group.java @@ -48,6 +48,8 @@ public class NC2Group extends Group { protected ucar.nc2.Group netCDFGroup; /** + * Get the corresponding netcdf Group for this group. + * * @return the corresponding netcdf Group for this group. */ public ucar.nc2.Group getNetCDFGroup() { return netCDFGroup; } @@ -110,6 +112,8 @@ public NC2Group(FileFormat fileFormat, String name, String path, Group parent, l public boolean hasAttribute() { return false; } /** + * Get if this group has an attached dimension. + * * @return true if this group has an attached dimension. */ public boolean hasDimension() { return false; }