Repository: jcryptool/core
Branch: develop
Commit: 285888cbf2f4
Files: 1579
Total size: 19.4 MB
Directory structure:
gitextract_vhwcz6kc/
├── .development-configs/
│ ├── checkstyle-suppressions.xml
│ ├── checkstyle.xml
│ └── formatter.xml
├── .github/
│ └── workflows/
│ └── maven.yml
├── .gitignore
├── .metals/
│ └── .gitignore
├── LICENSE
├── com.thoughtworks.qdox/
│ ├── .classpath
│ ├── .project
│ ├── META-INF/
│ │ ├── LICENSE.txt
│ │ └── MANIFEST.MF
│ ├── OSGI-INF/
│ │ └── l10n/
│ │ ├── bundle.properties
│ │ └── bundle_de.properties
│ ├── build.properties
│ └── pom.xml
├── de.flexiprovider/
│ ├── .classpath
│ ├── .project
│ ├── META-INF/
│ │ └── MANIFEST.MF
│ ├── OSGI-INF/
│ │ └── l10n/
│ │ ├── bundle.properties
│ │ └── bundle_de.properties
│ ├── build.properties
│ ├── gpl.txt
│ ├── lgpl.txt
│ ├── libs/
│ │ ├── FlexiProvider-1.7p7.signed.jar
│ │ └── FlexiProvider-1.7p7.signed_source.jar
│ ├── licensing.txt
│ ├── plugin.xml
│ ├── pom.xml
│ ├── src/
│ │ └── de/
│ │ └── flexiprovider/
│ │ ├── FlexiProviderController.java
│ │ └── FlexiProviderPlugin.java
│ └── xml/
│ └── algorithms.xml
├── net.sourceforge.codec/
│ ├── .classpath
│ ├── .project
│ ├── META-INF/
│ │ └── MANIFEST.MF
│ ├── OSGI-INF/
│ │ └── l10n/
│ │ ├── bundle.properties
│ │ └── bundle_de.properties
│ ├── build.properties
│ └── pom.xml
├── net.sourceforge.javahexeditor/
│ ├── .classpath
│ ├── .gitignore
│ ├── .project
│ ├── META-INF/
│ │ └── MANIFEST.MF
│ ├── about.ini
│ ├── build.properties
│ ├── doc/
│ │ ├── COPYING.txt
│ │ ├── PROJECT.txt
│ │ └── RELEASE.txt
│ ├── nl/
│ │ ├── de/
│ │ │ └── contexts.xml
│ │ └── en/
│ │ └── contexts.xml
│ ├── plugin.properties
│ ├── plugin.xml
│ ├── plugin_de.properties
│ ├── pom.xml
│ ├── schema/
│ │ └── outline.exsd
│ └── src/
│ ├── images/
│ │ └── javahexeditor-48x48.icns
│ └── net/
│ └── sourceforge/
│ └── javahexeditor/
│ ├── BinaryContent.java
│ ├── BinaryContentActionHistory.java
│ ├── BinaryContentFinder.java
│ ├── ClipboardHelper.java
│ ├── ContextMenu.java
│ ├── CopyDialog.java
│ ├── DisplayedContent.java
│ ├── FileToucher.java
│ ├── FindReplaceDialog.java
│ ├── FindReplaceHistory.java
│ ├── GoToDialog.java
│ ├── HelpResources.java
│ ├── HexTexts.java
│ ├── Manager.java
│ ├── OpenInTexteditor.java
│ ├── PasteDialog.java
│ ├── Preferences.java
│ ├── PreferencesManager.java
│ ├── RandomAccessFileFactory.java
│ ├── SelectBlockDialog.java
│ ├── StatusLine.java
│ ├── Texts.java
│ ├── Texts.properties
│ ├── Texts_de.properties
│ ├── common/
│ │ ├── ByteArrayUtility.java
│ │ ├── NumberUtility.java
│ │ ├── ResourceUtility.java
│ │ ├── SWTUtility.java
│ │ └── TextUtility.java
│ └── plugin/
│ ├── HexEditorPlugin.java
│ ├── actions/
│ │ └── FileOpenAction.java
│ └── editors/
│ ├── HexEditor.java
│ ├── HexEditorActionBarContributor.java
│ ├── HexEditorInput.java
│ ├── HexEditorPreferences.java
│ ├── HexEditorPreferencesPage.java
│ ├── Texts.java
│ ├── Texts.properties
│ └── Texts_de.properties
├── notes_updatesitelocations.txt
├── org.apache.commons.cli/
│ ├── .classpath
│ ├── .project
│ ├── META-INF/
│ │ ├── LICENSE.txt
│ │ └── MANIFEST.MF
│ ├── OSGI-INF/
│ │ └── l10n/
│ │ ├── bundle.properties
│ │ └── bundle_de.properties
│ ├── build.properties
│ └── pom.xml
├── org.bouncycastle/
│ ├── .classpath
│ ├── .project
│ ├── META-INF/
│ │ └── MANIFEST.MF
│ ├── OSGI-INF/
│ │ └── l10n/
│ │ ├── bundle.properties
│ │ └── bundle_de.properties
│ ├── build.properties
│ ├── license.txt
│ ├── plugin.xml
│ ├── pom.xml
│ └── src/
│ └── org/
│ └── bouncycastle/
│ ├── BouncyCastleController.java
│ └── BouncyCastlePlugin.java
├── org.jcryptool.actions.core/
│ ├── .classpath
│ ├── .project
│ ├── META-INF/
│ │ └── MANIFEST.MF
│ ├── OSGI-INF/
│ │ └── l10n/
│ │ ├── bundle.properties
│ │ └── bundle_de.properties
│ ├── build.properties
│ ├── pom.xml
│ ├── resources/
│ │ └── actioncascade.xsd
│ └── src/
│ └── org/
│ └── jcryptool/
│ └── actions/
│ └── core/
│ ├── ActionsCorePlugin.java
│ ├── registry/
│ │ └── ActionCascadeService.java
│ ├── types/
│ │ ├── ActionCascade.java
│ │ └── ActionItem.java
│ └── utils/
│ ├── Constants.java
│ └── ImportUtils.java
├── org.jcryptool.actions.ui/
│ ├── .classpath
│ ├── .project
│ ├── META-INF/
│ │ └── MANIFEST.MF
│ ├── OSGI-INF/
│ │ └── l10n/
│ │ ├── bundle.properties
│ │ └── bundle_de.properties
│ ├── build.properties
│ ├── nl/
│ │ ├── de/
│ │ │ ├── contexts.xml
│ │ │ ├── help/
│ │ │ │ ├── preferences.html
│ │ │ │ └── view.html
│ │ │ ├── index.xml
│ │ │ └── toc.xml
│ │ └── en/
│ │ ├── contexts.xml
│ │ ├── help/
│ │ │ ├── preferences.html
│ │ │ └── view.html
│ │ ├── index.xml
│ │ └── toc.xml
│ ├── plugin.xml
│ ├── pom.xml
│ ├── src/
│ │ └── org/
│ │ └── jcryptool/
│ │ └── actions/
│ │ └── ui/
│ │ ├── ActionsUIPlugin.java
│ │ ├── handler/
│ │ │ ├── ExportHandler.java
│ │ │ ├── ImportActionCascadeHandler.java
│ │ │ ├── ImportHandler.java
│ │ │ ├── ImportSampleHandler.java
│ │ │ ├── Messages.java
│ │ │ ├── MoveDownHandler.java
│ │ │ ├── MoveUpHandler.java
│ │ │ ├── NewCascadeHandler.java
│ │ │ ├── RecordHandler.java
│ │ │ ├── RemoveSelectedHandler.java
│ │ │ ├── StartHandler.java
│ │ │ ├── messages.properties
│ │ │ └── messages_de.properties
│ │ ├── preferences/
│ │ │ ├── GeneralPage.java
│ │ │ ├── Messages.java
│ │ │ ├── PreferenceConstants.java
│ │ │ ├── PreferenceInitializer.java
│ │ │ ├── messages.properties
│ │ │ └── messages_de.properties
│ │ ├── propertytester/
│ │ │ └── RecordPropertyTester.java
│ │ ├── utils/
│ │ │ ├── Constants.java
│ │ │ ├── Messages.java
│ │ │ ├── messages.properties
│ │ │ └── messages_de.properties
│ │ └── views/
│ │ ├── ActionView.java
│ │ ├── Messages.java
│ │ ├── messages.properties
│ │ ├── messages_de.properties
│ │ └── provider/
│ │ └── ActionLabelProvider.java
│ └── templates/
│ ├── Caesar1.xml
│ ├── Caesar1_old.xml
│ ├── Caesar2.xml
│ └── Caesar2_old.xml
├── org.jcryptool.bci/
│ ├── .classpath
│ ├── .project.disabled
│ ├── META-INF/
│ │ └── MANIFEST.MF
│ ├── bcijar/
│ │ └── .gitignore
│ ├── build.properties
│ ├── nl/
│ │ ├── de/
│ │ │ ├── contexts.xml
│ │ │ ├── help/
│ │ │ │ └── content/
│ │ │ │ └── index.html
│ │ │ └── toc.xml
│ │ └── en/
│ │ ├── contexts.xml
│ │ ├── help/
│ │ │ └── content/
│ │ │ └── index.html
│ │ └── toc.xml
│ ├── plugin.xml
│ ├── pom.xml.disabled
│ └── src/
│ └── org/
│ ├── eclipse/
│ │ └── wb/
│ │ └── swt/
│ │ └── SWTResourceManager.java
│ └── jcryptool/
│ └── bci/
│ ├── Activator.java
│ └── views/
│ └── OperationView.java
├── org.jcryptool.buildinfo/
│ ├── .classpath
│ ├── .project
│ ├── META-INF/
│ │ └── MANIFEST.MF
│ ├── build.properties
│ ├── nl/
│ │ └── .gitkeep
│ ├── plugin.xml
│ ├── pom.xml
│ ├── res/
│ │ ├── .gitkeep
│ │ └── Weekly-1.0.8.1-20220711/
│ │ └── functionlist/
│ │ ├── de.csv
│ │ └── en.csv
│ └── src/
│ └── org/
│ └── jcryptool/
│ └── buildinfo/
│ ├── Activator.java
│ └── views/
│ └── OperationView.java
├── org.jcryptool.commands.core/
│ ├── .classpath
│ ├── .project
│ ├── META-INF/
│ │ └── MANIFEST.MF
│ ├── OSGI-INF/
│ │ └── l10n/
│ │ ├── bundle.properties
│ │ └── bundle_de.properties
│ ├── build.properties
│ ├── plugin.xml
│ ├── pom.xml
│ ├── schema/
│ │ └── commands.exsd
│ ├── src/
│ │ └── org/
│ │ └── jcryptool/
│ │ └── commands/
│ │ └── core/
│ │ ├── Command.java
│ │ ├── CommandFactory.java
│ │ ├── CommandsCorePlugin.java
│ │ ├── ExtendedHelpCommand.java
│ │ ├── HELP_Command.java
│ │ ├── HelpCommand.java
│ │ ├── Messages.java
│ │ ├── ProxiedCommand.java
│ │ ├── ProxiedExtendedCommand.java
│ │ ├── api/
│ │ │ ├── AbstractCommand.java
│ │ │ ├── IllegalCommandException.java
│ │ │ ├── Messages.java
│ │ │ ├── OptionsBuilder.java
│ │ │ ├── messages.properties
│ │ │ └── messages_de.properties
│ │ ├── evaluator/
│ │ │ ├── CommandEvaluator.java
│ │ │ ├── Messages.java
│ │ │ ├── messages.properties
│ │ │ └── messages_de.properties
│ │ ├── messages.properties
│ │ └── messages_de.properties
│ └── txt/
│ ├── help_de.txt
│ └── help_en.txt
├── org.jcryptool.commands.ui/
│ ├── .classpath
│ ├── .project
│ ├── META-INF/
│ │ └── MANIFEST.MF
│ ├── OSGI-INF/
│ │ └── l10n/
│ │ ├── bundle.properties
│ │ └── bundle_de.properties
│ ├── build.properties
│ ├── nl/
│ │ ├── de/
│ │ │ ├── help/
│ │ │ │ ├── preferences.html
│ │ │ │ └── view.html
│ │ │ ├── index.xml
│ │ │ └── toc.xml
│ │ └── en/
│ │ ├── help/
│ │ │ ├── preferences.html
│ │ │ └── view.html
│ │ ├── index.xml
│ │ └── toc.xml
│ ├── plugin.xml
│ ├── pom.xml
│ └── src/
│ └── org/
│ └── jcryptool/
│ └── commands/
│ └── ui/
│ ├── CommandsUIPlugin.java
│ ├── commands/
│ │ ├── Messages.java
│ │ ├── ShowConsoleView.java
│ │ ├── messages.properties
│ │ └── messages_de.properties
│ └── eclipseconsole/
│ ├── CommandsUiStartup.java
│ ├── Messages.java
│ ├── console/
│ │ ├── IOConsoleInputStreamWrapper.java
│ │ ├── IOConsolePromptShell.java
│ │ ├── IOConsoleShell.java
│ │ └── IOConsoleStaticPromptShell.java
│ ├── messages.properties
│ └── messages_de.properties
├── org.jcryptool.core/
│ ├── .classpath
│ ├── .project
│ ├── META-INF/
│ │ └── MANIFEST.MF
│ ├── OSGI-INF/
│ │ └── l10n/
│ │ ├── bundle.properties
│ │ └── bundle_de.properties
│ ├── about.html
│ ├── about.ini
│ ├── build.properties
│ ├── css/
│ │ └── jcryptool.css
│ ├── ide/
│ │ └── JCTIDEConfiguration.setup
│ ├── plugin.xml
│ ├── plugin_customization.ini
│ ├── pom.xml
│ ├── schema/
│ │ ├── editorButton.exsd
│ │ └── platformLanguage.exsd
│ └── src/
│ └── org/
│ └── jcryptool/
│ └── core/
│ ├── Application.java
│ ├── ApplicationActionBarAdvisor.java
│ ├── ApplicationWorkbenchAdvisor.java
│ ├── ApplicationWorkbenchWindowAdvisor.java
│ ├── CorePlugin.java
│ ├── EditorAreaDropTargetListener.java
│ ├── LanguageChooser.java
│ ├── Messages.java
│ ├── Perspective.java
│ ├── Startup.java
│ ├── commands/
│ │ ├── FileOpener.java
│ │ ├── HelpHrefRegistry.java
│ │ ├── Messages.java
│ │ ├── OpenFileHandler.java
│ │ ├── OpenNewEmptyHexEditorCommand.java
│ │ ├── OpenNewEmptyTextEditorCommand.java
│ │ ├── OpenNewSampleHexEditorCommand.java
│ │ ├── OpenNewSampleTextEditorCommand.java
│ │ ├── ShowHelpContents.java
│ │ ├── ShowPluginViewHandler.java
│ │ ├── messages.properties
│ │ └── messages_de.properties
│ ├── messages.properties
│ ├── messages_de.properties
│ └── preferences/
│ └── pages/
│ ├── AlgorithmsPage.java
│ ├── AnalysisPage.java
│ ├── CryptoPage.java
│ ├── EditorsPage.java
│ ├── GamesPage.java
│ ├── GeneralPage.java
│ ├── Messages.java
│ ├── VisualsPage.java
│ ├── messages.properties
│ └── messages_de.properties
├── org.jcryptool.core.cryptosystem/
│ ├── .classpath
│ ├── .project
│ ├── META-INF/
│ │ └── MANIFEST.MF
│ ├── OSGI-INF/
│ │ └── l10n/
│ │ ├── bundle.properties
│ │ └── bundle_de.properties
│ ├── build.properties
│ ├── pom.xml
│ └── src/
│ └── org/
│ └── jcryptool/
│ └── core/
│ └── cryptosystem/
│ ├── CryptosystemPlugin.java
│ ├── core/
│ │ ├── Alphabet.java
│ │ ├── Cryptosystem.java
│ │ ├── Key.java
│ │ ├── exception/
│ │ │ └── ElementNotInAlphabetException.java
│ │ └── text/
│ │ ├── CharAlphabet.java
│ │ ├── TextCompatibleAlphabet.java
│ │ ├── TextCompatibleAlphabetWrapper.java
│ │ ├── TextCompatibleCryptosystem.java
│ │ ├── TextCompatibleCryptosystemWrapper.java
│ │ └── TextConverter.java
│ └── vigenere/
│ ├── TextVigenere.java
│ ├── VigenereCryptosystem.java
│ └── VigenereKey.java
├── org.jcryptool.core.dependencies.feature/
│ ├── .project
│ ├── build.properties
│ ├── epl-v10.html
│ ├── feature.xml
│ └── pom.xml
├── org.jcryptool.core.dependencies.nl_de.feature/
│ ├── .project
│ ├── build.properties
│ ├── epl-v10.html
│ ├── feature.xml
│ └── pom.xml
├── org.jcryptool.core.feature/
│ ├── .project
│ ├── build.properties
│ ├── epl-v10.html
│ ├── feature.xml
│ └── pom.xml
├── org.jcryptool.core.help/
│ ├── .classpath
│ ├── .project
│ ├── META-INF/
│ │ └── MANIFEST.MF
│ ├── OSGI-INF/
│ │ └── l10n/
│ │ ├── bundle.properties
│ │ └── bundle_de.properties
│ ├── about.html
│ ├── build.properties
│ ├── css/
│ │ ├── book.css
│ │ └── narrow_book.css
│ ├── dev/
│ │ ├── jetty-server-9.4.30.v20200611-sources.jar
│ │ └── jetty-util-9.4.30.v20200611-sources.jar
│ ├── javascript/
│ │ ├── MathJax-master/
│ │ │ ├── .github/
│ │ │ │ ├── FUNDING.yml
│ │ │ │ └── ISSUE_TEMPLATE/
│ │ │ │ ├── bug_report.md
│ │ │ │ └── feature_request.md
│ │ │ ├── .gitignore
│ │ │ ├── .travis.yml
│ │ │ ├── CONTRIBUTING.md
│ │ │ ├── LICENSE
│ │ │ ├── README.md
│ │ │ ├── bower.json
│ │ │ ├── composer.json
│ │ │ ├── es5/
│ │ │ │ ├── a11y/
│ │ │ │ │ ├── assistive-mml.js
│ │ │ │ │ ├── complexity.js
│ │ │ │ │ ├── explorer.js
│ │ │ │ │ └── semantic-enrich.js
│ │ │ │ ├── adaptors/
│ │ │ │ │ └── liteDOM.js
│ │ │ │ ├── core.js
│ │ │ │ ├── input/
│ │ │ │ │ ├── asciimath.js
│ │ │ │ │ ├── mml/
│ │ │ │ │ │ └── entities.js
│ │ │ │ │ ├── mml.js
│ │ │ │ │ ├── tex/
│ │ │ │ │ │ └── extensions/
│ │ │ │ │ │ ├── action.js
│ │ │ │ │ │ ├── all-packages.js
│ │ │ │ │ │ ├── ams.js
│ │ │ │ │ │ ├── amscd.js
│ │ │ │ │ │ ├── autoload.js
│ │ │ │ │ │ ├── bbox.js
│ │ │ │ │ │ ├── boldsymbol.js
│ │ │ │ │ │ ├── braket.js
│ │ │ │ │ │ ├── bussproofs.js
│ │ │ │ │ │ ├── cancel.js
│ │ │ │ │ │ ├── color.js
│ │ │ │ │ │ ├── colorV2.js
│ │ │ │ │ │ ├── configMacros.js
│ │ │ │ │ │ ├── enclose.js
│ │ │ │ │ │ ├── extpfeil.js
│ │ │ │ │ │ ├── html.js
│ │ │ │ │ │ ├── mhchem.js
│ │ │ │ │ │ ├── newcommand.js
│ │ │ │ │ │ ├── noerrors.js
│ │ │ │ │ │ ├── noundefined.js
│ │ │ │ │ │ ├── physics.js
│ │ │ │ │ │ ├── require.js
│ │ │ │ │ │ ├── tagFormat.js
│ │ │ │ │ │ ├── unicode.js
│ │ │ │ │ │ └── verb.js
│ │ │ │ │ ├── tex-base.js
│ │ │ │ │ ├── tex-full.js
│ │ │ │ │ └── tex.js
│ │ │ │ ├── latest.js
│ │ │ │ ├── loader.js
│ │ │ │ ├── mml-chtml.js
│ │ │ │ ├── mml-svg.js
│ │ │ │ ├── node-main.js
│ │ │ │ ├── output/
│ │ │ │ │ ├── chtml/
│ │ │ │ │ │ └── fonts/
│ │ │ │ │ │ └── tex.js
│ │ │ │ │ ├── chtml.js
│ │ │ │ │ ├── svg/
│ │ │ │ │ │ └── fonts/
│ │ │ │ │ │ └── tex.js
│ │ │ │ │ └── svg.js
│ │ │ │ ├── sre/
│ │ │ │ │ ├── mathmaps/
│ │ │ │ │ │ ├── en.js
│ │ │ │ │ │ ├── es.js
│ │ │ │ │ │ ├── fr.js
│ │ │ │ │ │ ├── mathmaps_ie.js
│ │ │ │ │ │ └── nemeth.js
│ │ │ │ │ └── sre_browser.js
│ │ │ │ ├── startup.js
│ │ │ │ ├── tex-chtml-full.js
│ │ │ │ ├── tex-chtml.js
│ │ │ │ ├── tex-mml-chtml.js
│ │ │ │ ├── tex-mml-svg.js
│ │ │ │ ├── tex-svg-full.js
│ │ │ │ ├── tex-svg.js
│ │ │ │ └── ui/
│ │ │ │ └── menu.js
│ │ │ └── package.json
│ │ ├── bootstrap_jct_utilities.js
│ │ ├── jquery.js
│ │ ├── test.txt
│ │ └── tocbot-4.11.2/
│ │ ├── .babelrc
│ │ ├── .gitignore
│ │ ├── .travis.yml
│ │ ├── CHANGELOG.md
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── bower.json
│ │ ├── codecept.json
│ │ ├── dist/
│ │ │ ├── styles.css
│ │ │ ├── tocbot.css
│ │ │ └── tocbot.js
│ │ ├── index.d.ts
│ │ ├── next.config.js
│ │ ├── package.json
│ │ ├── pages/
│ │ │ ├── _config.js
│ │ │ ├── changelog.js
│ │ │ ├── index.js
│ │ │ └── skipRendering.js
│ │ ├── scripts/
│ │ │ └── fix-export.js
│ │ ├── server.js
│ │ ├── src/
│ │ │ ├── components/
│ │ │ │ └── Template/
│ │ │ │ ├── Hero/
│ │ │ │ │ └── index.js
│ │ │ │ ├── Tocbot/
│ │ │ │ │ └── index.js
│ │ │ │ ├── Tracking/
│ │ │ │ │ └── index.js
│ │ │ │ ├── TryIt/
│ │ │ │ │ └── index.js
│ │ │ │ └── index.js
│ │ │ ├── js/
│ │ │ │ ├── build-html.js
│ │ │ │ ├── default-options.js
│ │ │ │ ├── index.js
│ │ │ │ ├── parse-content.js
│ │ │ │ └── scroll-smooth/
│ │ │ │ └── index.js
│ │ │ ├── scss/
│ │ │ │ ├── _code-styles.scss
│ │ │ │ ├── _page-styles.scss
│ │ │ │ ├── _tocbot-core.scss
│ │ │ │ ├── _tocbot-default-theme.scss
│ │ │ │ ├── _tocbot-responsive.scss
│ │ │ │ ├── styles.scss
│ │ │ │ └── tocbot.scss
│ │ │ └── utils/
│ │ │ ├── make-ids.js
│ │ │ └── path.js
│ │ ├── test/
│ │ │ ├── data/
│ │ │ │ ├── json-data.js
│ │ │ │ ├── markdown.md
│ │ │ │ ├── rendered.html
│ │ │ │ ├── sample-bootstrap.html
│ │ │ │ └── sample-meat.html
│ │ │ ├── diff.html
│ │ │ ├── imageDiff.js
│ │ │ ├── index.js
│ │ │ ├── integration_test.js
│ │ │ └── steps_file.js
│ │ └── travis-deploy.sh
│ ├── nl/
│ │ ├── de/
│ │ │ ├── developer_about.txt
│ │ │ ├── help/
│ │ │ │ ├── home.html
│ │ │ │ ├── resources/
│ │ │ │ │ ├── book.css
│ │ │ │ │ └── narrow_book.css
│ │ │ │ └── users/
│ │ │ │ ├── about/
│ │ │ │ │ ├── about.html
│ │ │ │ │ ├── about.htmlxxx
│ │ │ │ │ └── tips.html
│ │ │ │ ├── algorithms/
│ │ │ │ │ ├── encryption/
│ │ │ │ │ │ ├── asymmetric/
│ │ │ │ │ │ │ └── toc.html
│ │ │ │ │ │ ├── classic/
│ │ │ │ │ │ │ └── toc.html
│ │ │ │ │ │ ├── hybrid/
│ │ │ │ │ │ │ └── toc.html
│ │ │ │ │ │ ├── symmetric/
│ │ │ │ │ │ │ └── toc.html
│ │ │ │ │ │ └── toc.html
│ │ │ │ │ ├── hash/
│ │ │ │ │ │ └── toc.html
│ │ │ │ │ ├── keystore/
│ │ │ │ │ │ └── toc.html
│ │ │ │ │ ├── mac/
│ │ │ │ │ │ └── toc.html
│ │ │ │ │ ├── randomnumber/
│ │ │ │ │ │ └── toc.html
│ │ │ │ │ ├── signature/
│ │ │ │ │ │ └── toc.html
│ │ │ │ │ └── toc.html
│ │ │ │ ├── analysis/
│ │ │ │ │ └── toc.html
│ │ │ │ ├── cryptology/
│ │ │ │ │ ├── crypto_methods.html
│ │ │ │ │ ├── crypto_timeline.html
│ │ │ │ │ ├── cryptology.html
│ │ │ │ │ └── toc.html
│ │ │ │ ├── games/
│ │ │ │ │ └── toc.html
│ │ │ │ ├── general/
│ │ │ │ │ ├── editor_hex.html
│ │ │ │ │ ├── editor_hex_manual.html
│ │ │ │ │ ├── editor_text.html
│ │ │ │ │ ├── editors.html
│ │ │ │ │ ├── images/
│ │ │ │ │ │ ├── JCT_GUI-Components-01_en.odg
│ │ │ │ │ │ └── JCT_GUI-Components-02_en.odg
│ │ │ │ │ ├── language.html
│ │ │ │ │ ├── perspective_algorithm.html
│ │ │ │ │ ├── perspective_default.html
│ │ │ │ │ ├── perspectives.html
│ │ │ │ │ ├── preferences.html
│ │ │ │ │ ├── preferences_provider.html
│ │ │ │ │ ├── toc.html
│ │ │ │ │ ├── updates.html
│ │ │ │ │ ├── view_algorithms.html
│ │ │ │ │ └── views.html
│ │ │ │ ├── toc.html
│ │ │ │ └── visualizations/
│ │ │ │ └── toc.html
│ │ │ ├── index.xml
│ │ │ ├── single/
│ │ │ │ ├── AES.html
│ │ │ │ ├── DSA.html
│ │ │ │ ├── ElGamal.html
│ │ │ │ ├── HMACMD5.html
│ │ │ │ ├── IDEA.html
│ │ │ │ ├── MD5.html
│ │ │ │ ├── RC6.html
│ │ │ │ ├── RNGSHA1.html
│ │ │ │ ├── RSA.html
│ │ │ │ ├── SHA1.html
│ │ │ │ └── SHA256.html
│ │ │ ├── toc.xml
│ │ │ ├── tocAES.xml
│ │ │ ├── tocDSA.xml
│ │ │ ├── tocElGamal.xml
│ │ │ ├── tocHMACMD5.xml
│ │ │ ├── tocIDEA.xml
│ │ │ ├── tocMD5.xml
│ │ │ ├── tocRC6.xml
│ │ │ ├── tocRNGSHA1.xml
│ │ │ ├── tocRSA.xml
│ │ │ └── tocSHA256.xml
│ │ ├── en/
│ │ │ ├── developer_about.txt
│ │ │ ├── help/
│ │ │ │ ├── home.html
│ │ │ │ ├── resources/
│ │ │ │ │ ├── book.css
│ │ │ │ │ └── narrow_book.css
│ │ │ │ └── users/
│ │ │ │ ├── about/
│ │ │ │ │ ├── about.html
│ │ │ │ │ ├── about.htmlxxx
│ │ │ │ │ └── tips.html
│ │ │ │ ├── algorithms/
│ │ │ │ │ ├── encryption/
│ │ │ │ │ │ ├── asymmetric/
│ │ │ │ │ │ │ └── toc.html
│ │ │ │ │ │ ├── classic/
│ │ │ │ │ │ │ └── toc.html
│ │ │ │ │ │ ├── hybrid/
│ │ │ │ │ │ │ └── toc.html
│ │ │ │ │ │ ├── symmetric/
│ │ │ │ │ │ │ └── toc.html
│ │ │ │ │ │ └── toc.html
│ │ │ │ │ ├── hash/
│ │ │ │ │ │ └── toc.html
│ │ │ │ │ ├── keystore/
│ │ │ │ │ │ └── toc.html
│ │ │ │ │ ├── mac/
│ │ │ │ │ │ └── toc.html
│ │ │ │ │ ├── randomnumber/
│ │ │ │ │ │ └── toc.html
│ │ │ │ │ ├── signature/
│ │ │ │ │ │ └── toc.html
│ │ │ │ │ └── toc.html
│ │ │ │ ├── analysis/
│ │ │ │ │ └── toc.html
│ │ │ │ ├── cryptology/
│ │ │ │ │ ├── crypto_methods.html
│ │ │ │ │ ├── crypto_timeline.html
│ │ │ │ │ ├── cryptology.html
│ │ │ │ │ └── toc.html
│ │ │ │ ├── games/
│ │ │ │ │ └── toc.html
│ │ │ │ ├── general/
│ │ │ │ │ ├── editor_hex.html
│ │ │ │ │ ├── editor_hex_manual.html
│ │ │ │ │ ├── editor_text.html
│ │ │ │ │ ├── editors.html
│ │ │ │ │ ├── images/
│ │ │ │ │ │ ├── JCT_GUI-Components-01_en.odg
│ │ │ │ │ │ └── JCT_GUI-Components-02_en.odg
│ │ │ │ │ ├── language.html
│ │ │ │ │ ├── perspective_algorithm.html
│ │ │ │ │ ├── perspective_default.html
│ │ │ │ │ ├── perspectives.html
│ │ │ │ │ ├── preferences.html
│ │ │ │ │ ├── preferences_provider.html
│ │ │ │ │ ├── toc.html
│ │ │ │ │ ├── updates.html
│ │ │ │ │ ├── view_algorithms.html
│ │ │ │ │ └── views.html
│ │ │ │ ├── toc.html
│ │ │ │ └── visualizations/
│ │ │ │ └── toc.html
│ │ │ ├── index.xml
│ │ │ ├── single/
│ │ │ │ ├── AES.html
│ │ │ │ ├── DSA.html
│ │ │ │ ├── ElGamal.html
│ │ │ │ ├── HMACMD5.html
│ │ │ │ ├── IDEA.html
│ │ │ │ ├── MD5.html
│ │ │ │ ├── RC6.html
│ │ │ │ ├── RNGSHA1.html
│ │ │ │ ├── RSA.html
│ │ │ │ ├── SHA1.html
│ │ │ │ └── SHA256.html
│ │ │ ├── toc.xml
│ │ │ ├── tocAES.xml
│ │ │ ├── tocDSA.xml
│ │ │ ├── tocElGamal.xml
│ │ │ ├── tocHMACMD5.xml
│ │ │ ├── tocIDEA.xml
│ │ │ ├── tocMD5.xml
│ │ │ ├── tocRC6.xml
│ │ │ ├── tocRNGSHA1.xml
│ │ │ ├── tocRSA.xml
│ │ │ └── tocSHA256.xml
│ │ └── info-box-examples.html
│ ├── plugin.xml
│ ├── pom.xml
│ └── src/
│ └── org/
│ └── jcryptool/
│ └── core/
│ └── help/
│ ├── CreditsPage.java
│ ├── Doc_Server.java
│ ├── HelpInjectionService.java
│ ├── HelpPlugin.java
│ ├── JCTJSInjectionFilter.java
│ ├── JCTJS_Server.java
│ ├── Messages.java
│ ├── NotificationDisplayComposite.java
│ ├── ServerStartup.java
│ ├── messages.properties
│ └── messages_de.properties
├── org.jcryptool.core.introduction/
│ ├── .classpath
│ ├── .project
│ ├── META-INF/
│ │ └── MANIFEST.MF
│ ├── OSGI-INF/
│ │ └── l10n/
│ │ ├── bundle.properties
│ │ └── bundle_de.properties
│ ├── build.properties
│ ├── nl/
│ │ ├── de/
│ │ │ └── contexts.xml
│ │ └── en/
│ │ └── contexts.xml
│ ├── plugin.xml
│ ├── pom.xml
│ └── src/
│ └── org/
│ ├── eclipse/
│ │ └── nebula/
│ │ └── effects/
│ │ └── stw/
│ │ ├── ImageCapture.java
│ │ ├── ImageTransitionable.java
│ │ ├── Transition.java
│ │ ├── TransitionListener.java
│ │ ├── TransitionManager.java
│ │ ├── Transitionable.java
│ │ ├── transitions/
│ │ │ └── SlideTransition.java
│ │ └── utils/
│ │ └── Utilities.java
│ └── jcryptool/
│ └── core/
│ └── introduction/
│ ├── IntroPageStartup.java
│ ├── Messages.java
│ ├── handler/
│ │ ├── AutoslideHandler.java
│ │ ├── Messages.java
│ │ ├── messages.properties
│ │ └── messages_de.properties
│ ├── messages.properties
│ ├── messages_de.properties
│ ├── utils/
│ │ ├── DebounceExecutor.java
│ │ └── ImageScaler.java
│ └── views/
│ ├── AlgorithmInstruction.java
│ ├── IntroductionPlugin.java
│ ├── Messages.java
│ ├── messages.properties
│ └── messages_de.properties
├── org.jcryptool.core.logging/
│ ├── .classpath
│ ├── .project
│ ├── META-INF/
│ │ └── MANIFEST.MF
│ ├── OSGI-INF/
│ │ └── l10n/
│ │ ├── bundle.properties
│ │ └── bundle_de.properties
│ ├── about.html
│ ├── build.properties
│ ├── nl/
│ │ ├── de/
│ │ │ └── contexts.xml
│ │ └── en/
│ │ └── contexts.xml
│ ├── plugin.xml
│ ├── pom.xml
│ └── src/
│ └── org/
│ └── jcryptool/
│ └── core/
│ └── logging/
│ ├── LoggingPlugin.java
│ ├── dialogs/
│ │ ├── ExceptionDetailsErrorDialog.java
│ │ ├── JCTMessageDialog.java
│ │ ├── JFaceResources.java
│ │ ├── Messages.java
│ │ ├── messages.properties
│ │ └── messages_de.properties
│ ├── preferences/
│ │ └── pages/
│ │ ├── LoggerPage.java
│ │ ├── Messages.java
│ │ ├── messages.properties
│ │ └── messages_de.properties
│ └── utils/
│ └── LogUtil.java
├── org.jcryptool.core.nl/
│ ├── .classpath
│ ├── .project
│ ├── META-INF/
│ │ └── MANIFEST.MF
│ ├── about.html
│ ├── build.properties
│ ├── fragment.xml
│ ├── nl/
│ │ ├── de/
│ │ │ ├── contexts.xml
│ │ │ ├── css/
│ │ │ │ ├── root.css
│ │ │ │ ├── shared.css
│ │ │ │ └── standby.css
│ │ │ ├── firststeps/
│ │ │ │ └── firststeps.html
│ │ │ ├── introContent.xml
│ │ │ ├── overview/
│ │ │ │ └── overview.html
│ │ │ ├── root.html
│ │ │ ├── tutorials/
│ │ │ │ └── tutorials.html
│ │ │ └── whatsnew/
│ │ │ └── whatsnew.html
│ │ └── en/
│ │ ├── contexts.xml
│ │ ├── css/
│ │ │ ├── root.css
│ │ │ ├── shared.css
│ │ │ └── standby.css
│ │ ├── firststeps/
│ │ │ └── firststeps.html
│ │ ├── introContent.xml
│ │ ├── overview/
│ │ │ └── overview.html
│ │ ├── root.html
│ │ ├── tutorials/
│ │ │ └── tutorials.html
│ │ └── whatsnew/
│ │ └── whatsnew.html
│ └── pom.xml
├── org.jcryptool.core.operations/
│ ├── .classpath
│ ├── .project
│ ├── META-INF/
│ │ └── MANIFEST.MF
│ ├── OSGI-INF/
│ │ └── l10n/
│ │ ├── bundle.properties
│ │ └── bundle_de.properties
│ ├── about.html
│ ├── build.properties
│ ├── nl/
│ │ ├── de/
│ │ │ └── contexts.xml
│ │ └── en/
│ │ └── contexts.xml
│ ├── plugin.xml
│ ├── pom.xml
│ ├── schema/
│ │ ├── algorithms_cmd.exsd
│ │ ├── alphabets.exsd
│ │ ├── analysis.exsd
│ │ ├── editorServices.exsd
│ │ ├── games.exsd
│ │ ├── keystores.exsd
│ │ ├── operationsManager.exsd
│ │ ├── pkcsFactories.exsd
│ │ ├── providers.exsd
│ │ ├── providers2.exsd
│ │ └── visuals.exsd
│ ├── src/
│ │ └── org/
│ │ └── jcryptool/
│ │ └── core/
│ │ └── operations/
│ │ ├── AbstractOperationsManager.java
│ │ ├── CommandInfo.java
│ │ ├── IOperationsConstants.java
│ │ ├── OperationsPlugin.java
│ │ ├── algorithm/
│ │ │ ├── AbstractAlgorithm.java
│ │ │ ├── AbstractAlgorithmHandler.java
│ │ │ ├── AlgorithmDescriptor.java
│ │ │ ├── AlgorithmRegistry.java
│ │ │ ├── IAlgorithmDescriptor.java
│ │ │ ├── Messages.java
│ │ │ ├── ShadowAlgorithmHandler.java
│ │ │ ├── classic/
│ │ │ │ ├── AbstractClassicAlgorithm.java
│ │ │ │ ├── IClassicAlgorithmEngine.java
│ │ │ │ └── textmodify/
│ │ │ │ ├── Messages.java
│ │ │ │ ├── Transform.java
│ │ │ │ ├── TransformData.java
│ │ │ │ ├── messages.properties
│ │ │ │ └── messages_de.properties
│ │ │ ├── messages.properties
│ │ │ ├── messages_de.properties
│ │ │ └── modern/
│ │ │ ├── AbstractModernAlgorithm.java
│ │ │ ├── asymmetric/
│ │ │ │ └── AbstractAsymmetricAlgorithm.java
│ │ │ ├── hash/
│ │ │ │ └── AbstractMessageDigestAlgorithm.java
│ │ │ ├── hybrid/
│ │ │ │ └── AbstractHybridAlgorithm.java
│ │ │ └── symmetric/
│ │ │ └── AbstractSymmetricAlgorithm.java
│ │ ├── alphabets/
│ │ │ ├── AbstractAlphabet.java
│ │ │ ├── AbstractAlphabetStore.java
│ │ │ ├── AbstractAlphabetStore2.java
│ │ │ ├── AlphaConverter.java
│ │ │ ├── AlphabetReference.java
│ │ │ ├── AlphabetsManager.java
│ │ │ ├── AlphabetsManager2.java
│ │ │ └── GenericAlphabet.java
│ │ ├── dataobject/
│ │ │ ├── DataObjectConverter.java
│ │ │ ├── IDataObject.java
│ │ │ ├── classic/
│ │ │ │ ├── ClassicDataObject.java
│ │ │ │ ├── ExtendedClassicDataObject.java
│ │ │ │ └── IClassicDataObject.java
│ │ │ └── modern/
│ │ │ ├── IModernDataObject.java
│ │ │ ├── ModernDataObject.java
│ │ │ ├── asymmetric/
│ │ │ │ ├── AsymmetricDataObject.java
│ │ │ │ └── IAsymmetricDataObject.java
│ │ │ ├── hybrid/
│ │ │ │ ├── HybridDataObject.java
│ │ │ │ └── IHybridDataObject.java
│ │ │ └── symmetric/
│ │ │ ├── ISymmetricDataObject.java
│ │ │ ├── LfsrDataObject.java
│ │ │ └── SymmetricDataObject.java
│ │ ├── editors/
│ │ │ ├── AbstractEditorService.java
│ │ │ ├── EditorNotFoundException.java
│ │ │ ├── EditorUtils.java
│ │ │ ├── EditorsManager.java
│ │ │ ├── JCTElementFactory.java
│ │ │ ├── Messages.java
│ │ │ ├── messages.properties
│ │ │ ├── messages_de.properties
│ │ │ └── messages_es.properties
│ │ ├── keys/
│ │ │ └── KeyVerificator.java
│ │ ├── pkcs/
│ │ │ ├── AbstractPKCS7Factory.java
│ │ │ ├── IPKCSFactory.java
│ │ │ └── PKCSManager.java
│ │ ├── providers/
│ │ │ ├── AbstractProviderController.java
│ │ │ ├── ProviderDescriptor.java
│ │ │ ├── ProviderManager2.java
│ │ │ ├── ProvidersManager.java
│ │ │ └── preferences/
│ │ │ ├── Messages.java
│ │ │ ├── ProvidersPreferencesInitializer.java
│ │ │ ├── ProvidersPreferencesPage.java
│ │ │ ├── messages.properties
│ │ │ └── messages_de.properties
│ │ └── util/
│ │ ├── ByteArrayUtils.java
│ │ └── PathEditorInput.java
│ └── templates/
│ ├── de.txt
│ ├── empty.txt
│ ├── en.txt
│ └── es.txt
├── org.jcryptool.core.splitpackages/
│ ├── .classpath
│ ├── .project
│ ├── META-INF/
│ │ └── MANIFEST.MF
│ ├── build.properties
│ ├── jsr305/
│ │ └── jsr305-3.0.2.jar
│ ├── pom.xml
│ └── src/
│ └── .gitkeep
├── org.jcryptool.core.util/
│ ├── .classpath
│ ├── .project
│ ├── META-INF/
│ │ └── MANIFEST.MF
│ ├── OSGI-INF/
│ │ └── l10n/
│ │ ├── bundle.properties
│ │ └── bundle_de.properties
│ ├── build.properties
│ ├── plugin.xml
│ ├── pom.xml
│ └── src/
│ └── org/
│ └── jcryptool/
│ └── core/
│ └── util/
│ ├── DynamicOnetimeTask.java
│ ├── calendar/
│ │ └── CalendarService.java
│ ├── colors/
│ │ └── ColorService.java
│ ├── constants/
│ │ ├── IConstants.java
│ │ ├── Messages.java
│ │ ├── messages.properties
│ │ └── messages_de.properties
│ ├── directories/
│ │ └── DirectoryService.java
│ ├── fonts/
│ │ └── FontService.java
│ ├── images/
│ │ └── ImageService.java
│ ├── input/
│ │ ├── AbstractUIInput.java
│ │ ├── ButtonInput.java
│ │ ├── InputVerificationResult.java
│ │ ├── Messages.java
│ │ ├── TextfieldInput.java
│ │ ├── handler/
│ │ │ ├── UIInputResultHandler.java
│ │ │ └── WidgetRelatedUIInputResultHandler.java
│ │ ├── messages.properties
│ │ └── messages_de.properties
│ ├── numbers/
│ │ └── NumberService.java
│ ├── ui/
│ │ ├── HexTextbox.java
│ │ ├── Messages.java
│ │ ├── PasswordPrompt.java
│ │ ├── SingleVanishTooltipLauncher.java
│ │ ├── StartupPartTracker.java
│ │ ├── TitleAndDescriptionComposite.java
│ │ ├── VisualPluginHelp.java
│ │ ├── auto/
│ │ │ ├── LayoutAdvisor.java
│ │ │ ├── ScrollingUtils.java
│ │ │ └── SmoothScroller.java
│ │ ├── layout/
│ │ │ └── GridDataBuilder.java
│ │ ├── messages.properties
│ │ └── messages_de.properties
│ └── units/
│ ├── BigMath.java
│ ├── ByteFormatter.java
│ ├── DefaultByteFormatter.java
│ ├── Messages.java
│ ├── UnitsService.java
│ ├── messages.properties
│ └── messages_de.properties
├── org.jcryptool.core.views/
│ ├── .classpath
│ ├── .project
│ ├── META-INF/
│ │ └── MANIFEST.MF
│ ├── OSGI-INF/
│ │ └── l10n/
│ │ ├── bundle.properties
│ │ └── bundle_de.properties
│ ├── about.html
│ ├── build.properties
│ ├── nl/
│ │ ├── de/
│ │ │ └── contexts.xml
│ │ └── en/
│ │ └── contexts.xml
│ ├── plugin.xml
│ ├── pom.xml
│ └── src/
│ └── org/
│ └── jcryptool/
│ └── core/
│ └── views/
│ ├── AlgorithmView.java
│ ├── ISearchable.java
│ ├── Messages.java
│ ├── ViewsPlugin.java
│ ├── content/
│ │ ├── PaletteView.java
│ │ ├── TreeView.java
│ │ ├── palette/
│ │ │ ├── AlgorithmPaletteViewer.java
│ │ │ ├── Messages.java
│ │ │ ├── ViewProviderPaletteViewer.java
│ │ │ ├── messages.properties
│ │ │ └── messages_de.properties
│ │ ├── structure/
│ │ │ ├── NameSorter.java
│ │ │ ├── TreeObject.java
│ │ │ ├── TreeParent.java
│ │ │ ├── ViewContentProvider.java
│ │ │ └── ViewLabelProvider.java
│ │ └── tree/
│ │ ├── AlgorithmTreeViewer.java
│ │ ├── Messages.java
│ │ ├── ViewProviderTreeViewer.java
│ │ ├── messages.properties
│ │ └── messages_de.properties
│ ├── messages.properties
│ └── messages_de.properties
├── org.jcryptool.crypto.feature/
│ ├── .project
│ ├── build.properties
│ ├── epl-v10.html
│ ├── feature.xml
│ └── pom.xml
├── org.jcryptool.crypto.flexiprovider/
│ ├── .classpath
│ ├── .project
│ ├── META-INF/
│ │ └── MANIFEST.MF
│ ├── OSGI-INF/
│ │ └── l10n/
│ │ ├── bundle.properties
│ │ └── bundle_de.properties
│ ├── build.properties
│ ├── plugin.xml
│ ├── pom.xml
│ └── src/
│ └── org/
│ └── jcryptool/
│ └── crypto/
│ └── flexiprovider/
│ ├── FlexiProviderPlugin.java
│ ├── descriptors/
│ │ ├── IFlexiProviderOperation.java
│ │ ├── algorithms/
│ │ │ ├── AlgorithmDescriptor.java
│ │ │ ├── BlockCipherDescriptor.java
│ │ │ └── SecureRandomDescriptor.java
│ │ ├── meta/
│ │ │ ├── MetaAlgorithm.java
│ │ │ ├── MetaKeyGenerator.java
│ │ │ ├── MetaLength.java
│ │ │ ├── MetaMode.java
│ │ │ ├── MetaOID.java
│ │ │ ├── MetaPaddingScheme.java
│ │ │ └── interfaces/
│ │ │ ├── IMetaAlgorithm.java
│ │ │ ├── IMetaEntry.java
│ │ │ ├── IMetaKeyGenerator.java
│ │ │ ├── IMetaLength.java
│ │ │ ├── IMetaMode.java
│ │ │ ├── IMetaOID.java
│ │ │ └── IMetaPaddingScheme.java
│ │ └── reflect/
│ │ ├── MetaConstructor.java
│ │ ├── MetaParameter.java
│ │ ├── MetaSpec.java
│ │ └── interfaces/
│ │ ├── IMetaConstructor.java
│ │ ├── IMetaParameter.java
│ │ └── IMetaSpec.java
│ ├── exception/
│ │ ├── FlexiProviderException.java
│ │ └── InvalidAlgorithmsXMLElementException.java
│ ├── reflect/
│ │ ├── ClassUtil.java
│ │ └── Reflector.java
│ ├── types/
│ │ ├── OperationType.java
│ │ └── RegistryType.java
│ ├── ui/
│ │ ├── nodes/
│ │ │ ├── ITreeNode.java
│ │ │ └── TreeNode.java
│ │ └── perspective/
│ │ └── FlexiProviderPerspective.java
│ └── xml/
│ ├── AlgorithmsXMLConstants.java
│ ├── AlgorithmsXMLManager.java
│ └── FlexiProviderRootElement.java
├── org.jcryptool.crypto.flexiprovider.algorithms/
│ ├── .classpath
│ ├── .project
│ ├── META-INF/
│ │ └── MANIFEST.MF
│ ├── OSGI-INF/
│ │ └── l10n/
│ │ ├── bundle.properties
│ │ └── bundle_de.properties
│ ├── build.properties
│ ├── nl/
│ │ ├── de/
│ │ │ ├── contexts.xml
│ │ │ └── contexts_algorithms.xml
│ │ └── en/
│ │ ├── contexts.xml
│ │ └── contexts_algorithms.xml
│ ├── plugin.xml
│ ├── pom.xml
│ ├── schema/
│ │ └── newOperation.exsd
│ ├── src/
│ │ └── org/
│ │ └── jcryptool/
│ │ └── crypto/
│ │ └── flexiprovider/
│ │ └── algorithms/
│ │ ├── AlgorithmsManager.java
│ │ ├── FlexiProviderAlgorithmsPlugin.java
│ │ ├── listeners/
│ │ │ ├── INewOperationListener.java
│ │ │ └── NewOperationManager.java
│ │ └── ui/
│ │ ├── dynamic/
│ │ │ ├── DynamicComposite.java
│ │ │ ├── IAlgorithmParameterInputArea.java
│ │ │ ├── IDynamicComposite.java
│ │ │ ├── IInputArea.java
│ │ │ ├── InputFactory.java
│ │ │ ├── Messages.java
│ │ │ ├── composites/
│ │ │ │ ├── ByteArrayInputArea.java
│ │ │ │ ├── CurveParamSelectionArea.java
│ │ │ │ ├── DiscreteIntInputArea.java
│ │ │ │ ├── FixedModeParameterArea.java
│ │ │ │ ├── FlexiBigIntInputArea.java
│ │ │ │ ├── Messages.java
│ │ │ │ ├── QuadraticIdealComposite.java
│ │ │ │ ├── RangeIntInputArea.java
│ │ │ │ ├── StringInputArea.java
│ │ │ │ ├── UnspecifiedIntInputArea.java
│ │ │ │ ├── VariableModeParameterArea.java
│ │ │ │ ├── messages.properties
│ │ │ │ └── messages_de.properties
│ │ │ ├── messages.properties
│ │ │ └── messages_de.properties
│ │ ├── views/
│ │ │ ├── FlexiProviderAlgorithmsView.java
│ │ │ ├── nodes/
│ │ │ │ ├── AlgorithmNode.java
│ │ │ │ ├── CategoryNode.java
│ │ │ │ └── FolderNode.java
│ │ │ └── providers/
│ │ │ ├── FlexiProviderAlgorithmsViewContentProvider.java
│ │ │ ├── FlexiProviderAlgorithmsViewLabelProvider.java
│ │ │ ├── Messages.java
│ │ │ ├── messages.properties
│ │ │ └── messages_de.properties
│ │ └── wizards/
│ │ ├── AlgorithmIntroductionPage.java
│ │ ├── AlgorithmParameterWizardPage.java
│ │ ├── AlgorithmWizard.java
│ │ ├── Messages.java
│ │ ├── blockcipher/
│ │ │ ├── BlockCipherIntroductionPage.java
│ │ │ ├── BlockCipherWizard.java
│ │ │ ├── BlockCipherWizardDialog.java
│ │ │ ├── IBlockCipherWizardListener.java
│ │ │ ├── Messages.java
│ │ │ ├── ModeParameterSpecPage.java
│ │ │ ├── messages.properties
│ │ │ └── messages_de.properties
│ │ ├── messages.properties
│ │ ├── messages_de.properties
│ │ ├── securerandom/
│ │ │ ├── Messages.java
│ │ │ ├── SecureRandomWizard.java
│ │ │ ├── SecureRandomWizardPage.java
│ │ │ ├── messages.properties
│ │ │ └── messages_de.properties
│ │ └── signature/
│ │ ├── Messages.java
│ │ ├── SignatureWizard.java
│ │ ├── SignatureWizardPage.java
│ │ ├── messages.properties
│ │ └── messages_de.properties
│ └── xml/
│ └── help_algorithms.xml
├── org.jcryptool.crypto.flexiprovider.engines/
│ ├── .classpath
│ ├── .project
│ ├── META-INF/
│ │ └── MANIFEST.MF
│ ├── OSGI-INF/
│ │ └── l10n/
│ │ ├── bundle.properties
│ │ └── bundle_de.properties
│ ├── build.properties
│ ├── plugin.xml
│ ├── pom.xml
│ └── src/
│ └── org/
│ └── jcryptool/
│ └── crypto/
│ └── flexiprovider/
│ └── engines/
│ ├── FlexiProviderEngine.java
│ ├── FlexiProviderEngineFactory.java
│ ├── FlexiProviderEnginesPlugin.java
│ ├── Messages.java
│ ├── cipher/
│ │ ├── AsymmetricBlockCipherEngine.java
│ │ ├── AsymmetricHybridCipherEngine.java
│ │ ├── BlockCipherEngine.java
│ │ ├── CipherEngine.java
│ │ ├── Messages.java
│ │ ├── messages.properties
│ │ └── messages_de.properties
│ ├── listener/
│ │ ├── CheckOperationListener.java
│ │ └── PerformOperationListener.java
│ ├── mac/
│ │ ├── MacEngine.java
│ │ ├── Messages.java
│ │ ├── messages.properties
│ │ └── messages_de.properties
│ ├── messagedigest/
│ │ └── MessageDigestEngine.java
│ ├── messages.properties
│ ├── messages_de.properties
│ ├── securerandom/
│ │ └── SecureRandomEngine.java
│ └── signature/
│ ├── Messages.java
│ ├── SignatureEngine.java
│ ├── messages.properties
│ └── messages_de.properties
├── org.jcryptool.crypto.flexiprovider.feature/
│ ├── .project
│ ├── build.properties
│ ├── epl-v10.html
│ ├── feature.xml
│ └── pom.xml
├── org.jcryptool.crypto.flexiprovider.integrator/
│ ├── .classpath
│ ├── .project
│ ├── META-INF/
│ │ └── MANIFEST.MF
│ ├── OSGI-INF/
│ │ └── l10n/
│ │ ├── bundle.properties
│ │ └── bundle_de.properties
│ ├── build.properties
│ ├── nl/
│ │ ├── de/
│ │ │ └── contexts.xml
│ │ └── en/
│ │ └── contexts.xml
│ ├── plugin.xml
│ ├── pom.xml
│ └── src/
│ └── org/
│ └── jcryptool/
│ └── crypto/
│ └── flexiprovider/
│ └── integrator/
│ ├── IntegratorHandler.java
│ ├── IntegratorOperation.java
│ ├── IntegratorPlugin.java
│ ├── IntegratorWizard.java
│ ├── IntegratorWizardPage.java
│ ├── Messages.java
│ ├── NewKeyComposite.java
│ ├── NewKeyPairComposite.java
│ ├── asymmetric/
│ │ ├── elgamal/
│ │ │ ├── ElGamal.java
│ │ │ └── ElGamalHandler.java
│ │ └── rsa/
│ │ ├── Rsa.java
│ │ └── RsaHandler.java
│ ├── blockcipher/
│ │ ├── aes/
│ │ │ ├── Aes.java
│ │ │ └── AesHandler.java
│ │ ├── idea/
│ │ │ ├── Idea.java
│ │ │ └── IdeaHandler.java
│ │ └── rc6/
│ │ ├── Rc6.java
│ │ └── Rc6Handler.java
│ ├── mac/
│ │ └── hmacmd5/
│ │ ├── HMacMd5.java
│ │ └── HMacMd5Handler.java
│ ├── messagedigest/
│ │ ├── md5/
│ │ │ ├── Md5.java
│ │ │ └── Md5Handler.java
│ │ └── sha/
│ │ ├── Sha.java
│ │ └── ShaHandler.java
│ ├── messages.properties
│ ├── messages_de.properties
│ ├── prng/
│ │ └── sha1/
│ │ ├── Sha1.java
│ │ └── Sha1Handler.java
│ └── signature/
│ └── dsa/
│ ├── Dsa.java
│ └── DsaHandler.java
├── org.jcryptool.crypto.flexiprovider.keystore/
│ ├── .classpath
│ ├── .project
│ ├── META-INF/
│ │ └── MANIFEST.MF
│ ├── OSGI-INF/
│ │ └── l10n/
│ │ ├── bundle.properties
│ │ └── bundle_de.properties
│ ├── build.properties
│ ├── plugin.xml
│ ├── pom.xml
│ └── src/
│ └── org/
│ └── jcryptool/
│ └── crypto/
│ └── flexiprovider/
│ └── keystore/
│ ├── FlexiProviderKeystorePlugin.java
│ ├── ImportManager.java
│ ├── KeyStoreHelper.java
│ ├── actions/
│ │ ├── ImportKeyHandler.java
│ │ ├── Messages.java
│ │ ├── NewKeyPairHandler.java
│ │ ├── NewSymmetricKeyHandler.java
│ │ ├── messages.properties
│ │ └── messages_de.properties
│ └── wizards/
│ ├── ImportWizard.java
│ ├── ImportWizardPage.java
│ ├── Messages.java
│ ├── NewKeyPairWizard.java
│ ├── NewKeyPairWizardPage.java
│ ├── NewSymmetricKeyWizard.java
│ ├── NewSymmetricKeyWizardPage.java
│ ├── messages.properties
│ └── messages_de.properties
├── org.jcryptool.crypto.flexiprovider.operations/
│ ├── .classpath
│ ├── .project
│ ├── META-INF/
│ │ └── MANIFEST.MF
│ ├── OSGI-INF/
│ │ └── l10n/
│ │ ├── bundle.properties
│ │ └── bundle_de.properties
│ ├── build.properties
│ ├── nl/
│ │ ├── de/
│ │ │ └── contexts.xml
│ │ └── en/
│ │ └── contexts.xml
│ ├── plugin.xml
│ ├── pom.xml
│ ├── schema/
│ │ ├── checkFlexiProviderOperation.exsd
│ │ └── performFlexiProviderOperation.exsd
│ └── src/
│ └── org/
│ └── jcryptool/
│ └── crypto/
│ └── flexiprovider/
│ └── operations/
│ ├── FlexiProviderOperationsPlugin.java
│ ├── Messages.java
│ ├── NewOperationListener.java
│ ├── OperationsManager.java
│ ├── engines/
│ │ ├── CheckOperationManager.java
│ │ ├── ICheckOperationListener.java
│ │ ├── IPerfomOperationListener.java
│ │ └── PerformOperationManager.java
│ ├── messages.properties
│ ├── messages_de.properties
│ ├── ui/
│ │ ├── actions/
│ │ │ ├── context/
│ │ │ │ ├── Messages.java
│ │ │ │ ├── RemoveHandler.java
│ │ │ │ ├── RemoveKeyHandler.java
│ │ │ │ ├── RenameHandler.java
│ │ │ │ ├── io/
│ │ │ │ │ ├── Messages.java
│ │ │ │ │ ├── SelectInputFileHandler.java
│ │ │ │ │ ├── SelectOutputFileHandler.java
│ │ │ │ │ ├── SelectSignatureHandler.java
│ │ │ │ │ ├── SetInputEditorHandler.java
│ │ │ │ │ ├── SetOutputEditorHandler.java
│ │ │ │ │ ├── UndefinedOperationException.java
│ │ │ │ │ ├── messages.properties
│ │ │ │ │ └── messages_de.properties
│ │ │ │ ├── messages.properties
│ │ │ │ ├── messages_de.properties
│ │ │ │ └── ops/
│ │ │ │ ├── DecryptHandler.java
│ │ │ │ ├── EncryptHandler.java
│ │ │ │ ├── Messages.java
│ │ │ │ ├── messages.properties
│ │ │ │ └── messages_de.properties
│ │ │ └── menu/
│ │ │ ├── ExecuteOperationHandler.java
│ │ │ ├── ExportOperationHandler.java
│ │ │ ├── ImportOperationHandler.java
│ │ │ ├── Messages.java
│ │ │ ├── messages.properties
│ │ │ └── messages_de.properties
│ │ ├── handlers/
│ │ │ ├── Messages.java
│ │ │ ├── SelectKeyHandler.java
│ │ │ ├── messages.properties
│ │ │ └── messages_de.properties
│ │ ├── listeners/
│ │ │ ├── IOperationChangedListener.java
│ │ │ └── ISelectedOperationListener.java
│ │ └── views/
│ │ ├── EditorDragListener.java
│ │ ├── FlexiProviderOperationsView.java
│ │ ├── KeyDropListener.java
│ │ ├── Messages.java
│ │ ├── messages.properties
│ │ ├── messages_de.properties
│ │ ├── nodes/
│ │ │ ├── EntryNode.java
│ │ │ ├── Messages.java
│ │ │ ├── algorithms/
│ │ │ │ ├── AlgorithmNode.java
│ │ │ │ ├── Messages.java
│ │ │ │ ├── messages.properties
│ │ │ │ └── messages_de.properties
│ │ │ ├── io/
│ │ │ │ ├── IONode.java
│ │ │ │ ├── InputNode.java
│ │ │ │ ├── InputOutputNode.java
│ │ │ │ ├── Messages.java
│ │ │ │ ├── OutputNode.java
│ │ │ │ ├── SignatureIONode.java
│ │ │ │ ├── SignatureNode.java
│ │ │ │ ├── messages.properties
│ │ │ │ └── messages_de.properties
│ │ │ ├── keys/
│ │ │ │ ├── KeyNode.java
│ │ │ │ ├── KeyPairNode.java
│ │ │ │ ├── Messages.java
│ │ │ │ ├── SecretKeyNode.java
│ │ │ │ ├── messages.properties
│ │ │ │ └── messages_de.properties
│ │ │ ├── messages.properties
│ │ │ ├── messages_de.properties
│ │ │ └── ops/
│ │ │ ├── Messages.java
│ │ │ ├── OperationsNode.java
│ │ │ ├── messages.properties
│ │ │ └── messages_de.properties
│ │ └── providers/
│ │ ├── FlexiProviderOperationsViewContentProvider.java
│ │ └── FlexiProviderOperationsViewLabelProvider.java
│ └── xml/
│ ├── EntryElement.java
│ ├── ExportRootElement.java
│ ├── Messages.java
│ ├── OperationsViewEntryRootElement.java
│ ├── algorithms/
│ │ ├── AlgorithmDescriptorElement.java
│ │ ├── BlockCipherDescriptorElement.java
│ │ ├── SecureRandomDescriptorElement.java
│ │ └── paramspecs/
│ │ ├── AlgorithmParameterSpecElement.java
│ │ ├── Base64Coder.java
│ │ └── ModeParameterSpecElement.java
│ ├── io/
│ │ ├── InputOutputElement.java
│ │ ├── InputSignatureElement.java
│ │ ├── Messages.java
│ │ ├── OutputElement.java
│ │ ├── messages.properties
│ │ └── messages_de.properties
│ ├── keys/
│ │ ├── KeyElement.java
│ │ ├── Messages.java
│ │ ├── messages.properties
│ │ └── messages_de.properties
│ ├── messages.properties
│ ├── messages_de.properties
│ └── ops/
│ └── OperationElement.java
├── org.jcryptool.crypto.keystore/
│ ├── .classpath
│ ├── .project
│ ├── META-INF/
│ │ └── MANIFEST.MF
│ ├── OSGI-INF/
│ │ └── l10n/
│ │ ├── bundle.properties
│ │ └── bundle_de.properties
│ ├── build.properties
│ ├── contactstore/
│ │ └── contacts.xml
│ ├── keystore/
│ │ ├── defunct_keystore_apr2022.ksf
│ │ ├── jctKeystore.ksf
│ │ ├── jctKeystore_2018.ksf
│ │ ├── jctKeystore_2020.ksf
│ │ ├── jctKeystore_Nov06.ksf
│ │ ├── jctKeystore_Nov18_2020.ksf
│ │ └── jctKeystore_Oct_2020.ksf
│ ├── nl/
│ │ ├── de/
│ │ │ └── contexts.xml
│ │ └── en/
│ │ └── contexts.xml
│ ├── plugin.xml
│ ├── pom.xml
│ ├── schema/
│ │ ├── keyStoreActions.exsd
│ │ └── keyStoreCommands.exsd
│ ├── src/
│ │ └── org/
│ │ └── jcryptool/
│ │ └── crypto/
│ │ └── keystore/
│ │ ├── IKeyStoreConstants.java
│ │ ├── KeyStorePlugin.java
│ │ ├── backend/
│ │ │ ├── ImportExportManager.java
│ │ │ ├── KeyStoreActionManager.java
│ │ │ ├── KeyStoreAlias.java
│ │ │ ├── KeyStoreManager.java
│ │ │ ├── Messages.java
│ │ │ ├── messages.properties
│ │ │ └── messages_de.properties
│ │ ├── certificates/
│ │ │ └── CertificateFactory.java
│ │ ├── commands/
│ │ │ ├── OpenKeystoreHandler.java
│ │ │ └── ShowPropertiesHandler.java
│ │ ├── descriptors/
│ │ │ ├── ImportDescriptor.java
│ │ │ ├── NewEntryDescriptor.java
│ │ │ ├── NewKeyPairDescriptor.java
│ │ │ ├── NewSecretKeyDescriptor.java
│ │ │ └── interfaces/
│ │ │ ├── IContactDescriptor.java
│ │ │ ├── IImportDescriptor.java
│ │ │ ├── IImportWizard.java
│ │ │ ├── INewEntryDescriptor.java
│ │ │ ├── INewKeyPairDescriptor.java
│ │ │ ├── INewKeyWizard.java
│ │ │ └── INewSecretKeyDescriptor.java
│ │ ├── keys/
│ │ │ ├── IKeyStoreAlias.java
│ │ │ └── KeyType.java
│ │ └── ui/
│ │ ├── KeystoreViewer.java
│ │ ├── KeystoreWidget.java
│ │ ├── actions/
│ │ │ ├── AbstractImportKeyStoreEntryHandler.java
│ │ │ ├── AbstractKeyStoreHandler.java
│ │ │ ├── AbstractNewKeyStoreEntryHandler.java
│ │ │ ├── IKeyStoreActionDescriptor.java
│ │ │ ├── KeyStoreActionDescriptor.java
│ │ │ ├── KeyStoreBackupHandler.java
│ │ │ ├── Messages.java
│ │ │ ├── ShadowKeyStoreHandler.java
│ │ │ ├── contacts/
│ │ │ │ ├── DeleteContactHandler.java
│ │ │ │ └── NewContactHandler.java
│ │ │ ├── del/
│ │ │ │ ├── DeleteCertificateHandler.java
│ │ │ │ ├── DeleteKeyPairHandler.java
│ │ │ │ ├── DeleteSecretKeyHandler.java
│ │ │ │ ├── Messages.java
│ │ │ │ ├── messages.properties
│ │ │ │ └── messages_de.properties
│ │ │ ├── ex/
│ │ │ │ ├── ExportCertificateHandler.java
│ │ │ │ ├── ExportKeyPairHandler.java
│ │ │ │ ├── ExportSecretKeyHandler.java
│ │ │ │ ├── Messages.java
│ │ │ │ ├── messages.properties
│ │ │ │ └── messages_de.properties
│ │ │ ├── messages.properties
│ │ │ └── messages_de.properties
│ │ ├── dialogs/
│ │ │ ├── CommonPropertyDialog.java
│ │ │ ├── Messages.java
│ │ │ ├── SelectKeyDialog.java
│ │ │ ├── ShowCertificateDialog.java
│ │ │ ├── ShowSecretKeyDialog.java
│ │ │ ├── TableEntry.java
│ │ │ ├── contentproviders/
│ │ │ │ ├── AbstractKeyNodeContentProvider.java
│ │ │ │ ├── CertificateContentProvider.java
│ │ │ │ ├── CommonContentProvider.java
│ │ │ │ ├── ContentProviderFactory.java
│ │ │ │ ├── Messages.java
│ │ │ │ ├── keypair/
│ │ │ │ │ ├── CMSSPrivateKeyContentProvider.java
│ │ │ │ │ ├── CMSSPublicKeyContentProvider.java
│ │ │ │ │ ├── DSAPrivateKeyContentProvider.java
│ │ │ │ │ ├── DSAPublicKeyContentProvider.java
│ │ │ │ │ ├── ECPrivateKeyContentProvider.java
│ │ │ │ │ ├── ECPublicKeyContentProvider.java
│ │ │ │ │ ├── ElGamalPrivateKeyContentProvider.java
│ │ │ │ │ ├── ElGamalPublicKeyContentProvider.java
│ │ │ │ │ ├── GMSSPrivateKeyContentProvider.java
│ │ │ │ │ ├── GMSSPublicKeyContentProvider.java
│ │ │ │ │ ├── IQDSAPrivateKeyContentProvider.java
│ │ │ │ │ ├── IQDSAPublicKeyContentProvider.java
│ │ │ │ │ ├── IQGQPrivateKeyContentProvider.java
│ │ │ │ │ ├── IQGQPublicKeyContentProvider.java
│ │ │ │ │ ├── IQRDSAPrivateKeyContentProvider.java
│ │ │ │ │ ├── IQRDSAPublicKeyContentProvider.java
│ │ │ │ │ ├── LMOTSPrivateKeyContentProvider.java
│ │ │ │ │ ├── LMOTSPublicKeyContentProvider.java
│ │ │ │ │ ├── McElieceCCA2PrivateKeyContentProvider.java
│ │ │ │ │ ├── McElieceCCA2PublicKeyContentProvider.java
│ │ │ │ │ ├── McEliecePrivateKeyContentProvider.java
│ │ │ │ │ ├── McEliecePublicKeyContentProvider.java
│ │ │ │ │ ├── MeRSAPrivateKeyContentProvider.java
│ │ │ │ │ ├── MerkleOTSPrivateKeyContentProvider.java
│ │ │ │ │ ├── MerkleOTSPublicKeyContentProvider.java
│ │ │ │ │ ├── MpRSAPrivateKeyContentProvider.java
│ │ │ │ │ ├── NiederreiterPrivateKeyContentProvider.java
│ │ │ │ │ ├── NiederreiterPublicKeyContentProvider.java
│ │ │ │ │ ├── PFlashPrivateKeyContentProvider.java
│ │ │ │ │ ├── PFlashPublicKeyContentProvider.java
│ │ │ │ │ ├── RSAPublicKeyContentProvider.java
│ │ │ │ │ ├── RainbowPrivateKeyContentProvider.java
│ │ │ │ │ ├── RainbowPublicKeyContentProvider.java
│ │ │ │ │ ├── SSVElGamalPrivateKeyContentProvider.java
│ │ │ │ │ └── SSVElGamalPublicKeyContentProvider.java
│ │ │ │ ├── messages.properties
│ │ │ │ ├── messages_de.properties
│ │ │ │ └── secretkey/
│ │ │ │ ├── ECSecretKeyContentProvider.java
│ │ │ │ └── PBESecretKeyContentProvider.java
│ │ │ ├── messages.properties
│ │ │ └── messages_de.properties
│ │ ├── views/
│ │ │ ├── KeyDragListener.java
│ │ │ ├── KeystoreView.java
│ │ │ ├── interfaces/
│ │ │ │ ├── IChangeKeyStoreListener.java
│ │ │ │ ├── IKeyStoreListener.java
│ │ │ │ ├── ISelectedNodeListener.java
│ │ │ │ └── IViewKeyInformation.java
│ │ │ ├── nodes/
│ │ │ │ ├── Contact.java
│ │ │ │ ├── ContactDescriptorNode.java
│ │ │ │ ├── ContactManager.java
│ │ │ │ ├── ContactStore.java
│ │ │ │ ├── ITreeNode.java
│ │ │ │ ├── Messages.java
│ │ │ │ ├── NodeType.java
│ │ │ │ ├── TreeNode.java
│ │ │ │ ├── containers/
│ │ │ │ │ ├── AbstractContainerNode.java
│ │ │ │ │ ├── CertificateContainerNode.java
│ │ │ │ │ ├── IKeyPairContainerNode.java
│ │ │ │ │ ├── KeyPairContainerNode.java
│ │ │ │ │ ├── Messages.java
│ │ │ │ │ ├── SecretKeyContainerNode.java
│ │ │ │ │ ├── messages.properties
│ │ │ │ │ └── messages_de.properties
│ │ │ │ ├── keys/
│ │ │ │ │ ├── AbstractKeyNode.java
│ │ │ │ │ ├── CertificateNode.java
│ │ │ │ │ ├── KeyPairNode.java
│ │ │ │ │ ├── Messages.java
│ │ │ │ │ ├── PrivateKeyNode.java
│ │ │ │ │ ├── SecretKeyNode.java
│ │ │ │ │ ├── messages.properties
│ │ │ │ │ └── messages_de.properties
│ │ │ │ ├── messages.properties
│ │ │ │ └── messages_de.properties
│ │ │ └── providers/
│ │ │ ├── KeyStoreViewContentProvider.java
│ │ │ └── KeyStoreViewLabelProvider.java
│ │ ├── wizardpages/
│ │ │ ├── BackupRestorePage.java
│ │ │ ├── Messages.java
│ │ │ ├── messages.properties
│ │ │ └── messages_de.properties
│ │ └── wizards/
│ │ ├── BackupRestoreWizard.java
│ │ ├── Messages.java
│ │ ├── messages.properties
│ │ └── messages_de.properties
│ └── swt-grouplayout.jar
├── org.jcryptool.devtools/
│ ├── .classpath
│ ├── .project
│ ├── META-INF/
│ │ └── MANIFEST.MF
│ ├── build.properties
│ ├── plugin.xml
│ └── src/
│ └── org/
│ └── jcryptool/
│ └── devtools/
│ ├── Activator.java
│ ├── EditorAPIStartup.java
│ ├── HexEditorDebugLogic.java
│ ├── HexEditorDebugView.java
│ └── TestShell1.java
├── org.jcryptool.editor.hex/
│ ├── .classpath
│ ├── .project
│ ├── META-INF/
│ │ └── MANIFEST.MF
│ ├── OSGI-INF/
│ │ └── l10n/
│ │ ├── bundle.properties
│ │ └── bundle_de.properties
│ ├── build.properties
│ ├── plugin.xml
│ ├── pom.xml
│ └── src/
│ └── org/
│ └── jcryptool/
│ └── editor/
│ └── hex/
│ ├── HexEditorConstants.java
│ ├── Messages.java
│ ├── commands/
│ │ ├── Messages.java
│ │ ├── NewEmptyFile.java
│ │ ├── NewFile.java
│ │ ├── OpenEditorHandler.java
│ │ ├── OpenInTextEditor.java
│ │ ├── messages.properties
│ │ └── messages_de.properties
│ ├── messages.properties
│ ├── messages_de.properties
│ └── service/
│ └── HexEditorService.java
├── org.jcryptool.editor.text/
│ ├── .classpath
│ ├── .project
│ ├── META-INF/
│ │ └── MANIFEST.MF
│ ├── OSGI-INF/
│ │ └── l10n/
│ │ ├── bundle.properties
│ │ └── bundle_de.properties
│ ├── build.properties
│ ├── nl/
│ │ ├── de/
│ │ │ └── contexts.xml
│ │ └── en/
│ │ └── contexts.xml
│ ├── plugin.xml
│ ├── pom.xml
│ └── src/
│ └── org/
│ └── jcryptool/
│ └── editor/
│ └── text/
│ ├── JCTTextEditorPlugin.java
│ ├── commands/
│ │ ├── Messages.java
│ │ ├── NewEmptyTextFile.java
│ │ ├── NewSampleTextFile.java
│ │ ├── OpenEditorHandler.java
│ │ ├── OpenInHex.java
│ │ ├── messages.properties
│ │ └── messages_de.properties
│ ├── editor/
│ │ ├── JCTTextEditor.java
│ │ ├── Messages.java
│ │ ├── SimpleDocumentProvider.java
│ │ ├── messages.properties
│ │ └── messages_de.properties
│ ├── service/
│ │ └── JCTEditorService.java
│ └── startup/
│ ├── Messages.java
│ ├── StartUp.java
│ ├── messages.properties
│ └── messages_de.properties
├── org.jcryptool.editors.feature/
│ ├── .project
│ ├── build.properties
│ ├── epl-v10.html
│ ├── feature.xml
│ └── pom.xml
├── org.jcryptool.fileexplorer/
│ ├── .classpath
│ ├── .project
│ ├── META-INF/
│ │ └── MANIFEST.MF
│ ├── OSGI-INF/
│ │ └── l10n/
│ │ ├── bundle.properties
│ │ └── bundle_de.properties
│ ├── build.properties
│ ├── nl/
│ │ ├── de/
│ │ │ ├── contexts.xml
│ │ │ ├── help/
│ │ │ │ ├── preferences.html
│ │ │ │ └── view.html
│ │ │ ├── index.xml
│ │ │ └── toc.xml
│ │ └── en/
│ │ ├── contexts.xml
│ │ ├── help/
│ │ │ ├── preferences.html
│ │ │ └── view.html
│ │ ├── index.xml
│ │ └── toc.xml
│ ├── plugin.xml
│ ├── pom.xml
│ └── src/
│ └── org/
│ └── jcryptool/
│ └── fileexplorer/
│ ├── FileExplorerPlugin.java
│ ├── commands/
│ │ ├── CollapseHandler.java
│ │ ├── CopyHandler.java
│ │ ├── CryptoHandler.java
│ │ ├── CutHandler.java
│ │ ├── DeleteHandler.java
│ │ ├── HomeHandler.java
│ │ ├── InvisibleToggleHandler.java
│ │ ├── Messages.java
│ │ ├── PasteHandler.java
│ │ ├── RefreshHandler.java
│ │ ├── RenameHandler.java
│ │ ├── ShowPropertiesHandler.java
│ │ ├── messages.properties
│ │ └── messages_de.properties
│ ├── popup/
│ │ └── contributions/
│ │ ├── CryptoContributionItem.java
│ │ ├── Messages.java
│ │ ├── messages.properties
│ │ └── messages_de.properties
│ ├── preferences/
│ │ ├── GeneralPreferencePage.java
│ │ ├── Messages.java
│ │ ├── PreferenceConstants.java
│ │ ├── PreferenceInitializer.java
│ │ ├── messages.properties
│ │ └── messages_de.properties
│ ├── properties/
│ │ ├── Messages.java
│ │ ├── ResourcePropertyPage.java
│ │ ├── messages.properties
│ │ └── messages_de.properties
│ ├── tester/
│ │ └── IFileStorePropertyTester.java
│ └── views/
│ ├── FileExplorerContentProvider.java
│ ├── FileExplorerLabelProvider.java
│ ├── FileExplorerView.java
│ ├── FileExplorerViewerComparator.java
│ ├── Messages.java
│ ├── factories/
│ │ ├── FileExplorerAdapterFactory.java
│ │ └── ImageFactory.java
│ ├── messages.properties
│ └── messages_de.properties
├── org.jcryptool.functionlistgen/
│ ├── .classpath
│ ├── .project
│ ├── META-INF/
│ │ └── MANIFEST.MF
│ ├── OSGI-INF/
│ │ └── l10n/
│ │ ├── bundle.properties
│ │ └── bundle_de.properties
│ ├── build.properties
│ ├── plugin.xml
│ ├── pom.xml
│ └── src/
│ └── org/
│ └── jcryptool/
│ └── functionlistgen/
│ ├── Activator.java
│ ├── AtStartup.java
│ └── FunctionalityRecord.java
├── org.jcryptool.jre.master.feature/
│ ├── .project
│ ├── build.properties
│ ├── feature.xml
│ └── pom.xml
├── org.jcryptool.product/
│ ├── .project
│ ├── JCT-Maven-Build.launch
│ ├── a.txt
│ ├── icons/
│ │ ├── icons_linux.xpm
│ │ └── icons_osx.icns
│ ├── jcryptool.p2.inf
│ ├── jcryptool.product
│ └── pom.xml
├── org.jcryptool.providers.feature/
│ ├── .project
│ ├── build.properties
│ ├── epl-v10.html
│ ├── feature.xml
│ └── pom.xml
├── org.jcryptool.releng/
│ ├── .project
│ ├── epl.txt
│ ├── helper/
│ │ ├── ignored_links.txt
│ │ └── link_availability_checker.py
│ ├── pom.xml
│ └── rebuild_weekly.txt
├── org.jcryptool.target/
│ ├── .project
│ ├── org.jcryptool.target.fordevelopers.target
│ ├── org.jcryptool.target.jctpde.target
│ ├── org.jcryptool.target.target
│ └── pom.xml
├── org.jcryptool.views.feature/
│ ├── .project
│ ├── build.properties
│ ├── epl-v10.html
│ ├── feature.xml
│ └── pom.xml
├── org.jdom/
│ ├── .classpath
│ ├── .project
│ ├── LICENSE.txt
│ ├── META-INF/
│ │ └── MANIFEST.MF
│ ├── OSGI-INF/
│ │ └── l10n/
│ │ ├── bundle.properties
│ │ └── bundle_de.properties
│ ├── build.properties
│ └── pom.xml
├── pom.xml
└── readme.md
================================================
FILE CONTENTS
================================================
================================================
FILE: .development-configs/checkstyle-suppressions.xml
================================================
================================================
FILE: .development-configs/checkstyle.xml
================================================
================================================
FILE: .development-configs/formatter.xml
================================================
================================================
FILE: .github/workflows/maven.yml
================================================
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: Java CI with Maven
on:
push:
branches: [ develop ]
pull_request:
branches: [ develop ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ '17', '17.0.7' ]
steps:
- name: Checkout core repository
uses: actions/checkout@v2
with:
repository: jcryptool/core
path: core
- name: Checkout crypto repository
uses: actions/checkout@v2
with:
repository: jcryptool/crypto
path: crypto
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: ${{ matrix.java }}
distribution: 'zulu'
- name: Build with Maven
run: mvn clean package --file $GITHUB_WORKSPACE/core/org.jcryptool.releng/pom.xml
================================================
FILE: .gitignore
================================================
*.class
*/bin*
*/target*
*/.settings*
.DS_Store
workspace
build.xml
javaCompiler...args
Thumbs.db
*.exe
*.zip
*.tar.gz
org.jcryptool.product/plugin_customization.ini
.settings/
.java-version
**/.tycho-consumer-pom.xml
================================================
FILE: .metals/.gitignore
================================================
/metals.h2.db
/metals.lock.db
/metals.log
================================================
FILE: LICENSE
================================================
Eclipse Public License - v 1.0
THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC
LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM
CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
1. DEFINITIONS
"Contribution" means:
a) in the case of the initial Contributor, the initial code and documentation
distributed under this Agreement, and
b) in the case of each subsequent Contributor:
i) changes to the Program, and
ii) additions to the Program;
where such changes and/or additions to the Program originate from and are
distributed by that particular Contributor. A Contribution 'originates'
from a Contributor if it was added to the Program by such Contributor
itself or anyone acting on such Contributor's behalf. Contributions do not
include additions to the Program which: (i) are separate modules of
software distributed in conjunction with the Program under their own
license agreement, and (ii) are not derivative works of the Program.
"Contributor" means any person or entity that distributes the Program.
"Licensed Patents" mean patent claims licensable by a Contributor which are
necessarily infringed by the use or sale of its Contribution alone or when
combined with the Program.
"Program" means the Contributions distributed in accordance with this
Agreement.
"Recipient" means anyone who receives the Program under this Agreement,
including all Contributors.
2. GRANT OF RIGHTS
a) Subject to the terms of this Agreement, each Contributor hereby grants
Recipient a non-exclusive, worldwide, royalty-free copyright license to
reproduce, prepare derivative works of, publicly display, publicly
perform, distribute and sublicense the Contribution of such Contributor,
if any, and such derivative works, in source code and object code form.
b) Subject to the terms of this Agreement, each Contributor hereby grants
Recipient a non-exclusive, worldwide, royalty-free patent license under
Licensed Patents to make, use, sell, offer to sell, import and otherwise
transfer the Contribution of such Contributor, if any, in source code and
object code form. This patent license shall apply to the combination of
the Contribution and the Program if, at the time the Contribution is
added by the Contributor, such addition of the Contribution causes such
combination to be covered by the Licensed Patents. The patent license
shall not apply to any other combinations which include the Contribution.
No hardware per se is licensed hereunder.
c) Recipient understands that although each Contributor grants the licenses
to its Contributions set forth herein, no assurances are provided by any
Contributor that the Program does not infringe the patent or other
intellectual property rights of any other entity. Each Contributor
disclaims any liability to Recipient for claims brought by any other
entity based on infringement of intellectual property rights or
otherwise. As a condition to exercising the rights and licenses granted
hereunder, each Recipient hereby assumes sole responsibility to secure
any other intellectual property rights needed, if any. For example, if a
third party patent license is required to allow Recipient to distribute
the Program, it is Recipient's responsibility to acquire that license
before distributing the Program.
d) Each Contributor represents that to its knowledge it has sufficient
copyright rights in its Contribution, if any, to grant the copyright
license set forth in this Agreement.
3. REQUIREMENTS
A Contributor may choose to distribute the Program in object code form under
its own license agreement, provided that:
a) it complies with the terms and conditions of this Agreement; and
b) its license agreement:
i) effectively disclaims on behalf of all Contributors all warranties
and conditions, express and implied, including warranties or
conditions of title and non-infringement, and implied warranties or
conditions of merchantability and fitness for a particular purpose;
ii) effectively excludes on behalf of all Contributors all liability for
damages, including direct, indirect, special, incidental and
consequential damages, such as lost profits;
iii) states that any provisions which differ from this Agreement are
offered by that Contributor alone and not by any other party; and
iv) states that source code for the Program is available from such
Contributor, and informs licensees how to obtain it in a reasonable
manner on or through a medium customarily used for software exchange.
When the Program is made available in source code form:
a) it must be made available under this Agreement; and
b) a copy of this Agreement must be included with each copy of the Program.
Contributors may not remove or alter any copyright notices contained
within the Program.
Each Contributor must identify itself as the originator of its Contribution,
if
any, in a manner that reasonably allows subsequent Recipients to identify the
originator of the Contribution.
4. COMMERCIAL DISTRIBUTION
Commercial distributors of software may accept certain responsibilities with
respect to end users, business partners and the like. While this license is
intended to facilitate the commercial use of the Program, the Contributor who
includes the Program in a commercial product offering should do so in a manner
which does not create potential liability for other Contributors. Therefore,
if a Contributor includes the Program in a commercial product offering, such
Contributor ("Commercial Contributor") hereby agrees to defend and indemnify
every other Contributor ("Indemnified Contributor") against any losses,
damages and costs (collectively "Losses") arising from claims, lawsuits and
other legal actions brought by a third party against the Indemnified
Contributor to the extent caused by the acts or omissions of such Commercial
Contributor in connection with its distribution of the Program in a commercial
product offering. The obligations in this section do not apply to any claims
or Losses relating to any actual or alleged intellectual property
infringement. In order to qualify, an Indemnified Contributor must:
a) promptly notify the Commercial Contributor in writing of such claim, and
b) allow the Commercial Contributor to control, and cooperate with the
Commercial Contributor in, the defense and any related settlement
negotiations. The Indemnified Contributor may participate in any such claim at
its own expense.
For example, a Contributor might include the Program in a commercial product
offering, Product X. That Contributor is then a Commercial Contributor. If
that Commercial Contributor then makes performance claims, or offers
warranties related to Product X, those performance claims and warranties are
such Commercial Contributor's responsibility alone. Under this section, the
Commercial Contributor would have to defend claims against the other
Contributors related to those performance claims and warranties, and if a
court requires any other Contributor to pay any damages as a result, the
Commercial Contributor must pay those damages.
5. NO WARRANTY
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR
IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each
Recipient is solely responsible for determining the appropriateness of using
and distributing the Program and assumes all risks associated with its
exercise of rights under this Agreement , including but not limited to the
risks and costs of program errors, compliance with applicable laws, damage to
or loss of data, programs or equipment, and unavailability or interruption of
operations.
6. DISCLAIMER OF LIABILITY
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY
CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION
LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE
EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGES.
7. GENERAL
If any provision of this Agreement is invalid or unenforceable under
applicable law, it shall not affect the validity or enforceability of the
remainder of the terms of this Agreement, and without further action by the
parties hereto, such provision shall be reformed to the minimum extent
necessary to make such provision valid and enforceable.
If Recipient institutes patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Program itself
(excluding combinations of the Program with other software or hardware)
infringes such Recipient's patent(s), then such Recipient's rights granted
under Section 2(b) shall terminate as of the date such litigation is filed.
All Recipient's rights under this Agreement shall terminate if it fails to
comply with any of the material terms or conditions of this Agreement and does
not cure such failure in a reasonable period of time after becoming aware of
such noncompliance. If all Recipient's rights under this Agreement terminate,
Recipient agrees to cease use and distribution of the Program as soon as
reasonably practicable. However, Recipient's obligations under this Agreement
and any licenses granted by Recipient relating to the Program shall continue
and survive.
Everyone is permitted to copy and distribute copies of this Agreement, but in
order to avoid inconsistency the Agreement is copyrighted and may only be
modified in the following manner. The Agreement Steward reserves the right to
publish new versions (including revisions) of this Agreement from time to
time. No one other than the Agreement Steward has the right to modify this
Agreement. The Eclipse Foundation is the initial Agreement Steward. The
Eclipse Foundation may assign the responsibility to serve as the Agreement
Steward to a suitable separate entity. Each new version of the Agreement will
be given a distinguishing version number. The Program (including
Contributions) may always be distributed subject to the version of the
Agreement under which it was received. In addition, after a new version of the
Agreement is published, Contributor may elect to distribute the Program
(including its Contributions) under the new version. Except as expressly
stated in Sections 2(a) and 2(b) above, Recipient receives no rights or
licenses to the intellectual property of any Contributor under this Agreement,
whether expressly, by implication, estoppel or otherwise. All rights in the
Program not expressly granted under this Agreement are reserved.
This Agreement is governed by the laws of the State of New York and the
intellectual property laws of the United States of America. No party to this
Agreement will bring a legal action under this Agreement more than one year
after the cause of action arose. Each party waives its rights to a jury trial in
any resulting litigation.
================================================
FILE: com.thoughtworks.qdox/.classpath
================================================
================================================
FILE: com.thoughtworks.qdox/.project
================================================
com.thoughtworks.qdoxorg.eclipse.jdt.core.javabuilderorg.eclipse.pde.ManifestBuilderorg.eclipse.pde.SchemaBuilderorg.eclipse.m2e.core.maven2Builderorg.eclipse.m2e.core.maven2Natureorg.eclipse.pde.PluginNatureorg.eclipse.jdt.core.javanature
================================================
FILE: com.thoughtworks.qdox/META-INF/LICENSE.txt
================================================
Copyright 2002-2006 Joe Walnes and QDox Project Team
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
================================================
FILE: com.thoughtworks.qdox/META-INF/MANIFEST.MF
================================================
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: com.thoughtworks.qdox;singleton:=true
Bundle-Vendor: %Bundle-Vendor
Export-Package: com.thoughtworks.qdox,
com.thoughtworks.qdox.ant,
com.thoughtworks.qdox.directorywalker,
com.thoughtworks.qdox.junit,
com.thoughtworks.qdox.model,
com.thoughtworks.qdox.model.util,
com.thoughtworks.qdox.parser,
com.thoughtworks.qdox.parser.impl,
com.thoughtworks.qdox.parser.structs,
com.thoughtworks.qdox.tools
Bundle-RequiredExecutionEnvironment: JavaSE-17
Bundle-ActivationPolicy: lazy
Automatic-Module-Name: com.thoughtworks.qdox
Bundle-Version: 1.0.9.1-20230901
================================================
FILE: com.thoughtworks.qdox/OSGI-INF/l10n/bundle.properties
================================================
#Properties file for com.thoughtworks.qdox
Bundle-Vendor = THOUGHTWORKS
Bundle-Name = Qdox Plug-in
================================================
FILE: com.thoughtworks.qdox/OSGI-INF/l10n/bundle_de.properties
================================================
#Properties file for com.thoughtworks.qdox
Bundle-Vendor = THOUGHTWORKS
Bundle-Name = Qdox Plug-in
================================================
FILE: com.thoughtworks.qdox/build.properties
================================================
output.. = .
bin.includes = META-INF/,\
com/,\
OSGI-INF/
================================================
FILE: com.thoughtworks.qdox/pom.xml
================================================
org.jcryptoolorg.jcryptool.core.parent1.0.84.0.0com.thoughtworkscom.thoughtworks.qdox1.0.9.1-20230901eclipse-plugin
================================================
FILE: de.flexiprovider/.classpath
================================================
================================================
FILE: de.flexiprovider/.project
================================================
de.flexiproviderorg.eclipse.jdt.core.javabuilderorg.eclipse.pde.ManifestBuilderorg.eclipse.pde.SchemaBuilderorg.eclipse.m2e.core.maven2Builderorg.eclipse.m2e.core.maven2Natureorg.eclipse.pde.PluginNatureorg.eclipse.jdt.core.javanature
================================================
FILE: de.flexiprovider/META-INF/MANIFEST.MF
================================================
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: de.flexiprovider;singleton:=true
Bundle-Version: 1.7.0.p7
Bundle-Activator: de.flexiprovider.FlexiProviderPlugin
Bundle-Vendor: %Bundle-Vendor.0
Require-Bundle: org.eclipse.core.runtime,
org.jdom;bundle-version="1.1.1",
net.sourceforge.codec;bundle-version="1.7.0",
bcprov;bundle-version="[1.68.0,1.68.0]"
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .,
libs/FlexiProvider-1.7p7.signed.jar
Bundle-RequiredExecutionEnvironment: JavaSE-17
Import-Package: org.jcryptool.core.logging.utils,
org.jcryptool.core.operations.providers
Export-Package: de.flexiprovider,
de.flexiprovider.api,
de.flexiprovider.api.exceptions,
de.flexiprovider.api.keys,
de.flexiprovider.api.parameters,
de.flexiprovider.common.exceptions,
de.flexiprovider.common.ies,
de.flexiprovider.common.math,
de.flexiprovider.common.math.codingtheory,
de.flexiprovider.common.math.ellipticcurves,
de.flexiprovider.common.math.finitefields,
de.flexiprovider.common.math.linearalgebra,
de.flexiprovider.common.math.polynomials,
de.flexiprovider.common.math.quadraticfields,
de.flexiprovider.common.mode,
de.flexiprovider.common.padding,
de.flexiprovider.common.util,
de.flexiprovider.core,
de.flexiprovider.core.camellia,
de.flexiprovider.core.desede,
de.flexiprovider.core.desede.interfaces,
de.flexiprovider.core.dsa,
de.flexiprovider.core.dsa.interfaces,
de.flexiprovider.core.elgamal,
de.flexiprovider.core.elgamal.semanticallysecure,
de.flexiprovider.core.idea,
de.flexiprovider.core.kdf,
de.flexiprovider.core.mac,
de.flexiprovider.core.mars,
de.flexiprovider.core.md,
de.flexiprovider.core.mersa,
de.flexiprovider.core.misty1,
de.flexiprovider.core.mprsa,
de.flexiprovider.core.pbe,
de.flexiprovider.core.pbe.interfaces,
de.flexiprovider.core.random,
de.flexiprovider.core.rbrsa,
de.flexiprovider.core.rc2,
de.flexiprovider.core.rc2.interfaces,
de.flexiprovider.core.rc5,
de.flexiprovider.core.rc6,
de.flexiprovider.core.rijndael,
de.flexiprovider.core.rprimersa,
de.flexiprovider.core.rsa,
de.flexiprovider.core.rsa.interfaces,
de.flexiprovider.core.saferplus,
de.flexiprovider.core.saferplusplus,
de.flexiprovider.core.serpent,
de.flexiprovider.core.shacal,
de.flexiprovider.core.shacal2,
de.flexiprovider.core.twofish,
de.flexiprovider.ec,
de.flexiprovider.ec.asn1,
de.flexiprovider.ec.keys,
de.flexiprovider.ec.parameters,
de.flexiprovider.nf,
de.flexiprovider.nf.iq.iqdsa,
de.flexiprovider.nf.iq.iqgq,
de.flexiprovider.nf.iq.iqrdsa,
de.flexiprovider.pki,
de.flexiprovider.pqc,
de.flexiprovider.pqc.ecc,
de.flexiprovider.pqc.ecc.mceliece,
de.flexiprovider.pqc.ecc.niederreiter,
de.flexiprovider.pqc.hbc,
de.flexiprovider.pqc.hbc.cmss,
de.flexiprovider.pqc.hbc.gmss,
de.flexiprovider.pqc.hbc.ots,
de.flexiprovider.pqc.ots.lm,
de.flexiprovider.pqc.ots.merkle,
de.flexiprovider.pqc.pflash,
de.flexiprovider.pqc.rainbow,
de.flexiprovider.pqc.rainbow.util,
de.flexiprovider.pqc.tss
Automatic-Module-Name: de.flexiprovider
================================================
FILE: de.flexiprovider/OSGI-INF/l10n/bundle.properties
================================================
#Properties file for de.flexiprovider
Bundle-Vendor.0 = Technische Universitaet Darmstadt
Bundle-Name = Flexiprovider Plug-in
================================================
FILE: de.flexiprovider/OSGI-INF/l10n/bundle_de.properties
================================================
#Properties file for de.flexiprovider
Bundle-Vendor.0 = Technische Universit\u00e4t Darmstadt
Bundle-Name = Flexiprovider Plug-in
================================================
FILE: de.flexiprovider/build.properties
================================================
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml,\
licensing.txt,\
license.pdf,\
lgpl.txt,\
gpl.txt,\
xml/,\
OSGI-INF/,\
libs/FlexiProvider-1.7p7.signed.jar
================================================
FILE: de.flexiprovider/gpl.txt
================================================
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
Copyright (C)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.
================================================
FILE: de.flexiprovider/lgpl.txt
================================================
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
Copyright (C)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!
================================================
FILE: de.flexiprovider/licensing.txt
================================================
Licensing: The FlexiProvider is open source. The Core Provider module is LGPL licensed, the EC and the NF Provider modules are GPL licensed. Alternative licensing options are available upon request.
Licensing of the codec package is subject to the SeMoA license which is similar to the LGPL.
This licensing information was copied from http://flexiprovider.de/#Licensing on 2007-06-12
================================================
FILE: de.flexiprovider/plugin.xml
================================================
================================================
FILE: de.flexiprovider/pom.xml
================================================
org.jcryptoolorg.jcryptool.core.parent1.0.84.0.0de.flexiprovider1.7.0.p7eclipse-pluginde.flexiprovider
================================================
FILE: de.flexiprovider/src/de/flexiprovider/FlexiProviderController.java
================================================
//-----BEGIN DISCLAIMER-----
/*******************************************************************************
* Copyright (c) 2011, 2021 JCrypTool Team and Contributors
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*******************************************************************************/
//-----END DISCLAIMER-----
/**
*
*/
package de.flexiprovider;
import java.security.Provider;
import java.security.Security;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import org.jcryptool.core.logging.utils.LogUtil;
import org.jcryptool.core.operations.providers.AbstractProviderController;
import de.flexiprovider.core.FlexiCoreProvider;
import de.flexiprovider.ec.FlexiECProvider;
import de.flexiprovider.nf.FlexiNFProvider;
import de.flexiprovider.pqc.FlexiPQCProvider;
/**
* Serves as the focal point for adressing the FlexiProvider library.
* Attempts at putting the FlexiProvider library as the priority 1-4 providers for JCrypTool.
*
* @author tkern
*
*/
public class FlexiProviderController extends AbstractProviderController {
public static final FlexiNFProvider FLEXI_NF_PROVIDER = new FlexiNFProvider();
public static final FlexiPQCProvider FLEXI_PQC_PROVIDER = new FlexiPQCProvider();
public static final FlexiECProvider FLEXI_EC_PROVIDER = new FlexiECProvider();
public static final FlexiCoreProvider FLEXICORE_PROVIDER = new FlexiCoreProvider();
private static final Provider[] FLEXI_PROVIDERS = new Provider[] {FlexiProviderController.FLEXICORE_PROVIDER, FLEXI_EC_PROVIDER, FLEXI_PQC_PROVIDER, FLEXI_NF_PROVIDER};
static {
FLEXICORE_PROVIDER.remove("SecureRandom.BBS");
FLEXICORE_PROVIDER.remove("SecureRandom.BBSRandom");
FLEXICORE_PROVIDER.remove("Alg.Alias.SecureRandom.BBSRandom");
FLEXI_EC_PROVIDER.remove("SecureRandom.ECPRNG");
}
/**
* Empty no-args constructor.
*/
public FlexiProviderController() {
}
// these get cached before any of JCT's providers are set, so they can be repositioned (before or after) according to the current needs
private List defaultProviders = null;
private void cacheDefaultProviders() {
if (defaultProviders == null) {
defaultProviders = new LinkedList<>();
for (Provider p : Security.getProviders()) {
defaultProviders.add(p);
}
}
}
@Override
public void setProviders__sunPromoted() {
LogUtil.logInfo(FlexiProviderPlugin.PLUGIN_ID, "promoting sun security providers in FlexiProviderController");
cacheDefaultProviders();
for(Provider p: Security.getProviders()) {
Security.removeProvider(p.getName());
}
// add the sun providers first
for (Provider provider: defaultProviders) {
// LogUtil.logInfo(FlexiProviderPlugin.PLUGIN_ID, "adding Provider: " + provider.getName());
Security.addProvider(provider);
}
// add the Flexiproviders after
for (Provider provider : FLEXI_PROVIDERS) {
// LogUtil.logInfo(FlexiProviderPlugin.PLUGIN_ID, "adding Provider: " + provider.getName());
Security.addProvider(provider);
}
// System.out.println("Sun cryptoprovider prioritized");
}
@Override
public void setProviders__flexiPromoted() {
// LogUtil.logInfo(FlexiProviderPlugin.PLUGIN_ID, "promoting flexi security providers in FlexiProviderController");
cacheDefaultProviders();
for(Provider p: Security.getProviders()) {
Security.removeProvider(p.getName());
}
// add the Flexiproviders first
for (Provider provider : FLEXI_PROVIDERS) {
// LogUtil.logInfo(FlexiProviderPlugin.PLUGIN_ID, "adding Provider: " + provider.getName());
Security.addProvider(provider);
}
Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
// add the sun providers after
for (Provider provider: defaultProviders) {
// LogUtil.logInfo(FlexiProviderPlugin.PLUGIN_ID, "adding Provider: " + provider.getName());
Security.addProvider(provider);
}
// System.out.println("FlexiProvider cryptoprovider prioritized");
}
/**
* Adds the four distinctive FlexiProvider cryptographic providers as the top priority providers for the platform.
*
* @see org.jcryptool.core.operations.providers.AbstractProviderController#addProviders()
*/
@Override
public List addProviders() {
List providers = new ArrayList(4);
providers.add(FlexiProviderController.FLEXICORE_PROVIDER.getName() + AbstractProviderController.SEPARATOR + FlexiProviderController.FLEXICORE_PROVIDER.getInfo());
providers.add(FLEXI_EC_PROVIDER.getName() + AbstractProviderController.SEPARATOR + FLEXI_EC_PROVIDER.getInfo());
providers.add(FLEXI_PQC_PROVIDER.getName() + AbstractProviderController.SEPARATOR + FLEXI_PQC_PROVIDER.getInfo());
providers.add(FLEXI_NF_PROVIDER.getName() + AbstractProviderController.SEPARATOR + FLEXI_NF_PROVIDER.getInfo());
setProviders__sunPromoted();
LogUtil.logInfo(FlexiProviderPlugin.PLUGIN_ID, "CURRENT PROVIDERS: ----");
for (Provider p: Security.getProviders()) {
LogUtil.logInfo(FlexiProviderPlugin.PLUGIN_ID, "- " + p.getName());
}
LogUtil.logInfo(FlexiProviderPlugin.PLUGIN_ID, "END: CURRENT PROVIDERS: ----");
return providers;
}
public static void reset_crypto_providers_generic() {
// TODO Auto-generated method stub
}
}
================================================
FILE: de.flexiprovider/src/de/flexiprovider/FlexiProviderPlugin.java
================================================
//-----BEGIN DISCLAIMER-----
/*******************************************************************************
* Copyright (c) 2011, 2021 JCrypTool Team and Contributors
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*******************************************************************************/
//-----END DISCLAIMER-----
package de.flexiprovider;
import java.io.IOException;
import java.net.URL;
import org.eclipse.core.runtime.Plugin;
import org.jcryptool.core.logging.utils.LogUtil;
import org.jdom.Document;
import org.jdom.JDOMException;
import org.jdom.input.SAXBuilder;
import org.osgi.framework.BundleContext;
/**
* The activator class controls the plug-in life cycle
*/
public class FlexiProviderPlugin extends Plugin {
// The plug-in ID
public static final String PLUGIN_ID = "de.flexiprovider";
// The shared instance
private static FlexiProviderPlugin plugin;
/**
* The constructor
*/
public FlexiProviderPlugin() {
}
/*
* (non-Javadoc)
* @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
*/
@Override
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
}
/*
* (non-Javadoc)
* @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
*/
@Override
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
}
/**
* Returns the shared instance
*
* @return the shared instance
*/
public static FlexiProviderPlugin getDefault() {
return plugin;
}
/**
* Reads the algorithms.xml file and creates a document object.
*
* @return A jdom document
*/
public static Document getAlgorithmsXML() {
URL xmlFile = FlexiProviderPlugin.getDefault().getBundle().getEntry("/xml/algorithms.xml");
SAXBuilder builder = new SAXBuilder();
try {
return builder.build(xmlFile);
} catch (JDOMException e) {
LogUtil.logError(PLUGIN_ID, e);
} catch (IOException e) {
LogUtil.logError(PLUGIN_ID, e);
}
return null;
}
}
================================================
FILE: de.flexiprovider/xml/algorithms.xml
================================================
the key size in bitsthe key size (128, 192, or 256 bits)the key size (128, 192, or 256 bits)the key size (128, 192, or 256 bits)the key size (128, 192, 256, 320, 384, or 448 bits)the key size in bitsthe key size (128, 192, or 256 bits)the key size (128, 192, or 256 bits)the key size (128 or 256 bits)the key size (128, 192, 256, 320, 384, or 448 bits)the key size (128, 192, 256, 320, 384, or 448 bits)the key size (128, 192, or 256 bits)the saltthe iteration countthe saltthe iteration countthe key sizethe KDF parameters (salt, iteration count, and key size)the initialization vector for the underlying cipherthe byte array containing the IVthe offset where the IV startsthe length of the IVthe number of rounds (8...127)the word size (16, 32, or 64 bits)the block size (128, 192, or 256 bits)the name of the desired symmetric cipher algorithm
("internal" for the internal cipher (one-time pad), or one
of "DESede_CBC", "AES128_CBC", "AES192_CBC", or
"AES256_CBC").the name of the desired MAC function ("HmacSHA1",
"HmacSHA256", "HmacSHA384", "HmacSHA512", or
"HmacRIPEMD160").the encoding parameter used for the MACthe shared data used for the key derivation functionthe bit size of the prime <tt>p</tt>the discriminant of the class groupthe generator of the class groupthe bit length of the discriminant (>= 2, <=
{@link #MAX_SIZE})the discriminant of the class groupthe bit length of the discriminant (>= 2, <=
{@link #MAX_SIZE})the discriminant of the class groupthe modulusthe bit length of the discriminant (>= 2, <=
{@link #MAX_SIZE})the height of the authentication treesthe size in bytes of the seed for the PRNGlayers of the GMSS treeheight of the single layers of the GMSS treeWinternitz parameters for each layerparameter for the AuthPath computationthe name of the hash functiondegree of the finite field GF(2^m)error correction capability of the codethe field polynomialthe name of the message digestthe salt length (in bytes)the primethe subprimethe basethe OID of the hash functionthe initialization vectorthe block sizethe initialization vectorthe block sizeRC28...128DESedeSerpent128,192,256IDEAHmacMD564,128,192,256HmacSHA1128,192,256HmacTiger128,192,256HmacRIPEMD160128,192,256HmacDHA256128,192,256HmacFORK256128,192,256HmacMD4128,192,256HmacRIPEMD128128,192,256HmacRIPEMD256128,192,256HmacRIPEMD320128,192,256HmacSHA224128,192,256HmacSHA256128,192,256HmacSHA384128,192,256HmacSHA512128,192,256AES,Rijndael128,192,256Camellia128,192,256MARS128,192,256Misty1PBE,PBES1,PBES2RC50...2040RC6128,192,256SAFER+128,192,256SAFER++128,192,256Shacal128,256,384,512Shacal2128,256,384,512TwoTrackMacTwofish128,192,256PbeWithSHAAnd3_KeyTripleDES_CBCPbeWithSHAAnd40BitRC2_CBCPbeWithSHA1AndDES_CBCPBES2PbeWithMD5AndDES_CBCCamellia128_CBCCamellia192_CBCCamellia256_CBCRC2_CBCDESede_CBCSerpentSerpent128_ECBSerpent128_CBCSerpent192_ECBSerpent192_CBCSerpent192_OFBSerpent192_CFBSerpent128_OFBSerpent128_CFBSerpent256_ECBSerpent256_CBCSerpent256_OFBSerpent256_CFBIDEAIDEA_ECBIDEA_CBCIDEA_CFBIDEA_OFBAES128,192,256AES128_ECBAES128_CBCAES192_ECBAES192_CBCAES192_OFBAES192_CFBAES128_OFBAES128_CFBAES256_ECBAES256_CBCAES256_OFBAES256_CFBCamelliaDESedeMARSMisty1RC2RC532,64,128RC6Rijndael128,192,256SAFER+SAFER++ShacalShacal2TwofishHmacMD5HmacSHA1HmacTigerHmacRIPEMD160CBCmacAES128CBCmacAES192CBCmacAES256CBCmacCamelliaCBCmacDESedeCBCmacIDEACBCmacMARSCBCmacMisty1CBCmacRC2CBCmacRC5CBCmacRC6CBCmacSAFER+CBCmacSAFER++CBCmacSerpentCBCmacShacalCBCmacShacal2CBCmacTwofishCmacAES128CmacAES192CmacAES256CmacDESedeHmacDHA256HmacFORK256HmacMD4HmacRIPEMD128HmacRIPEMD256HmacRIPEMD320HmacSHA224HmacSHA256HmacSHA384HmacSHA512TTmac128,TwoTrackMac128TTmac,TTmac160,TwoTrackMac,TwoTrackMac160TTmac32,TwoTrackMac32TTmac64,TwoTrackMac64TTmac96,TwoTrackMac96TTmac128,TwoTrackMac128TTmac32,TwoTrackMac32TTmac64,TwoTrackMac64EC,ECDH,ECDSA,ECIES,ECNRRSADSAElGamalIQDSAIQGQIQRDSAMerkleOTSwithSHA1MerkleOTS,MerkleOTSwithSHA256MerkleOTSwithSHA384MerkleOTSwithSHA512CMSSwithSHA1andWinternitzOTS_12,4,6,8,10,12CMSSwithSHA384andWinternitzOTS_22,4,6,8,10,12CMSSwithSHA384andWinternitzOTS_32,4,6,8,10,12CMSSwithSHA384andWinternitzOTS_42,4,6,8,10,12CMSSwithSHA512andWinternitzOTS_12,4,6,8,10,12CMSSwithSHA512andWinternitzOTS_22,4,6,8,10,12CMSSwithSHA512andWinternitzOTS_32,4,6,8,10,12CMSSwithSHA512andWinternitzOTS_42,4,6,8,10,12CMSSwithSHA1andWinternitzOTS_22,4,6,8,10,12CMSSwithSHA1andWinternitzOTS_32,4,6,8,10,12CMSSwithSHA1andWinternitzOTS_42,4,6,8,10,12CMSSwithSHA256andWinternitzOTS_12,4,6,8,10,12CMSSwithSHA256andWinternitzOTS_22,4,6,8,10,12CMSSwithSHA256andWinternitzOTS_32,4,6,8,10,12CMSSwithSHA256andWinternitzOTS_42,4,6,8,10,12CMSSwithSHA384andWinternitzOTS_12,4,6,8,10,12GMSSwithSHA110,20,40GMSSwithSHA22410,20,40GMSSwithSHA25610,20,40GMSSwithSHA38410,20,40GMSSwithSHA51210,20,40McElieceMcElieceCCA2NiederreiterMpRSARbRSARprimeRSAECDSA,SHA1/ECDSA,SHA1withECDSA1.3.132.0.29,1.3.132.0.28,1.2.840.10045.3.1.7,1.2.840.10045.3.1.2,1.2.840.10045.3.1.1,1.2.840.10045.3.1.6,1.2.840.10045.3.1.5,1.2.840.10045.3.1.4,1.2.840.10045.3.1.3,1.3.36.3.3.2.8.1.1.9,1.3.36.3.3.2.8.1.1.11,1.3.36.3.3.2.8.1.1.7,1.3.36.3.3.2.8.1.1.5,1.3.36.3.3.2.8.1.1.13,1.3.132.0.30,1.3.132.0.32,1.3.132.0.31,1.3.132.0.34,1.3.132.0.33,1.3.6.1.4.1.8301.3.1.2.9.0.16,1.3.6.1.4.1.8301.3.1.2.9.0.17,1.3.6.1.4.1.8301.3.1.2.9.0.14,1.3.6.1.4.1.8301.3.1.2.9.0.15,1.3.6.1.4.1.8301.3.1.2.9.0.18,1.3.6.1.4.1.8301.3.1.2.9.0.19,1.3.6.1.4.1.8301.3.1.2.9.0.7,1.3.6.1.4.1.8301.3.1.2.9.0.8,1.3.132.0.6,1.3.6.1.4.1.8301.3.1.2.9.0.5,1.3.132.0.7,1.3.6.1.4.1.8301.3.1.2.9.0.6,1.3.132.0.8,1.3.6.1.4.1.8301.3.1.2.9.0.12,1.3.132.0.9,1.3.6.1.4.1.8301.3.1.2.9.0.13,1.3.6.1.4.1.8301.3.1.2.9.0.9,1.3.6.1.4.1.8301.3.1.2.9.0.10,1.3.6.1.4.1.8301.3.1.2.9.0.11,1.3.6.1.4.1.8301.3.1.2.9.0.2,1.3.6.1.4.1.8301.3.1.2.9.0.1,1.3.6.1.4.1.8301.3.1.2.9.0.4,1.3.6.1.4.1.8301.3.1.2.9.0.3,1.3.6.1.4.1.8301.3.1.2.9.0.22,1.3.6.1.4.1.8301.3.1.2.9.0.21,1.3.6.1.4.1.8301.3.1.2.9.0.24,1.3.6.1.4.1.8301.3.1.2.9.0.23,1.3.6.1.4.1.8301.3.1.2.9.0.20,1.3.6.1.4.1.8301.3.1.2.9.0.29,1.3.6.1.4.1.8301.3.1.2.9.0.26,1.3.6.1.4.1.8301.3.1.2.9.0.25,1.3.6.1.4.1.8301.3.1.2.9.0.28,1.3.6.1.4.1.8301.3.1.2.9.0.27,1.3.36.3.3.2.8.1.1.1,1.3.36.3.3.2.8.1.1.3,1.3.132.0.10,1.3.6.1.4.1.8301.3.1.2.9.0.35,1.3.6.1.4.1.8301.3.1.2.9.0.34,1.3.6.1.4.1.8301.3.1.2.9.0.33,1.3.6.1.4.1.8301.3.1.2.9.0.32,1.3.6.1.4.1.8301.3.1.2.9.0.31,1.3.6.1.4.1.8301.3.1.2.9.0.30,1.3.6.1.4.1.8301.3.1.2.9.0.38,1.3.6.1.4.1.8301.3.1.2.9.0.37,1.3.6.1.4.1.8301.3.1.2.9.0.36SHA224/ECDSA,SHA224withECDSA1.3.132.0.29,1.3.132.0.28,1.2.840.10045.3.1.7,1.2.840.10045.3.1.2,1.2.840.10045.3.1.1,1.2.840.10045.3.1.6,1.2.840.10045.3.1.5,1.2.840.10045.3.1.4,1.2.840.10045.3.1.3,1.3.36.3.3.2.8.1.1.9,1.3.36.3.3.2.8.1.1.11,1.3.36.3.3.2.8.1.1.7,1.3.36.3.3.2.8.1.1.5,1.3.36.3.3.2.8.1.1.13,1.3.132.0.30,1.3.132.0.32,1.3.132.0.31,1.3.132.0.34,1.3.132.0.33,1.3.6.1.4.1.8301.3.1.2.9.0.16,1.3.6.1.4.1.8301.3.1.2.9.0.17,1.3.6.1.4.1.8301.3.1.2.9.0.14,1.3.6.1.4.1.8301.3.1.2.9.0.15,1.3.6.1.4.1.8301.3.1.2.9.0.18,1.3.6.1.4.1.8301.3.1.2.9.0.19,1.3.6.1.4.1.8301.3.1.2.9.0.7,1.3.6.1.4.1.8301.3.1.2.9.0.8,1.3.132.0.6,1.3.6.1.4.1.8301.3.1.2.9.0.5,1.3.132.0.7,1.3.6.1.4.1.8301.3.1.2.9.0.6,1.3.132.0.8,1.3.6.1.4.1.8301.3.1.2.9.0.12,1.3.132.0.9,1.3.6.1.4.1.8301.3.1.2.9.0.13,1.3.6.1.4.1.8301.3.1.2.9.0.9,1.3.6.1.4.1.8301.3.1.2.9.0.10,1.3.6.1.4.1.8301.3.1.2.9.0.11,1.3.6.1.4.1.8301.3.1.2.9.0.2,1.3.6.1.4.1.8301.3.1.2.9.0.1,1.3.6.1.4.1.8301.3.1.2.9.0.4,1.3.6.1.4.1.8301.3.1.2.9.0.3,1.3.6.1.4.1.8301.3.1.2.9.0.22,1.3.6.1.4.1.8301.3.1.2.9.0.21,1.3.6.1.4.1.8301.3.1.2.9.0.24,1.3.6.1.4.1.8301.3.1.2.9.0.23,1.3.6.1.4.1.8301.3.1.2.9.0.20,1.3.6.1.4.1.8301.3.1.2.9.0.29,1.3.6.1.4.1.8301.3.1.2.9.0.26,1.3.6.1.4.1.8301.3.1.2.9.0.25,1.3.6.1.4.1.8301.3.1.2.9.0.28,1.3.6.1.4.1.8301.3.1.2.9.0.27,1.3.36.3.3.2.8.1.1.1,1.3.36.3.3.2.8.1.1.3,1.3.132.0.10,1.3.6.1.4.1.8301.3.1.2.9.0.35,1.3.6.1.4.1.8301.3.1.2.9.0.34,1.3.6.1.4.1.8301.3.1.2.9.0.33,1.3.6.1.4.1.8301.3.1.2.9.0.32,1.3.6.1.4.1.8301.3.1.2.9.0.31,1.3.6.1.4.1.8301.3.1.2.9.0.30,1.3.6.1.4.1.8301.3.1.2.9.0.38,1.3.6.1.4.1.8301.3.1.2.9.0.37,1.3.6.1.4.1.8301.3.1.2.9.0.36SHA256/ECDSA,SHA256withECDSA1.3.132.0.29,1.3.132.0.28,1.2.840.10045.3.1.7,1.2.840.10045.3.1.2,1.2.840.10045.3.1.1,1.2.840.10045.3.1.6,1.2.840.10045.3.1.5,1.2.840.10045.3.1.4,1.2.840.10045.3.1.3,1.3.36.3.3.2.8.1.1.9,1.3.36.3.3.2.8.1.1.11,1.3.36.3.3.2.8.1.1.7,1.3.36.3.3.2.8.1.1.5,1.3.36.3.3.2.8.1.1.13,1.3.132.0.30,1.3.132.0.32,1.3.132.0.31,1.3.132.0.34,1.3.132.0.33,1.3.6.1.4.1.8301.3.1.2.9.0.16,1.3.6.1.4.1.8301.3.1.2.9.0.17,1.3.6.1.4.1.8301.3.1.2.9.0.14,1.3.6.1.4.1.8301.3.1.2.9.0.15,1.3.6.1.4.1.8301.3.1.2.9.0.18,1.3.6.1.4.1.8301.3.1.2.9.0.19,1.3.6.1.4.1.8301.3.1.2.9.0.7,1.3.6.1.4.1.8301.3.1.2.9.0.8,1.3.132.0.6,1.3.6.1.4.1.8301.3.1.2.9.0.5,1.3.132.0.7,1.3.6.1.4.1.8301.3.1.2.9.0.6,1.3.132.0.8,1.3.6.1.4.1.8301.3.1.2.9.0.12,1.3.132.0.9,1.3.6.1.4.1.8301.3.1.2.9.0.13,1.3.6.1.4.1.8301.3.1.2.9.0.9,1.3.6.1.4.1.8301.3.1.2.9.0.10,1.3.6.1.4.1.8301.3.1.2.9.0.11,1.3.6.1.4.1.8301.3.1.2.9.0.2,1.3.6.1.4.1.8301.3.1.2.9.0.1,1.3.6.1.4.1.8301.3.1.2.9.0.4,1.3.6.1.4.1.8301.3.1.2.9.0.3,1.3.6.1.4.1.8301.3.1.2.9.0.22,1.3.6.1.4.1.8301.3.1.2.9.0.21,1.3.6.1.4.1.8301.3.1.2.9.0.24,1.3.6.1.4.1.8301.3.1.2.9.0.23,1.3.6.1.4.1.8301.3.1.2.9.0.20,1.3.6.1.4.1.8301.3.1.2.9.0.29,1.3.6.1.4.1.8301.3.1.2.9.0.26,1.3.6.1.4.1.8301.3.1.2.9.0.25,1.3.6.1.4.1.8301.3.1.2.9.0.28,1.3.6.1.4.1.8301.3.1.2.9.0.27,1.3.36.3.3.2.8.1.1.1,1.3.36.3.3.2.8.1.1.3,1.3.132.0.10,1.3.6.1.4.1.8301.3.1.2.9.0.35,1.3.6.1.4.1.8301.3.1.2.9.0.34,1.3.6.1.4.1.8301.3.1.2.9.0.33,1.3.6.1.4.1.8301.3.1.2.9.0.32,1.3.6.1.4.1.8301.3.1.2.9.0.31,1.3.6.1.4.1.8301.3.1.2.9.0.30,1.3.6.1.4.1.8301.3.1.2.9.0.38,1.3.6.1.4.1.8301.3.1.2.9.0.37,1.3.6.1.4.1.8301.3.1.2.9.0.36SHA384/ECDSA,SHA384withECDSA1.3.132.0.29,1.3.132.0.28,1.2.840.10045.3.1.7,1.2.840.10045.3.1.2,1.2.840.10045.3.1.1,1.2.840.10045.3.1.6,1.2.840.10045.3.1.5,1.2.840.10045.3.1.4,1.2.840.10045.3.1.3,1.3.36.3.3.2.8.1.1.9,1.3.36.3.3.2.8.1.1.11,1.3.36.3.3.2.8.1.1.7,1.3.36.3.3.2.8.1.1.5,1.3.36.3.3.2.8.1.1.13,1.3.132.0.30,1.3.132.0.32,1.3.132.0.31,1.3.132.0.34,1.3.132.0.33,1.3.6.1.4.1.8301.3.1.2.9.0.16,1.3.6.1.4.1.8301.3.1.2.9.0.17,1.3.6.1.4.1.8301.3.1.2.9.0.14,1.3.6.1.4.1.8301.3.1.2.9.0.15,1.3.6.1.4.1.8301.3.1.2.9.0.18,1.3.6.1.4.1.8301.3.1.2.9.0.19,1.3.6.1.4.1.8301.3.1.2.9.0.7,1.3.6.1.4.1.8301.3.1.2.9.0.8,1.3.132.0.6,1.3.6.1.4.1.8301.3.1.2.9.0.5,1.3.132.0.7,1.3.6.1.4.1.8301.3.1.2.9.0.6,1.3.132.0.8,1.3.6.1.4.1.8301.3.1.2.9.0.12,1.3.132.0.9,1.3.6.1.4.1.8301.3.1.2.9.0.13,1.3.6.1.4.1.8301.3.1.2.9.0.9,1.3.6.1.4.1.8301.3.1.2.9.0.10,1.3.6.1.4.1.8301.3.1.2.9.0.11,1.3.6.1.4.1.8301.3.1.2.9.0.2,1.3.6.1.4.1.8301.3.1.2.9.0.1,1.3.6.1.4.1.8301.3.1.2.9.0.4,1.3.6.1.4.1.8301.3.1.2.9.0.3,1.3.6.1.4.1.8301.3.1.2.9.0.22,1.3.6.1.4.1.8301.3.1.2.9.0.21,1.3.6.1.4.1.8301.3.1.2.9.0.24,1.3.6.1.4.1.8301.3.1.2.9.0.23,1.3.6.1.4.1.8301.3.1.2.9.0.20,1.3.6.1.4.1.8301.3.1.2.9.0.29,1.3.6.1.4.1.8301.3.1.2.9.0.26,1.3.6.1.4.1.8301.3.1.2.9.0.25,1.3.6.1.4.1.8301.3.1.2.9.0.28,1.3.6.1.4.1.8301.3.1.2.9.0.27,1.3.36.3.3.2.8.1.1.1,1.3.36.3.3.2.8.1.1.3,1.3.132.0.10,1.3.6.1.4.1.8301.3.1.2.9.0.35,1.3.6.1.4.1.8301.3.1.2.9.0.34,1.3.6.1.4.1.8301.3.1.2.9.0.33,1.3.6.1.4.1.8301.3.1.2.9.0.32,1.3.6.1.4.1.8301.3.1.2.9.0.31,1.3.6.1.4.1.8301.3.1.2.9.0.30,1.3.6.1.4.1.8301.3.1.2.9.0.38,1.3.6.1.4.1.8301.3.1.2.9.0.37,1.3.6.1.4.1.8301.3.1.2.9.0.36SHA512/ECDSA,SHA512withECDSA1.3.132.0.29,1.3.132.0.28,1.2.840.10045.3.1.7,1.2.840.10045.3.1.2,1.2.840.10045.3.1.1,1.2.840.10045.3.1.6,1.2.840.10045.3.1.5,1.2.840.10045.3.1.4,1.2.840.10045.3.1.3,1.3.36.3.3.2.8.1.1.9,1.3.36.3.3.2.8.1.1.11,1.3.36.3.3.2.8.1.1.7,1.3.36.3.3.2.8.1.1.5,1.3.36.3.3.2.8.1.1.13,1.3.132.0.30,1.3.132.0.32,1.3.132.0.31,1.3.132.0.34,1.3.132.0.33,1.3.6.1.4.1.8301.3.1.2.9.0.16,1.3.6.1.4.1.8301.3.1.2.9.0.17,1.3.6.1.4.1.8301.3.1.2.9.0.14,1.3.6.1.4.1.8301.3.1.2.9.0.15,1.3.6.1.4.1.8301.3.1.2.9.0.18,1.3.6.1.4.1.8301.3.1.2.9.0.19,1.3.6.1.4.1.8301.3.1.2.9.0.7,1.3.6.1.4.1.8301.3.1.2.9.0.8,1.3.132.0.6,1.3.6.1.4.1.8301.3.1.2.9.0.5,1.3.132.0.7,1.3.6.1.4.1.8301.3.1.2.9.0.6,1.3.132.0.8,1.3.6.1.4.1.8301.3.1.2.9.0.12,1.3.132.0.9,1.3.6.1.4.1.8301.3.1.2.9.0.13,1.3.6.1.4.1.8301.3.1.2.9.0.9,1.3.6.1.4.1.8301.3.1.2.9.0.10,1.3.6.1.4.1.8301.3.1.2.9.0.11,1.3.6.1.4.1.8301.3.1.2.9.0.2,1.3.6.1.4.1.8301.3.1.2.9.0.1,1.3.6.1.4.1.8301.3.1.2.9.0.4,1.3.6.1.4.1.8301.3.1.2.9.0.3,1.3.6.1.4.1.8301.3.1.2.9.0.22,1.3.6.1.4.1.8301.3.1.2.9.0.21,1.3.6.1.4.1.8301.3.1.2.9.0.24,1.3.6.1.4.1.8301.3.1.2.9.0.23,1.3.6.1.4.1.8301.3.1.2.9.0.20,1.3.6.1.4.1.8301.3.1.2.9.0.29,1.3.6.1.4.1.8301.3.1.2.9.0.26,1.3.6.1.4.1.8301.3.1.2.9.0.25,1.3.6.1.4.1.8301.3.1.2.9.0.28,1.3.6.1.4.1.8301.3.1.2.9.0.27,1.3.36.3.3.2.8.1.1.1,1.3.36.3.3.2.8.1.1.3,1.3.132.0.10,1.3.6.1.4.1.8301.3.1.2.9.0.35,1.3.6.1.4.1.8301.3.1.2.9.0.34,1.3.6.1.4.1.8301.3.1.2.9.0.33,1.3.6.1.4.1.8301.3.1.2.9.0.32,1.3.6.1.4.1.8301.3.1.2.9.0.31,1.3.6.1.4.1.8301.3.1.2.9.0.30,1.3.6.1.4.1.8301.3.1.2.9.0.38,1.3.6.1.4.1.8301.3.1.2.9.0.37,1.3.6.1.4.1.8301.3.1.2.9.0.36RSASSA-PSS,RbRSASHA256/RSA,SHA256withRSASHA384/RSA,SHA384withRSASHA512/RSA,SHA512withRSASHA224/RSA,SHA224withRSAMD5/RSA,MD5withRSASHA/RSA,SHA1/RSA,SHA1withRSA,SHAwithRSADSS,SHA/DSA,SHA1/DSA,SHA1withDSA,SHAwithDSARIPEMD160/RSA,RIPEMD160withRSAIQDSA,SHA1withIQDSARIPEMD160withIQDSAIQGQ,SHA1withIQGQRIPEMD160withIQGQIQRDSA,SHA1withIQRDSARIPEMD160withIQRDSAMerkleOTSwithSHA1MerkleOTS,MerkleOTSwithSHA256MerkleOTSwithSHA384MerkleOTSwithSHA512CMSSwithSHA1andWinternitzOTS_1CMSSwithSHA1andWinternitzOTS_2CMSSwithSHA1andWinternitzOTS_3CMSSwithSHA1andWinternitzOTS_4CMSSwithSHA256andWinternitzOTS_1CMSS,CMSSwithSHA256andWinternitzOTS_2CMSSwithSHA256andWinternitzOTS_3CMSSwithSHA256andWinternitzOTS_4CMSSwithSHA384andWinternitzOTS_1CMSSwithSHA384andWinternitzOTS_2CMSSwithSHA384andWinternitzOTS_3CMSSwithSHA384andWinternitzOTS_4CMSSwithSHA512andWinternitzOTS_1CMSSwithSHA512andWinternitzOTS_2CMSSwithSHA512andWinternitzOTS_3CMSSwithSHA512andWinternitzOTS_4GMSSwithSHA1GMSSwithSHA224GMSSwithSHA256GMSSwithSHA384GMSSwithSHA512Niederreiter,NiederreiterCFSMD5/RSA/RAWMpRSA,RprimeRSARAW/DSA,RawDSARIPEMD160/RSA/RAWRAWECDSA,RawECDSA1.3.132.0.29,1.3.132.0.28,1.2.840.10045.3.1.7,1.2.840.10045.3.1.2,1.2.840.10045.3.1.1,1.2.840.10045.3.1.6,1.2.840.10045.3.1.5,1.2.840.10045.3.1.4,1.2.840.10045.3.1.3,1.3.36.3.3.2.8.1.1.9,1.3.36.3.3.2.8.1.1.11,1.3.36.3.3.2.8.1.1.7,1.3.36.3.3.2.8.1.1.5,1.3.36.3.3.2.8.1.1.13,1.3.132.0.30,1.3.132.0.32,1.3.132.0.31,1.3.132.0.34,1.3.132.0.33,1.3.6.1.4.1.8301.3.1.2.9.0.16,1.3.6.1.4.1.8301.3.1.2.9.0.17,1.3.6.1.4.1.8301.3.1.2.9.0.14,1.3.6.1.4.1.8301.3.1.2.9.0.15,1.3.6.1.4.1.8301.3.1.2.9.0.18,1.3.6.1.4.1.8301.3.1.2.9.0.19,1.3.6.1.4.1.8301.3.1.2.9.0.7,1.3.6.1.4.1.8301.3.1.2.9.0.8,1.3.132.0.6,1.3.6.1.4.1.8301.3.1.2.9.0.5,1.3.132.0.7,1.3.6.1.4.1.8301.3.1.2.9.0.6,1.3.132.0.8,1.3.6.1.4.1.8301.3.1.2.9.0.12,1.3.132.0.9,1.3.6.1.4.1.8301.3.1.2.9.0.13,1.3.6.1.4.1.8301.3.1.2.9.0.9,1.3.6.1.4.1.8301.3.1.2.9.0.10,1.3.6.1.4.1.8301.3.1.2.9.0.11,1.3.6.1.4.1.8301.3.1.2.9.0.2,1.3.6.1.4.1.8301.3.1.2.9.0.1,1.3.6.1.4.1.8301.3.1.2.9.0.4,1.3.6.1.4.1.8301.3.1.2.9.0.3,1.3.6.1.4.1.8301.3.1.2.9.0.22,1.3.6.1.4.1.8301.3.1.2.9.0.21,1.3.6.1.4.1.8301.3.1.2.9.0.24,1.3.6.1.4.1.8301.3.1.2.9.0.23,1.3.6.1.4.1.8301.3.1.2.9.0.20,1.3.6.1.4.1.8301.3.1.2.9.0.29,1.3.6.1.4.1.8301.3.1.2.9.0.26,1.3.6.1.4.1.8301.3.1.2.9.0.25,1.3.6.1.4.1.8301.3.1.2.9.0.28,1.3.6.1.4.1.8301.3.1.2.9.0.27,1.3.36.3.3.2.8.1.1.1,1.3.36.3.3.2.8.1.1.3,1.3.132.0.10,1.3.6.1.4.1.8301.3.1.2.9.0.35,1.3.6.1.4.1.8301.3.1.2.9.0.34,1.3.6.1.4.1.8301.3.1.2.9.0.33,1.3.6.1.4.1.8301.3.1.2.9.0.32,1.3.6.1.4.1.8301.3.1.2.9.0.31,1.3.6.1.4.1.8301.3.1.2.9.0.30,1.3.6.1.4.1.8301.3.1.2.9.0.38,1.3.6.1.4.1.8301.3.1.2.9.0.37,1.3.6.1.4.1.8301.3.1.2.9.0.36ECNR,SHA1/ECNR,SHA1withECNR1.3.132.0.29,1.3.132.0.28,1.2.840.10045.3.1.7,1.2.840.10045.3.1.2,1.2.840.10045.3.1.1,1.2.840.10045.3.1.6,1.2.840.10045.3.1.5,1.2.840.10045.3.1.4,1.2.840.10045.3.1.3,1.3.36.3.3.2.8.1.1.9,1.3.36.3.3.2.8.1.1.11,1.3.36.3.3.2.8.1.1.7,1.3.36.3.3.2.8.1.1.5,1.3.36.3.3.2.8.1.1.13,1.3.132.0.30,1.3.132.0.32,1.3.132.0.31,1.3.132.0.34,1.3.132.0.33,1.3.6.1.4.1.8301.3.1.2.9.0.16,1.3.6.1.4.1.8301.3.1.2.9.0.17,1.3.6.1.4.1.8301.3.1.2.9.0.14,1.3.6.1.4.1.8301.3.1.2.9.0.15,1.3.6.1.4.1.8301.3.1.2.9.0.18,1.3.6.1.4.1.8301.3.1.2.9.0.19,1.3.6.1.4.1.8301.3.1.2.9.0.7,1.3.6.1.4.1.8301.3.1.2.9.0.8,1.3.132.0.6,1.3.6.1.4.1.8301.3.1.2.9.0.5,1.3.132.0.7,1.3.6.1.4.1.8301.3.1.2.9.0.6,1.3.132.0.8,1.3.6.1.4.1.8301.3.1.2.9.0.12,1.3.132.0.9,1.3.6.1.4.1.8301.3.1.2.9.0.13,1.3.6.1.4.1.8301.3.1.2.9.0.9,1.3.6.1.4.1.8301.3.1.2.9.0.10,1.3.6.1.4.1.8301.3.1.2.9.0.11,1.3.6.1.4.1.8301.3.1.2.9.0.2,1.3.6.1.4.1.8301.3.1.2.9.0.1,1.3.6.1.4.1.8301.3.1.2.9.0.4,1.3.6.1.4.1.8301.3.1.2.9.0.3,1.3.6.1.4.1.8301.3.1.2.9.0.22,1.3.6.1.4.1.8301.3.1.2.9.0.21,1.3.6.1.4.1.8301.3.1.2.9.0.24,1.3.6.1.4.1.8301.3.1.2.9.0.23,1.3.6.1.4.1.8301.3.1.2.9.0.20,1.3.6.1.4.1.8301.3.1.2.9.0.29,1.3.6.1.4.1.8301.3.1.2.9.0.26,1.3.6.1.4.1.8301.3.1.2.9.0.25,1.3.6.1.4.1.8301.3.1.2.9.0.28,1.3.6.1.4.1.8301.3.1.2.9.0.27,1.3.36.3.3.2.8.1.1.1,1.3.36.3.3.2.8.1.1.3,1.3.132.0.10,1.3.6.1.4.1.8301.3.1.2.9.0.35,1.3.6.1.4.1.8301.3.1.2.9.0.34,1.3.6.1.4.1.8301.3.1.2.9.0.33,1.3.6.1.4.1.8301.3.1.2.9.0.32,1.3.6.1.4.1.8301.3.1.2.9.0.31,1.3.6.1.4.1.8301.3.1.2.9.0.30,1.3.6.1.4.1.8301.3.1.2.9.0.38,1.3.6.1.4.1.8301.3.1.2.9.0.37,1.3.6.1.4.1.8301.3.1.2.9.0.36SHA1/RSA/RAWSHA224/RSA/RAWSHA256/RSA/RAWSHA384/RSA/RAWSHA512/RSA/RAWSSL_MD5andSHA1withRSARSA,RSA_PKCS1_v1_5RSA-OAEP,RSA_PKCS1_v2_1,RbRSAElGamalMcEliece,McEliecePKCSMpRSA,RprimeRSANiederreiterMcElieceFujisakiCipherMcElieceKobaraImaiCipherECIESBBSRandomECPRNGSHA1PRNGMD4MD5SHA,SHA1RIPEMD160RIPEMD128RIPEMD256TigerSHA256SHA384SHA512SHA224DHA256FORK256RIPEMD320VSH
================================================
FILE: net.sourceforge.codec/.classpath
================================================
================================================
FILE: net.sourceforge.codec/.project
================================================
net.sourceforge.codecorg.eclipse.jdt.core.javabuilderorg.eclipse.pde.ManifestBuilderorg.eclipse.pde.SchemaBuilderorg.eclipse.m2e.core.maven2Builderorg.eclipse.m2e.core.maven2Natureorg.eclipse.pde.PluginNatureorg.eclipse.jdt.core.javanature
================================================
FILE: net.sourceforge.codec/META-INF/MANIFEST.MF
================================================
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: net.sourceforge.codec;singleton:=true
Bundle-Version: 2.3.0
Bundle-Vendor: %Bundle-Vendor
Export-Package: codec,
codec.asn1,
codec.pkcs,
codec.pkcs1,
codec.pkcs10,
codec.pkcs12,
codec.pkcs7,
codec.pkcs8,
codec.pkcs9,
codec.util,
codec.x501,
codec.x509,
codec.x509.extensions
Bundle-RequiredExecutionEnvironment: JavaSE-17
Bundle-ActivationPolicy: lazy
Automatic-Module-Name: net.sourceforge.codec
================================================
FILE: net.sourceforge.codec/OSGI-INF/l10n/bundle.properties
================================================
#Properties file for net.sourceforge.codec
Bundle-Vendor=Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V.
Bundle-Name=CoDec Plug-in
================================================
FILE: net.sourceforge.codec/OSGI-INF/l10n/bundle_de.properties
================================================
#Properties file for net.sourceforge.codec
Bundle-Vendor=Fraunhofer-Gesellschaft zur F\u00f6rderung der angewandten Forschung e.V.
Bundle-Name=CoDec Plug-in
================================================
FILE: net.sourceforge.codec/build.properties
================================================
output.. = .
bin.includes = META-INF/,\
codec/,\
OSGI-INF/
================================================
FILE: net.sourceforge.codec/pom.xml
================================================
org.jcryptoolorg.jcryptool.core.parent1.0.84.0.0net.sourceforgenet.sourceforge.codec2.3.0eclipse-plugin
================================================
FILE: net.sourceforge.javahexeditor/.classpath
================================================
================================================
FILE: net.sourceforge.javahexeditor/.gitignore
================================================
/bin/
================================================
FILE: net.sourceforge.javahexeditor/.project
================================================
net.sourceforge.javahexeditororg.eclipse.jdt.core.javabuilderorg.eclipse.pde.ManifestBuilderorg.eclipse.pde.SchemaBuilderorg.eclipse.m2e.core.maven2Builderorg.eclipse.m2e.core.maven2Natureorg.eclipse.pde.PluginNatureorg.eclipse.jdt.core.javanature
================================================
FILE: net.sourceforge.javahexeditor/META-INF/MANIFEST.MF
================================================
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Java Hex Editor
Bundle-SymbolicName: net.sourceforge.javahexeditor; singleton:=true
Bundle-Activator: net.sourceforge.javahexeditor.plugin.HexEditorPlugin
Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.ui.workbench.texteditor,
org.eclipse.ui.views,
org.eclipse.ui.editors,
org.eclipse.core.resources,
org.eclipse.ui.ide,
org.eclipse.core.filesystem,
org.jcryptool.core.util,
org.eclipse.swt,
org.jcryptool.editor.text,
org.jcryptool.core.operations
Bundle-ActivationPolicy: lazy
Bundle-Vendor: Jordi Bergenthal,
Peter Dell,
Andrey Loskutov
Bundle-RequiredExecutionEnvironment: JavaSE-17
Automatic-Module-Name: net.sourceforge.javahexeditor
Export-Package: net.sourceforge.javahexeditor,
net.sourceforge.javahexeditor.common,
net.sourceforge.javahexeditor.plugin,
net.sourceforge.javahexeditor.plugin.actions,
net.sourceforge.javahexeditor.plugin.editors
Import-Package: org.apache.commons.codec,
org.apache.commons.codec.binary,
org.jcryptool.core.logging.utils
Bundle-Version: 1.0.9.1-20230901
================================================
FILE: net.sourceforge.javahexeditor/about.ini
================================================
featureImage=images/javahexeditor-32x32.png
aboutText=Java Hex Editor
================================================
FILE: net.sourceforge.javahexeditor/build.properties
================================================
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
plugin.xml,\
.,\
nl/,\
schema/,\
plugin.properties,\
plugin_de.properties,\
about.ini,\
icons/
================================================
FILE: net.sourceforge.javahexeditor/doc/COPYING.txt
================================================
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
Java Hex Editor - the cross-platform hex editor plugin for Eclipse
Copyright (C) 2006 - 2014 Jordi Bergenthal
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
================================================
FILE: net.sourceforge.javahexeditor/doc/PROJECT.txt
================================================
Project URL https://sourceforge.net/projects/javahexeditor/
Client: Bitkinex
Host: web.sourceforge.net
Protocol: SFTP
Port: 22
Username: Your Login Name (User Name) (e.g. peterdell)
Password: Your Login Password
Upload path: /home/project-web/javahexeditor/htdocs
Project Site URL: http://javahexeditor.sourceforge.net
Update Site URL : http://javahexeditor.sourceforge.net/update
================================================
FILE: net.sourceforge.javahexeditor/doc/RELEASE.txt
================================================
javahexeditor - Java Hex Editor
Copyright (C) 2006 - 2017 Jordi Bergenthal, pestatije(-at_)users.sourceforge.net.
The official javahexeditor project site is sourceforge.net/projects/javahexeditor.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
javahexeditor installation notes
--------------------------------
See http://javahexeditor.sourceforge.net.
javahexeditor change log
------------------------
26/11/2017 version 0.5.1.
Adapt wrappers for Windows and Mac OS X to Java 1.8.
Update help files and internal help file structure.
09/08/2017 version 0.5.1.
Update to Java 1.7 and Eclipse Oxygene.
08/08/2017 version 0.5.0
Fixed page-up/page-down handling.
Enabled opening files from the local history.
Thanks to Andrey Loskutov for the fixes.
13/11/2014 version 0.4.9.
Separated Eclipse plugin from stand-alone application.
Included standard OSGI and SWT jars for location and UI widgets.
New build process creates separate self-contained "JavaHexEditor.jar" file for Linux (32-bit), Windows (32-bit) and Windows (64-bit)
29/12/2009 version 0.4.2.
Moved precompiled to swt 3.5.1, gcc 4.4.0.
6/12/2009 version 0.4.1.
Bugfix: charset 8859-1 chars between 128 and 159 have length 0.
29/11/2009 version 0.4.0.
Added Block selection dialog; selection and values in status bar.
Use system default character encoding.
Added "Open With Hex Editor" menu option in Eclipse context menu.
Added plugin to update site.
Moved sources to source control (svn).
Thanks Andre Bossert and Alexander Kuramshin for your contributions.
28/6/2009 version 0.3.1.
Added replace option in Find dialog.
User guide available in plugin.
25/1/2009 version 0.3.0.
Bugfix: precompiled saving files bigger than 2 megs error.
Bugfix: undo restores unchanged text to black color.
Bugfix: plugin doesn't activate menu options after "Select All".
Added user guide in stand-alone.
16/9/2008, version 0.2.9.
Enable [Alt Gr] input.
Bugfix: ensure whole screen has data after undo/redo.
1/8/2008, version 0.2.8.
Bugfixes for SWT 3.4: re-setting font crash; lost overwrite caret.
Bugfix: plugin recognises text editor location provider input.
9/7/2008, version 0.2.7.
Bugfix: scrolling up freezes editor in SWT 3.4.
Bugfix: lost selection when scrolling.
5/7/2008, version 0.2.6.
Bugfix(1990431): in plugin, Eclipse 3.3, external file open error.
Bugfix: crash when opening a file with no read access.
Enabled drag-select.
Precompiled accepts command parameter in the same way as
stand-alone.
11/6/2008, version 0.2.5.
Bugfix: searching for a new literal leaks previous Finder object.
Added win32 precompiled release.
27/5/2008, version 0.2.4.
Bugfix: close unreferenced files before saving.
20/3/2008, version 0.2.3.
Added overwrite and unfocused carets.
Added undo/redo inserts/overwrites.
10/2/2008, version 0.2.2.
Preferences dialog: font list loaded asynchronously.
Bugfix: empty font list in ubuntu.
Bugfix: saving new file crash.
19/1/2008, version 0.2.1.
Bugfix: plugin could not open external files.
Bugfix: undo/redo: single deletes merging not working.
Bugfix: undo/redo: insert then delete not working.
Bugfix: font sizes 1 and 2 not used anymore.
Bugfix: file drop-open not working in linux.
1/1/2008, version 0.2.0.
Added file drop-open to stand-alone.
Bugfix: clear finder cache if user modifies data.
Added undo/redo deletes.
Bugfix: plugin actions were enabled/disabled when showing menu
only.
27/5/2007, version 0.1.9.
Bugfix: some scrolls were shuffling lines at the top or bottom
of the screen.
18/4/2007, version 0.1.8.
Bugfix for File->New crash.
24/3/2007, version 0.1.7.
Bugfix: save-as or save-selection-as won't overwrite files used
for reading.
Added optional command parameter: file to edit.
25/1/2007, version 0.1.6.
Bugfix: javahexeditor crashed when re-finding after a save.
16/10/2006, version 0.1.5.
Bugfix: javahexeditor crashed when combining a large shell with
very small fonts.
Bugfix: preferences dialog was showing error messages in linux.
Bugfix: caret position and caret line color unsincronized,
sometimes causing crashes.
8/10/2006, version 0.1.4.
Added font preferences.
Bugfix: selection was not shown after pasting or trimming.
15/9/2006, version 0.1.3.
Enabled editing in text area.
10/9/2006, version 0.1.2.
'Go to' highlights location position.
Bugfix: text area is now updated when overwriting.
25/8/2006, version 0.1.1.
Added 'new file' and trim options.
5/8/2006, version 0.1.0.
Added 'go to' shortcut key in plugin.
Previous input is now selected when reopening find and 'go to'
dialogs.
28/7/2006, version 0.0.9.
Added 'go to' option.
Bugfix: in Eclipse, an error was shown when javahexeditor was the
first editor being opened.
Bugfix: stand-alone crashed when clicking inside the text area and
dragging the mouse past the bottom.
Defined default button for find dialog.
23/7/2006, version 0.0.8.
Added 'save as' and 'save selection as' options.
Bugfix, now can correctly insert at end of file.
User interface response optimized (event queue emptied before
redraw).
30/6/2006, version 0.0.7.
Added binary cut copy and paste, and text cut and copy.
Bugfix, shift + mouse click now correctly selects data.
Finished rendering of background vertical hint lines.
18/6/2006, version 0.0.6.
Added pasting of text and files.
Added stand-alone release.
11/6/2006, version 0.0.5.
Added single and block delete.
Bugfix, now multiple open files share the same status display.
Code rearranged: added Manager class to decouple javahexeditor from
Eclipse.
5/6/2006, version 0.0.4.
Added insert mode.
14/5/2006, version 0.0.3.
Small bugfix, now can handle files of size 21 Gbytes+
13/5/2006, version 0.0.2.
Find functionality revamped: forward/backwards, ignore case, only one find
dialog open at a time, find dialog reopened restores previous status, only
one text box for hex/text, dynamic update of related controls after user
interaction, plus, now when finding, a reposition in the editor does
reposition find start.
6/5/2006, version 0.0.1. First beta release.
First version that can be called a java hex editor. Released as an Eclipse
plugin.
Basic file viewing/browsing, hex unicode and ASCII find, hex overwriting,
and file saving.
Support for very big files.
================================================
FILE: net.sourceforge.javahexeditor/nl/de/contexts.xml
================================================
Mit dem Hexeditor können beliebige Dateien angelegt, bearbeitet und betrachtet werden.
================================================
FILE: net.sourceforge.javahexeditor/nl/en/contexts.xml
================================================
The hexeditor can be used to create, edit and view all types of files.
================================================
FILE: net.sourceforge.javahexeditor/plugin.properties
================================================
editor.name = Hex Editor
preferences-page.name = Java Hex Editor
action.label = Open in Hex Editor
action.tooltip = Open the Hex Editor for selected files
content-type.binary.name = Binary File (Java Hex Editor)
content-type.archive.name = Archive File
content-type.executable.name = Executable File
content-type.object.name = Object File
content-type.shared-library.name = Shared Library File
content-type.static-library.name = Static Library File
content-type.miscellaneous.name = Miscellaneous Binary File
================================================
FILE: net.sourceforge.javahexeditor/plugin.xml
================================================
================================================
FILE: net.sourceforge.javahexeditor/plugin_de.properties
================================================
editor.name = Hex Editor
preferences-page.name = Java Hex Editor
action.label = ffnen mit Hex Editor
action.tooltip = Ausgewhlte Dateien im Hex Editor ffnen
content-type.binary.name = Binr-Datei (Java Hex Editor)
content-type.archive.name = Archiv-Datei
content-type.executable.name = Ausfhrbare Datei
content-type.object.name = Objekt-Datei
content-type.shared-library.name = Shared-Library-Datei
content-type.static-library.name = Static-Library-Datei
content-type.miscellaneous.name = Sonstige Binr-Datei
================================================
FILE: net.sourceforge.javahexeditor/pom.xml
================================================
org.jcryptoolorg.jcryptool.core.parent1.0.84.0.0net.sourceforge1.0.9.1-20230901net.sourceforge.javahexeditoreclipse-plugin
================================================
FILE: net.sourceforge.javahexeditor/schema/outline.exsd
================================================
Outline view of binary file
0.3.0
Schema tree view of file type
todo
Empty outline
================================================
FILE: net.sourceforge.javahexeditor/src/net/sourceforge/javahexeditor/BinaryContent.java
================================================
/*
* javahexeditor, a java hex editor
* Copyright (C) 2006, 2009 Jordi Bergenthal, pestatije(-at_)users.sourceforge.net
* The official javahexeditor site is sourceforge.net/projects/javahexeditor
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package net.sourceforge.javahexeditor;
import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.ByteBuffer;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;
import java.util.ArrayList;
import java.util.EventListener;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.SortedSet;
import java.util.TreeSet;
import net.sourceforge.javahexeditor.BinaryContentActionHistory.Entry;
/**
* A binary content provider. Content backed by files has no effect on memory
* footprint. Content backed by memory buffers is limited by amount of memory.
* Notifies ModifyListeners when it has been modified. Keeps track of the
* positions where changes have been done. Files that back this content must not
* be modified while the content is still in use.
*
* @author Jordi Bergenthal
*/
public final class BinaryContent {
/**
* Used to notify changes in content
*/
public static interface ModifyListener extends EventListener {
/**
* Notifies the listener that the content has just been changed
*/
public void modified();
}
public static final class RangeSelection {
public final long start;
public final long end;
public RangeSelection(long start, long end) {
if (start < 0) {
throw new IllegalArgumentException("Parameter start must not be negative, specified value is " + start);
}
if (end < 0) {
throw new IllegalArgumentException("Parameter end must not be negative, specified value is " + end);
}
if (end < start) {
throw new IllegalArgumentException(
"Parameter end must not be less than start, specified value is " + end + " < " + start);
}
this.start = start;
this.end = end;
}
public long getLength() {
return end - start;
}
@Override
public String toString() {
return "start=" + start + ", end=" + end;
}
}
/**
* A subset of data contained in a ByteBuffer or a File
*/
final static class Range implements Comparable, Cloneable {
long position = -1L;
long length = -1L;
boolean dirty = true;
long dataOffset;
Object data; // ByteBuffer or RandomAccessFile
File file; // used when data is a RandomAccessFile since we cannot get a
// File from it
Range(long aPosition, long aLength) {
position = aPosition;
length = aLength;
}
Range(long aPosition, ByteBuffer aBuffer, boolean isDirty) {
this(aPosition, aBuffer.remaining());
data = aBuffer;
dirty = isDirty;
}
Range(long position, File file, boolean isDirty) throws IOException {
this(position, file.length());
if (length < 0L) {
throw new RuntimeException("File length is negative, specified value is " + length + ".");
}
this.file = file;
data = RandomAccessFileFactory.createRandomAccessFile(this.file, "r");
dirty = isDirty;
}
long exclusiveEnd() {
return position + length;
}
@Override
public Range clone() {
try {
return (Range) super.clone();
} catch (CloneNotSupportedException e) {
throw new RuntimeException(e);
}
}
@Override
public int compareTo(Range other) {
if (position < other.position && exclusiveEnd() <= other.position) {
return -1;
}
if (other.position < position && other.exclusiveEnd() <= position) {
return 1;
}
return 0; // overlap
}
@Override
public boolean equals(Object obj) {
if (obj instanceof Range) {
return compareTo((Range) obj) == 0; // to maintain contract with
// Map use
}
return false;
}
@Override
public int hashCode() {
return super.hashCode();
}
@Override
public String toString() {
return "Range {position:" + position + ", length:" + length + '}';
}
}
public static final long mappedFileBufferLength = 2048 * 1024; // for mapped
// file I/O
BinaryContentActionHistory actions; // undo/redo actions history
BinaryContentActionHistory actionsTemp;
boolean dirty;
boolean dirtySize;
long exclusiveEnd = -1L;
long lastUpperNibblePosition = -1L;
ArrayList listeners;
List myChanges;
boolean myChangesInserted = false;
long myChangesPosition = -1L;
TreeSet myRanges;
Iterator tailTree;
/**
* Create new empty content.
*/
public BinaryContent() {
myRanges = new TreeSet();
}
/**
* Create new content from a file
*
* @param aFile
* the backing content provider
* @throws IOException
* when i/o problems occur. The content will be empty but valid
*/
public BinaryContent(File aFile) throws IOException {
this();
if (aFile == null || aFile.length() < 1L) {
return;
}
myRanges.add(new Range(0L, aFile, false));
}
void actionsOn(boolean on) {
if (on) {
if (actions == null) {
actions = actionsTemp;
}
} else {
actionsTemp = actions;
actions = null;
}
}
/**
* Add a listener to the list of listeners to be notified when there is a change
* in the content
*
* @param listener
* to be notified of the change
*/
public void addModifyListener(ModifyListener listener) {
if (listeners == null) {
listeners = new ArrayList();
}
listeners.add(listener);
}
/**
* Tells whether a redo is possible
*
* @return true if something can be redone
*/
public boolean canRedo() {
return actions != null && actions.canRedo();
}
/**
* Tells whether an undo is possible
*
* @return true if something can be undone
*/
public boolean canUndo() {
return actions != null && actions.canUndo();
}
void commitChanges() {
if (myChanges == null) {
return;
}
ByteBuffer store = ByteBuffer.allocate(myChanges.size());
for (Iterator iterator = myChanges.iterator(); iterator.hasNext();) {
store.put(iterator.next().byteValue());
}
store.position(0);
myChanges = null;
if (myChangesInserted) {
insertRange(new Range(myChangesPosition, store, true));
} else {
overwriteRange(new Range(myChangesPosition, store, true));
}
myChangesInserted = false;
myChangesPosition = -1L;
}
/**
* Deletes length bytes from the content at the given position
*
* @param position
* start deletion point
* @param length
* number of bytes to delete
*/
public void delete(long position, long length) {
if (position < 0 || position >= length() || length < 1L) {
return;
}
dirty = true;
dirtySize = true;
if (length > length() - position) {
length = length() - position;
}
if (actions != null) {
lastUpperNibblePosition = -1L;
actions.eventPreModify(BinaryContentActionHistory.TYPE_DELETE, position, length == 1L);
}
if (myChanges != null && myChangesInserted && myChangesPosition <= position
&& myChangesPosition + myChanges.size() >= position + length) {
int deleteStart = (int) (position - myChangesPosition);
List subList = myChanges.subList(deleteStart, deleteStart + (int) length);
if (actions != null) {
actions.addDeleted(position, subList, length == 1L);
if (length > 1) {
actions.endAction();
}
}
if (length < myChanges.size()) {
subList.clear();
} else { // length == myChanges.size()
myChanges = null;
// splitAndShift(position, 0); // mark them as dirty
}
} else {
commitChanges();
deleteAndShift(position, length);
}
notifyListeners();
}
void deleteAndShift(long start, long length) {
deleteInternal(start, length);
initSubtreeTraversing(start, 0L);
shiftRemainingRanges(-length);
}
void deleteInternal(long startPosition, long length) {
if (length < 1L) {
return;
}
initSubtreeTraversing(startPosition, length);
if (!tailTree.hasNext()) {
return;
}
ArrayList deleted = new ArrayList();
Range firstRange = tailTree.next();
Range secondRange = firstRange.clone(); // will be tail part of
// firstRange
Range lastRange = null;
if (firstRange.position < startPosition) {
firstRange.length = startPosition - firstRange.position;
secondRange.length = secondRange.exclusiveEnd() - startPosition; // actions
secondRange.dataOffset += startPosition - secondRange.position; // actions
secondRange.position = startPosition; // actions
} else { // firstRange.position == startPosition
tailTree.remove();
}
long endSoFar = secondRange.exclusiveEnd();
boolean toBeAdded = false;
if (endSoFar > exclusiveEnd) {
lastRange = secondRange.clone();
toBeAdded = true;
secondRange.length = exclusiveEnd - secondRange.position; // actions
}
deleted.add(secondRange); // actions
if (endSoFar < exclusiveEnd) {
while (tailTree.hasNext() && lastRange == null) {
lastRange = tailTree.next();
if (lastRange.exclusiveEnd() <= exclusiveEnd) {
tailTree.remove();
deleted.add(lastRange); // actions
lastRange = null;
}
}
if (lastRange != null && lastRange.position < exclusiveEnd) { // actions
Range beforeLastRange = lastRange.clone();
beforeLastRange.length = exclusiveEnd - beforeLastRange.position;
deleted.add(beforeLastRange);
}
}
if (lastRange != null && lastRange.position < exclusiveEnd && lastRange.exclusiveEnd() > exclusiveEnd) {
long delta = exclusiveEnd - lastRange.position;
lastRange.position += delta;
lastRange.length -= delta;
lastRange.dataOffset += delta;
if (toBeAdded) {
myRanges.add(lastRange);
}
}
if (actions != null) {
actions.addLostRanges(deleted);
}
}
private long[] deleteRanges(List currentAction) {
long[] result = new long[2];
result[0] = result[1] = (currentAction.get(0)).position;
actionsOn(false);
deleteAndShift(result[0], (currentAction.get(currentAction.size() - 1)).exclusiveEnd() - result[0]);
actionsOn(true);
return result;
}
/**
* Closes all files before termination. After this call the object is no longer
* valid. Calling dispose() is optional, but it will let use of files
* immediately in the operating system, instead of having to wait until the
* object is garbage collected. Note: apparently due to a bug in the Java
* virtual machine combined with some dumb OS, files won't be freed after this
* call. See http://forum.java.sun.com/thread.jspa?forumID=4&threadID=158689
*/
public void dispose() {
if (myRanges == null) {
return;
}
for (Iterator i = myRanges.iterator(); i.hasNext();) {
Range value = i.next();
if (value.data instanceof RandomAccessFile) {
try {
((RandomAccessFile) value.data).close();
} catch (IOException e) {
// ok, leave this file alone and close the rest
}
}
}
if (actions != null) {
actions.finalize();
}
myRanges = null;
listeners = null;
}
int fillWithChanges(ByteBuffer dst, long position) {
long relativePosition = position - myChangesPosition;
int changesSize = myChanges.size();
if (relativePosition < 0L || relativePosition >= changesSize) {
return 0;
}
int remaining = dst.remaining();
int i = (int) relativePosition;
for (; remaining > 0 && i < changesSize; ++i, --remaining) {
dst.put((myChanges.get(i)).byteValue());
}
return i - (int) relativePosition;
}
int fillWithPartOfRange(ByteBuffer dst, Range sourceRange, long overlapBytes, int maxCopyLength)
throws IOException {
int dstInitialPosition = dst.position();
if (sourceRange.data instanceof ByteBuffer) {
ByteBuffer src = (ByteBuffer) sourceRange.data;
src.limit((int) (sourceRange.dataOffset + sourceRange.length));
src.position((int) (sourceRange.dataOffset + overlapBytes));
if (src.remaining() > dst.remaining() || src.remaining() > maxCopyLength) {
src.limit(src.position() + Math.min(dst.remaining(), maxCopyLength));
}
dst.put(src);
} else if (sourceRange.data instanceof RandomAccessFile) {
RandomAccessFile src = (RandomAccessFile) sourceRange.data;
long start = sourceRange.dataOffset + overlapBytes;
int length = (int) Math.min(sourceRange.length - overlapBytes, maxCopyLength);
int limit = -1;
if (dst.remaining() > length) {
limit = dst.limit();
dst.limit(dst.position() + length);
}
src.getChannel().read(dst, start);
if (limit > 0) {
dst.limit(limit);
}
}
return dst.position() - dstInitialPosition;
}
void fillWithRange(ByteBuffer dst, Range sourceRange, long overlapBytes, long position, List rangesModified)
throws IOException {
long positionSoFar = position;
if (position < myChangesPosition) {
int added = fillWithPartOfRange(dst, sourceRange, overlapBytes,
(int) Math.min(myChangesPosition - position, Integer.MAX_VALUE));
positionSoFar += added;
overlapBytes += added;
}
int changesAdded = 0;
long changesPosition = positionSoFar;
if (myChanges != null && positionSoFar >= myChangesPosition
&& positionSoFar < myChangesPosition + myChanges.size() && overlapBytes < sourceRange.length) {
changesAdded = fillWithChanges(dst, positionSoFar);
if (myChangesInserted) {
positionSoFar += changesAdded;
} else {
overlapBytes += changesAdded;
}
}
positionSoFar += fillWithPartOfRange(dst, sourceRange, overlapBytes, Integer.MAX_VALUE);
if (rangesModified != null) {
if (sourceRange.dirty) {
rangesModified.add(position);
rangesModified.add(positionSoFar - position);
} else if (changesAdded > 0) {// && !myChangesInserted) {
rangesModified.add(changesPosition);
rangesModified.add((long) changesAdded);
// } else if (myChanges != null && changesPosition >=
// myChangesPosition && myChangesInserted &&
// positionSoFar - changesPosition > 0) {
// rangesModified.add(new Long(changesPosition));
// rangesModified.add(new Long(positionSoFar -
// changesPosition));
}
}
}
/**
* Closes all files for termination
*
* @see Object#finalize()
*/
@Override
protected void finalize() {
dispose();
}
/**
* Reads a sequence of bytes from this content into the given buffer, starting
* at the given position
*
* @param dst
* where to write the read result to
* @param position
* starting read point
* @return number of bytes read
* @throws IOException
*/
public int get(ByteBuffer dst, long position) throws IOException {
return get(dst, null, position);
}
/**
* Reads a sequence of bytes from this content into the given buffer, starting
* at the given position
*
* @param dst
* where to write the read result to
* @param rangesModified
* ordered Long's sequence (range start, range length, ...). Return
* variable that specifies current ranges of modified content. Useful
* for highlighting changes in content.
* @param position
* starting read point
* @return number of bytes read
* @throws IOException
*/
public int get(ByteBuffer dst, List rangesModified, long position) throws IOException {
if (rangesModified != null) {
rangesModified.clear();
}
long positionShift = 0;
int dstInitialRemaining = dst.remaining();
if (myChanges != null && myChangesInserted && position > myChangesPosition) {
positionShift = (int) Math.min(myChanges.size(), position - myChangesPosition);
}
long positionSoFar = position - positionShift;
initSubtreeTraversing(positionSoFar, dst.remaining());
Range partialRange = null;
while (tailTree.hasNext() && (partialRange = tailTree.next()).position < exclusiveEnd) {
fillWithRange(dst, partialRange, positionSoFar - partialRange.position, positionSoFar + positionShift,
rangesModified); // throws IOException
positionSoFar = partialRange.exclusiveEnd();
if (myChanges != null && myChangesInserted && positionSoFar + positionShift > myChangesPosition) {
positionShift = myChanges.size();
}
}
if (dst.remaining() > 0 && myChanges != null
&& positionSoFar + positionShift < myChangesPosition + myChanges.size()) {
int size = fillWithChanges(dst, positionSoFar + positionShift);
if (rangesModified != null) {
rangesModified.add(positionSoFar + positionShift);
rangesModified.add((long) size);
}
}
return dstInitialRemaining - dst.remaining();
}
/**
* Reads the sequence of all bytes from this content into the given file
*
* @param destinationFile
* where to write the read result to
* @return number of bytes read
* @throws IOException
*/
public long get(File destinationFile) throws IOException {
return get(destinationFile, 0L, length());
}
/**
* Reads a sequence of bytes from this content into the given file
*
* @param destinationFile
* where to write the read result to
* @param start
* first byte in sequence
* @param length
* number of bytes to read
* @return number of bytes read
* @throws IOException
*/
public long get(File destinationFile, long start, long length) throws IOException {
if (start < 0L || length < 0L || start + length > length()) {
return 0L;
}
if (actions != null) {
actions.endAction();
}
commitChanges();
RandomAccessFile dst = RandomAccessFileFactory.createRandomAccessFile(destinationFile, "rws");
IOException preCloseException = null;
try {
dst.setLength(length);
FileChannel channel = dst.getChannel();
ByteBuffer buffer = null;
for (long position = 0L; position < length; position += mappedFileBufferLength) {
int partLength = (int) Math.min(mappedFileBufferLength, length - position);
boolean bufferFromMap = true;
try {
buffer = channel.map(FileChannel.MapMode.READ_WRITE, position, partLength);
} catch (IOException e) {
// gcj 4.3.0 channel maps work differently than sun's:
// gcj won't accept two calls to channel.map with a
// different position, sun does
// gcj will happily accept maps of size bigger than
// available memory, sun won't
// to access past the 2Gb barrier there is no choice but use
// plain ByteBuffers in gcj
bufferFromMap = false;
if (buffer == null) {
buffer = ByteBuffer.allocateDirect((int) mappedFileBufferLength);
}
buffer.position(0);
buffer.limit(partLength);
}
get(buffer, start + position);
if (bufferFromMap) {
((MappedByteBuffer) buffer).force();
buffer = null;
} else {
buffer.position(0);
buffer.limit(partLength);
channel.write(buffer, position);
}
}
channel.force(true);
channel.close();
} catch (IOException e) {
preCloseException = e;
}
try {
dst.close();
} catch (IOException e) {
if (preCloseException == null) {
throw e;
}
throw preCloseException; // throw previous exception instead
}
if (preCloseException != null) {
throw preCloseException;
}
return length;
}
/*
* Does not check myChanges
*/
private int getFromRanges(long position) throws IOException {
int result = 0;
Range range = getRangeAt(position);
if (range != null) {
Object value = range.data;
if (value instanceof ByteBuffer) {
ByteBuffer data = (ByteBuffer) value;
data.limit(data.capacity());
data.position((int) range.dataOffset);
result = data.get((int) (position - range.position)) & 0x0ff;
} else if (value instanceof RandomAccessFile) {
@SuppressWarnings("resource")
RandomAccessFile randomFile = (RandomAccessFile) value;
randomFile.seek(position);
result = randomFile.read();
}
}
return result;
}
/**
* Get the list of files that back this object.
*
* @return list of File's. It is not a live list (changes are not propagated)
*/
public List getOpenFiles() {
HashSet result = new HashSet();
if (myRanges == null || myRanges.size() == 0) {
return new ArrayList(result);
}
for (Iterator i = myRanges.iterator(); i.hasNext();) {
Range value = i.next();
if (value.data instanceof RandomAccessFile && value.file != null) {
result.add(value.file);
}
}
return new ArrayList(result);
}
Range getRangeAt(long position) {
SortedSet subSet = myRanges.tailSet(new Range(position, 1L));
if (subSet.isEmpty()) {
return null;
}
return subSet.first();
}
SortedSet initSubtreeTraversing(long position, long length) {
SortedSet result = myRanges.tailSet(new Range(position, 1L));
tailTree = result.iterator();
exclusiveEnd = position + length;
if (exclusiveEnd > length()) {
exclusiveEnd = length();
}
return result;
}
/**
* Inserts a byte into this content at the given position
*
* @param source
* byte
* @param position
* insert point
* @throws IOException
*/
public void insert(byte source, long position) throws IOException {
if (position > length()) {
return;
}
dirty = true;
dirtySize = true;
lastUpperNibblePosition = position;
if (actions != null) {
actions.eventPreModify(BinaryContentActionHistory.TYPE_INSERT, position, true);
}
updateChanges(position, true);
myChanges.set((int) (position - myChangesPosition), source & 0x0ff);
notifyListeners();
}
/**
* Inserts a sequence of bytes from the given buffer into this content, starting
* at the given position and shifting the existing ones.
*
* @param source
* bytes. The buffer is not copied internally, changes after this
* call will result in undefined behaviour.
* @param position
* starting insert point
*/
public void insert(ByteBuffer source, long position) {
if (source.remaining() < 1 || position > length()) {
return;
}
dirty = true;
dirtySize = true;
lastUpperNibblePosition = -1L;
if (actions != null) {
actions.eventPreModify(BinaryContentActionHistory.TYPE_INSERT, position, false);
}
commitChanges();
Range newRange = new Range(position, source, true);
insertRange(newRange);
if (actions != null) {
actions.addInserted(newRange.clone());
}
notifyListeners();
}
/**
* Inserts a sequence of bytes from the given file into this content, starting
* at the given position and shifting the existing ones.
*
* @param aFile
* The file is not copied internally, changes after this call will
* result in undefined behaviour.
* @param position
* starting insert point
* @throws IOException
* when i/o problems occur. The content stays unchanged and valid
*/
public void insert(File aFile, long position) throws IOException {
long fileLength = aFile.length();
if (fileLength < 1L || position > length()) {
return;
}
Range newRange = new Range(position, aFile, true);
dirty = true;
dirtySize = true;
lastUpperNibblePosition = -1L;
if (actions != null) {
actions.eventPreModify(BinaryContentActionHistory.TYPE_INSERT, position, false);
}
commitChanges();
insertRange(newRange);
if (actions != null) {
actions.addInserted(newRange.clone());
}
notifyListeners();
}
private void insertRange(Range newRange) {
splitAndShift(newRange.position, newRange.length);
myRanges.add(newRange);
}
private long[] insertRanges(List ranges) {
Range firstRange = ranges.get(0);
Range lastRange = ranges.get(ranges.size() - 1);
splitAndShift(firstRange.position, lastRange.exclusiveEnd() - firstRange.position);
ArrayList cloned = new ArrayList(ranges.size());
for (int i = 0; i < ranges.size(); ++i) {
cloned.add((ranges.get(i)).clone());
}
myRanges.addAll(cloned);
return new long[] { firstRange.position, lastRange.exclusiveEnd() };
}
/**
* Tells whether changes have been done to the original content
*
* @return true: the content has been modified
*/
public boolean isDirty() {
return dirty;
}
/**
* Tells whether changes have been done to the original content's size
*
* @return true: the content has been modified in size
*/
public boolean isDirtySize() {
return dirtySize;
}
/**
* Number of bytes in content
*
* @return length of content in byte units
*/
public long length() {
long result = 0L;
if (myRanges.size() > 0) {
result = (myRanges.last()).exclusiveEnd();
}
if (myChanges != null && myChangesInserted) {
result += myChanges.size();
}
return result;
}
void notifyListeners() {
if (listeners == null) {
return;
}
for (int i = 0; i < listeners.size(); ++i) {
listeners.get(i).modified();
}
}
/**
* Writes a byte into this content at the given position
*
* @param source
* byte
* @param position
* overwrite point
* @throws IOException
*/
public void overwrite(byte source, long position) throws IOException {
overwrite(source, 0, 8, position);
}
/**
* Writes a byte into this content at the given position with bit offset and
* length bits Examples: previous content 0000 0000, source 1111 1111, offset 0,
* length 8 -> resulting content 1111 1111 previous content 0000 0000, source
* 1111 1111, offset 1, length 2 -> resulting content 0110 0000 previous content
* 0000 0000, source stuv wxyz, offset 2, length 5 -> resulting content 00vw
* xyz0
*
* When action history is on, considers the special case of user generated
* input(in hex) from a keyboard, in which nibbles are input in different calls
* to this method: the lower nibble input is not considered in action history so
* undoing/redoing takes effect on the whole byte.
*
*
* @param source
* byte, interesting bits are to the right
* @param offset
* bit offset (0 <= offset < 8)
* @param length
* number of bits to copy
* @param position
* overwrite point
* @throws IOException
*/
public void overwrite(byte source, int offset, int length, long position) throws IOException {
if (offset < 0 || offset > 7 || length < 0 || position >= length()) {
return;
}
dirty = true;
if (actions != null) {
if (lastUpperNibblePosition == position && offset == 4 && length == 4) {
actionsOn(false);
} else {
actions.eventPreModify(BinaryContentActionHistory.TYPE_OVERWRITE, position, true);
}
}
if (length + offset > 8) {
length = 8 - offset;
}
Range range = updateChanges(position, false);
int previous = (myChanges.get((int) (position - myChangesPosition))).intValue();
int mask = (0x0ff >>> offset) & (0x0ff << (8 - offset - length));
int newValue = previous & ~mask | (source << (8 - offset - length)) & mask;
myChanges.set((int) (position - myChangesPosition), newValue);
if (actions != null) {
if (range == null) {
actions.addLostByte(position, previous);
} else {
Range clone = range.clone();
clone.position = position;
clone.length = 1L;
clone.dataOffset = range.dataOffset + position - range.position;
// clone.dirty = true;
actions.addLostRange(clone);
}
}
actionsOn(true);
lastUpperNibblePosition = actions != null && offset == 0 && length == 4 ? position : -1L;
notifyListeners();
}
/**
* Writes a sequence of bytes from the given buffer into this content, starting
* at the given position and overwriting the existing ones.
*
* @param source
* bytes. The buffer is not copied internally, changes after this
* call will result in undefined behaviour.
* @param position
* starting overwrite point
*/
public void overwrite(ByteBuffer source, long position) {
if (source.remaining() > 0 && position < length()) {
overwriteInternal(new Range(position, source, true));
}
}
/**
* Writes a sequence of bytes from the given file into this content, starting at
* the given position and overwriting the existing ones. Changes to the file
* after this call will result in undefined behaviour.
*
* @param aFile
* with source bytes.
* @param position
* starting overwrite point
* @throws IOException
* when i/o problems occur. The content stays unchanged and valid
*/
public void overwrite(File aFile, long position) throws IOException {
if (aFile.length() > 0L && position < length()) {
overwriteInternal(new Range(position, aFile, true));
}
}
void overwriteInternal(Range newRange) {
dirty = true;
lastUpperNibblePosition = -1L;
if (actions != null) {
actions.eventPreModify(BinaryContentActionHistory.TYPE_OVERWRITE, newRange.position, false);
}
commitChanges();
overwriteRange(newRange);
if (actions != null) {
actions.addRangeToCurrentAction(newRange.clone());
}
notifyListeners();
}
private void overwriteRange(Range aRange) {
deleteInternal(aRange.position, aRange.length);
myRanges.add(aRange);
}
private long[] overwriteRanges(List ranges) {
Range firstRange = ranges.get(0);
Range lastRange = ranges.get(ranges.size() - 1);
splitAndShift(firstRange.position, 0);
splitAndShift(lastRange.exclusiveEnd(), 0);
initSubtreeTraversing(firstRange.position, 0L);
if (tailTree.hasNext()) {
Range goingRange = tailTree.next();
while (goingRange != null && goingRange.exclusiveEnd() <= lastRange.exclusiveEnd()) {
tailTree.remove();
goingRange = null;
if (tailTree.hasNext()) {
goingRange = tailTree.next();
}
}
}
ArrayList cloned = new ArrayList(ranges.size());
for (int i = 0; i < ranges.size(); ++i) {
cloned.add((ranges.get(i)).clone());
}
myRanges.addAll(cloned);
return new long[] { firstRange.position, lastRange.exclusiveEnd() };
}
/**
* Redoes last action on BinaryContent. Action history should be on:
* setActionHistory()
*
* @return 2 elements long array, first one the start point (inclusive) of
* finished undo operation, second one the end point (exclusive).
* null if redo is not performed
*/
public long[] redo() {
if (actions == null) {
return null;
}
Entry entry = actions.redoAction();
if (entry == null) {
return null;
}
long[] result = null;
List ranges = entry.getRanges();
if (entry.getActionType() == BinaryContentActionHistory.TYPE_DELETE) {
result = deleteRanges(ranges);
} else if (entry.getActionType() == BinaryContentActionHistory.TYPE_INSERT) {
result = insertRanges(ranges);
} else if (entry.getActionType() == BinaryContentActionHistory.TYPE_OVERWRITE) {
// 0 to size - 1: overwritten ranges, last one: overwriter range
int size = ranges.size();
result = overwriteRanges(ranges.subList(size - 1, size));
}
notifyListeners();
return result;
}
/**
* Remove a listener to the list of listeners to be notified when there is a
* change in the content
*
* @param listener
* not to be notified of the change
*/
public void removeModifyListener(ModifyListener listener) {
if (listeners != null) {
listeners.remove(listener);
}
}
/**
* Sets action history on. After this call the content will remember past
* actions to undo and redo
*/
public void setActionsHistory() {
if (actions == null) {
commitChanges();
actions = new BinaryContentActionHistory(this);
}
}
void shiftRemainingRanges(long increment) {
if (increment == 0L) {
return;
}
while (tailTree.hasNext()) {
Range currentRange = tailTree.next();
currentRange.position += increment;
// currentRange.dirty = true;
}
}
void splitAndShift(long position, long increment) {
initSubtreeTraversing(position, 0);
if (!tailTree.hasNext()) {
return;
}
Range firstRange = tailTree.next();
Range secondRange = null;
if (firstRange.position < position) {
secondRange = firstRange.clone(); // will be tail part of
// firstRange
long delta = position - firstRange.position;
firstRange.length = delta;
secondRange.length -= delta;
secondRange.dataOffset += delta;
secondRange.position = secondRange.position + delta + increment;
// secondRange.dirty |= increment != 0;
} else {
firstRange.position += increment;
// firstRange.dirty |= increment != 0;
}
shiftRemainingRanges(increment);
if (secondRange != null) {
myRanges.add(secondRange);
}
}
/**
* Lists the ranges that back this content
*/
@Override
public String toString() {
StringBuilder result = new StringBuilder("BinaryContent: length=").append(length()).append("}\n");
for (Range range : myRanges) {
result.append(range.toString()).append('\n');
}
return result.toString();
}
/**
* Undoes last action on BinaryContent. Action history should be on:
* setActionHistory()
*
* @return 2 elements long array, first one the start point (inclusive) of
* finished undo operation, second one the end point (exclusive).
* null if undo is not performed
*/
public long[] undo() {
if (actions == null) {
return null;
}
Entry entry = actions.undoAction();
if (entry == null) {
return null;
}
commitChanges();
long[] result = null;
List ranges = entry.getRanges();
if (entry.getActionType() == BinaryContentActionHistory.TYPE_DELETE) {
result = insertRanges(ranges);
} else if (entry.getActionType() == BinaryContentActionHistory.TYPE_INSERT) {
result = deleteRanges(ranges);
} else if (entry.getActionType() == BinaryContentActionHistory.TYPE_OVERWRITE) {
// 0 to size - 1: overwritten ranges, last one: overwriter range
result = overwriteRanges(ranges.subList(0, ranges.size() - 1));
}
notifyListeners();
return result;
}
private Range updateChanges(long position, boolean insert) throws IOException {
Range result = null;
if (myChanges != null) {
long lowerLimit = myChangesPosition;
long upperLimit = myChangesPosition + myChanges.size();
if (!insert && position >= lowerLimit && position < upperLimit) {
return result; // reuse without expanding
}
if (!insert) {
--lowerLimit;
}
if (insert == myChangesInserted && position >= lowerLimit && position <= upperLimit) { // reuse
if (insert) {
myChanges.add((int) (position - myChangesPosition), 0);
} else {
result = getRangeAt(position);
if (myChangesPosition > position) {
myChangesPosition = position;
myChanges.add(0, getFromRanges(position));
} else if (myChangesPosition + myChanges.size() <= position) {
myChanges.add(getFromRanges(position));
}
}
return result;
}
commitChanges();
}
myChanges = new ArrayList();
myChanges.add(getFromRanges(position));
myChangesInserted = insert;
myChangesPosition = position;
if (!insert) {
result = getRangeAt(position);
}
return result;
}
}
================================================
FILE: net.sourceforge.javahexeditor/src/net/sourceforge/javahexeditor/BinaryContentActionHistory.java
================================================
/*
* javahexeditor, a java hex editor
* Copyright (C) 2006, 2009 Jordi Bergenthal, pestatije(-at_)users.sourceforge.net
* The official javahexeditor site is sourceforge.net/projects/javahexeditor
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package net.sourceforge.javahexeditor;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.jcryptool.core.logging.utils.LogUtil;
import net.sourceforge.javahexeditor.BinaryContent.Range;
/**
* Keeps track of actions performed on a BinaryContent so they can be undone and
* redone. Actions can be single or block deletes, inserts or overwrites.
* Consecutive single actions are merged into a block action if they are of the
* same type, their data is contiguous, and are performed with a time difference
* lower than {@link #MERGE_TIME}. Block actions are sequences of Range. Single
* actions are one range of size 1.
*
* @author Jordi Bergenthal
*/
final class BinaryContentActionHistory {
public final static class Entry {
private Integer actionType;
private List ranges;
public Entry(Integer actionType, List ranges) {
if (actionType == null) {
throw new IllegalArgumentException("Parameter 'actionType' must not be null.");
}
if (ranges == null) {
throw new IllegalArgumentException("Parameter 'ranges' must not be null.");
}
this.actionType = actionType;
this.ranges = ranges;
}
public Integer getActionType() {
return actionType;
}
public List getRanges() {
return ranges;
}
}
/**
* Waiting time before a single action is considered separate from the previous
* one. Current value is 1500 milliseconds.
*/
static final int MERGE_TIME = 1500; // milliseconds
/**
* Action types
*/
static final Integer TYPE_DELETE = 0;
static final Integer TYPE_INSERT = 1;
static final Integer TYPE_OVERWRITE = 2;
private BinaryContent content;
private Range myLastActionRange;
private List deletedList;
private boolean isBackspace;
private List myActions;
private int myActionsIndex;
private List myCurrentActionRanges;
private Integer myCurrentActionType;
private long myMergedSinglesTop = -1L;
private boolean myMergingSingles;
private long myPreviousTime = 0L;
private long newRangeLength = -1L;
private long newRangePosition = -1L;
/**
* Create new action history storage object
*
* @param content
* The new content, not null.
*/
public BinaryContentActionHistory(BinaryContent content) {
if (content == null) {
throw new IllegalArgumentException("Parameter 'content' must not be null.");
}
this.content = content;
myActions = new ArrayList();
}
private long actionExclusiveEnd() {
long result = 0L;
if (myCurrentActionRanges != null && myCurrentActionRanges.size() > 0) {
Range highest = myCurrentActionRanges.get(myCurrentActionRanges.size() - 1);
result = highest.exclusiveEnd();
}
long newRangeExclusiveEnd = newRangePosition + newRangeLength;
if (newRangeExclusiveEnd > result) {
result = newRangeExclusiveEnd;
}
return result;
}
private long actionPosition() {
long result = -1L;
if (myCurrentActionRanges != null && myCurrentActionRanges.size() > 0) {
Range lowest = myCurrentActionRanges.get(0);
result = lowest.position;
}
if (result < 0 || newRangePosition >= 0 && newRangePosition < result) {
result = newRangePosition;
}
return result;
}
/**
* Adds a list of deleted integers to the current action. If possible, merges
* integerList with the list in the previous call to this method.
*
* @param position
* starting delete point
* @param integerList
* deleted integers
* @param isSingle
* used when integerList.size == 1 to tell whether it is a single or
* a piece of a block delete. When integerList.size() > 1 (a block
* delete for sure) isSingle is ignored.
*/
public void addDeleted(long position, List integerList, boolean isSingle) {
if (integerList.size() > 1L || !isSingle) { // block delete
Range range = newRangeFromIntegerList(position, integerList);
List oneElementList = new ArrayList(1);
oneElementList.add(range);
addLostRanges(oneElementList);
} else {
addLostByte(position, integerList.get(0));
}
myPreviousTime = System.currentTimeMillis();
}
public void addLostByte(long position, Integer integer) {
if (deletedList == null) {
deletedList = new ArrayList();
}
updateNewRange(position);
if (isBackspace) {
deletedList.add(0, integer);
} else { // delete(Del) or overwite
deletedList.add(integer);
}
myPreviousTime = System.currentTimeMillis();
}
public void addLostRange(Range aRange) {
if (myMergingSingles) {
if (myMergedSinglesTop < 0L) {
myMergedSinglesTop = aRange.exclusiveEnd();
// merging singles shifts aRange
} else if (myCurrentActionType == TYPE_DELETE && !isBackspace) {
aRange.position = myMergedSinglesTop++;
}
myPreviousTime = System.currentTimeMillis();
}
mergeRange(aRange);
}
public void addLostRanges(List ranges) {
if (ranges == null) {
return;
}
for (int i = 0; i < ranges.size(); ++i) {
addLostRange(ranges.get(i));
}
}
public void addRangeToCurrentAction(Range range) {
if (actionPosition() <= range.position) {
// they're == when ending an overwrite action
myCurrentActionRanges.add(range);
} else {
myCurrentActionRanges.add(0, range);
}
myLastActionRange = range;
}
/**
* Adds an inserted range to a new action. Does not merge Ranges nor single
* actions.
*
* @param range
* the range being inserted
*/
public void addInserted(Range range) {
myCurrentActionRanges.add(range);
endAction();
}
/**
* Tells whether a redo is possible
*
* @return true if something can be redone
*/
public boolean canRedo() {
return myActionsIndex < myActions.size() && myCurrentActionRanges == null;
}
/**
* Tells whether an undo is possible
*
* @return true if something can be undone
*/
public boolean canUndo() {
return myCurrentActionRanges != null || myActionsIndex > 0;
}
/**
* Sets the last processed action as finished. Calling this method will prevent
* single action merging. Must be called after each block action.
*/
public void endAction() {
if (myCurrentActionRanges == null) {
return;
}
if (myMergingSingles) {
newRangeToCurrentAction();
}
Entry entry = new Entry(myCurrentActionType, myCurrentActionRanges);
myActions.subList(myActionsIndex, myActions.size()).clear();
myActions.add(entry);
myActionsIndex = myActions.size();
isBackspace = false;
myCurrentActionType = null;
myCurrentActionRanges = null;
myLastActionRange = null;
newRangePosition = -1L;
newRangeLength = -1L;
myMergedSinglesTop = -1L;
}
/**
* User event: single/block delete/insert/overwrite. Called before any change
* has been done
*
* @param type
* @param position
* @param isSingle
*/
public void eventPreModify(Integer type, long position, boolean isSingle) {
if (type != myCurrentActionType || !isSingle || System.currentTimeMillis() - myPreviousTime > MERGE_TIME
|| (type == TYPE_INSERT || type == TYPE_OVERWRITE) && actionExclusiveEnd() != position
|| type == TYPE_DELETE && actionPosition() != position && actionPosition() - 1L != position) {
startAction(type, isSingle);
} else {
isBackspace = actionPosition() > position;
}
if (isSingle && type == TYPE_INSERT) { // never calls addInserted...
updateNewRange(position);
myPreviousTime = System.currentTimeMillis();
}
}
/**
* Closes all files for termination
*
* @see Object#finalize()
*/
@Override
protected void finalize() {
dispose();
}
private void dispose() {
if (myActions != null) {
for (Iterator i = myActions.iterator(); i.hasNext();) {
Entry entry = i.next();
List ranges = entry.getRanges();
disposeRanges(ranges);
}
}
disposeRanges(myCurrentActionRanges);
}
private void disposeRanges(List ranges) {
if (ranges == null) {
return;
}
for (Iterator j = ranges.iterator(); j.hasNext();) {
Range range = j.next();
if (range.data instanceof RandomAccessFile) {
RandomAccessFile randomAccessFile = (RandomAccessFile) range.data;
try {
randomAccessFile.close();
} catch (IOException ex) {
LogUtil.logError("Cannot close random access file " + range.file.getAbsolutePath(), ex);
}
}
}
}
private void mergeRange(Range range) {
if (myLastActionRange == null || myLastActionRange.data != range.data) {
newRangeToCurrentAction();
addRangeToCurrentAction(range);
} else {
if (myLastActionRange.compareTo(range) > 0) {
myLastActionRange.position -= range.length;
myLastActionRange.dataOffset -= range.length;
newRangePosition = range.position;
}
myLastActionRange.length += range.length;
}
if (myCurrentActionType == TYPE_OVERWRITE && myMergingSingles) {
if (newRangePosition < 0L) {
newRangePosition = range.position;
newRangeLength = 1L;
} else {
++newRangeLength;
}
}
}
private ByteBuffer newBufferFromIntegerList(List integerList) {
ByteBuffer store = ByteBuffer.allocate(integerList.size());
for (Iterator iterator = integerList.iterator(); iterator.hasNext();) {
store.put((iterator.next()).byteValue());
}
store.position(0);
return store;
}
private Range newRangeFromIntegerList(long position, List integerList) {
ByteBuffer store = newBufferFromIntegerList(integerList);
return new Range(position, store, true);
}
private void newRangeToCurrentAction() {
Range newRange = null;
if (myCurrentActionType == TYPE_DELETE) {
if (deletedList == null) {
return;
}
newRange = newRangeFromIntegerList(newRangePosition, deletedList);
deletedList = null;
} else {
// myCurrentActionType == TYPE_INSERT || myCurrentActionType ==
// TYPE_OVERWRITE
if (newRangePosition < 0L) {
return;
}
content.actionsOn(false);
content.commitChanges();
content.actionsOn(true);
newRange = content.getRangeAt(newRangePosition).clone();
}
addRangeToCurrentAction(newRange);
}
/**
* Redoes last action on BinaryContent.
*
* @return
*/
public Entry redoAction() {
if (!canRedo()) {
return null;
}
return myActions.get(myActionsIndex++);
}
/**
* Starts the processing of a new action.
*
* @param type
* one of TYPE_DELETE, TYPE_INSERT or TYPE_OVERWRITE
* @param isSingle
* whether the action is a single byte or more
*/
private void startAction(Integer type, boolean isSingle) {
endAction();
myCurrentActionRanges = new ArrayList();
myCurrentActionType = type;
myMergingSingles = isSingle;
}
/**
* Undoes last action on BinaryContent.
*
* @return
*/
public Entry undoAction() {
if (!canUndo()) {
return null;
}
endAction();
--myActionsIndex;
return myActions.get(myActionsIndex);
}
private void updateNewRange(long position) {
if (newRangePosition < 0L) {
newRangePosition = position;
newRangeLength = 1L;
} else {
if (newRangePosition > position) { // Backspace (BS)
newRangePosition = position;
}
++newRangeLength;
}
}
@Override
public String toString() {
return myActions.toString();
}
}
================================================
FILE: net.sourceforge.javahexeditor/src/net/sourceforge/javahexeditor/BinaryContentFinder.java
================================================
/*
* javahexeditor, a java hex editor
* Copyright (C) 2006, 2009 Jordi Bergenthal, pestatije(-at_)users.sourceforge.net
* The official javahexeditor site is sourceforge.net/projects/javahexeditor
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package net.sourceforge.javahexeditor;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Find helper class to find binary and string literals in files. Given a
* literal, finds its position in the file. It is possible to get subsequent
* finds. The search is either binary or text based. Text based search uses
* standard Java Unicode (all of big and little endian, odd and even address)
* plus ASCII when the literal falls within ASCII char limits.
*
* @author Jordi Bergenthal
*/
public final class BinaryContentFinder {
public static final class Match {
private boolean found;
private long startPosition;
private int length;
private IOException exception;
Match(boolean found, long position, int length, IOException exception) {
super();
this.found = found;
this.startPosition = position;
this.length = length;
this.exception = exception;
}
public boolean isFound() {
return found;
}
public long getStartPosition() {
return startPosition;
}
public long getEndPosition() {
return startPosition + length;
}
public int getLength() {
return length;
}
public IOException getException() {
return exception;
}
}
public static final int MAP_SIZE = 64 * 1024;
// a search string of 2K should be enough
public static final int MAX_SEQUENCE_SIZE = 2 * 1024;
private long bufferPosition = -1L;
private ByteBuffer byteBuffer;
private int currentPartFound = -1; // relative positions
private boolean currentPartFoundIsUnicode;
private long currentPosition = 0L; // absolute value, start of forward
// finds,
// end(exclusive) of backward finds
private byte[] myByteFindSequence;
private boolean myCaseSensitive = true;
private BinaryContent myContent;
private boolean myDirectionForward = true;
private CharSequence myLiteral;
private int myLiteralByteLength = -1;
private Pattern myPattern;
private boolean stopSearching;
/**
* Create a finder object for a sequence of characters; uses Unicode and ASCII
* traversing
*
* @param literal
* the char sequence to find
* @param aContent
* provider to be traversed
*/
public BinaryContentFinder(CharSequence literal, BinaryContent aContent) {
myLiteral = literal;
initSearchUnicodeAscii();
myContent = aContent;
bufferPosition = 0L;
currentPosition = 0L;
}
/**
* Create a finder object for a raw sequence of bytes
*
* @param sequence
* the byte sequence to find
* @param aContent
* provider to be traversed
*/
public BinaryContentFinder(byte[] sequence, BinaryContent aContent) {
initSearchHex(sequence);
myContent = aContent;
bufferPosition = 0L;
currentPosition = 0L;
}
private void findAllMatches() {
currentPartFound = findHexAsciiMatchInPart();
int currentPartFoundUnicode = findUnicodeMatchInPart();
currentPartFoundIsUnicode = false;
if (currentPartFoundUnicode >= 0
&& (currentPartFound < 0 || myDirectionForward && currentPartFound > currentPartFoundUnicode
|| !myDirectionForward && currentPartFound < currentPartFoundUnicode)) {
currentPartFound = currentPartFoundUnicode;
currentPartFoundIsUnicode = true;
}
}
private int findHexAsciiMatchInPart() {
if (myByteFindSequence == null) {
return -1;
}
int start = 0;
int inclusiveEnd = byteBuffer.limit() - myByteFindSequence.length;
if (!myDirectionForward) {
start = inclusiveEnd;
inclusiveEnd = 0;
}
for (int i = start; myDirectionForward && i <= inclusiveEnd
|| !myDirectionForward && i >= inclusiveEnd; i += myDirectionForward ? 1 : -1) {
boolean matchesSoFar = true;
for (int j = 0; j < myByteFindSequence.length && matchesSoFar; ++j) {
byte existing = byteBuffer.get(i + j);
byte matcher = myByteFindSequence[j];
if (existing != matcher) {
if (myCaseSensitive || existing < 'A' || existing > 'z' || matcher < 'A' || matcher > 'z'
|| existing - matcher != 32 && matcher - existing != 32) {
matchesSoFar = false;
}
}
}
if (matchesSoFar) {
return i;
}
}
return -1;
}
private int findUnicodeMatchInPart() {
if (myPattern == null) {
return -1;
}
int result = Integer.MAX_VALUE;
if (!myDirectionForward) {
result = -1;
}
byteBuffer.order(ByteOrder.LITTLE_ENDIAN);
Matcher matcher = myPattern.matcher(byteBuffer.asCharBuffer());
for (int encoding = 0; encoding < 4; ++encoding) {
while (matcher.find()) {
int index = matcher.start() * 2 + (encoding >= 2 ? 1 : 0);
if (myDirectionForward && result > index || !myDirectionForward && result < index) {
result = index;
}
if (myDirectionForward) {
break;
}
}
if (encoding == 0) {
byteBuffer.order(ByteOrder.BIG_ENDIAN);
} else if (encoding == 1 && byteBuffer.limit() > 0) {
byteBuffer.position(1);
} else if (encoding == 2) {
byteBuffer.order(ByteOrder.LITTLE_ENDIAN);
}
matcher.reset(byteBuffer.asCharBuffer());
}
if (result == Integer.MAX_VALUE) {
result = -1;
}
return result;
}
private long getContentLength() {
if (myContent == null) {
return 0L;
}
return myContent.length();
}
/**
* Get the next position and length of a matching literal.
*
* @return The {@link Match} describing the result, either not found, found or
* exception.
*/
public Match getNextMatch() {
stopSearching = false;
try {
populatePart();
findAllMatches();
while (currentPartFound < 0) { // end of part
if (nextPart() == null || stopSearching) {
stopSearching = false;
return new Match(false, 0, 0, null); // end of file
}
findAllMatches();
}
long resultStartPosition = bufferPosition + currentPartFound;
int resultLength = currentPartFoundIsUnicode ? myLiteralByteLength : myByteFindSequence.length;
setNewStart(resultStartPosition + (myDirectionForward ? 1 : resultLength - 1));
return new Match(true, resultStartPosition, resultLength, null);
} catch (IOException ex) {
return new Match(false, 0, 0, ex);
}
}
private void initSearchHex(byte[] sequence) {
myByteFindSequence = sequence;
if (sequence.length > MAX_SEQUENCE_SIZE) {
myByteFindSequence = new byte[MAX_SEQUENCE_SIZE];
System.arraycopy(sequence, 0, myByteFindSequence, 0, MAX_SEQUENCE_SIZE);
}
myLiteralByteLength = myByteFindSequence.length;
}
/**
* Get the current location being searched in the content. Approximate value.
*
* @return position in the content
*/
public long getSearchPosition() {
return bufferPosition;
}
private void initSearchUnicodeAscii() {
// everything-quoted regular expression
StringBuilder regex = new StringBuilder("\\Q");
// 16 bit Unicode chars
if (myLiteral.length() * 2 > MAX_SEQUENCE_SIZE) {
myLiteral = myLiteral.subSequence(0, MAX_SEQUENCE_SIZE / 2);
}
myLiteralByteLength = myLiteral.length() * 2;
boolean isAsciiCompatible = true;
byte[] tmpBytes = new byte[myLiteral.length()];
char previous = '\0';
for (int i = 0; i < myLiteral.length(); ++i) {
char aChar = myLiteral.charAt(i);
regex.append(aChar);
if (previous == '\\' && aChar == 'E') {
regex.append("\\\\E\\Q");
}
previous = aChar;
tmpBytes[i] = (byte) aChar;
if (aChar > 255) {
isAsciiCompatible = false;
}
}
regex.append("\\E");
int ignoreCaseFlags = 0;
if (!myCaseSensitive) {
ignoreCaseFlags = Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE;
}
myPattern = Pattern.compile(regex.toString(), ignoreCaseFlags);
if (isAsciiCompatible) {
myByteFindSequence = tmpBytes;
}
}
private ByteBuffer nextPart() throws IOException {
long newPos = bufferPosition + byteBuffer.limit() - myLiteralByteLength + 1L;
if (!myDirectionForward) {
newPos = bufferPosition - MAP_SIZE + myLiteralByteLength - 1L;
}
if (newPos < 0L) {
newPos = 0L;
}
int size = (int) Math.min(MAP_SIZE, getContentLength() - newPos);
if (!myDirectionForward) {
size = (int) (bufferPosition + myLiteralByteLength - 1L - newPos);
}
if (size < myLiteralByteLength) {
return null;
}
bufferPosition = newPos;
populatePart(size);
return byteBuffer;
}
private void populatePart() throws IOException {
int size = MAP_SIZE;
if (!myDirectionForward) {
size = (int) Math.min(MAP_SIZE, currentPosition);
}
populatePart(size);
}
private void populatePart(int size) throws IOException {
if (myContent == null) {
return;
}
byteBuffer = null;
// multiple FileChannel.read(byteBuffer) leak memory, so don't reuse
// buffer
byteBuffer = ByteBuffer.allocate(MAP_SIZE);
byteBuffer.limit(size);
byteBuffer.position(0);
myContent.get(byteBuffer, bufferPosition);
byteBuffer.limit(byteBuffer.position());
byteBuffer.position(0);
}
/**
* Sets the case sensitiveness. The default is always case sensitive (not ignore
* case)
*
* @param beSensitive
* set to true will not match 'a' with 'A'
*/
public void setCaseSensitive(boolean beSensitive) {
if (myCaseSensitive == beSensitive) {
return;
}
myCaseSensitive = beSensitive;
if (myLiteral != null) {
initSearchUnicodeAscii();
}
}
/**
* Sets the search direction. The default search direction is always forward
*
* @param goForward
* set to true for forward search
*/
public void setDirectionForward(boolean goForward) {
myDirectionForward = goForward;
}
/**
* Sets new search start point in the file. Inclusive in forward finds,
* exclusive in backward ones.
*
* @param startPoint
* next match search will start from this point
*/
public void setNewStart(long startPoint) {
if (startPoint < 0L || startPoint > getContentLength()) {
return;
}
currentPosition = startPoint;
bufferPosition = startPoint;
if (!myDirectionForward) {
bufferPosition = startPoint - MAP_SIZE;
}
if (bufferPosition < 0L) {
bufferPosition = 0L;
}
}
/**
* Stop searching. Long running searches can be stopped from another thread.
*/
public void stopSearching() {
stopSearching = true;
}
}
================================================
FILE: net.sourceforge.javahexeditor/src/net/sourceforge/javahexeditor/ClipboardHelper.java
================================================
package net.sourceforge.javahexeditor;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
import org.apache.commons.codec.DecoderException;
import org.apache.commons.codec.binary.Hex;
import org.eclipse.swt.dnd.Clipboard;
import org.eclipse.swt.dnd.TextTransfer;
import org.eclipse.swt.dnd.Transfer;
import org.eclipse.swt.dnd.TransferData;
import org.eclipse.swt.widgets.Display;
import org.jcryptool.core.logging.utils.LogUtil;
import net.sourceforge.javahexeditor.plugin.editors.HexEditor;
public final class ClipboardHelper {
/**
* The systems clipboard
*/
private static Clipboard clipboard = new Clipboard(Display.getCurrent());
/**
* Copies the selected hex to the clipboard.
* @param content The content of the editor.
* @param start The position to start coping data.
* @param length The amount of data to be copied.
* @return True, if data is copied to the clipboard, false if no data is copied,
* due to an exception or no data selected.
*/
public static boolean setHexContentToClipboard(BinaryContent content, long start, long length) {
if (length < 1L) {
return false;
}
Object[] data = null;
Transfer[] transfers = null;
try {
byte[] byteArrayData = new byte[(int) length];
content.get(ByteBuffer.wrap(byteArrayData), start);
StringBuilder sb = new StringBuilder();
int tempByteValue;
for (Byte b : byteArrayData) {
// Sometimes the integer representation of the hex values are negative
// due to javas signed ints. This causes problems when using Integer.toHexString.
// There I exlicitly convert them to an unsigned int.
tempByteValue = Byte.toUnsignedInt(b);
// This adds a preceding '0' when the hex value is less than F.
if (tempByteValue <= 16) {
sb.append(0);
}
sb.append(Integer.toHexString(tempByteValue).toUpperCase());
}
transfers = new Transfer[] { TextTransfer.getInstance() };
data = new Object[] { sb.toString() };
} catch (IOException e) {
LogUtil.logError(HexEditor.ID, e);
return false;
}
clipboard.setContents(data, transfers);
return true;
}
/**
* Copies the selected text to the clipboard.
* @param content The content of the editor.
* @param start The position to start coping data.
* @param length The amount of data to be copied.
* @return True, if data is copied to the clipboard, false if no data is copied,
* due to an exception or no data selected.
*/
public static boolean setContentsText(BinaryContent content, long start, long length) {
if (length < 1L) {
return false;
}
Object[] data = null;
Transfer[] transfers = null;
try {
byte[] byteArrayData = new byte[(int) length];
content.get(ByteBuffer.wrap(byteArrayData), start);
String textData = new String(byteArrayData);
transfers = new Transfer[] { TextTransfer.getInstance() };
data = new Object[] { textData };
} catch (IOException e) {
LogUtil.logError(HexEditor.ID, e);
return false;
}
clipboard.setContents(data, transfers);
return true;
}
/**
* Checks if pasteable content is in the clipboard. Files or texts.
* @return True, if a file or a text is in the clipboard.
*/
public static boolean hasContents() {
TransferData[] available = clipboard.getAvailableTypes();
for (int i = 0; i < available.length; ++i) {
if (TextTransfer.getInstance().isSupportedType(available[i])) {
return true;
}
}
return false;
}
/**
* Paste hex chars to the editor
* @param content The content of the editor
* @param start Point to start inserting
* @param insert Insert or overwrite data.
* @return Length of the inserted text. -1 for error and 0 if nothing happend.
*/
public static long tryGettingHex(BinaryContent content, long start, boolean insert) {
// Seems to be used to copy data from the "real" clipboard
// to javahexeditor.
byte[] byteArray = null;
String text = (String) clipboard.getContents(TextTransfer.getInstance());
// System.out.println("Text from clipboard: " + text);
if (text != null) {
// Paste the hex values to the editor
// Remove all non hex chars from the string.
String onlyHexChars = text.replaceAll("[^a-fA-F0-9]", "");
// ungerade anzahl an hex Zeichen -> kein komplettes letztes Byte.
// Zum Beispiel 5 Hex zeichen = 2,5 Byte.
// Pad a trailing 0 to the hex chars to fill the last byte.
if (onlyHexChars.length() % 2 == 1) {
onlyHexChars = onlyHexChars + "0";
}
try {
byteArray = Hex.decodeHex(onlyHexChars);
} catch (DecoderException e) {
LogUtil.logError(HexEditor.ID, e);
}
}
if (byteArray == null) {
return -1L;
}
long total = byteArray.length;
ByteBuffer buffer = ByteBuffer.wrap(byteArray);
if (insert) {
content.insert(buffer, start);
} else if (total <= content.length() - start) {
content.overwrite(buffer, start);
} else {
total = 0L;
}
return total;
}
/**
* Paste text to the editor
* @param content The content of the editor
* @param start Point to start inserting
* @param insert Insert or overwrite data.
* @return Length of the inserted text. -1 for error and 0 if nothing happend.
*/
public static long tryGettingText(BinaryContent content, long start, boolean insert) {
// Seems to be used to copy data from the "real" clipboard
// to javahexeditor.
byte[] byteArray = null;
String text = (String) clipboard.getContents(TextTransfer.getInstance());
if (text != null) {
// Paste the text representation to the editor.
byteArray = text.getBytes(Charset.forName("UTF-8"));
}
if (byteArray == null) {
return -1L;
}
long total = byteArray.length;
ByteBuffer buffer = ByteBuffer.wrap(byteArray);
if (insert) {
content.insert(buffer, start);
} else if (total <= content.length() - start) {
content.overwrite(buffer, start);
} else {
total = 0L;
}
return total;
}
}
================================================
FILE: net.sourceforge.javahexeditor/src/net/sourceforge/javahexeditor/ContextMenu.java
================================================
// -----BEGIN DISCLAIMER-----
/*******************************************************************************
* Copyright (c) 2011, 2021 JCrypTool Team and Contributors
*
* All rights reserved. This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*******************************************************************************/
// -----END DISCLAIMER-----
package net.sourceforge.javahexeditor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.events.MenuEvent;
import org.eclipse.swt.events.MenuListener;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.jcryptool.core.util.images.ImageService;
import org.jcryptool.editor.text.JCTTextEditorPlugin;
/**
* Context Menu
* @author Thorben Groos
*
*/
public class ContextMenu {
/**
* Adds the context menu to the given styled text
* @param st The styledText where the context menu should be added.
* @param manager JavaHexEditor Manager to get acces to methods like doCopy(), etc.
*/
public static void createMenuForText(StyledText st, Manager manager) {
Menu menu = new Menu(st);
st.setMenu(menu);
MenuItem undoItem = new MenuItem(menu, SWT.None);
undoItem.setText(Texts.ContextMenu_undo);
undoItem.setImage(ImageService.createIconFromURL("platform:/plugin/org.eclipse.ui/icons/full/etool16/undo_edit.png").createImage()); //$NON-NLS-1$
undoItem.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
manager.doUndo();
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
// This method did not get called.
}
});
MenuItem redoItem = new MenuItem(menu, SWT.None);
redoItem.setText(Texts.ContextMenu_redo);
redoItem.setImage(ImageService.createIconFromURL("platform:/plugin/org.eclipse.ui/icons/full/etool16/redo_edit.png").createImage()); //$NON-NLS-1$
redoItem.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
manager.doRedo();
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
// This method did not get called.
}
});
// Separator between redo and copy
new MenuItem(menu, SWT.SEPARATOR);
MenuItem cutItem = new MenuItem(menu, SWT.None);
cutItem.setText(Texts.ContextMenu_cut);
cutItem.setImage(ImageService.createIconFromURL("platform:/plugin/org.eclipse.ui/icons/full/etool16/cut_edit.png").createImage()); //$NON-NLS-1$
cutItem.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
manager.doCut();
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
// This method did not get called.
}
});
MenuItem copyItem = new MenuItem(menu, SWT.None);
copyItem.setText(Texts.ContextMenu_copy);
copyItem.setImage(ImageService.createIconFromURL("platform:/plugin/org.eclipse.ui/icons/full/etool16/copy_edit.png").createImage()); //$NON-NLS-1$
copyItem.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
manager.doCopy();
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
// This method did not get called.
}
});
MenuItem pasteItem = new MenuItem(menu, SWT.None);
pasteItem.setText(Texts.ContextMenu_paste);
pasteItem.setImage(ImageService.createIconFromURL("platform:/plugin/org.eclipse.ui/icons/full/etool16/paste_edit.png").createImage()); //$NON-NLS-1$
pasteItem.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
manager.doPaste();
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
// This method did not get called.
}
});
// Separator
new MenuItem(menu, SWT.SEPARATOR);
MenuItem switchItem = new MenuItem(menu, SWT.None);
switchItem.setText(Texts.ContextMenu_openin);
switchItem.setImage(ImageService.getImageDescriptor(JCTTextEditorPlugin.PLUGIN_ID, "icons/text_edit.png").createImage()); //$NON-NLS-1$
switchItem.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
OpenInTexteditor.changeEditor();
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
// This method did not get called.
}
});
menu.addMenuListener(new MenuListener() {
@Override
public void menuShown(MenuEvent e) {
// Enable / Disable the undo menu entry.
if (manager.canUndo()) {
undoItem.setEnabled(true);
} else {
undoItem.setEnabled(false);
}
// Enable / Disable the redo menu entry
if (manager.canRedo()) {
redoItem.setEnabled(true);
} else {
redoItem.setEnabled(false);
}
// Enable / Disable the cut menu entry
if (manager.isTextSelected() && !manager.isOverwriteMode()) {
cutItem.setEnabled(true);
} else {
cutItem.setEnabled(false);
}
// Enable / Disable the copy menu entry
if (manager.isTextSelected()) {
copyItem.setEnabled(true);
} else {
copyItem.setEnabled(false);
}
// Enable / Disable the paste Item
if (manager.canPaste()) {
pasteItem.setEnabled(true);
} else {
pasteItem.setEnabled(false);
}
}
@Override
public void menuHidden(MenuEvent e) {
// No action required when the menu is closed.
}
});
}
}
================================================
FILE: net.sourceforge.javahexeditor/src/net/sourceforge/javahexeditor/CopyDialog.java
================================================
package net.sourceforge.javahexeditor;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.jcryptool.core.util.colors.ColorService;
public class CopyDialog extends Dialog {
/**
* True, if the text is to big for the clipcoard and can not be copied.
* False, if the text is less than 4 MB and can be copied in the clipboard.
*/
private boolean toBigForClipboard;
/**
* Opens a dialog where you can choose whether to copy the hex values or
* the text representation.
* @param parentShell Most likely Display.getCurrent().getActiveShell()
* @param allowHexCopy Whether the selected lenght is less than 4MB. If it
* is more it would not fit into the clipboard.
*/
protected CopyDialog(Shell parentShell, boolean toBigForClipboard) {
super(parentShell);
this.toBigForClipboard = toBigForClipboard;
}
@Override
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
newShell.setText(Texts.CopyDialog_title);
}
@Override
protected Control createDialogArea(Composite parent) {
Composite container = (Composite) super.createDialogArea(parent);
Text t = new Text(container, SWT.MULTI | SWT.WRAP);
GridData gd_t = new GridData(SWT.FILL, SWT.FILL, true, true);
gd_t.widthHint = 600;
t.setLayoutData(gd_t);
t.setText(Texts.CopyDialog_hex_or_text);
t.setEditable(false);
if (toBigForClipboard) {
t.setText(Texts.CopyDialog_to_long_for_clipboard);
t.setForeground(ColorService.RED);
}
return container;
}
@Override
protected void createButtonsForButtonBar(Composite parent) {
if (toBigForClipboard) {
// Creates the "ok" Button
createButton(parent, 1, "Ok", true); //$NON-NLS-1$
} else {
// Creates the cancel button.
createButton(parent, 1, Texts.CopyDialog_cancel, false);
// Creates the "Hex" Button
createButton(parent, 2, "Hex", false); //$NON-NLS-1$
// Creates the "Text" Button.
createButton(parent, 3, "Text", true); //$NON-NLS-1$
}
}
@Override
protected void buttonPressed(int buttonId) {
// The user pressed the "Hex" Button
if (buttonId == 2) {
setReturnCode(2);
}
// The user pressed the "Text" Button
if (buttonId == 3) {
setReturnCode(3);
}
// Close the dialog.
close();
}
}
================================================
FILE: net.sourceforge.javahexeditor/src/net/sourceforge/javahexeditor/DisplayedContent.java
================================================
/*
* javahexeditor, a java hex editor
* Copyright (C) 2006, 2009 Jordi Bergenthal, pestatije(-at_)users.sourceforge.net
* The official javahexeditor site is sourceforge.net/projects/javahexeditor
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package net.sourceforge.javahexeditor;
import java.util.HashSet;
import java.util.Set;
import org.eclipse.swt.custom.StyledTextContent;
import org.eclipse.swt.custom.TextChangeListener;
import org.eclipse.swt.custom.TextChangedEvent;
import org.eclipse.swt.custom.TextChangingEvent;
import org.jcryptool.core.logging.utils.LogUtil;
import net.sourceforge.javahexeditor.plugin.editors.HexEditor;
/**
* StyledTextContent customized for content that fills up to one page of the
* StyledText widget. No line delimiters, content wraps lines.
*
* @author Jordi Bergenthal
*/
final class DisplayedContent implements StyledTextContent {
private StringBuilder myData;
private Set myTextListeners;
private int numberOfColumns = -1;
// private int numberOfLines = -1;
private int linesTimesColumns = -1;
/**
* Create empty content for a StyledText of the specified size
*
* @param numberOfLines
* @param numberOfColumns
*/
DisplayedContent(int numberOfColumns, int numberOfLines) {
// reserve space and account for replacements
myData = new StringBuilder(numberOfColumns * numberOfLines * 2);
myTextListeners = new HashSet();
setDimensions(numberOfColumns, numberOfLines);
}
@Override
public void addTextChangeListener(TextChangeListener listener) {
if (listener == null) {
throw new IllegalArgumentException("Parameter 'listener' must not be null.");
}
myTextListeners.add(listener);
}
@Override
public int getCharCount() {
return myData.length();
}
@Override
public String getLine(int lineIndex) {
return getTextRange(lineIndex * numberOfColumns, numberOfColumns);
}
@Override
public int getLineAtOffset(int offset) {
int result = offset / numberOfColumns;
if (result >= getLineCount()) {
return getLineCount() - 1;
}
return result;
}
@Override
public int getLineCount() {
return (myData.length() - 1) / numberOfColumns + 1;
}
@Override
public String getLineDelimiter() {
return Texts.EMPTY;
}
@Override
public int getOffsetAtLine(int lineIndex) {
return lineIndex * numberOfColumns;
}
@Override
public String getTextRange(int start, int length) {
int dataLength = myData.length();
if (start > dataLength) {
return Texts.EMPTY;
}
return myData.substring(start, Math.min(dataLength, start + length));
}
@Override
public void removeTextChangeListener(TextChangeListener listener) {
if (listener == null) {
throw new IllegalArgumentException("Cannot remove a null listener");
}
myTextListeners.remove(listener);
}
/**
* Replaces part of the content with new text. Works only when the new text
* length is the same as replaceLength (when the content's size won't change).
* For other cases use setText() or shiftLines()
* instead.
*
* @see org.eclipse.swt.custom.StyledTextContent#replaceTextRange(int, int,
* java.lang.String)
*/
@Override
public void replaceTextRange(int start, int replaceLength, String text) {
int length = text.length();
if (length != replaceLength || start + length > myData.length()) {
return;
}
myData.replace(start, start + length, text);
}
void setDimensions(int columns, int lines) {
numberOfColumns = columns;
// numberOfLines = lines;
linesTimesColumns = lines * columns;
setText(myData.toString());
}
@Override
public void setText(String text) {
myData.setLength(0);
myData.append(text.substring(0, Math.min(text.length(), linesTimesColumns)));
TextChangedEvent changedEvent = new TextChangedEvent(this);
for (TextChangeListener listener : myTextListeners) {
listener.textSet(changedEvent);
}
}
/**
* Shifts full lines of text and fills the new empty space with text
*
* @param text
* to replace new empty lines. Its size determines the number of
* lines to shift
* @param forward
* shifts lines either forward or backward
*/
@SuppressWarnings("boxing")
void shiftLines(String text, boolean forward) {
if (text.length() == 0) {
return;
}
int linesInText = (text.length() - 1) / numberOfColumns + 1;
int currentLimit = Math.min(myData.length(), linesTimesColumns);
TextChangingEvent event = new TextChangingEvent(this);
event.start = forward ? 0 : currentLimit;
event.newText = text;
event.replaceCharCount = 0;
event.newCharCount = text.length();
event.replaceLineCount = 0;
event.newLineCount = linesInText;
for (TextChangeListener listener : myTextListeners) {
listener.textChanging(event);
}
myData.insert(event.start, text);
LogUtil.logInfo(HexEditor.ID, "Event 1: start=" + event.start + ", newCharCount=" + event.newCharCount + ", newLineCount=" + event.newLineCount);
TextChangedEvent changedEvent = new TextChangedEvent(this);
for (TextChangeListener listener : myTextListeners) {
listener.textChanged(changedEvent);
}
event = new TextChangingEvent(this);
// event.start = forward ? linesTimesColumns : 0;
event.start = forward ? linesTimesColumns - 1 : 0;
event.newText = "";
event.replaceCharCount = linesInText * numberOfColumns - linesTimesColumns + currentLimit;
event.newCharCount = 0;
event.replaceLineCount = linesInText;
event.newLineCount = 0;
for (TextChangeListener listener : myTextListeners) {
listener.textChanging(event);
}
if (forward) {
myData.delete(linesTimesColumns, linesTimesColumns + event.replaceCharCount);
} else {
myData.delete(0, event.replaceCharCount);
}
// Log.trace(this, );
LogUtil.logInfo(HexEditor.ID, "Event 2: start=" + event.start + ", newCharCount=" + event.newCharCount + ", newLineCount=" +event.newLineCount);
changedEvent = new TextChangedEvent(this);
for (TextChangeListener listener : myTextListeners) {
listener.textChanged(changedEvent);
}
}
}
================================================
FILE: net.sourceforge.javahexeditor/src/net/sourceforge/javahexeditor/FileToucher.java
================================================
package net.sourceforge.javahexeditor;
import java.io.File;
import java.io.IOException;
import org.eclipse.core.runtime.IProgressMonitor;
public interface FileToucher {
void touchFile(File contentFile, IProgressMonitor monitor) throws IOException;
}
================================================
FILE: net.sourceforge.javahexeditor/src/net/sourceforge/javahexeditor/FindReplaceDialog.java
================================================
/*
* javahexeditor, a java hex editor
* Copyright (C) 2006, 2009 Jordi Bergenthal, pestatije(-at_)users.sourceforge.net
* The official javahexeditor site is sourceforge.net/projects/javahexeditor
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package net.sourceforge.javahexeditor;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.Iterator;
import java.util.List;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.ShellAdapter;
import org.eclipse.swt.events.ShellEvent;
import org.eclipse.swt.events.VerifyEvent;
import org.eclipse.swt.events.VerifyListener;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Dialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.ProgressBar;
import org.eclipse.swt.widgets.Shell;
import net.sourceforge.javahexeditor.BinaryContentFinder.Match;
import net.sourceforge.javahexeditor.common.ByteArrayUtility;
import net.sourceforge.javahexeditor.common.NumberUtility;
import net.sourceforge.javahexeditor.common.SWTUtility;
import net.sourceforge.javahexeditor.common.TextUtility;
/**
* Find/Replace dialog with hex/text, forward/backward, and ignore case options.
* Remembers previous state, in case it has been closed by the user and reopened
* again.
*
* @author Jordi Bergenthal
*
*/
final class FindReplaceDialog extends Dialog {
SelectionAdapter defaultSelectionAdapter = new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (lastIgnoreCase != ignoreCaseCheckBox.getSelection() || lastForward != forwardRadioButton.getSelection()
|| lastFindHexButtonSelected != findGroup.hexRadioButton.getSelection()
|| lastReplaceHexButtonSelected != replaceGroup.hexRadioButton.getSelection()) {
sendInfoMessage(Texts.EMPTY);
}
lastFocused.textCombo.setFocus();
}
};
private List findList;
private List replaceList;
HexTexts myTarget;
TextHexInputGroup lastFocused;
boolean lastForward = true;
boolean lastFindHexButtonSelected = true;
boolean lastReplaceHexButtonSelected = true;
boolean lastIgnoreCase = false;
boolean searching = false;
// Visual components
Shell shell;
TextHexInputGroup findGroup;
TextHexInputGroup replaceGroup;
private Group directionGroup;
Button forwardRadioButton;
Button backwardRadioButton;
private Group optionsGroup;
Button ignoreCaseCheckBox;
private Composite feedbackComposite;
Label feedbackLabel;
Composite progressComposite;
ProgressBar progressBar;
private Button progressBarStopButton;
private Button findButton;
private Button replaceButton;
private Button replaceAllButton;
private Button closeButton;
/**
* Group with text/hex selector and text input
*/
private final class TextHexInputGroup {
List items;
// visual components
Group group;
private Composite composite;
Button hexRadioButton;
Button textRadioButton;
Combo textCombo;
public TextHexInputGroup(List oldItems) {
if (oldItems == null) {
throw new IllegalArgumentException("Parameter 'oldItems' must not be null.");
}
items = oldItems;
}
public void initialise() {
group = new Group(shell, SWT.NONE);
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 2;
group.setLayout(gridLayout);
group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
createRadioButtonComposite();
textCombo = new Combo(group, SWT.BORDER);
// Calculate the size of the input field and set it as width hint.
int columns = 35;
GC gc = new GC(textCombo);
int width = (int) (columns * SWTUtility.getAverageCharacterWidth(gc));
gc.dispose();
GridData gridData_textCombo = new GridData();
gridData_textCombo.widthHint = width;
textCombo.setLayoutData(gridData_textCombo);
textCombo.addVerifyListener(new VerifyListener() {
@Override
public void verifyText(VerifyEvent e) {
if (e.keyCode == 0) {
return; // a list selection
}
}
});
textCombo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
int index = textCombo.getSelectionIndex();
if (index < 0) {
return;
}
refreshHexOrText((items.get(index).isHex()));
}
});
textCombo.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
sendInfoMessage(Texts.EMPTY);
if (TextHexInputGroup.this == findGroup) {
dataToUI();
}
}
});
}
/**
* This method initializes composite
*/
private void createRadioButtonComposite() {
composite = new Composite(group, SWT.NONE);
composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
GridLayout gridLayout_composite = new GridLayout();
gridLayout_composite.marginHeight = 0;
gridLayout_composite.marginWidth = 0;
composite.setLayout(gridLayout_composite);
hexRadioButton = new Button(composite, SWT.RADIO);
hexRadioButton.setText(Texts.FIND_REPLACE_DIALOG_HEX_RADIO_LABEL);
hexRadioButton.addSelectionListener(defaultSelectionAdapter);
hexRadioButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (ByteArrayUtility.parseString(textCombo.getText()) == null) {
textCombo.setText(Texts.EMPTY);
}
}
});
textRadioButton = new Button(composite, SWT.RADIO);
textRadioButton.setText(Texts.FIND_REPLACE_DIALOG_TEXT_RADIO_LABEL);
textRadioButton.addSelectionListener(defaultSelectionAdapter);
}
public void refreshCombo() {
if (items == null) {
return;
}
if (textCombo.getItemCount() > 0) {
textCombo.remove(0, textCombo.getItemCount() - 1);
}
for (Iterator iterator = items.iterator(); iterator.hasNext();) {
String itemString = (iterator.next()).getStringValue();
textCombo.add(itemString);
}
if (!items.isEmpty()) {
textCombo.setText(items.get(0).getStringValue());
}
selectText();
}
public void refreshHexOrText(boolean hex) {
hexRadioButton.setSelection(hex);
textRadioButton.setSelection(!hex);
}
public void rememberText() {
String lastText = textCombo.getText();
if (Texts.EMPTY.equals(lastText) || items == null) {
return;
}
for (Iterator iterator = items.iterator(); iterator.hasNext();) {
String itemString = iterator.next().getStringValue();
if (lastText.equals(itemString)) {
iterator.remove();
}
}
items.add(0, new FindReplaceHistory.Entry(lastText, hexRadioButton.getSelection()));
refreshCombo();
}
public void selectText() {
textCombo.setSelection(new Point(0, textCombo.getText().length()));
}
public void setEnabled(boolean enabled) {
group.setEnabled(enabled);
hexRadioButton.setEnabled(enabled);
textRadioButton.setEnabled(enabled);
textCombo.setEnabled(enabled);
}
}
/**
* Create find/replace dialog always on top of shell
*
* @param shell
* where it is displayed
*/
public FindReplaceDialog(Shell shell) {
super(shell);
}
private void activateProgressBar() {
// Set the progress bar to visible after 0,5 seconds.
Display.getCurrent().timerExec(500, new Runnable() {
@Override
public void run() {
if (searching && !progressComposite.isDisposed()) {
setProgressCompositeVisible(true);
}
}
});
long max = myTarget.myContent.length();
long min = myTarget.getCaretPos();
if (backwardRadioButton.getSelection()) {
max = min;
min = 0L;
}
int factor = 0;
while (max > Integer.MAX_VALUE) {
max = max >>> 1;
min = min >>> 1;
++factor;
}
progressBar.setMaximum((int) max);
progressBar.setMinimum((int) min);
progressBar.setSelection(0);
final int finalFactor = factor;
Display.getCurrent().timerExec(1000, new Runnable() {
@Override
public void run() {
if (!searching || progressBar.isDisposed()) {
return;
}
int selection = 0;
if (myTarget.myFinder != null) {
selection = (int) (myTarget.myFinder.getSearchPosition() >>> finalFactor);
if (backwardRadioButton.getSelection()) {
selection = progressBar.getMaximum() - selection;
}
}
progressBar.setSelection(selection);
Display.getCurrent().timerExec(1000, this);
}
});
}
/**
* Open and display the dialog.
*
* @param target
* The target with data to search, not null.
* @param findReplaceHistory
* The modifiable find-replace history, not null.
**/
public void open(HexTexts target, FindReplaceHistory findReplaceHistory) {
if (target == null) {
throw new IllegalArgumentException("Parameter 'target' must not be null.");
}
if (findReplaceHistory == null) {
throw new IllegalArgumentException("Parameter 'findReplaceHistory' must not be null.");
}
myTarget = target;
this.findList = findReplaceHistory.getFindList();
this.replaceList = findReplaceHistory.getReplaceList();
if (shell == null || shell.isDisposed()) {
createShell();
}
SWTUtility.placeInCenterOf(shell, target.getShell());
findGroup.refreshCombo();
long selectionLength = myTarget.getSelection().getLength();
if (selectionLength > 0L && selectionLength <= BinaryContentFinder.MAX_SEQUENCE_SIZE) {
findGroup.refreshHexOrText(true);
ignoreCaseCheckBox.setEnabled(false);
StringBuilder selectedText = new StringBuilder();
byte[] selection = new byte[(int) selectionLength];
try {
myTarget.myContent.get(ByteBuffer.wrap(selection), myTarget.getSelection().start);
} catch (IOException ex) {
throw new RuntimeException(ex);
}
for (int i = 0; i < selectionLength; i++) {
selectedText.append(HexTexts.byteToHex[selection[i] & 0x0ff]);
if (i < selectionLength - 1) {
selectedText.append(' ');
}
}
findGroup.textCombo.setText(selectedText.toString());
findGroup.selectText();
} else {
findGroup.refreshHexOrText(lastFindHexButtonSelected);
ignoreCaseCheckBox.setEnabled(!lastFindHexButtonSelected);
}
replaceGroup.refreshHexOrText(lastReplaceHexButtonSelected);
replaceGroup.refreshCombo();
ignoreCaseCheckBox.setSelection(lastIgnoreCase);
if (lastForward) {
forwardRadioButton.setSelection(true);
} else {
backwardRadioButton.setSelection(true);
}
sendInfoMessage(Texts.FIND_REPLACE_DIALOG_MESSAGE_SPECIFY_VALUE_TO_FIND);
lastFocused = findGroup;
lastFocused.textCombo.setFocus();
dataToUI();
shell.open();
}
/**
* This method initializes composite3
*/
private void createOptionsGroup() {
optionsGroup = new Group(shell, SWT.NONE);
optionsGroup.setLayout(new GridLayout());
optionsGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
optionsGroup.setText(Texts.FIND_REPLACE_DIALOG_OPTIONS_GROUP_LABEL);
ignoreCaseCheckBox = new Button(optionsGroup, SWT.CHECK);
ignoreCaseCheckBox.setText(Texts.FIND_REPLACE_DIALOG_IGNORE_CASE_CHECKBOX_LABEL);
ignoreCaseCheckBox.addSelectionListener(defaultSelectionAdapter);
}
/**
* This method initializes group1
*/
private void createDirectionGroup() {
directionGroup = new Group(shell, SWT.NONE);
directionGroup.setText(Texts.FIND_REPLACE_DIALOG_DIRECTION_GROUP_LABEL);
directionGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
directionGroup.setLayout(new GridLayout());
forwardRadioButton = new Button(directionGroup, SWT.RADIO);
forwardRadioButton.setText(Texts.FIND_REPLACE_DIALOG_DIRECTION_FORWARD_RADIO_LABEL);
forwardRadioButton.addSelectionListener(defaultSelectionAdapter);
backwardRadioButton = new Button(directionGroup, SWT.RADIO);
backwardRadioButton.setText(Texts.FIND_REPLACE_DIALOG_DIRECTION_BACKWARD_RADIO_LABEL);
backwardRadioButton.addSelectionListener(defaultSelectionAdapter);
}
private void createFeedbackComposite() {
feedbackComposite = new Composite(shell, SWT.NONE);
GridLayout gridLayout_feedbackComposite = new GridLayout();
gridLayout_feedbackComposite.verticalSpacing = 0;
gridLayout_feedbackComposite.horizontalSpacing = 0;
feedbackComposite.setLayout(gridLayout_feedbackComposite);
feedbackComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
feedbackLabel = new Label(feedbackComposite, SWT.NONE);
feedbackLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
}
private void sendInfoMessage(String message) {
feedbackLabel.setForeground(null);
feedbackLabel.setText(message);
}
private void sendErrorMessage(String message) {
Color color_red = new Color(Display.getCurrent(), 255, 0, 0);
feedbackLabel.setForeground(color_red);
feedbackLabel.setText(message);
}
private void createProgressComposite() {
progressComposite = new Composite(shell, SWT.NONE);
progressComposite.setLayout(new GridLayout(2, false));
progressComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
progressBar = new ProgressBar(progressComposite, SWT.NONE);
progressBar.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
progressBarStopButton = new Button(progressComposite, SWT.NONE);
progressBarStopButton.setText(Texts.FIND_REPLACE_DIALOG_STOP_SEARCHING_BUTTON_LABEL);
setProgressCompositeVisible(false);
progressBarStopButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
myTarget.stopSearching();
}
});
}
private void setProgressCompositeVisible(boolean visible) {
progressComposite.setVisible(visible);
((GridData) progressComposite.getLayoutData()).exclude = !visible;
progressComposite.getParent().pack();
}
private void createButtonBarComposite() {
Composite buttonBar = new Composite(shell, SWT.NONE);
buttonBar.setLayout(new GridLayout(5, false));
buttonBar.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));
// This Label does not show anything.
// It is just used to push the buttons to the right.
Label spacerLabel = new Label(buttonBar, SWT.NONE);
spacerLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
findButton = new Button(buttonBar, SWT.NONE);
findButton.setText(Texts.FIND_REPLACE_DIALOG_FIND_BUTTON_LABEL);
findButton.addSelectionListener(defaultSelectionAdapter);
findButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
doFind();
}
});
replaceButton = new Button(buttonBar, SWT.NONE);
replaceButton.setText(Texts.FIND_REPLACE_DIALOG_REPLACE_BUTTON_LABEL);
replaceButton.addSelectionListener(defaultSelectionAdapter);
replaceButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
doReplace();
}
});
replaceAllButton = new Button(buttonBar, SWT.NONE);
replaceAllButton.setText(Texts.FIND_REPLACE_DIALOG_REPLACE_ALL_BUTTON_LABEL);
replaceAllButton.addSelectionListener(defaultSelectionAdapter);
replaceAllButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
doReplaceAll();
}
});
closeButton = new Button(buttonBar, SWT.NONE);
closeButton.setText(Texts.BUTTON_CLOSE_LABEL);
closeButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
shell.close();
}
});
}
/**
* This method initializes the shell
*/
private void createShell() {
shell = new Shell(getParent(), SWT.MODELESS | SWT.DIALOG_TRIM);
shell.setText(Texts.FIND_REPLACE_DIALOG_TITLE);
shell.setLayout(new GridLayout());
shell.addShellListener(new ShellAdapter() {
@Override
public void shellActivated(ShellEvent e) {
dataToUI();
}
});
// Create the search group
if (findGroup == null) {
findGroup = new TextHexInputGroup(findList);
}
findGroup.initialise();
findGroup.group.setText(Texts.FIND_REPLACE_DIALOG_FIND_GROUP_LABEL);
SelectionAdapter hexTextSelectionAdapter = new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
ignoreCaseCheckBox.setEnabled(e.widget == findGroup.textRadioButton);
}
};
findGroup.textRadioButton.addSelectionListener(hexTextSelectionAdapter);
findGroup.hexRadioButton.addSelectionListener(hexTextSelectionAdapter);
// create the replace with group
if (replaceGroup == null) {
replaceGroup = new TextHexInputGroup(replaceList);
}
replaceGroup.initialise();
replaceGroup.group.setText(Texts.FIND_REPLACE_DIALOG_REPLACE_GROUP_LABEL);
createDirectionGroup();
createOptionsGroup();
createFeedbackComposite();
createProgressComposite();
createButtonBarComposite();
shell.setDefaultButton(findButton);
shell.addListener(SWT.Close, new Listener() {
@Override
public void handleEvent(Event event) {
myTarget.stopSearching();
}
});
}
void doFind() {
prepareToRun();
progressBarStopButton.setText(Texts.FIND_REPLACE_DIALOG_STOP_SEARCHING_BUTTON_LABEL);
String findLiteral = findGroup.textCombo.getText();
if (findLiteral.length() > 0) {
try {
Match match = myTarget.findAndSelect(findLiteral, findGroup.hexRadioButton.getSelection(),
forwardRadioButton.getSelection(), ignoreCaseCheckBox.getSelection());
if (match.isFound()) {
sendInfoMessage(TextUtility.format(Texts.FIND_REPLACE_DIALOG_MESSAGE_FOUND, findLiteral,
NumberUtility.getDecimalAndHexString(match.getStartPosition())));
} else {
if (match.getException() == null) {
sendErrorMessage(TextUtility.format(Texts.FIND_REPLACE_DIALOG_MESSAGE_NOT_FOUND, findLiteral));
} else {
sendErrorMessage(TextUtility.format(Texts.FIND_REPLACE_DIALOG_MESSAGE_ERROR_WHILE_SEARCHING,
findLiteral, match.getException().getLocalizedMessage()));
}
}
} catch (NumberFormatException ex) {
sendErrorMessage(ex.getMessage());
}
} else {
sendErrorMessage(Texts.FIND_REPLACE_DIALOG_MESSAGE_SPECIFY_VALUE_TO_FIND);
}
endOfRun();
}
void doReplace() {
replace();
doFind();
}
void doReplaceAll() {
prepareToRun();
progressBarStopButton.setText(Texts.FIND_REPLACE_DIALOG_STOP_SEARCHING_BUTTON_LABEL);
String findLiteral = findGroup.textCombo.getText();
String replaceLiteral = replaceGroup.textCombo.getText();
if (findLiteral.length() > 0) {
try {
long[] result = myTarget.replaceAll(findLiteral, findGroup.hexRadioButton.getSelection(),
forwardRadioButton.getSelection(), ignoreCaseCheckBox.getSelection(), replaceLiteral,
replaceGroup.hexRadioButton.getSelection());
long replacements = result[0];
long startPosition = result[1];
if (replacements == 1) {
sendInfoMessage(TextUtility.format(Texts.FIND_REPLACE_DIALOG_MESSAGE_ONE_REPLACEMENT, findLiteral,
replaceLiteral, NumberUtility.getDecimalAndHexString(startPosition)));
} else {
sendInfoMessage(TextUtility.format(Texts.FIND_REPLACE_DIALOG_MESSAGE_MANY_REPLACEMENTS,
NumberUtility.getDecimalString(replacements), findLiteral, replaceLiteral));
}
} catch (NumberFormatException ex) {
sendErrorMessage(ex.getMessage());
} catch (IOException ex) {
sendErrorMessage(TextUtility.format(Texts.FIND_REPLACE_DIALOG_MESSAGE_ERROR_WHILE_REPLACING,
findLiteral, replaceLiteral, ex.getLocalizedMessage()));
}
} else {
sendErrorMessage(Texts.FIND_REPLACE_DIALOG_MESSAGE_SPECIFY_VALUE_TO_FIND);
}
endOfRun();
}
void dataToUI() {
findGroup.setEnabled(!searching);
replaceGroup.setEnabled(!searching);
directionGroup.setEnabled(!searching);
forwardRadioButton.setEnabled(!searching);
backwardRadioButton.setEnabled(!searching);
ignoreCaseCheckBox.setEnabled(!searching);
findButton.setEnabled(!searching);
replaceButton.setEnabled(!searching);
replaceAllButton.setEnabled(!searching);
closeButton.setEnabled(!searching);
if (searching) {
return;
}
boolean somethingToFind = findGroup.textCombo.getText().length() > 0;
long selectionLength = 0L;
if (myTarget != null) {
selectionLength = myTarget.getSelection().getLength();
}
findButton.setEnabled(somethingToFind);
replaceButton.setEnabled(selectionLength > 0L && somethingToFind);
replaceAllButton.setEnabled(somethingToFind);
}
private void endOfRun() {
searching = false;
if (progressComposite.isDisposed()) {
return;
}
setProgressCompositeVisible(false);
dataToUI();
}
private void prepareToRun() {
searching = true;
lastFindHexButtonSelected = findGroup.hexRadioButton.getSelection();
lastReplaceHexButtonSelected = replaceGroup.hexRadioButton.getSelection();
replaceGroup.rememberText();
findGroup.rememberText();
lastForward = forwardRadioButton.getSelection();
lastIgnoreCase = ignoreCaseCheckBox.getSelection();
feedbackLabel.setText(Texts.FIND_REPLACE_DIALOG_MESSAGE_SEARCHING);
dataToUI();
activateProgressBar();
}
private void replace() {
try {
myTarget.replace(replaceGroup.textCombo.getText(), replaceGroup.hexRadioButton.getSelection());
} catch (NumberFormatException ex) {
feedbackLabel.setText(ex.getMessage());
}
}
}
================================================
FILE: net.sourceforge.javahexeditor/src/net/sourceforge/javahexeditor/FindReplaceHistory.java
================================================
/*
* javahexeditor, a java hex editor
* Copyright (C) 2006, 2009 Jordi Bergenthal, pestatije(-at_)users.sourceforge.net
* The official javahexeditor site is sourceforge.net/projects/javahexeditor
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package net.sourceforge.javahexeditor;
import java.util.ArrayList;
import java.util.List;
/**
* Find/Replace input history.
*
* @author Peter Dell
*/
public final class FindReplaceHistory {
/**
* An entry has a string value and a flag indicating whether the text is to be
* interpreted as text or as hex value(s).
*/
public static final class Entry {
private String stringValue;
private boolean hex;
public Entry(String stringValue, boolean selected) {
if (stringValue == null) {
throw new IllegalArgumentException("Parameter 'stringValue' must not be null.");
}
this.stringValue = stringValue;
this.hex = selected;
}
public String getStringValue() {
return stringValue;
}
public boolean isHex() {
return hex;
}
}
private List findList;
private List replaceList;
public FindReplaceHistory() {
findList = new ArrayList();
replaceList = new ArrayList();
}
/**
* Gets the list of previous find operations
*
* @return The modifiable list of previous find operations, may be empty, not
* null.
*/
public List getFindList() {
return findList;
}
/**
* Gets the list of previous replace operations
*
* @return The modifiable list of previous replace operations, may be empty, not
* null.
*/
public List getReplaceList() {
return replaceList;
}
}
================================================
FILE: net.sourceforge.javahexeditor/src/net/sourceforge/javahexeditor/GoToDialog.java
================================================
/*
* javahexeditor, a java hex editor
* Copyright (C) 2006, 2009 Jordi Bergenthal, pestatije(-at_)users.sourceforge.net
* The official javahexeditor site is sourceforge.net/projects/javahexeditor
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package net.sourceforge.javahexeditor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Dialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import net.sourceforge.javahexeditor.common.NumberUtility;
import net.sourceforge.javahexeditor.common.SWTUtility;
import net.sourceforge.javahexeditor.common.TextUtility;
/**
* Go to dialog. Remembers previous state.
*
* @author Jordi Bergenthal
*/
final class GoToDialog extends Dialog {
Shell shell;
private Composite composite;
private Composite composite2;
Button hexRadioButton;
private Button decRadioButton;
Button showButton;
Button gotoButton;
private Button closeButton;
private Composite composite1;
Text text;
private Label label;
Label label2;
SelectionAdapter defaultSelectionAdapter = new SelectionAdapter() {
@Override
public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
text.setFocus();
}
};
private long finalResult = -1L;
long buttonPressed = 0;
boolean lastHexButtonSelected = true;
String lastLocationText;
long limit = -1L;
long tempResult = -1L;
public GoToDialog(Shell aShell) {
super(aShell);
lastLocationText = Texts.EMPTY;
}
/**
* This method initializes composite
*/
private void createComposite() {
RowLayout rowLayout1 = new RowLayout();
// rowLayout1.marginHeight = 5;
rowLayout1.marginTop = 2;
rowLayout1.marginBottom = 2;
// rowLayout1.marginWidth = 5;
rowLayout1.type = SWT.VERTICAL;
composite = new Composite(composite1, SWT.NONE);
composite.setLayout(rowLayout1);
SelectionAdapter hexTextSelectionAdapter = new SelectionAdapter() {
@Override
public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
text.setText(text.getText()); // generate event
lastHexButtonSelected = e.widget == hexRadioButton;
/*
* Crashes when the text is not a number if (lastHexButtonSelected) return;
* String textNew = text.getText(); textNew =
* Integer.toHexString(Integer.parseInt(textNew)).toUpperCase();
* text.setText(textNew); // generate event lastHexButtonSelected = true;
*/
}
};
/*
* Crashes when the text is not radix 16 SelectionAdapter
* decTextSelectionAdapter = new SelectionAdapter() { public void
* widgetSelected(org.eclipse.swt.events.SelectionEvent e) { if
* (!lastHexButtonSelected) return; String textNew = text.getText(); textNew =
* Integer.toString(Integer.parseInt(textNew, 16)); text.setText(textNew); //
* generate event lastHexButtonSelected = false; } };
*/
// Besides the crashes: the user always knows which number is entering,
// don't need any automatic
// conversion. What does sometimes happen is one enters the right number
// and the wrong hex or dec was
// selected. In that case automatic conversion is the wrong thing to do
// and very annoying.
hexRadioButton = new Button(composite, SWT.RADIO);
hexRadioButton.setText(Texts.GOTO_DIALOG_HEX);
hexRadioButton.addSelectionListener(defaultSelectionAdapter);
hexRadioButton.addSelectionListener(hexTextSelectionAdapter);
decRadioButton = new Button(composite, SWT.RADIO);
decRadioButton.setText(Texts.GOTO_DIALOG_DECIMAL);
decRadioButton.addSelectionListener(defaultSelectionAdapter);
decRadioButton.addSelectionListener(hexTextSelectionAdapter);// decTextSelectionAdapter);
}
/**
* Save the result and close dialog
*/
void saveResultAndClose() {
lastLocationText = text.getText();
finalResult = tempResult;
shell.close();
}
public long getButtonPressed() {
return buttonPressed;
}
/**
* This method initializes composite2
*
*/
private void createComposite2() {
RowLayout rowLayout1 = new RowLayout();
rowLayout1.type = org.eclipse.swt.SWT.VERTICAL;
rowLayout1.marginHeight = 10;
rowLayout1.marginWidth = 10;
rowLayout1.fill = true;
composite2 = new Composite(shell, SWT.NONE);
FormData formData = new FormData();
formData.left = new FormAttachment(composite1);
formData.right = new FormAttachment(100);
composite2.setLayoutData(formData);
composite2.setLayout(rowLayout1);
showButton = new Button(composite2, SWT.NONE);
showButton.setText(Texts.GOTO_DIALOG_SHOW_LOCATION_BUTTON_LABEL);
showButton.addSelectionListener(defaultSelectionAdapter);
showButton.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
@Override
public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
buttonPressed = 1;
saveResultAndClose();
}
});
gotoButton = new Button(composite2, SWT.NONE);
gotoButton.setText(Texts.GOTO_DIALOG_GOTO_LOCATION_BUTTON_LABEL);
gotoButton.addSelectionListener(defaultSelectionAdapter);
gotoButton.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
@Override
public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
buttonPressed = 2;
saveResultAndClose();
}
});
closeButton = new Button(composite2, SWT.NONE);
closeButton.setText(Texts.BUTTON_CLOSE_LABEL);
closeButton.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
@Override
public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
shell.close();
}
});
shell.setDefaultButton(showButton);
}
/**
* This method initializes composite1
*/
private void createComposite1() {
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 2;
composite1 = new Composite(shell, SWT.NONE);
composite1.setLayout(gridLayout);
createComposite();
text = new Text(composite1, SWT.BORDER | SWT.SINGLE);
text.setTextLimit(30);
int columns = 35;
GC gc = new GC(text);
int width = (int) (columns * SWTUtility.getAverageCharacterWidth(gc));
gc.dispose();
text.setLayoutData(new GridData(width, SWT.DEFAULT));
text.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
String newText = text.getText();
tempResult = NumberUtility.parseString(hexRadioButton.getSelection(), newText);
if (tempResult >= 0L && tempResult <= limit) {
showButton.setEnabled(true);
gotoButton.setEnabled(true);
label2.setText(Texts.EMPTY);
} else {
showButton.setEnabled(false);
gotoButton.setEnabled(false);
if (Texts.EMPTY.equals(newText)) {
label2.setText(Texts.EMPTY);
} else if (tempResult < 0) {
label2.setText(Texts.DIALOG_ERROR_NOT_A_NUMBER_MESSAGE);
} else {
label2.setText(Texts.DIALOG_ERROR_LOCATION_OUT_OF_RANGE_MESSAGE);
}
}
}
});
FormData formData = new FormData();
formData.top = new FormAttachment(label);
composite1.setLayoutData(formData);
}
/**
* This method initializes the shell.
*/
private void createShell() {
shell = new Shell(getParent(), SWT.APPLICATION_MODAL | SWT.DIALOG_TRIM);
shell.setText(Texts.GOTO_DIALOG_GOTO_LOCATION_SHELL_LABEL);
FormLayout formLayout = new FormLayout();
formLayout.marginHeight = 3;
formLayout.marginWidth = 3;
shell.setLayout(formLayout);
label = new Label(shell, SWT.NONE);
FormData formData = new FormData();
formData.left = new FormAttachment(0, 5);
formData.right = new FormAttachment(100);
label.setLayoutData(formData);
createComposite1();
createComposite2();
label2 = new Label(shell, SWT.CENTER);
FormData formData2 = new FormData();
formData2.left = new FormAttachment(0);
formData2.right = new FormAttachment(100);
formData2.top = new FormAttachment(composite1);
formData2.bottom = new FormAttachment(100, -10);
label2.setLayoutData(formData2);
}
public long open(Shell parentShell, long limit) {
this.limit = limit;
finalResult = -1L;
buttonPressed = 0;
if (shell == null || shell.isDisposed()) {
createShell();
}
SWTUtility.placeInCenterOf(shell, parentShell);
if (lastHexButtonSelected) {
hexRadioButton.setSelection(true);
} else {
decRadioButton.setSelection(true);
}
label.setText(TextUtility.format(Texts.GOTO_DIALOG_MESSAGE_ENTER_LOCATION,
NumberUtility.getDecimalAndHexRangeString(0, this.limit)));
text.setText(lastLocationText);
text.selectAll();
text.setFocus();
shell.open();
Display display = getParent().getDisplay();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return finalResult;
}
}
================================================
FILE: net.sourceforge.javahexeditor/src/net/sourceforge/javahexeditor/HelpResources.java
================================================
/*
* javahexeditor, a java hex editor
* Copyright (C) 2006, 2009 Jordi Bergenthal, pestatije(-at_)users.sourceforge.net
* The official javahexeditor site is sourceforge.net/projects/javahexeditor
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package net.sourceforge.javahexeditor;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.net.URISyntaxException;
public final class HelpResources {
/**
* Gets the URI to open for displaying the help document.
*
* @param online
* true to get the URI for the project web site,
* false to get an URI in the local file system. All
* relevant resources will be copied to the file system in this case.
* @return The URI, not null.
*/
public static URI getHelpResourceURI(boolean online) {
URI uri;
if (online) {
try {
uri = new URI("http://javahexeditor.sourceforge.net");
} catch (URISyntaxException ex) {
throw new RuntimeException(ex);
}
} else {
{
uri = writeResource("/index.html", null).toURI();
writeResource("/images/javahexeditor-48x48.png", null);
writeResource("/images/linux-files-preferences.png", null);
writeResource("/images/screenshot-01.png", null);
writeResource("/images/screenshot-02.png", null);
}
}
return uri;
}
/**
* Copies a file from the class path to the temporary folder.
*
* @param resourcePath
* The resource path in the class path, not empty, not
* null.
* @param filePath
* The file path or null if the resource path shall be
* used.
* @return
*/
private static File writeResource(String resourcePath, String filePath) {
if (resourcePath == null) {
throw new IllegalArgumentException("Parameter 'resourcePath' must not be null.");
}
if (filePath == null) {
filePath = resourcePath;
}
InputStream inStream = HelpResources.class.getResourceAsStream(resourcePath);
if (inStream == null) {
throw new RuntimeException("Help file '" + resourcePath + "' missing in classpath.");
}
File localFolder = new File(System.getProperty("java.io.tmpdir"), "javahexeditor");
File localFile = new File(localFolder, filePath);
localFile.getParentFile().mkdirs();
try {
FileOutputStream outStream = new FileOutputStream(localFile);
byte[] buffer = new byte[512];
int read = 0;
try {
while ((read = inStream.read(buffer)) > 0) {
outStream.write(buffer, 0, read);
}
} finally {
outStream.close();
}
} catch (IOException ignore) {
// Open browser anyway
}
try {
inStream.close();
} catch (IOException ignore) {
// Open browser anyway
}
localFile.deleteOnExit();
return localFile;
}
}
================================================
FILE: net.sourceforge.javahexeditor/src/net/sourceforge/javahexeditor/HexTexts.java
================================================
/*
* javahexeditor, a java hex editor
* Copyright (C) 2006, 2009 Jordi Bergenthal, pestatije(-at_)users.sourceforge.net
* The official javahexeditor site is sourceforge.net/projects/javahexeditor
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package net.sourceforge.javahexeditor;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
import java.nio.charset.CodingErrorAction;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyleRange;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.custom.VerifyKeyListener;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.FocusAdapter;
import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.FocusListener;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.KeyListener;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.events.TraverseEvent;
import org.eclipse.swt.events.TraverseListener;
import org.eclipse.swt.events.VerifyEvent;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Caret;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.ScrollBar;
import org.eclipse.swt.widgets.Text;
import org.jcryptool.core.util.constants.IConstants;
import net.sourceforge.javahexeditor.BinaryContent.RangeSelection;
import net.sourceforge.javahexeditor.BinaryContentFinder.Match;
import net.sourceforge.javahexeditor.common.ByteArrayUtility;
import net.sourceforge.javahexeditor.common.SWTUtility;
/**
* A binary file editor, composed of two synchronized displays: an hexadecimal
* and a basic ASCII char display. The file size has no effect on the memory
* footprint of the editor. It has binary, ASCII and Unicode find functionality.
* Use addListener(SWT.Modify, Listener) to listen to changes of the 'dirty',
* 'overwrite/insert', 'selection' and 'canUndo/canRedo' status.
*
* @author Jordi Bergenthal
*/
public final class HexTexts extends Composite {
/**
* Map of displayed chars. Chars that cannot be displayed correctly are changed
* for a '.' char. There are differences on which chars can correctly be
* displayed in each operating system, charset encoding, or font system.
*/
public static final char[] byteToChar = new char[256]; // TODO should not be static
static final String[] byteToHex = new String[256];
private static final int CHARS_FOR_ADDRESS = 12; // Files up to 16 Ters: 11
// hex digits
// + ':'
private final Color colorBlue = Display.getCurrent().getSystemColor(SWT.COLOR_BLUE);
private final Color colorLightShadow = Display.getCurrent().getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW);
private final Color colorNormalShadow = Display.getCurrent().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW);
private final Color black = Display.getCurrent().getSystemColor(SWT.COLOR_BLACK);
private final Color colorCaretLine = new Color(Display.getCurrent(), 232, 242, 254); // very light blue
private final Color colorHighlight = new Color(Display.getCurrent(), 255, 248, 147); // mellow / yellow
private static final byte[] HEX_TO_NIBBLE = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, -1, -1, 10, 11, 12,
13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 10, 11, 12, 13, 14, 15 };
private static final int MAX_SCREEN_RESOLUTION = 1920;
private static final int MIN_CHAR_SIZE = 5;
private static final char[] NIBBLE_TO_HEX = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D',
'E', 'F' };
private static final int SET_TEXT = 0;
private static final int SHIFT_FORWARD = 1; // frame
private static final int SHIFT_BACKWARD = 2;
private int charsForFileSizeAddress = 0;
private String charset;
private boolean delayedInQueue = false;
private Runnable delayedWaiting;
boolean dragging = false;
double fontCharWidth = -1;
private String headerRow; // Computed based on MAX_SCREEN_RESOLUTION
private List highlightRangesInScreen;
private List mergeChangeRanges;
private List mergeHighlightRanges;
private int mergeIndexChange = -2;
private int mergeIndexHighlight = -2;
private boolean mergeRangesIsBlue = false;
private boolean mergeRangesIsHighlight = false;
private int mergeRangesPosition = -1;
int myBytesPerLine = 16;
boolean myCaretStickToStart = false; // stick to end
BinaryContent myContent;
BinaryContentFinder myFinder;
boolean myInserting = false;
private KeyListener myKeyAdapter = new MyKeyAdapter();
int myLastFocusedTextArea = -1; // 1 or 2;
private long myLastLocationPosition = -1L;
private List myLongSelectionListeners;
private long myPreviousFindEnd = -1;
private boolean myPreviousFindIgnoredCase = false;
private String myPreviousFindString;
private boolean myPreviousFindStringWasHex = false;
private int myPreviousLine = -1;
private long myPreviousRedrawStart = -1;
long myStart = 0L;
long myTextAreasStart = 0L;
long myEnd = 0L;
private final MyTraverseAdapter myTraverseAdapter = new MyTraverseAdapter();
int myUpANibble = 0; // always 0 or 1
private final MyVerifyKeyAdapter myVerifyKeyAdapter = new MyVerifyKeyAdapter();
private int numberOfLines = 16;
private int numberOfLines_1 = numberOfLines - 1;
private boolean stopSearching = false;
private byte[] tmpRawBuffer = new byte[MAX_SCREEN_RESOLUTION / MIN_CHAR_SIZE / 3 * MAX_SCREEN_RESOLUTION
/ MIN_CHAR_SIZE];
private int verticalBarFactor = 0;
// visual components
private Font fontCurrent; // disposed externally
private Font fontDefault; // disposed internally
private Composite column0;
private Text textSeparator0;
private StyledText styledText0;
private Composite column1;
private StyledText header1Text;
private StyledText styledText1;
private GridData styledText1GridData;
private GC styledText1GC;
private Composite column2;
private Text textSeparator2;
private StyledText styledText2;
private GridData styledText2GridData;
private GC styledText2GC;
/**
* Manager of the current Editor page.
* Used by the ContextMenu to enable/disable the
* commands in the context menu (right click menu).
*/
private Manager manager;
/**
* compose byte-to-hex map
*/
private void composeByteToHexMap() {
for (int i = 0; i < 256; ++i) {
byteToHex[i] = Character.toString(NIBBLE_TO_HEX[i >>> 4]) + NIBBLE_TO_HEX[i & 0x0f];
}
}
/**
* compose byte-to-char map
*/
private void composeByteToCharMap() {
if (charset == null || styledText2 == null) {
return;
}
CharsetDecoder d = Charset.forName(charset).newDecoder().onMalformedInput(CodingErrorAction.REPLACE)
.onUnmappableCharacter(CodingErrorAction.REPLACE).replaceWith(".");
ByteBuffer bb = ByteBuffer.allocate(1);
CharBuffer cb = CharBuffer.allocate(1);
for (int i = 0; i < 256; ++i) {
if (i < 0x20 || i == 0x7f) {
byteToChar[i] = '.';
} else {
bb.clear();
bb.put((byte) i);
bb.rewind();
cb.clear();
d.reset();
d.decode(bb, cb, true);
d.flush(cb);
cb.rewind();
char decoded = cb.get();
// neither font metrics nor graphic context work for charset
// 8859-1 chars between 128 and
// 159
String text = styledText2.getText();
styledText2.setText("|" + decoded);
if (styledText2.getLocationAtOffset(2).x
- styledText2.getLocationAtOffset(1).x < styledText2.getLocationAtOffset(1).x
- styledText2.getLocationAtOffset(0).x) {
decoded = '.';
}
styledText2.setText(text);
byteToChar[i] = decoded;
}
}
}
/**
* compose header row
*/
private void composeHeaderRow() {
StringBuilder rowChars = new StringBuilder();
for (int i = 0; i < MAX_SCREEN_RESOLUTION / MIN_CHAR_SIZE / 3; ++i) {
rowChars.append(byteToHex[i & 0x0ff]).append(' ');
}
headerRow = rowChars.toString().toUpperCase();
}
public String getCharset() {
return charset;
}
public void setCharset(String name) {
if ((name == null) || (name.length() == 0)) {
name = IConstants.UTF8_ENCODING;
}
charset = name;
composeByteToCharMap();
}
private class MyKeyAdapter extends KeyAdapter {
public MyKeyAdapter() {
}
@Override
public void keyPressed(KeyEvent e) {
switch (e.keyCode) {
case SWT.ARROW_UP:
case SWT.ARROW_DOWN:
case SWT.ARROW_LEFT:
case SWT.ARROW_RIGHT:
case SWT.END:
case SWT.HOME:
case SWT.PAGE_UP:
case SWT.PAGE_DOWN:
boolean selection = myStart != myEnd;
boolean ctrlKey = (e.stateMask & SWT.CONTROL) != 0;
boolean countNibbles = (e.widget == styledText1);
if ((e.stateMask & SWT.SHIFT) != 0) { // shift mod2
long newPos = doNavigateKeyPressed(ctrlKey, e.keyCode, getCaretPos(), false);
shiftStartAndEnd(newPos);
} else { // if no modifier or control or alt
long position = doNavigateKeyPressed(ctrlKey, e.keyCode, getCaretPos(),
countNibbles && !myInserting);
setStartAndEnd(position, position);
myCaretStickToStart = false;
}
ensureCaretIsVisible();
Runnable delayed = new Runnable() {
@Override
public void run() {
redrawTextAreas(false);
runnableEnd();
}
};
runnableAdd(delayed);
notifyLongSelectionListeners();
if (selection != (myStart != myEnd)) {
notifyListeners(SWT.Modify, null);
}
e.doit = false;
break;
case SWT.INSERT:
if ((e.stateMask & SWT.MODIFIER_MASK) == 0) {
redrawCaret(true);
} else if (e.stateMask == SWT.SHIFT) {
paste();
} else if (e.stateMask == SWT.CONTROL) {
copy();
}
break;
case 'a':
if (e.stateMask == SWT.CONTROL) {
selectAll();
}
break;
case 'c':
if (e.stateMask == SWT.CONTROL) {
copy();
}
break;
case 'v':
if (e.stateMask == SWT.CONTROL) {
paste();
}
break;
case 'x':
if (e.stateMask == SWT.CONTROL) {
cut();
}
break;
case 'y':
if (e.stateMask == SWT.CONTROL) {
redo();
}
break;
case 'z':
if (e.stateMask == SWT.CONTROL) {
undo();
}
break;
default:
break;
}
}
}
private class MyMouseAdapter extends MouseAdapter {
int charLen;
public MyMouseAdapter(boolean hexContent) {
charLen = 1;
if (hexContent) {
charLen = 3;
}
}
@Override
public void mouseDown(MouseEvent e) {
if (e.button == 1) {
dragging = true;
}
int textOffset = 0;
try {
textOffset = SWTUtility.getOffsetAtPoint(((StyledText) e.widget), new Point(e.x, e.y));
} catch (IllegalArgumentException ex) {
textOffset = ((StyledText) e.widget).getCharCount();
}
if (textOffset < 0) {
return;
}
int byteOffset = textOffset / charLen;
((StyledText) e.widget).setTopIndex(0);
if (e.button == 1 && (e.stateMask & SWT.MODIFIER_MASK & ~SWT.SHIFT) == 0) {// no
// modifier or shift
if ((e.stateMask & SWT.MODIFIER_MASK) == 0) {
myCaretStickToStart = false;
long position = myTextAreasStart + byteOffset;
setStartAndEnd(position, position);
} else { // shift
shiftStartAndEnd(myTextAreasStart + byteOffset);
}
refreshCaretsPosition();
setFocus();
refreshSelections();
notifyListeners(SWT.Modify, null);
notifyLongSelectionListeners();
}
}
@Override
public void mouseUp(MouseEvent e) {
if (e.button == 1) {
dragging = false;
}
}
}
/**
* Draws the separate lines on the right of every 8 byte block in the hex area.
*/
private class MyPaintAdapter1 implements PaintListener {
@Override
public void paintControl(PaintEvent event) {
event.gc.setBackground(colorLightShadow);
int xPos;
for (int block = 8; block <= myBytesPerLine; block += 8) {
xPos = (int) (3 * block * fontCharWidth);
event.gc.fillRectangle((int) (xPos - fontCharWidth), event.y, (int) fontCharWidth, event.y + event.height);
}
}
}
/**
* Draws the separate lines on the right of every 8 byte block in the text area.
*/
private class MyPaintAdapter2 implements PaintListener {
@Override
public void paintControl(PaintEvent event) {
event.gc.setForeground(colorLightShadow);
event.gc.setLineWidth(1);
for (int block = 8; block <= myBytesPerLine; block += 8) {
int xPos = (int) (block * fontCharWidth);
event.gc.drawLine(xPos, event.y, xPos, event.y + event.height);
}
}
}
private class MySelectionAdapter extends SelectionAdapter {
int charLen;
public MySelectionAdapter(boolean hexContent) {
charLen = 1;
if (hexContent) {
charLen = 3;
}
}
@Override
public void widgetSelected(SelectionEvent e) {
if (!dragging) {
return;
}
boolean selection = myStart != myEnd;
int lower = e.x / charLen;
int higher = e.y / charLen;
int caretPos = ((StyledText) e.widget).getCaretOffset() / charLen;
myCaretStickToStart = caretPos < higher || caretPos < lower;
if (lower > higher) {
lower = higher;
higher = e.x / charLen;
}
select(myTextAreasStart + lower, myTextAreasStart + higher);
if (selection != (myStart != myEnd)) {
notifyListeners(SWT.Modify, null);
}
redrawTextAreas(false);
}
}
private class MyTraverseAdapter implements TraverseListener {
public MyTraverseAdapter() {
}
@Override
public void keyTraversed(TraverseEvent e) {
if (e.detail == SWT.TRAVERSE_TAB_NEXT) {
e.doit = true;
}
}
}
private class MyVerifyKeyAdapter implements VerifyKeyListener {
public MyVerifyKeyAdapter() {
}
@Override
public void verifyKey(VerifyEvent e) {
// Log.log(this, "verifyKey={0}", e);
if ((e.character == SWT.DEL || e.character == SWT.BS) && myInserting) {
if (!deleteSelected()) {
if (e.character == SWT.BS) {
long newStart = myStart + myUpANibble;
long newEnd = myEnd;
if (newStart > 0L) {
myContent.delete(newStart - 1L, 1L);
newEnd = --newStart;
}
setStartAndEnd(newStart, newEnd);
} else { // e.character == SWT.DEL
myContent.delete(myStart, 1L);
}
ensureWholeScreenIsVisible();
ensureCaretIsVisible();
Runnable delayed = new Runnable() {
@Override
public void run() {
redrawTextAreas(true);
runnableEnd();
}
};
runnableAdd(delayed);
updateScrollBar();
notifyListeners(SWT.Modify, null);
notifyLongSelectionListeners();
}
myUpANibble = 0;
} else {
doModifyKeyPressed(e);
}
e.doit = false;
}
}
private final class MyFinderRunnable implements Runnable {
private Match match;
public MyFinderRunnable() {
}
@Override
public void run() {
match = myFinder.getNextMatch();
}
public Match getMatch() {
if (match == null) {
throw new IllegalStateException("Field 'match' must not be null.");
}
return match;
}
}
/**
* Create a binary text editor
*
* @param parent
* parent in the widget hierarchy
* @param style
* not used for the moment
*/
public HexTexts(final Composite parent, int style, Manager mngr) {
super(parent, style | SWT.BORDER | SWT.V_SCROLL);
manager = mngr;
highlightRangesInScreen = new ArrayList();
composeByteToHexMap();
composeHeaderRow();
myLongSelectionListeners = new ArrayList();
addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
colorCaretLine.dispose();
colorHighlight.dispose();
if (fontDefault != null && !fontDefault.isDisposed()) {
fontDefault.dispose();
}
}
});
initialize();
myLastFocusedTextArea = 1;
myPreviousLine = -1;
}
/**
* redraw the caret with respect of Inserting/Overwriting mode
*
* @param focus
*/
public void redrawCaret(boolean focus) {
drawUnfocusedCaret(false);
setInsertMode(focus ? (!myInserting) : myInserting);
if (myInserting && myUpANibble != 0) {
myUpANibble = 0;
refreshCaretsPosition();
if (focus) {
setFocus();
}
} else {
drawUnfocusedCaret(true);
}
if (focus) {
notifyListeners(SWT.Modify, null);
}
}
/**
* Adds a long selection listener. Events sent to the listener have long start
* and end points. The start point is formed by event.width as the most
* significant int and event.x as the least significant int. The end point is
* similarly formed by event.height and event.y A listener can obtain the long
* selection with this code: getLongSelection(SelectionEvent) long start =
* ((long)event.width) << 32 | (event.x & 0x0ffffffffL) Similarly for the end
* point: long end = ((long)event.height) << 32 | (event.y & 0x0ffffffffL)
*
* @param listener
* the listener
* @see StyledText#addSelectionListener(org.eclipse.swt.events.SelectionListener)
*/
public void addLongSelectionListener(SelectionListener listener) {
if (listener == null) {
throw new IllegalArgumentException("Parameter 'listener' must not be null.");
}
if (!myLongSelectionListeners.contains(listener)) {
myLongSelectionListeners.add(listener);
}
}
/**
* This method initializes composite
*/
private void initialize() {
GridLayout mainGridLayout = new GridLayout();
mainGridLayout.numColumns = 3;
mainGridLayout.marginHeight = 0;
mainGridLayout.verticalSpacing = 0;
mainGridLayout.horizontalSpacing = 0;
mainGridLayout.marginWidth = 0;
setLayout(mainGridLayout);
Display display = Display.getCurrent();
fontDefault = new Font(display, Preferences.getDefaultFontData());
fontCurrent = fontDefault;
column0 = new Composite(this, SWT.NONE);
GridLayout column0Layout = new GridLayout();
column0Layout.marginHeight = 0;
column0Layout.verticalSpacing = 0;
column0Layout.horizontalSpacing = 0;
column0Layout.marginWidth = 0;
column0.setLayout(column0Layout);
column0.setBackground(colorLightShadow);
GridData gridDataColumn = new GridData(SWT.BEGINNING, SWT.FILL, false, true);
column0.setLayoutData(gridDataColumn);
GridData gridDataTextSeparator = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
gridDataTextSeparator.widthHint = 10;
textSeparator0 = new Text(column0, SWT.SEPARATOR);
textSeparator0.setEnabled(false);
textSeparator0.setBackground(colorLightShadow);
textSeparator0.setLayoutData(gridDataTextSeparator);
styledText0 = new StyledText(column0, SWT.MULTI | SWT.READ_ONLY);
styledText0.setEditable(false);
styledText0.setEnabled(false);
styledText0.setBackground(colorLightShadow);
styledText0.setForeground(black);
styledText0.setFont(fontCurrent);
GC styledTextGC = new GC(styledText0);
fontCharWidth = SWTUtility.getAverageCharacterWidth(styledTextGC);
styledTextGC.dispose();
GridData gridDataAddresses = new GridData(SWT.BEGINNING, SWT.FILL, false, true);
gridDataAddresses.heightHint = numberOfLines * styledText0.getLineHeight();
styledText0.setLayoutData(gridDataAddresses);
setAddressesGridDataWidthHint();
styledText0.setContent(new DisplayedContent(CHARS_FOR_ADDRESS, numberOfLines));
column1 = new Composite(this, SWT.NONE);
GridLayout column1Layout = new GridLayout();
column1Layout.marginHeight = 0;
column1Layout.verticalSpacing = 0;
column1Layout.horizontalSpacing = 0;
column1Layout.marginWidth = 0;
column1.setLayout(column1Layout);
column1.setBackground(colorLightShadow);
GridData gridDataColumn1 = new GridData(SWT.BEGINNING, SWT.FILL, false, true);
column1.setLayoutData(gridDataColumn1);
header1Text = new StyledText(column1, SWT.SINGLE | SWT.READ_ONLY);
GridData gridData_header1Text = new GridData();
gridData_header1Text.horizontalIndent = 0; // because of small line left
header1Text.setLayoutData(gridData_header1Text);
header1Text.setEditable(false);
header1Text.setEnabled(false);
header1Text.setForeground(black);
header1Text.setBackground(colorLightShadow);
header1Text.setFont(fontCurrent);
refreshHeader();
styledText1 = new StyledText(column1, SWT.MULTI);
styledText1.setFont(fontCurrent);
styledText1GC = new GC(styledText1);
styledText1GridData = new GridData(SWT.DEFAULT, SWT.FILL, false, true);
styledText1.setLayoutData(styledText1GridData);
styledText1.addKeyListener(myKeyAdapter);
FocusListener myFocusAdapter = new FocusAdapter() {
@Override
public void focusGained(FocusEvent e) {
drawUnfocusedCaret(false);
myLastFocusedTextArea = 1;
if (e.widget == styledText2) {
myLastFocusedTextArea = 2;
}
getDisplay().asyncExec(new Runnable() {
@Override
public void run() {
drawUnfocusedCaret(true);
}
});
}
};
styledText1.addFocusListener(myFocusAdapter);
styledText1.addMouseListener(new MyMouseAdapter(true));
styledText1.addPaintListener(new MyPaintAdapter1());
styledText1.addTraverseListener(myTraverseAdapter);
styledText1.addVerifyKeyListener(myVerifyKeyAdapter);
styledText1.setContent(new DisplayedContent(myBytesPerLine * 3, numberOfLines));
styledText1.setDoubleClickEnabled(false);
styledText1.addSelectionListener(new MySelectionAdapter(true));
// StyledText.setCaretOffset() version 3.448 bug resets the caret size
// if using the default one,
// so we use not the default one.
Caret defaultCaret = styledText1.getCaret();
Caret nonDefaultCaret = new Caret(defaultCaret.getParent(), defaultCaret.getStyle());
nonDefaultCaret.setBounds(defaultCaret.getBounds());
styledText1.setCaret(nonDefaultCaret);
// This creates the context menu on the hex area.
// TODO here I work.
// styledText1.setMenu(new ContextMenu(styledText1, manager));
ContextMenu.createMenuForText(styledText1, manager);
// Menu contextMenu = new Menu(styledText1);
// contextMenu.addMenuListener(new MenuListener() {
//
// @Override
// public void menuShown(MenuEvent e) {
// // TODO Auto-generated method stub
//
// }
//
// @Override
// public void menuHidden(MenuEvent e) {
// // TODO Auto-generated method stub
//
// }
// });
// styledText1.setMenu(contextMenu);
// styledText1
// MenuItem mi1 = new MenuItem(contextMenu, SWT.None);
// mi1.setText("Rechtsklick9");
// mi1.setMenu(contextMenu);
// mi1.
column2 = new Composite(this, SWT.NONE);
GridLayout column2Layout = new GridLayout();
column2Layout.marginHeight = 0;
column2Layout.verticalSpacing = 0;
column2Layout.horizontalSpacing = 0;
column2Layout.marginWidth = 0;
column2.setLayout(column2Layout);
column2.setBackground(styledText1.getBackground());
GridData gridDataColumn2 = new GridData(SWT.FILL, SWT.FILL, true, true);
column2.setLayoutData(gridDataColumn2);
textSeparator2 = new Text(column2, SWT.SEPARATOR);
textSeparator2.setEnabled(false);
textSeparator2.setBackground(colorLightShadow);
textSeparator2.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
makeFirstRowSameHeight();
styledText2 = new StyledText(column2, SWT.MULTI);
styledText2.setFont(fontCurrent);
styledText2GridData = new GridData(SWT.FILL, SWT.FILL, true, true);
styledText2.setLayoutData(styledText2GridData);
styledText2.addKeyListener(myKeyAdapter);
styledText2.addFocusListener(myFocusAdapter);
styledText2.addMouseListener(new MyMouseAdapter(false));
styledText2.addPaintListener(new MyPaintAdapter2());
styledText2.addTraverseListener(myTraverseAdapter);
styledText2.addVerifyKeyListener(myVerifyKeyAdapter);
styledText2.setContent(new DisplayedContent(myBytesPerLine, numberOfLines));
styledText2.setDoubleClickEnabled(false);
styledText2.addSelectionListener(new MySelectionAdapter(false));
// StyledText.setCaretOffset() version 3.448 bug resets the caret size
// if using the default one,
// so we use not the default one.
defaultCaret = styledText2.getCaret();
nonDefaultCaret = new Caret(defaultCaret.getParent(), defaultCaret.getStyle());
nonDefaultCaret.setBounds(defaultCaret.getBounds());
styledText2.setCaret(nonDefaultCaret);
styledText2GC = new GC(styledText2);
setCharset(null);
ContextMenu.createMenuForText(styledText2, manager);
// TODO: For debugging layout issues
// styledText2.setBackground(colorBlue);
adaptWidthToBytesPerLine();
super.setFont(fontCurrent);
ScrollBar vertical = getVerticalBar();
vertical.setSelection(0);
vertical.setMinimum(0);
vertical.setIncrement(1);
vertical.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
e.doit = false;
long previousStart = myTextAreasStart;
myTextAreasStart = getVerticalBar().getSelection();
myTextAreasStart = (myTextAreasStart << verticalBarFactor) * myBytesPerLine;
if (previousStart == myTextAreasStart) {
return;
}
Runnable delayed = new Runnable() {
@Override
public void run() {
redrawTextAreas(false);
setFocus();
runnableEnd();
}
};
runnableAdd(delayed);
}
});
updateScrollBar();
addMouseListener(new org.eclipse.swt.events.MouseAdapter() {
@Override
public void mouseDown(org.eclipse.swt.events.MouseEvent e) {
setFocus();
}
});
addControlListener(new org.eclipse.swt.events.ControlAdapter() {
@Override
public void controlResized(org.eclipse.swt.events.ControlEvent e) {
updateTextsMetrics();
}
});
addDisposeListener(new org.eclipse.swt.events.DisposeListener() {
@Override
public void widgetDisposed(org.eclipse.swt.events.DisposeEvent e) {
if (myContent != null) {
myContent.dispose();
}
}
});
}
/**
* Calculate the width of the styled text containing the hex values
* and the styled text containing the utf-8 values.
*/
private void adaptWidthToBytesPerLine() {
int width = (int) (((myBytesPerLine * 3) -1 ) * fontCharWidth);
styledText1GridData.widthHint = styledText1.computeTrim(0, 0, width, 0).width;
width = (int) ((myBytesPerLine - 1) * fontCharWidth + 1); // one pixel for caret in last column
styledText2GridData.widthHint = styledText2.computeTrim(0, 0, width, 0).width;
}
public boolean isValid() {
return myContent != null;
}
public boolean isEditable() {
return myContent != null;
}
/**
* Tells whether the last action can be redone
*
* @return true: an action can be redone
*/
public boolean canRedo() {
return myContent != null && myContent.canRedo();
}
/**
* Tells whether the last action can be undone
*
* @return true: an action can be undone
*/
public boolean canUndo() {
return myContent != null && myContent.canUndo();
}
/**
* Copies the selection into the clipboard. If nothing is selected leaves the
* clipboard with its current contents. The clipboard will hold text data (for
* pasting into a text editor) and binary data (internal for HexText). Text data
* is limited to 4Mbytes, binary data is limited by disk space.
*/
public void copy() {
if (myStart >= myEnd) {
return;
}
long length = myEnd - myStart;
boolean toBigforClipboard = false;
if (length > (4 * 1024 * 1024)) {
toBigforClipboard = true;
}
// Create the "copy hex or text" dialog
Dialog d = new CopyDialog(Display.getCurrent().getActiveShell(), toBigforClipboard);
int returnValue = d.open();
if (returnValue == 0 || returnValue == 1) {
// 1 is returned if the user closed the dialog
// Do nothing
} else if (returnValue == 2) {
// The user pressed "hex"
// Copy the hex values to the clipboard
ClipboardHelper.setHexContentToClipboard(myContent, myStart, length);
} else if (returnValue == 3) {
// The user pressed "utf8"
// copy the text representation to the clipboard.
ClipboardHelper.setContentsText(myContent, myStart, length);
}
}
private StringBuilder cookAddresses(long address, int limit) {
StringBuilder theText = new StringBuilder();
for (int i = 0; i < limit; i += myBytesPerLine, address += myBytesPerLine) {
boolean indenting = true;
for (int j = (CHARS_FOR_ADDRESS - 2) * 4; j > 0; j -= 4) {
int nibble = ((int) (address >>> j)) & 0x0f;
if (nibble != 0) {
indenting = false;
}
if (indenting) {
if (j >= (charsForFileSizeAddress * 4)) {
theText.append(' ');
} else {
theText.append('0');
}
} else {
theText.append(NIBBLE_TO_HEX[nibble]);
}
}
theText.append(NIBBLE_TO_HEX[((int) address) & 0x0f]).append(':');
}
return theText;
}
private StringBuilder cookTexts(boolean hex, int length) {
if (length > tmpRawBuffer.length) {
length = tmpRawBuffer.length;
}
StringBuilder result;
if (hex) {
result = new StringBuilder(length * 3);
for (int i = 0; i < length; ++i) {
result.append(byteToHex[tmpRawBuffer[i] & 0x0ff]).append(' ');
}
} else {
result = new StringBuilder(length);
for (int i = 0; i < length; ++i) {
result.append(byteToChar[tmpRawBuffer[i] & 0x0ff]);
}
}
return result;
}
/**
* Calls copy();deleteSelected();
*
* @see #copy() #deleteSelected()
*/
public void cut() {
copy();
deleteSelected();
}
private void setStartAndEnd(long start, long end) {
if (start < 0) {
throw new IllegalArgumentException(
"Parameter start must not be negative. Specifed value is " + start + ".");
}
if (end < 0) {
throw new IllegalArgumentException("Parameter end must not be negative. Specifed value is " + end + ".");
}
myStart = start;
myEnd = end;
}
/**
* While in insert mode, trims the selection
*
* @return did delete something
*/
public boolean deleteNotSelected() {
if (!myInserting || myStart < 1L && myEnd >= myContent.length()) {
return false;
}
myContent.delete(myEnd, myContent.length() - myEnd);
myContent.delete(0L, myStart);
setStartAndEnd(0, myContent.length());
myUpANibble = 0;
ensureWholeScreenIsVisible();
restoreStateAfterModify();
return true;
}
/**
* While in insert mode, deletes the selection
*
* @return did delete something
*/
public boolean deleteSelected() {
if (!handleSelectedPreModify()) {
return false;
}
myUpANibble = 0;
ensureWholeScreenIsVisible();
restoreStateAfterModify();
return true;
}
void doModifyKeyPressed(KeyEvent event) {
char aChar = event.character;
if (aChar == '\0' || aChar == '\b' || aChar == '\u007f' || event.stateMask == SWT.CTRL
|| event.widget == styledText1 && ((event.stateMask & SWT.MODIFIER_MASK) != 0 || aChar < '0'
|| aChar > '9' && aChar < 'A' || aChar > 'F' && aChar < 'a' || aChar > 'f')) {
return;
}
if (getCaretPos() == myContent.length() && !myInserting) {
ensureCaretIsVisible();
redrawTextAreas(false);
return;
}
handleSelectedPreModify();
try {
if (myInserting) {
if (event.widget == styledText2) {
myContent.insert((byte) aChar, getCaretPos());
} else if (myUpANibble == 0) {
myContent.insert((byte) (HEX_TO_NIBBLE[aChar - '0'] << 4), getCaretPos());
} else {
myContent.overwrite(HEX_TO_NIBBLE[aChar - '0'], 4, 4, getCaretPos());
}
} else {
if (event.widget == styledText2) {
myContent.overwrite((byte) aChar, getCaretPos());
} else {
myContent.overwrite(HEX_TO_NIBBLE[aChar - '0'], myUpANibble * 4, 4, getCaretPos());
}
myContent.get(ByteBuffer.wrap(tmpRawBuffer, 0, 1), null, getCaretPos());
int offset = (int) (getCaretPos() - myTextAreasStart);
styledText1.replaceTextRange(offset * 3, 2, byteToHex[tmpRawBuffer[0] & 0x0ff]);
styledText1.setStyleRange(new StyleRange(offset * 3, 2, colorBlue, null));
styledText2.replaceTextRange(offset, 1, Character.toString(byteToChar[tmpRawBuffer[0] & 0x0ff]));
styledText2.setStyleRange(new StyleRange(offset, 1, colorBlue, null));
}
} catch (IOException e) {
throw new RuntimeException(e);
}
long position = incrementPosWithinLimits(getCaretPos(), event.widget == styledText1);
setStartAndEnd(position, position);
Runnable delayed = new Runnable() {
@Override
public void run() {
ensureCaretIsVisible();
redrawTextAreas(false);
if (myInserting) {
updateScrollBar();
redrawTextAreas(true);
}
refreshSelections();
runnableEnd();
}
};
runnableAdd(delayed);
notifyListeners(SWT.Modify, null);
notifyLongSelectionListeners();
}
long doNavigateKeyPressed(boolean ctrlKey, int keyCode, long oldPos, boolean countNibbles) {
if (!countNibbles) {
myUpANibble = 0;
}
switch (keyCode) {
case SWT.ARROW_UP:
if (oldPos >= myBytesPerLine) {
oldPos -= myBytesPerLine;
}
break;
case SWT.ARROW_DOWN:
if (oldPos <= myContent.length() - myBytesPerLine) {
oldPos += myBytesPerLine;
}
if (countNibbles && oldPos == myContent.length()) {
myUpANibble = 0;
}
break;
case SWT.ARROW_LEFT:
if (countNibbles && (oldPos > 0 || oldPos == 0 && myUpANibble > 0)) {
if (myUpANibble == 0) {
--oldPos;
}
myUpANibble ^= 1; // 1->0, 0->1
}
if (!countNibbles && oldPos > 0) {
--oldPos;
}
break;
case SWT.ARROW_RIGHT:
oldPos = incrementPosWithinLimits(oldPos, countNibbles);
break;
case SWT.END:
if (ctrlKey) {
oldPos = myContent.length();
} else {
oldPos = oldPos - oldPos % myBytesPerLine + myBytesPerLine - 1L;
if (oldPos >= myContent.length()) {
oldPos = myContent.length();
}
}
myUpANibble = 0;
if (countNibbles && oldPos < myContent.length()) {
myUpANibble = 1;
}
break;
case SWT.HOME:
if (ctrlKey) {
oldPos = 0;
} else {
oldPos = oldPos - oldPos % myBytesPerLine;
}
myUpANibble = 0;
break;
case SWT.PAGE_UP:
if (oldPos >= myBytesPerLine) {
oldPos = oldPos - myBytesPerLine * numberOfLines_1;
if (oldPos < 0L) {
oldPos = (oldPos + myBytesPerLine * numberOfLines_1) % myBytesPerLine;
}
}
break;
case SWT.PAGE_DOWN:
if (oldPos <= myContent.length() - myBytesPerLine) {
oldPos = oldPos + myBytesPerLine * numberOfLines_1;
if (oldPos > myContent.length()) {
oldPos = oldPos - ((oldPos - 1 - myContent.length()) / myBytesPerLine + 1) * myBytesPerLine;
}
}
if (countNibbles && oldPos == myContent.length()) {
myUpANibble = 0;
}
break;
}
return oldPos;
}
void drawUnfocusedCaret(boolean visible) {
if (styledText1.isDisposed()) {
return;
}
GC unfocusedGC = null;
Caret unfocusedCaret = null;
int chars = 0;
int shift = 0;
if (myLastFocusedTextArea == 1) {
unfocusedCaret = styledText2.getCaret();
unfocusedGC = styledText2GC;
} else {
unfocusedCaret = styledText1.getCaret();
unfocusedGC = styledText1GC;
chars = 1;
if (styledText1.getCaretOffset() % 3 == 1) {
shift = -1;
}
}
if (unfocusedCaret.getVisible()) {
Rectangle unfocused = unfocusedCaret.getBounds();
unfocusedGC.setForeground(visible ? colorNormalShadow : colorCaretLine);
unfocusedGC.drawRectangle(unfocused.x + shift * unfocused.width, unfocused.y, unfocused.width << chars,
unfocused.height - 1);
}
}
void ensureCaretIsVisible() {
long caretPos = getCaretPos();
long posInLine = caretPos % myBytesPerLine;
if (myTextAreasStart > caretPos) {
myTextAreasStart = caretPos - posInLine;
} else if (myTextAreasStart + myBytesPerLine * numberOfLines < caretPos
|| myTextAreasStart + myBytesPerLine * numberOfLines == caretPos && caretPos != myContent.length()) {
myTextAreasStart = caretPos - posInLine - myBytesPerLine * numberOfLines_1;
if (caretPos == myContent.length() && posInLine == 0) {
myTextAreasStart = caretPos - myBytesPerLine * numberOfLines;
}
if (myTextAreasStart < 0L) {
myTextAreasStart = 0L;
}
} else {
return;
}
getVerticalBar().setSelection((int) ((myTextAreasStart / myBytesPerLine) >>> verticalBarFactor));
}
void ensureWholeScreenIsVisible() {
if (myTextAreasStart + myBytesPerLine * numberOfLines > myContent.length()) {
myTextAreasStart = myContent.length() - (myContent.length() - 1L) % myBytesPerLine - 1L
- myBytesPerLine * numberOfLines_1;
}
if (myTextAreasStart < 0L) {
myTextAreasStart = 0L;
}
}
/**
* Performs a find on the text and sets the selection accordingly. The find
* starts at the current caret position.
*
* @param findString
* the literal to find
* @param isHexString
* consider the literal as an hex string (ie. "0fdA1"). Used for
* binary finds. Will search full bytes only, odd number of hex
* characters will have a leading '0' added.
* @param searchForward
* look for matches after current position
* @param ignoreCase
* match upper case with lower case characters
* @return whether a match was found
*/
public Match findAndSelect(String findString, boolean isHexString, boolean searchForward, boolean ignoreCase)
throws NumberFormatException {
if (findString == null) {
throw new IllegalArgumentException("Parameter 'findString' must not be null.");
}
Match result = findAndSelectInternal(findString, isHexString, searchForward, ignoreCase, true);
return result;
}
// Used by "find" and by "replace".
private Match findAndSelectInternal(String findString, boolean isHexString, boolean searchForward,
boolean ignoreCase, boolean updateGui) throws NumberFormatException {
if (findString == null) {
throw new IllegalArgumentException("Parameter 'findString' must not be null.");
}
initFinder(findString, isHexString, searchForward, ignoreCase);
MyFinderRunnable finderRunnable = new MyFinderRunnable();
SWTUtility.blockUntilFinished(finderRunnable);
Match match = finderRunnable.getMatch();
if (match.getException() != null) {
return match;
}
if (match.isFound()) {
myCaretStickToStart = false;
if (updateGui) {
setSelection(match.getStartPosition(), match.getEndPosition());
} else {
select(match.getStartPosition(), match.getEndPosition());
}
myPreviousFindEnd = getCaretPos();
}
return match;
}
/**
* Get caret position in file, which can be out of view
*
* @return the current caret position
*/
public long getCaretPos() {
if (myCaretStickToStart) {
return myStart;
}
return myEnd;
}
public byte getActualValue() {
return getValue(getCaretPos());
}
public byte getValue(long pos) {
if (myContent == null) {
return -1;
}
try {
myContent.get(ByteBuffer.wrap(tmpRawBuffer, 0, 1), null, pos);
} catch (IOException ex) {
throw new RuntimeException("Unexpected IO error at position " + pos, ex);
}
return tmpRawBuffer[0];
}
/**
* Get the binary content
*
* @return the content being edited
*/
public BinaryContent getContent() {
return myContent;
}
private void getHighlightRangesInScreen(long start, int length) {
highlightRangesInScreen.clear();
if (myLastLocationPosition >= start && myLastLocationPosition < start + length) {
highlightRangesInScreen.add((int) (myLastLocationPosition - myTextAreasStart));
highlightRangesInScreen.add(1);
}
}
/**
* Gets the selection start and end points as long values
*
* @return 2 elements long array, first one the start point (inclusive), second
* one the end point (exclusive)
*/
public RangeSelection getSelection() {
return new RangeSelection(myStart, myEnd);
}
public boolean isSelected() {
return (myStart != myEnd);
}
private boolean handleSelectedPreModify() {
if (myStart == myEnd || !myInserting) {
return false;
}
myContent.delete(myStart, myEnd - myStart);
myEnd = myStart;
return true;
}
private long incrementPosWithinLimits(long oldPos, boolean countNibbles) {
if (oldPos < myContent.length()) {
if (countNibbles) {
if (myUpANibble > 0) {
++oldPos;
}
myUpANibble ^= 1; // 1->0, 0->1
} else {
++oldPos;
}
}
return oldPos;
}
/**
*
* @param findString
* @param isHexString
* @param searchForward
* @param ignoreCase
* @throws NumberFormatException
* if the replace string is not a valid hex string
*/
private void initFinder(String findString, boolean isHexString, boolean searchForward, boolean ignoreCase)
throws NumberFormatException {
if (!searchForward) {
myCaretStickToStart = true;
}
if (myFinder == null || !findString.equals(myPreviousFindString) || isHexString != myPreviousFindStringWasHex
|| ignoreCase != myPreviousFindIgnoredCase) {
myPreviousFindString = findString;
myPreviousFindStringWasHex = isHexString;
myPreviousFindIgnoredCase = ignoreCase;
if (isHexString) {
byte[] byteArray = ByteArrayUtility.parseString(findString);
myFinder = new BinaryContentFinder(byteArray, myContent);
} else {
myFinder = new BinaryContentFinder(findString, myContent);
if (ignoreCase) {
myFinder.setCaseSensitive(false);
}
}
myFinder.setNewStart(getCaretPos());
}
if (myPreviousFindEnd != getCaretPos()) {
myFinder.setNewStart(getCaretPos());
}
myFinder.setDirectionForward(searchForward);
}
/**
* Tells whether the input is in overwrite or insert mode
*
* @return true: overwriting, false: inserting
*/
public boolean isOverwriteMode() {
return !myInserting;
}
/**
*Adapts the heights of the spacers left and right of the adresses to
*the same height as the adresses text field.
*/
private void makeFirstRowSameHeight() {
((GridData) textSeparator0.getLayoutData()).heightHint = header1Text.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
((GridData) textSeparator2.getLayoutData()).heightHint = header1Text.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
}
/**
* Merge ranges of changes in file with ranges of highlighted elements. Finds
* lowest range border, finds next lowest range border. That's the first result.
* Keeps going until last range border.
*
* @param changeRanges
* @param highlightRanges
*
* @return list of StyleRanges, each with a style of type 'changed',
* 'highlighted', or both.
*/
public List mergeRanges(List changeRanges, List highlightRanges) {
if (!mergerInit(changeRanges, highlightRanges)) {
return null;
}
List result = new ArrayList();
mergerNext();
int start = mergeRangesPosition;
boolean blue = mergeRangesIsBlue;
boolean highlight = mergeRangesIsHighlight;
while (mergerNext()) {
if (blue || highlight) {
result.add(new StyleRange(start, mergeRangesPosition - start, blue ? colorBlue : null,
highlight ? colorHighlight : null));
}
start = mergeRangesPosition;
blue = mergeRangesIsBlue;
highlight = mergeRangesIsHighlight;
}
return result;
}
private boolean mergerCatchUps() {
boolean withinRange = false;
if (mergeChangeRanges != null && mergeChangeRanges.size() > mergeIndexChange) {
withinRange = true;
if (mergerPosition(true) < mergeRangesPosition) {
++mergeIndexChange;
}
}
if (mergeHighlightRanges != null && mergeHighlightRanges.size() > mergeIndexHighlight) {
withinRange = true;
if (mergerPosition(false) < mergeRangesPosition) {
++mergeIndexHighlight;
}
}
return withinRange;
}
/**
* Initialize merger variables
*
* @param changeRanges
* @param highlightRanges
*
* @return whether the parameters hold any data
*/
private boolean mergerInit(List changeRanges, List highlightRanges) {
if ((changeRanges == null || changeRanges.size() < 2)
&& (highlightRanges == null || highlightRanges.size() < 2)) {
return false;
}
this.mergeChangeRanges = changeRanges;
this.mergeHighlightRanges = highlightRanges;
mergeRangesIsBlue = false;
mergeRangesIsHighlight = false;
mergeRangesPosition = -1;
mergeIndexChange = 0;
mergeIndexHighlight = 0;
return true;
}
private int mergerMinimumInChangesHighlights() {
int change = Integer.MAX_VALUE;
if (mergeChangeRanges != null && mergeChangeRanges.size() > mergeIndexChange) {
change = mergerPosition(true);
}
int highlight = Integer.MAX_VALUE;
if (mergeHighlightRanges != null && mergeHighlightRanges.size() > mergeIndexHighlight) {
highlight = mergerPosition(false);
}
int result = Math.min(change, highlight);
if (change == result) {
mergeRangesIsBlue = (mergeIndexChange & 1) == 0;
}
if (highlight == result) {
mergeRangesIsHighlight = (mergeIndexHighlight & 1) == 0;
}
return result;
}
private boolean mergerNext() {
++mergeRangesPosition;
if (!mergerCatchUps()) {
return false;
}
mergeRangesPosition = mergerMinimumInChangesHighlights();
return true;
}
private int mergerPosition(boolean changesNotHighlights) {
int result = -1;
if (changesNotHighlights) {
result = (int) (mergeChangeRanges.get(mergeIndexChange & 0xfffffffe).longValue() - myTextAreasStart);
if ((mergeIndexChange & 1) == 1) {
result = (int) Math.min(myBytesPerLine * numberOfLines,
result + mergeChangeRanges.get(mergeIndexChange).longValue());
}
} else {
result = mergeHighlightRanges.get(mergeIndexHighlight & 0xfffffffe).intValue();
if ((mergeIndexHighlight & 1) == 1) {
result += mergeHighlightRanges.get(mergeIndexHighlight).intValue();
}
}
return result;
}
void notifyLongSelectionListeners() {
if (myLongSelectionListeners.isEmpty()) {
return;
}
Event basicEvent = new Event();
basicEvent.widget = this;
SelectionEvent anEvent = new SelectionEvent(basicEvent);
anEvent.width = (int) (myStart >>> 32);
anEvent.x = (int) myStart;
anEvent.height = (int) (myEnd >>> 32);
anEvent.y = (int) myEnd;
Iterator listeners = myLongSelectionListeners.iterator();
while (listeners.hasNext()) {
SelectionListener aListener = listeners.next();
aListener.widgetSelected(anEvent);
}
}
public boolean canPaste() {
// return myClipboard.hasContents();
return ClipboardHelper.hasContents();
}
/**
* Pastes the clipboard content. The result depends on which insertion mode is
* currently active: Insert mode replaces the selection with the DND.CLIPBOARD
* clipboard contents or, if there is no selection, inserts at the current caret
* offset. Overwrite mode replaces contents at the current caret offset, unless
* pasting would overflow the content length, in which case does nothing.
*/
public void paste() {
//TODO Add option to paste hex values
if (!ClipboardHelper.hasContents()) {
return;
}
handleSelectedPreModify();
//TODO Check which type of content is in the clipboard.
// Dann entscheiden, ob hex / Text dialog angezeigt wird oder nicht.
// Bei Dateien wird er nicht angezeigt.
Dialog d = new PasteDialog(Display.getCurrent().getActiveShell());
int returnValue = d.open();
long caretPos = getCaretPos();
// Anzahl an BYTES die eingefuegt werden sollen
long total = 0;
// total = ClipboardHelper.tryGettingFiles(myContent, caretPos, myInserting);
if (returnValue == 0 || returnValue == 1) {
// 1 is returned if the user closed the dialog
// Do nothing
return;
} else if (returnValue == 2) {
// The user pressed "hex"
total = ClipboardHelper.tryGettingHex(myContent, caretPos, myInserting);
} else if (returnValue == 3) {
// The user pressed "utf8"
total = ClipboardHelper.tryGettingText(myContent, caretPos, myInserting);
}
setStartAndEnd(caretPos, caretPos + total);
myCaretStickToStart = false;
redrawTextAreas(true);
restoreStateAfterModify();
}
/**
* Redoes the last undone action
*/
public void redo() {
undo(false);
}
private void redrawTextAreas(int mode, StringBuilder newText, StringBuilder resultHex, StringBuilder resultChar,
List viewRanges) {
styledText1.getCaret().setVisible(false);
styledText2.getCaret().setVisible(false);
if (mode == SET_TEXT) {
styledText0.getContent().setText(newText.toString());
styledText1.getContent().setText(resultHex.toString());
styledText2.getContent().setText(resultChar.toString());
myPreviousLine = -1;
} else {
boolean forward = mode == SHIFT_FORWARD;
styledText0.setRedraw(false);
styledText1.setRedraw(false);
styledText2.setRedraw(false);
((DisplayedContent) styledText0.getContent()).shiftLines(newText.toString(), forward);
((DisplayedContent) styledText1.getContent()).shiftLines(resultHex.toString(), forward);
((DisplayedContent) styledText2.getContent()).shiftLines(resultChar.toString(), forward);
styledText0.setRedraw(true);
styledText1.setRedraw(true);
styledText2.setRedraw(true);
if (myPreviousLine >= 0 && myPreviousLine < numberOfLines) {
myPreviousLine += newText.length() / CHARS_FOR_ADDRESS * (forward ? 1 : -1);
}
if (myPreviousLine < -1 || myPreviousLine >= numberOfLines) {
myPreviousLine = -1;
}
}
if (viewRanges != null) {
for (Iterator i = viewRanges.iterator(); i.hasNext();) {
StyleRange styleRange = i.next();
styledText2.setStyleRange(styleRange);
styleRange = (StyleRange) styleRange.clone();
styleRange.start *= 3;
styleRange.length *= 3;
styledText1.setStyleRange(styleRange);
}
}
}
void redrawTextAreas(boolean fromScratch) {
if (myContent == null || styledText1.isDisposed()) {
return;
}
long newLinesStart = myTextAreasStart;
int linesShifted = numberOfLines;
int mode = SET_TEXT;
if (!fromScratch && myPreviousRedrawStart >= 0L) {
long lines = (myTextAreasStart - myPreviousRedrawStart) / myBytesPerLine;
if (Math.abs(lines) < numberOfLines) {
mode = lines > 0L ? SHIFT_BACKWARD : SHIFT_FORWARD;
linesShifted = Math.abs((int) lines);
if (linesShifted < 1) {
refreshSelections();
refreshCaretsPosition();
return;
}
if (mode == SHIFT_BACKWARD) {
newLinesStart = myTextAreasStart + (numberOfLines - (int) lines) * myBytesPerLine;
}
}
}
myPreviousRedrawStart = myTextAreasStart;
StringBuilder newText = cookAddresses(newLinesStart, linesShifted * myBytesPerLine);
ArrayList changeRanges = new ArrayList();
int actuallyRead = 0;
try {
actuallyRead = myContent.get(ByteBuffer.wrap(tmpRawBuffer, 0, linesShifted * myBytesPerLine), changeRanges,
newLinesStart);
} catch (IOException e) {
actuallyRead = 0;
}
StringBuilder resultHex = cookTexts(true, actuallyRead);
StringBuilder resultChar = cookTexts(false, actuallyRead);
getHighlightRangesInScreen(newLinesStart, linesShifted * myBytesPerLine);
List viewRanges = mergeRanges(changeRanges, highlightRangesInScreen);
redrawTextAreas(mode, newText, resultHex, resultChar, viewRanges);
refreshSelections();
refreshCaretsPosition();
}
void refreshCaretsPosition() {
drawUnfocusedCaret(false);
long caretLocation = getCaretPos() - myTextAreasStart;
if (caretLocation >= 0L && caretLocation < myBytesPerLine * numberOfLines
|| getCaretPos() == myContent.length() && caretLocation == myBytesPerLine * numberOfLines) {
int tmp = (int) caretLocation;
if (tmp == myBytesPerLine * numberOfLines) {
styledText1.setCaretOffset(tmp * 3 - 1);
styledText2.setCaretOffset(tmp);
} else {
styledText1.setCaretOffset(tmp * 3 + myUpANibble);
styledText2.setCaretOffset(tmp);
}
int line = styledText1.getLineAtOffset(styledText1.getCaretOffset());
if (line != myPreviousLine) {
if (myPreviousLine >= 0 && myPreviousLine < numberOfLines) {
styledText1.setLineBackground(myPreviousLine, 1, null);
styledText2.setLineBackground(myPreviousLine, 1, null);
}
styledText1.setLineBackground(line, 1, colorCaretLine);
styledText2.setLineBackground(line, 1, colorCaretLine);
myPreviousLine = line;
}
styledText1.getCaret().setVisible(true);
styledText2.getCaret().setVisible(true);
getDisplay().asyncExec(new Runnable() {
@Override
public void run() {
drawUnfocusedCaret(true);
}
});
} else {
styledText1.getCaret().setVisible(false);
styledText2.getCaret().setVisible(false);
}
}
/**
* Sets the nummber of addresses in header1Text.
*/
private void refreshHeader() {
header1Text.setText(headerRow.substring(0, Math.min(myBytesPerLine * 3, headerRow.length())));
}
void refreshSelections() {
if (myStart >= myEnd || myStart > myTextAreasStart + myBytesPerLine * numberOfLines
|| myEnd <= myTextAreasStart) {
return;
}
long startLocation = myStart - myTextAreasStart;
if (startLocation < 0L) {
startLocation = 0L;
}
int intStart = (int) startLocation;
long endLocation = myEnd - myTextAreasStart;
if (endLocation > myBytesPerLine * numberOfLines) {
endLocation = myBytesPerLine * numberOfLines;
}
int intEnd = (int) endLocation;
if (myCaretStickToStart) {
int tmp = intStart;
intStart = intEnd;
intEnd = tmp;
}
styledText1.setSelection(intStart * 3, intEnd * 3);
styledText1.setTopIndex(0);
styledText2.setSelection(intStart, intEnd);
styledText2.setTopIndex(0);
}
/**
* Removes the specified selection listener
*
* @param listener
*
* @see StyledText#removeSelectionListener(org.eclipse.swt.events.SelectionListener)
*/
public void removeLongSelectionListener(SelectionListener listener) {
if (listener == null) {
throw new IllegalArgumentException();
}
myLongSelectionListeners.remove(listener);
}
/**
* Replaces the selection. The result depends on which insertion mode is
* currently active: Insert mode replaces the selection with the replaceString
* or, if there is no selection, inserts at the current caret offset. Overwrite
* mode replaces contents at the current selection start.
*
* @param replaceString
* the new string
* @param isHexString
* consider the literal as an hex string (ie. "0fdA1"). Used for
* binary finds. Will replace full bytes only, odd number of hex
* characters will have a leading '0' added.
* @throws NumberFormatException
* if the replace string is not a valid hex string
*/
public void replace(String replaceString, boolean isHexString) throws NumberFormatException {
if (replaceString == null) {
throw new IllegalArgumentException("Parameter 'replaceString' must not be null.");
}
handleSelectedPreModify();
byte[] replaceData = replaceString.getBytes();
if (isHexString) {
replaceData = ByteArrayUtility.parseString(replaceString);
}
ByteBuffer newSelection = ByteBuffer.wrap(replaceData);
if (myInserting) {
myContent.insert(newSelection, myStart);
} else {
newSelection.limit((int) Math.min(newSelection.limit(), myContent.length() - myStart));
myContent.overwrite(newSelection, myStart);
}
myEnd = myStart + newSelection.limit() - newSelection.position();
myCaretStickToStart = false;
redrawTextAreas(true);
restoreStateAfterModify();
}
/**
* Replaces all occurrences of findString with replaceString. The find starts at
* the current caret position.
*
* @param findString
* the literal to find
* @param isFindHexString
* consider the literal as an hex string (ie. "0fdA1"). Used for
* binary finds. Will search full bytes only, odd number of hex
* characters will have a leading '0' added.
* @param searchForward
* look for matches after current position
* @param ignoreCase
* match upper case with lower case characters
* @param replaceString
* the new string
* @param isReplaceHexString
* consider the literal as an hex string (ie. "0fdA1"). Used for
* binary finds. Will replace full bytes only, odd number of hex
* characters will have a leading '0' added.
* @return An array with [0]=number of replacements, [1]=last replaced start
* position
* @throws IOException
* @throws NumberFormatException
*/
public long[] replaceAll(String findString, boolean isFindHexString, boolean searchForward, boolean ignoreCase,
String replaceString, boolean isReplaceHexString) throws IOException, NumberFormatException {
if (findString == null) {
throw new IllegalArgumentException("Parameter 'findString' must not be null.");
}
if (replaceString == null) {
throw new IllegalArgumentException("Parameter 'replaceString' must not be null.");
}
long replacements = 0;
long lastStartPosition = 0;
stopSearching = false;
while (!stopSearching) {
Match match = findAndSelectInternal(findString, isFindHexString, searchForward, ignoreCase, false);
if (match.isFound()) {
replacements++;
lastStartPosition = match.getStartPosition();
replace(replaceString, isReplaceHexString);
} else {
stopSearching = true;
if (match.getException() != null) {
throw match.getException();
}
}
}
if (replacements > 0) {
RangeSelection selection = getSelection();
setSelection(selection.start, selection.end);
}
return new long[] { replacements, lastStartPosition };
}
private void restoreStateAfterModify() {
ensureCaretIsVisible();
redrawTextAreas(true);
updateScrollBar();
notifyListeners(SWT.Modify, null);
notifyLongSelectionListeners();
}
void runnableAdd(Runnable delayed) {
if (delayedInQueue) {
delayedWaiting = delayed;
} else {
delayedInQueue = true;
Display.getCurrent().asyncExec(delayed);
}
}
void runnableEnd() {
if (delayedWaiting != null) {
Display.getCurrent().asyncExec(delayedWaiting);
delayedWaiting = null;
} else {
delayedInQueue = false;
}
}
/**
* Sets the selection to the entire text. Caret remains either at the selection
* start or end
*/
public void selectAll() {
select(0L, myContent.length());
refreshSelections();
}
/**
* Sets the selection from start to end.
*
* @param start
* @param end
*/
public void selectBlock(long start, long end) {
select(start, end);
refreshSelections();
showMark(start);
}
void select(long start, long end) {
myUpANibble = 0;
boolean selection = (myStart != myEnd);
long newStart = 0L;
if (start > 0L) {
newStart = start;
if (newStart > myContent.length()) {
newStart = myContent.length();
}
}
long newEnd = newStart;
if (end > newStart) {
newEnd = end;
if (newEnd > myContent.length()) {
newEnd = myContent.length();
}
}
setStartAndEnd(newStart, newEnd);
notifyLongSelectionListeners();
boolean newSelection = (myStart != myEnd);
if (selection != newSelection) {
notifyListeners(SWT.Modify, null);
}
}
private void setAddressesGridDataWidthHint() {
((GridData) styledText0.getLayoutData()).widthHint = (int) (CHARS_FOR_ADDRESS * fontCharWidth);
}
public void setInsertMode(boolean insert) {
myInserting = insert;
int width = 0;
int height = styledText1.getCaret().getSize().y;
if (!myInserting) {
width = (int) fontCharWidth;
}
styledText1.getCaret().setSize(width, height);
styledText2.getCaret().setSize(width, height);
}
/**
* Sets the content to be displayed. Replacing an existing content keeps the
* display area in the same position, but only if it falls within the new
* content's limits.
*
* @param newContent
* the content to be displayed
*/
public void setContentProvider(BinaryContent newContent) {
boolean firstContent = (myContent == null);
if (myContent != null && myContent != newContent) {
myContent.dispose();
}
myContent = newContent;
myFinder = null;
if (myContent != null) {
myContent.setActionsHistory();
}
if (firstContent || myEnd > myContent.length() || myTextAreasStart >= myContent.length()) {
myTextAreasStart = 0L;
setStartAndEnd(myTextAreasStart, myTextAreasStart);
myCaretStickToStart = false;
}
charsForFileSizeAddress = Long.toHexString(myContent.length()).length();
setEnabled(true);
updateScrollBar();
redrawTextAreas(true);
notifyLongSelectionListeners();
notifyListeners(SWT.Modify, null);
}
/**
* Causes the receiver to have the keyboard focus. Within Eclipse, never call
* setFocus() before the workbench has called
* EditorActionBarContributor.setActiveEditor()
*
* @see Composite#setFocus()
*/
@Override
public boolean setFocus() {
redrawCaret(false);
if (myLastFocusedTextArea == 1) {
return styledText1.setFocus();
}
return styledText2.setFocus();
}
/**
* @see Control#setFont(org.eclipse.swt.graphics.Font) Font height must not be 1
* or 2.
* @throws IllegalArgumentException
* if font height is 1 or 2
*/
@Override
public void setFont(Font font) {
// bugfix: HexText's raw array overflows when font is very small and
// window very big very small sizes would compromise responsiveness in large
// windows, and they are too small to see anyway
if (font != null) {
int newSize = font.getFontData()[0].getHeight();
if (newSize == 1 || newSize == 2) {
throw new IllegalArgumentException("Font size is " + newSize + ", too small");
}
}
fontCurrent = font;
if (fontCurrent == null) {
fontCurrent = fontDefault;
}
super.setFont(fontCurrent);
header1Text.setFont(fontCurrent);
header1Text.pack(true);
GC gc = new GC(header1Text);
fontCharWidth = SWTUtility.getAverageCharacterWidth(gc);
gc.dispose();
makeFirstRowSameHeight();
styledText0.setFont(fontCurrent);
setAddressesGridDataWidthHint();
styledText0.pack(true);
styledText1.setFont(fontCurrent);
styledText1.pack(true);
styledText2.setFont(fontCurrent);
styledText2.pack(true);
updateTextsMetrics();
layout();
setInsertMode(myInserting);
}
/**
* Sets the selection. The caret may change position but stays at the same
* selection point (if it was at the start of the selection it will move to the
* new start, otherwise to the new end point). The new selection is made visible
*
* @param start
* inclusive start selection position
* @param end
* exclusive end selection position
*/
public void setSelection(long start, long end) {
select(start, end);
ensureCaretIsVisible();
redrawTextAreas(false);
}
void shiftStartAndEnd(long newPos) {
long newStart;
long newEnd;
if (myCaretStickToStart) {
newStart = Math.min(newPos, myEnd);
newEnd = Math.max(newPos, myEnd);
} else {
newStart = Math.min(newPos, myStart);
newEnd = Math.max(newPos, myStart);
}
setStartAndEnd(newStart, newEnd);
myCaretStickToStart = myEnd != newPos;
}
/**
* Shows the position on screen.
*
* @param position
* where relocation should go
*/
public void showMark(long position) {
myLastLocationPosition = position;
if (position < 0) {
return;
}
position = position - position % myBytesPerLine;
myTextAreasStart = position;
if (numberOfLines > 2) {
myTextAreasStart = position - (numberOfLines / 2) * myBytesPerLine;
}
ensureWholeScreenIsVisible();
redrawTextAreas(true);
// setFocus();
updateScrollBar();
}
/**
* Stop findAndSelect() or replaceAll() calls. Long running searches can be
* stopped from another thread.
*/
public void stopSearching() {
stopSearching = true;
if (myFinder != null) {
myFinder.stopSearching();
}
}
private long totalNumberOfLines() {
long result = 1L;
if (myContent != null) {
result = (myContent.length() - 1L) / myBytesPerLine + 1L;
}
return result;
}
/**
* Undoes the last action
*/
public void undo() {
undo(true);
}
private void undo(boolean previousAction) {
long[] selection = previousAction ? myContent.undo() : myContent.redo();
if (selection == null) {
return;
}
myUpANibble = 0;
setStartAndEnd(selection[0], selection[1]);
myCaretStickToStart = false;
ensureWholeScreenIsVisible();
restoreStateAfterModify();
}
private void updateNumberOfLines() {
int height = getClientArea().height - header1Text.computeSize(SWT.DEFAULT, SWT.DEFAULT, false).y;
numberOfLines = height / styledText0.getLineHeight();
if (numberOfLines < 1) {
numberOfLines = 1;
}
numberOfLines_1 = numberOfLines - 1;
((DisplayedContent) styledText0.getContent()).setDimensions(CHARS_FOR_ADDRESS, numberOfLines);
((DisplayedContent) styledText1.getContent()).setDimensions(myBytesPerLine * 3, numberOfLines);
((DisplayedContent) styledText2.getContent()).setDimensions(myBytesPerLine, numberOfLines);
}
void updateScrollBar() {
ScrollBar vertical = getVerticalBar();
long max = totalNumberOfLines();
verticalBarFactor = 0;
while (max > Integer.MAX_VALUE) {
max >>>= 1;
++verticalBarFactor;
}
vertical.setMaximum((int) max);
vertical.setSelection((int) ((myTextAreasStart / myBytesPerLine) >>> verticalBarFactor));
vertical.setPageIncrement(numberOfLines_1);
vertical.setThumb(numberOfLines);
}
void updateTextsMetrics() {
int width = getClientArea().width - styledText0.computeSize(SWT.DEFAULT, SWT.DEFAULT).x;
int displayedNumberWidth = (int) (fontCharWidth * 4); // styledText1 and
// styledText2
myBytesPerLine = (width / displayedNumberWidth) & 0xfffffff8; // 0, 8, 16, 24, etc.
if (myBytesPerLine < 8) {
myBytesPerLine = 8;
}
adaptWidthToBytesPerLine();
updateNumberOfLines();
layout(new Control[] { header1Text, styledText0, styledText1, styledText2 }, SWT.DEFER);
updateScrollBar();
refreshHeader();
myTextAreasStart = (((long) getVerticalBar().getSelection()) * myBytesPerLine) << verticalBarFactor;
redrawTextAreas(true);
}
}
================================================
FILE: net.sourceforge.javahexeditor/src/net/sourceforge/javahexeditor/Manager.java
================================================
/*
* javahexeditor, a java hex editor
* Copyright (C) 2006, 2009 Jordi Bergenthal, pestatije(-at_)users.sourceforge.net
* The official javahexeditor site is sourceforge.net/projects/javahexeditor
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package net.sourceforge.javahexeditor;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import net.sourceforge.javahexeditor.BinaryContent.RangeSelection;
import net.sourceforge.javahexeditor.common.ResourceUtility;
import net.sourceforge.javahexeditor.common.SWTUtility;
import net.sourceforge.javahexeditor.common.TextUtility;
import net.sourceforge.javahexeditor.plugin.HexEditorPlugin;
/**
* Manager of the javahexeditor application, either in its stand-alone or
* Eclipse plugin version. Manages creation of widgets, and executes menu
* actions, like "File->Save". Call {@link #createEditorPart} before any menu
* actions.
*
* @author Jordi Bergenthal
*
*/
public final class Manager {
public static final String APPLICATION_NAME = "javahexeditor";
// Path to the text files containing the OS and date time of the build.
private static final String OS_PATH = "net/sourceforge/javahexeditor/Manager.os";
private static final String VERSION_PATH = "net/sourceforge/javahexeditor/Manager.version";
// Logic components
private FileToucher fileToucher;
// State
private BinaryContent content;
private File contentFile;
private FindReplaceHistory findReplaceHistory;
private FontData fontData;
Font font;
private List listOfStatusChangedListeners;
private List listOfLongListeners;
// Visual controls
private Shell shell;
private Composite textsParent;
HexTexts hexTexts;
private StatusLine statusLine;
private FindReplaceDialog findDialog;
private GoToDialog goToDialog;
private SelectBlockDialog selectBlockDialog;
public Manager(FileToucher fileToucher) {
if (fileToucher == null) {
throw new IllegalArgumentException("Parameter 'fileToucher' must not be null.");
}
this.fileToucher = fileToucher;
}
/**
* Gets the build OS .
*
* @return The build OS, may be empty and not null.
*/
public String getBuildOS() {
String os = ResourceUtility.loadResourceAsString(OS_PATH);
if (os == null) {
os = "";
}
return os;
}
/**
* Gets the build version in the format "OS YYYY-MM-DD HH:MM:SS".
*
* @return The build version, not empty and not null.
*/
public String getBuildVersion() {
String version = ResourceUtility.loadResourceAsString(VERSION_PATH);
if (version == null) {
version = "????-??-?? ??:??:??";
}
return version;
}
/**
* Creates editor part of parent application. Can only be called once per
* Manager object.
*
* @param parent
* Composite where the part will be created, not null.
*/
public HexTexts createEditorPart(Composite parent) {
if (parent == null) {
throw new IllegalArgumentException("Parameter 'parent' must not be null.");
}
if (hexTexts != null) {
throw new IllegalStateException("Editor part exists already");
}
shell = parent.getShell();
textsParent = parent;
hexTexts = new HexTexts(textsParent, SWT.NONE, this);
hexTexts.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
hexTexts.setEnabled(false);
hexTexts.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
if (font != null && !font.isDisposed()) {
font.dispose();
}
hexTexts = null;
}
});
if (fontData != null) {
font = new Font(Display.getCurrent(), fontData);
hexTexts.setFont(font);
}
hexTexts.addLongSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
updateStatusLineAfterLongSelection();
}
});
hexTexts.addListener(SWT.Modify, new Listener() {
@Override
public void handleEvent(Event event) {
updateStatusLineAfterModify();
}
});
if (listOfStatusChangedListeners != null) {
for (Listener listener : listOfStatusChangedListeners) {
hexTexts.addListener(SWT.Modify, listener);
}
listOfStatusChangedListeners = null;
}
if (listOfLongListeners != null) {
for (SelectionListener listener : listOfLongListeners) {
hexTexts.addLongSelectionListener(listener);
}
listOfLongListeners = null;
}
return hexTexts;
}
/**
* Add a listener to changes of the 'dirty', 'insert/overwrite', 'selection' and
* 'canUndo/canRedo' status
*
* @param listener
* the listener to be notified of changes
*/
public void addListener(Listener listener) {
if (listener == null) {
return;
}
if (hexTexts == null) {
if (listOfStatusChangedListeners == null) {
listOfStatusChangedListeners = new ArrayList();
}
listOfStatusChangedListeners.add(listener);
} else {
hexTexts.addListener(SWT.Modify, listener);
}
}
/**
* Adds a long selection listener. Events sent to the listener have long start
* and end points.
*
* @see HexTexts#addLongSelectionListener(SelectionListener)
* @param listener
* the listener
* @see StyledText#addSelectionListener(org.eclipse.swt.events.SelectionListener)
*/
public void addLongSelectionListener(SelectionListener listener) {
if (listener == null) {
throw new IllegalArgumentException();
}
if (hexTexts == null) {
if (listOfLongListeners == null) {
listOfLongListeners = new ArrayList();
}
listOfLongListeners.add(listener);
} else {
hexTexts.addLongSelectionListener(listener);
}
}
/**
* Get long selection start and end points. Helper method for long selection
* listeners. The start point is formed by event.width as the most significant
* int and event.x as the least significant int. The end point is similarly
* formed by event.height and event.y
*
* @param event
* an event with long selection start and end points
* @return
* @see #addLongSelectionListener(org.eclipse.swt.events.SelectionListener)
*/
public long[] getLongSelection(SelectionEvent event) {
return new long[] { ((long) event.width) << 32 | (event.x & 0x0ffffffffL),
((long) event.height) << 32 | (event.y & 0x0ffffffffL) };
}
public boolean isValid() {
return hexTexts != null && hexTexts.isValid();
}
public boolean isFilled() {
return hexTexts != null && hexTexts.getContent().length() > 0;
}
public boolean isEditable() {
return hexTexts != null && hexTexts.isEditable();
}
/**
* Determines if the last action can be redone
*
* @return true: an action can be redone
*/
public boolean canRedo() {
return hexTexts != null && hexTexts.canRedo();
}
/**
* Determines if the last action can be undone
*
* @return true: an action can be undone
*/
public boolean canUndo() {
return hexTexts != null && hexTexts.canUndo();
}
/**
* Creates status part of parent application.
*
* @param parent
* Composite where the part will be created, not null.
* @param withLeftSeparator
* so it can be put besides other status items (for plugin)
*/
public Composite createStatusPart(Composite parent, boolean withLeftSeparator) {
if (parent == null) {
throw new IllegalArgumentException("Parameter 'parent' must not be null.");
}
statusLine = new StatusLine(parent, SWT.NONE, withLeftSeparator);
updateStatusLine();
return statusLine;
}
/**
* Copies selection into clipboard
*/
public void doCopy() {
if (hexTexts == null) {
return;
}
hexTexts.copy();
}
/**
* Cuts selection into clipboard
*/
public void doCut() {
if (hexTexts == null) {
return;
}
hexTexts.cut();
}
/**
* While in insert mode, deletes the selection
*/
public void doDelete() {
hexTexts.deleteSelected();
}
/**
* Open find dialog
*/
public void doFind() {
if (hexTexts == null) {
return;
}
if (findDialog == null) {
findDialog = new FindReplaceDialog(textsParent.getShell());
if (findReplaceHistory == null) {
findReplaceHistory = new FindReplaceHistory();
}
}
findDialog.open(hexTexts, findReplaceHistory);
}
/**
* Open 'go to' dialog
*/
public void doGoTo() {
if (content.length() < 1L) {
return;
}
if (goToDialog == null) {
goToDialog = new GoToDialog(textsParent.getShell());
}
long location = goToDialog.open(hexTexts.getShell(), content.length() - 1L);
if (location >= 0L) {
long button = goToDialog.getButtonPressed();
if (button == 1) {
hexTexts.showMark(location);
} else {
hexTexts.selectBlock(location, location);
}
}
}
/**
* Open 'select block' dialog
*/
public void doSelectBlock() {
if (content.length() < 1L) {
return;
}
if (selectBlockDialog == null) {
selectBlockDialog = new SelectBlockDialog(textsParent.getShell());
}
if (selectBlockDialog.open(hexTexts.getShell(), hexTexts.getSelection(), content.length())) {
long start = selectBlockDialog.getFinalStartResult();
long end = selectBlockDialog.getFinalEndResult();
if ((start >= 0L) && (end >= 0L) && (start != end)) {
hexTexts.selectBlock(start, end);
}
}
}
public void doOpen(File forceThisFile, boolean createNewFile, String charset) throws CoreException {
String filePath = "";
if (forceThisFile == null && !createNewFile) {
FileDialog fileDialog = createFileDialog(shell, SWT.OPEN);
filePath = fileDialog.open();
if (filePath == null) {
return;
}
forceThisFile = new File(filePath);
}
if (forceThisFile != null) {
try {
forceThisFile = forceThisFile.getCanonicalFile();
} catch (IOException e) {
// use non-canonical one then
}
filePath = forceThisFile.getAbsolutePath();
}
try {
openFile(forceThisFile, charset);
} catch (CoreException ex) {
throw ex;
}
hexTexts.setFocus();
}
public boolean canPaste() {
return isEditable() && hexTexts.canPaste();
}
/**
* Pastes clipboard into editor
*/
public void doPaste() {
if (hexTexts == null) {
return;
}
hexTexts.paste();
}
/**
* Perform save-selected-as action on selected data
*
* @param file
* The file, not null.
*
* @throws IOException
* If the operation fails
*/
public void doSaveSelectionAs(File file) throws IOException {
if (isFileBeingRead(file)) {
throw new IOException(TextUtility.format(Texts.MANAGER_SAVE_MESSAGE_CANNOT_OVERWRITE_FILE_IN_USE,
file.getAbsolutePath()));
}
RangeSelection selection = hexTexts.getSelection();
try {
content.get(file, selection.start, selection.getLength());
} catch (IOException ex) {
throw new IOException(TextUtility.format(Texts.MANAGER_SAVE_MESSAGE_CANNOT_SAVE_FILE,
file.getAbsolutePath(), ex.getMessage()));
}
}
/**
* Selects all file contents in editor
*/
public void doSelectAll() {
if (hexTexts == null) {
return;
}
hexTexts.selectAll();
}
/**
* Redoes the last undone action
*/
public void doRedo() {
hexTexts.redo();
}
/**
* While in insert mode, trims the selection
*/
public void doTrim() {
hexTexts.deleteNotSelected();
}
/**
* Undoes the last action
*/
public void doUndo() {
hexTexts.undo();
}
/**
* Gets the binary content.
*
* @return The content being edited or null if there is no content.
*/
public BinaryContent getContent() {
return content;
}
/**
* Gets the binary content file.
*
* @return The file which represents the content being edited or
* null if there is no file.
*/
public File getContentFile() {
return contentFile;
}
/**
* Gets the current selection.
*
* @return The current selection, not null.
*
* @see HexTexts#getSelection()
*/
public RangeSelection getSelection() {
if (hexTexts == null) {
return new RangeSelection(0, 0);
}
return hexTexts.getSelection();
}
/**
* Get whether the content has been modified or not
*
* @return if changes have been performed
*/
public boolean isDirty() {
if (content == null) {
return false;
}
return content.isDirty();
}
private boolean isFileBeingRead(File file) {
return file.equals(contentFile) || content.getOpenFiles().contains(file);
}
/**
* Tells whether the input is in overwrite or insert mode
*
* @return true: overwriting, false: inserting
*/
public boolean isOverwriteMode() {
if (hexTexts == null) {
return true;
}
return hexTexts.isOverwriteMode();
}
/**
* Tells whether the input has text selected
*
* @return true: text is selected, false: no text selected
*/
public boolean isTextSelected() {
if (hexTexts == null) {
return false;
}
return hexTexts.getSelection().getLength() > 0;
}
/**
* Open file for editing
*
* @param contentFile
* the input file or null if this will be a new file
* @param charset
* the charset, not null
* @throws CoreException
* if the input file cannot be read
*/
public void openFile(File contentFile, String charset) throws CoreException {
this.contentFile = contentFile;
if (contentFile == null) {
content = new BinaryContent();
} else {
try {
content = new BinaryContent(contentFile);
} catch (IOException ex) {
this.contentFile = null;
throw new CoreException(new Status(IStatus.ERROR, HexEditorPlugin.ID,
TextUtility.format(Texts.MANAGER_OPEN_MESSAGE_CANNOT_OPEN_FILE, contentFile.getAbsolutePath()),
ex));
}
}
hexTexts.setCharset(charset);
hexTexts.setContentProvider(content);
if (contentFile == null || getContent().length() == 0) {
hexTexts.setInsertMode(true);
} else if (contentFile != null) {
hexTexts.setInsertMode(false);
}
updateStatusLine();
}
/**
* Reuse the status line control from another manager. Useful for multiple open
* editors
*
* @param other
* manager to copy its control from
*/
public void reuseStatusLinelFrom(Manager other) {
if (other == null) {
throw new IllegalArgumentException("Parameter 'other' must not be null.");
}
statusLine = other.statusLine;
}
/**
* Perform save-as action on opened file
*
* @param file
* The new file, not null.
* @param monitor
*
* @throws IOException
* If the operation fails
*/
public void saveAsFile(File file, IProgressMonitor monitor) throws IOException {
if (file == null) {
throw new IllegalArgumentException("Parameter 'file' must not be null.");
}
if (!file.equals(contentFile) && isFileBeingRead(file)) {
throw new IOException(TextUtility.format(Texts.MANAGER_SAVE_MESSAGE_CANNOT_OVERWRITE_FILE_IN_USE,
file.getAbsolutePath()));
}
try {
content.get(file);
content.dispose();
} catch (IOException ex) {
throw new IOException(TextUtility.format(Texts.MANAGER_SAVE_MESSAGE_CANNOT_SAVE_FILE,
file.getAbsolutePath(), ex.getMessage()));
}
content = new BinaryContent(file);
contentFile = file;
fileToucher.touchFile(contentFile, monitor);
hexTexts.setContentProvider(content);
}
/**
* Perform save action on opened file
*
* @param monitor
* the progress monitor or null
*
* @throws IOException
* If the operation fails
*/
public void saveFile(IProgressMonitor monitor) throws IOException {
saveAsFile(contentFile, monitor);
}
/**
* Sets Find/Replace combo lists pre-exisiting values.
*
* @param findReplaceHistory
* The modifiable find-replace history, not null.
*/
public void setFindReplaceHistory(FindReplaceHistory findReplaceHistory) {
if (findReplaceHistory == null) {
throw new IllegalArgumentException("Parameter 'findReplaceHistory' must not be null.");
}
this.findReplaceHistory = findReplaceHistory;
}
/**
* Causes the text areas to have the keyboard focus
*/
public void setFocus() {
if (hexTexts != null) {
hexTexts.setFocus();
}
updateStatusLine();
}
private void updateStatusLine() {
if (statusLine != null) {
statusLine.updateInsertMode(hexTexts == null ? true : !hexTexts.isOverwriteMode());
if (hexTexts != null && hexTexts.getContent() != null) {
long size = hexTexts.getContent().length();
if (hexTexts.isSelected()) {
statusLine.updateSelectionAndSize(hexTexts.getSelection());
} else {
statusLine.updatePoitionAndSize(hexTexts.getCaretPos(), size);
}
statusLine.updateValue(hexTexts.getActualValue());
} else {
statusLine.clearValue();
statusLine.clearSize();
}
}
}
public void setSelection(RangeSelection selection) {
if (selection == null) {
throw new IllegalArgumentException("Parameter 'selection' must not be null.");
}
if (hexTexts == null) {
return;
}
hexTexts.setSelection(selection.start, selection.end);
}
/**
* Set the editor text font.
*
* @param aFont
* new font to be used; should be a constant char width font. Use
* null to set to the default font.
*/
public void setTextFont(FontData aFont) {
fontData = aFont;
if (Preferences.getDefaultFontData().equals(aFont)) {
fontData = null;
}
// dispose it after setting new one
// StyledTextRenderer 3.448 bug in line 994
Font fontToDispose = font;
font = null;
if (hexTexts != null) {
if (fontData != null) {
font = new Font(Display.getCurrent(), fontData);
}
hexTexts.setFont(font);
}
if (fontToDispose != null && !fontToDispose.isDisposed()) {
fontToDispose.dispose();
}
}
/**
* Show a file dialog with a save-as message
*
* @param aShell
* parent of the dialog
* @param selection
* @return
*/
public File showSaveAsDialog(Shell aShell, boolean selection) {
FileDialog dialog = createFileDialog(aShell, SWT.SAVE);
if (selection) {
dialog.setText(Texts.MANAGER_SAVE_DIALOG_TITLE_SAVE_SELECTION_AS);
} else {
dialog.setText(Texts.MANAGER_SAVE_DIALOG_TITLE_SAVE_AS);
}
String filePath = dialog.open();
if (filePath == null) {
return null;
}
File file = new File(filePath);
if (file.exists()) {
if (SWTUtility.showMessage(aShell, SWT.ICON_WARNING | SWT.YES | SWT.NO,
Texts.MANAGER_SAVE_DIALOG_TITLE_FILE_ALREADY_EXISTS,
Texts.MANAGER_SAVE_DIALOG_MESSAGE_FILE_ALREADY_EXISTS, file.getAbsolutePath()) != SWT.YES) {
return null;
}
}
return file;
}
private FileDialog createFileDialog(Shell aShell, int style) {
FileDialog dialog = new FileDialog(aShell, style);
String filterPath;
if (contentFile != null) {
filterPath = contentFile.getParentFile().getAbsolutePath();
} else {
filterPath = System.getProperty("user.dir");
}
dialog.setFilterPath(filterPath);
return dialog;
}
/**
* Event handler for updating the status line.
*/
void updateStatusLineAfterLongSelection() {
updateStatusLine();
}
/**
* Event handler for updating the status line.
*/
void updateStatusLineAfterModify() {
updateStatusLine();
}
}
================================================
FILE: net.sourceforge.javahexeditor/src/net/sourceforge/javahexeditor/OpenInTexteditor.java
================================================
package net.sourceforge.javahexeditor;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IPathEditorInput;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.jcryptool.core.operations.IOperationsConstants;
import org.jcryptool.core.operations.util.PathEditorInput;
/**
* The OpenInTextAction class takes an input of an active hex editor, shuts the hex editor down and opens it with the
* text editor.
*
* @author mwalthart
* @author Holger Friedrich (now extending AbstractHandler in order to use Commands instead of Actions)
* @version 0.2
*/
public class OpenInTexteditor {
/** The active editor. */
private static IEditorPart editor;
/** Active workbench page. */
private static IWorkbenchPage page;
/**
* Sets the active editor for the delegate.
*
* @param action the action proxy that handles presentation portion of the action
* @param targetEditor the new editor target
*/
public void setActiveEditor(IAction action, IEditorPart targetEditor) {
editor = targetEditor;
if (editor != null) {
page = editor.getSite().getPage();
}
}
/**
* Creates the editor input for the hex editor
*
* @param absolutePath the absolute file path
* @return the created editor input
*/
private static IEditorInput createEditorInput(String absolutePath) {
return new PathEditorInput(absolutePath);
}
/**
* Performs this action.
*
* @param action the action proxy that handles the presentation portion of the action
*/
public static void changeEditor() {
page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
editor = page.getActiveEditor();
if(editor == null) {
return;
}
IPathEditorInput originalInput = (IPathEditorInput) editor.getEditorInput();
IEditorInput input = createEditorInput(originalInput.getPath().toString());
// check if text editor plug-in is loaded
if (Platform.getBundle(IOperationsConstants.ID_TEXT_EDITOR_PLUGIN) != null) {
try {
page.closeEditor(editor, true);
page.openEditor(input, IOperationsConstants.ID_TEXT_EDITOR, true);
} catch (PartInitException e) {
MessageDialog.openWarning(new Shell(Display.getCurrent()), Texts.OpenInTexteditor_warning_title,
Texts.OpenInTexteditor_warning_message);
}
} else {
MessageDialog.openError(new Shell(Display.getCurrent()), Texts.OpenInTexteditor_error_title,
Texts.OpenInTexteditor_error_Message);
}
return;
}
}
================================================
FILE: net.sourceforge.javahexeditor/src/net/sourceforge/javahexeditor/PasteDialog.java
================================================
package net.sourceforge.javahexeditor;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.jcryptool.core.util.colors.ColorService;
import org.jcryptool.core.util.images.ImageService;
public class PasteDialog extends Dialog {
protected PasteDialog(Shell parentShell) {
super(parentShell);
}
@Override
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
newShell.setText(Texts.PasteDialog_title);
}
@Override
protected Control createDialogArea(Composite parent) {
Composite container = (Composite) super.createDialogArea(parent);
container.setLayout(new GridLayout(2, false));
Text t = new Text(container, SWT.MULTI | SWT.WRAP);
GridData gd_t = new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1);
gd_t.widthHint = 600;
t.setLayoutData(gd_t);
t.setEditable(false);
t.setText(Texts.PasteDialog_hexOrText);
// Information Icon
new Label(container, SWT.NONE).setImage(ImageService.ICON_INFO);
Text note = new Text(container, SWT.MULTI | SWT.WRAP);
GridData gd_note = new GridData(SWT.FILL, SWT.FILL, true, false);
gd_note.widthHint = 600;
note.setLayoutData(gd_note);
note.setForeground(ColorService.GRAY);
note.setEditable(false);
note.setText(Texts.PasteDialog_Information);
return container;
}
@Override
protected void createButtonsForButtonBar(Composite parent) {
// Creates the cancel button.
createButton(parent, 1, Texts.PasteDialog_cancel, false);
// Creates the "Hex" Button
createButton(parent, 2, "Hex", false); //$NON-NLS-1$
// Creates the "Text" Button.
createButton(parent, 3, "Text", true); //$NON-NLS-1$
}
@Override
protected void buttonPressed(int buttonId) {
// The user pressed the "Hex" Button
if (buttonId == 2) {
setReturnCode(2);
}
// The user pressed the "Text" Button
if (buttonId == 3) {
setReturnCode(3);
}
// Close the dialog.
close();
}
}
================================================
FILE: net.sourceforge.javahexeditor/src/net/sourceforge/javahexeditor/Preferences.java
================================================
/*
* javahexeditor, a java hex editor
* Copyright (C) 2006, 2009 Jordi Bergenthal, pestatije(-at_)users.sourceforge.net
* The official javahexeditor site is sourceforge.net/projects/javahexeditor
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package net.sourceforge.javahexeditor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.FontData;
/**
* Preferences data container.
*
* @author Peter Dell
*/
public final class Preferences {
// Property names
public static final String FONT_NAME = "font.name";
public static final String FONT_SIZE = "font.size";
public static final String FONT_STYLE = "font.style";
public static final String FONT_DATA = "font.data";
private static final FontData DEFAULT_FONT_DATA = new FontData("Courier New", 10, SWT.NORMAL);
public static FontData getDefaultFontData() {
return DEFAULT_FONT_DATA;
}
}
================================================
FILE: net.sourceforge.javahexeditor/src/net/sourceforge/javahexeditor/PreferencesManager.java
================================================
/*
* javahexeditor, a java hex editor
* Copyright (C) 2006, 2009 Jordi Bergenthal, pestatije(-at_)users.sourceforge.net
* The official javahexeditor site is sourceforge.net/projects/javahexeditor
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package net.sourceforge.javahexeditor;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import net.sourceforge.javahexeditor.common.SWTUtility;
/**
* Manager of all preferences-editing widgets, with an optional stand-alone
* dialog.
*
* @author Jordi Bergenthal
*/
public final class PreferencesManager {
private static final int itemsDisplayed = 9; // Number of font names
// displayed in list
private static final Set scalableSizes = new TreeSet(
Arrays.asList(new Integer[] { 6, 7, 8, 9, 10, 11, 12, 13, 14, 16, 18, 22, 32, 72 }));
int dialogResult = SWT.CANCEL;
private List fontsListCurrent;
private List fontsNonScalable;
private List fontsScalable;
private GC fontsGc;
private Set fontsRejected;
private Map> fontsSorted;
FontData initialFontData;
FontData sampleFontData;
// Visual components
private Button resetButton;
private Button okButton;
private Button cancelButton;
private Composite composite;
private Composite buttonBar;
private Composite parent;
Text text;
Text text1;
Text text2;
org.eclipse.swt.widgets.List list;
org.eclipse.swt.widgets.List list1;
org.eclipse.swt.widgets.List list2;
Font sampleFont;
private Text sampleText;
private Label label1;
private Label label2;
private Label label3;
Shell shell;
public static int fontStyleToInt(String styleString) {
int style = SWT.NORMAL;
if (Texts.PREFERENCES_MANAGER_FONT_STYLE_BOLD.equals(styleString)) {
style = SWT.BOLD;
} else if (Texts.PREFERENCES_MANAGER_FONT_STYLE_ITALIC.equals(styleString)) {
style = SWT.ITALIC;
} else if (Texts.PREFERENCES_MANAGER_FONT_STYLE_BOLD_ITALIC.equals(styleString)) {
style = SWT.BOLD | SWT.ITALIC;
}
return style;
}
public static String fontStyleToString(int style) {
switch (style) {
case SWT.BOLD:
return Texts.PREFERENCES_MANAGER_FONT_STYLE_BOLD;
case SWT.ITALIC:
return Texts.PREFERENCES_MANAGER_FONT_STYLE_ITALIC;
case SWT.BOLD | SWT.ITALIC:
return Texts.PREFERENCES_MANAGER_FONT_STYLE_BOLD_ITALIC;
default:
return Texts.PREFERENCES_MANAGER_FONT_STYLE_REGULAR;
}
}
public PreferencesManager(FontData fontData) {
initialFontData = sampleFontData = fontData;
fontsSorted = new TreeMap>();
}
/**
* Creates all internal widgets
*/
private void createComposite() {
composite = new Composite(parent, SWT.NONE);
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 3;
composite.setLayout(gridLayout);
GridData gridData = new GridData();
gridData.horizontalSpan = 3;
label1 = new Label(composite, SWT.NONE);
label1.setText(Texts.PREFERENCES_MANAGER_FONT_NAME);
label2 = new Label(composite, SWT.NONE);
label2.setText(Texts.PREFERENCES_MANAGER_FONT_STYLE);
label3 = new Label(composite, SWT.NONE);
label3.setText(Texts.PREFERENCES_MANAGER_FONT_SIZE);
text = new Text(composite, SWT.SINGLE | SWT.BORDER);
GridData gridData4 = new GridData();
gridData4.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
text.setLayoutData(gridData4);
text1 = new Text(composite, SWT.BORDER);
GridData gridData5 = new GridData();
gridData5.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
text1.setLayoutData(gridData5);
text1.setEnabled(false);
text2 = new Text(composite, SWT.BORDER);
GridData gridData6 = new GridData();
gridData6.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
GC gc = new GC(composite);
double averageCharWidth = SWTUtility.getAverageCharacterWidth(gc);
gc.dispose();
gridData6.widthHint = (int)(averageCharWidth * 6);
text2.setLayoutData(gridData6);
list = new org.eclipse.swt.widgets.List(composite, SWT.SINGLE | SWT.V_SCROLL | SWT.BORDER);
GridData gridData52 = new GridData();
gridData52.heightHint = itemsDisplayed * list.getItemHeight();
gridData52.widthHint = (int)(averageCharWidth * 40);
list.setLayoutData(gridData52);
list.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
text.setText(list.getSelection()[0]);
updateSizeItemsAndGuessSelected();
updateAndRefreshSample();
}
});
list1 = new org.eclipse.swt.widgets.List(composite, SWT.SINGLE | SWT.BORDER);
GridData gridData21 = new GridData();
gridData21.verticalAlignment = org.eclipse.swt.layout.GridData.FILL;
String[] texts = new String[] { Texts.PREFERENCES_MANAGER_FONT_STYLE_REGULAR,
Texts.PREFERENCES_MANAGER_FONT_STYLE_BOLD, Texts.PREFERENCES_MANAGER_FONT_STYLE_ITALIC,
Texts.PREFERENCES_MANAGER_FONT_STYLE_BOLD_ITALIC };
int maxLenght = 0;
for (String text : texts) {
maxLenght = Math.max(maxLenght, text.length());
}
gridData21.widthHint = (int)(averageCharWidth * maxLenght * 2);
list1.setLayoutData(gridData21);
list1.setItems(texts);
list1.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
text1.setText(list1.getSelection()[0]);
updateAndRefreshSample();
}
});
list2 = new org.eclipse.swt.widgets.List(composite, SWT.SINGLE | SWT.V_SCROLL | SWT.BORDER);
GridData gridData7 = new GridData();
gridData7.widthHint = gridData6.widthHint;
gridData7.heightHint = gridData52.heightHint;
list2.setLayoutData(gridData7);
list2.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
text2.setText(list2.getSelection()[0]);
updateAndRefreshSample();
}
});
sampleText = new Text(composite, SWT.MULTI | SWT.WRAP | SWT.V_SCROLL | SWT.READ_ONLY | SWT.BORDER);
sampleText.setText(Texts.PREFERENCES_MANAGER_SAMPLE_TEXT);
sampleText.setEditable(false);
GridData gridData8 = new GridData();
gridData8.horizontalSpan = 3;
gridData8.widthHint = gridData52.widthHint + gridData21.widthHint + gridData7.widthHint
+ gridLayout.horizontalSpacing * 2;
gridData8.heightHint = 50;
gridData8.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
sampleText.setLayoutData(gridData8);
sampleText.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
if (sampleFont != null && !sampleFont.isDisposed()) {
sampleFont.dispose();
}
}
});
}
private void createCompositeOkCancel() {
GridData gridData = new GridData();
gridData.horizontalAlignment = org.eclipse.swt.layout.GridData.END;
RowLayout rowLayout1 = new RowLayout();
rowLayout1.type = org.eclipse.swt.SWT.HORIZONTAL;
rowLayout1.marginHeight = 10;
rowLayout1.marginWidth = 10;
rowLayout1.pack = false;
buttonBar = new Composite(shell, SWT.NONE);
buttonBar.setLayout(rowLayout1);
buttonBar.setLayoutData(gridData);
resetButton = new Button(buttonBar, SWT.NONE);
resetButton.setText(Texts.BUTTON_RESET_LABEL);
resetButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
setFontData(null);
}
});
okButton = new Button(buttonBar, SWT.NONE);
okButton.setText(Texts.BUTTON_OK_LABEL);
okButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
initialFontData = sampleFontData;
dialogResult = SWT.OK;
shell.close();
}
});
shell.setDefaultButton(okButton);
cancelButton = new Button(buttonBar, SWT.NONE);
cancelButton.setText(Texts.BUTTON_CANCEL_LABEL);
cancelButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
sampleFontData = initialFontData;
dialogResult = SWT.CANCEL;
shell.close();
}
});
}
private void createShell(Shell parentShell) {
shell = new Shell(parentShell, SWT.APPLICATION_MODAL | SWT.DIALOG_TRIM);
GridLayout gridLayout1 = new GridLayout();
gridLayout1.marginHeight = 3;
gridLayout1.marginWidth = 3;
shell.setLayout(gridLayout1);
shell.setText(Texts.PREFERENCES_MANAGER_DIALOG_TITLE);
createPreferencesPart(shell);
createCompositeOkCancel();
}
/**
* Creates the part containing all preferences-editing widgets, that is, OK and
* cancel buttons are left out so we can call this method from both stand-alone
* and plugin.
*
* @param parent
* composite where preferences will be drawn
* @return
*/
public Composite createPreferencesPart(Composite parent) {
this.parent = parent;
createComposite();
if (fontsSorted.size() < 1) {
populateFixedCharWidthFonts();
} else {
list.setItems(fontsSorted.keySet().toArray(new String[0]));
refreshWidgets();
}
return composite;
}
/**
* Get the preferred font data
*
* @return a copy of the preferred font data
*/
public FontData getFontData() {
return new FontData(sampleFontData.getName(), sampleFontData.getHeight(), sampleFontData.getStyle());
}
FontData getNextFontData() {
if (fontsListCurrent.size() == 0) {
fontsListCurrent = fontsScalable;
}
FontData aData = fontsListCurrent.get(0);
fontsListCurrent.remove(0);
while (fontsRejected.contains(aData.getName()) && fontsScalable.size() > 0) {
if (fontsListCurrent.size() == 0) {
fontsListCurrent = fontsScalable;
}
aData = fontsListCurrent.get(0);
fontsListCurrent.remove(0);
}
return aData;
}
int getSize() {
int size = 0;
String text = text2.getText();
if (!text.isEmpty()) {
try {
size = Integer.parseInt(text);
} catch (NumberFormatException e) {
} // was not a number, keep it 0
}
// bugfix: HexText's raw array overflows when font is very small and
// window very big very small sizes would compromise responsiveness in
// large windows,
// and they are too small to see anyway
if (size == 1 || size == 2) {
size = 3;
}
return size;
}
/**
* Creates a self contained standalone dialog
*
* @param parentShell
* @return SWT.OK or SWT.CANCEL
*/
public int openDialog(Shell parentShell) {
dialogResult = SWT.CANCEL; // when user presses escape
if (shell == null || shell.isDisposed()) {
createShell(parentShell);
}
SWTUtility.placeInCenterOf(shell, parentShell);
shell.open();
Display display = parent.getDisplay();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return dialogResult;
}
void populateFixedCharWidthFonts() {
fontsNonScalable = new ArrayList(Arrays.asList(Display.getCurrent().getFontList(null, false)));
fontsScalable = new ArrayList(Arrays.asList(Display.getCurrent().getFontList(null, true)));
if (fontsNonScalable.size() == 0 && fontsScalable.size() == 0) {
fontsNonScalable = null;
fontsScalable = null;
return;
}
fontsListCurrent = fontsNonScalable;
fontsRejected = new HashSet();
fontsGc = new GC(parent);
Display.getCurrent().asyncExec(new Runnable() {
@Override
public void run() {
populateFixedCharWidthFontsAsync();
}
});
}
void populateFixedCharWidthFontsAsync() {
FontData aData = getNextFontData();
if (!fontsRejected.contains(aData.getName())) {
boolean isScalable = fontsListCurrent == fontsScalable;
int height = 10;
if (!isScalable) {
height = aData.getHeight();
}
Font font = new Font(Display.getCurrent(), aData.getName(), height, SWT.NORMAL);
fontsGc.setFont(font);
int width = fontsGc.getAdvanceWidth((char) 0x020);
boolean isFixedWidth = true;
for (int j = 0x021; j < 0x0100 && isFixedWidth; ++j) {
if (HexTexts.byteToChar[j] == '.' && j != '.') {
continue;
}
if (width != fontsGc.getAdvanceWidth((char) j)) {
isFixedWidth = false;
}
}
font.dispose();
if (isFixedWidth) {
if (isScalable) {
fontsSorted.put(aData.getName(), scalableSizes);
} else {
Set heights = fontsSorted.get(aData.getName());
if (heights == null) {
heights = new TreeSet();
fontsSorted.put(aData.getName(), heights);
}
heights.add(aData.getHeight());
}
if (!list.isDisposed()) {
list.setItems(fontsSorted.keySet().toArray(new String[0]));
}
refreshWidgets();
} else {
fontsRejected.add(aData.getName());
}
}
if (fontsNonScalable.size() == 0 && fontsScalable.size() == 0) {
if (!parent.isDisposed()) {
fontsGc.dispose();
}
fontsGc = null;
fontsNonScalable = fontsScalable = fontsListCurrent = null;
fontsRejected = null;
} else {
Display.getCurrent().asyncExec(new Runnable() {
@Override
public void run() {
populateFixedCharWidthFontsAsync();
}
});
}
}
void refreshSample() {
if (sampleFont != null && !sampleFont.isDisposed()) {
sampleFont.dispose();
}
sampleFont = new Font(Display.getCurrent(), sampleFontData);
sampleText.setFont(sampleFont);
}
void refreshWidgets() {
if (composite.isDisposed()) {
return;
}
if (fontsSorted == null || !fontsSorted.containsKey(sampleFontData.getName())) {
text.setText(Texts.PREFERENCES_MANAGER_DEFAULT_FONT_NAME);
} else {
text.setText(sampleFontData.getName());
}
showSelected(list, sampleFontData.getName());
text1.setText(fontStyleToString(sampleFontData.getStyle()));
list1.select(list1.indexOf(fontStyleToString(sampleFontData.getStyle())));
updateSizeItems();
text2.setText(Integer.toString(sampleFontData.getHeight()));
showSelected(list2, Integer.toString(sampleFontData.getHeight()));
refreshSample();
}
/**
* Set preferences to show a font.
*
* @param fontData
* the font to be shown. Use null to show default font.
*/
public void setFontData(FontData fontData) {
if (fontData == null) {
fontData = Preferences.getDefaultFontData();
}
sampleFontData = fontData;
refreshWidgets();
}
void showSelected(org.eclipse.swt.widgets.List aList, String item) {
int selected = aList.indexOf(item);
if (selected >= 0) {
aList.setSelection(selected);
aList.setTopIndex(Math.max(0, selected - itemsDisplayed + 1));
} else {
aList.deselectAll();
aList.setTopIndex(0);
}
}
void updateAndRefreshSample() {
sampleFontData = new FontData(text.getText(), getSize(), fontStyleToInt(text1.getText()));
refreshSample();
}
void updateSizeItems() {
Set sizes = fontsSorted.get(text.getText());
if (sizes == null) {
list2.removeAll();
return;
}
String[] items = new String[sizes.size()];
int i = 0;
for (Iterator j = sizes.iterator(); i < items.length; ++i) {
items[i] = j.next().toString();
}
list2.setItems(items);
}
void updateSizeItemsAndGuessSelected() {
int lastSize = getSize();
updateSizeItems();
int position = 0;
String[] items = list2.getItems();
for (int i = 1; i < items.length; ++i) {
if (lastSize >= Integer.parseInt(items[i])) {
position = i;
}
}
text2.setText(items[position]);
showSelected(list2, items[position]);
}
}
================================================
FILE: net.sourceforge.javahexeditor/src/net/sourceforge/javahexeditor/RandomAccessFileFactory.java
================================================
/*
* javahexeditor, a java hex editor
* Copyright (C) 2006, 2009 Jordi Bergenthal, pestatije(-at_)users.sourceforge.net
* The official javahexeditor site is sourceforge.net/projects/javahexeditor
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package net.sourceforge.javahexeditor;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.util.*;
/**
* Central factory to track creation of RandomAccessFile instance.
*
* @author Peter Dell
*/
public final class RandomAccessFileFactory {
private static final List instances = new ArrayList(3);
private static final boolean debug = false;
public static RandomAccessFile createRandomAccessFile(final File file, final String mode)
throws FileNotFoundException {
RandomAccessFile raf = new RandomAccessFile(file, mode) {
@Override
public void close() throws IOException {
super.close();
synchronized (instances) {
instances.remove(this);
}
logContext("Closed random access file for '" + file.getAbsolutePath());
}
};
synchronized (instances) {
instances.add(raf);
}
logContext("Created random access file for '" + file.getAbsolutePath() + "' in mode '" + mode + "'");
return raf;
}
public static void log(String message) {
if (debug) {
System.out.println("RandomAccessFileFactory: " + message);
System.out.flush();
}
}
private static void logContext(String message) {
if (debug) {
log(message);
log(instances.size() + " random access files open");
Thread.dumpStack();
System.err.flush();
}
}
}
================================================
FILE: net.sourceforge.javahexeditor/src/net/sourceforge/javahexeditor/SelectBlockDialog.java
================================================
/*
* javahexeditor, a java hex editor
* Copyright (C) 2006, 2009 Jordi Bergenthal, pestatije(-at_)users.sourceforge.net
* The official javahexeditor site is sourceforge.net/projects/javahexeditor
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package net.sourceforge.javahexeditor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Dialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import net.sourceforge.javahexeditor.BinaryContent.RangeSelection;
import net.sourceforge.javahexeditor.common.NumberUtility;
import net.sourceforge.javahexeditor.common.SWTUtility;
import net.sourceforge.javahexeditor.common.TextUtility;
/**
* Select block dialog. Remembers previous state.
*
* @author Andre Bossert
*/
final class SelectBlockDialog extends Dialog {
private final class MyModifyListener implements ModifyListener {
long result;
boolean empty;
public MyModifyListener() {
result = -1L;
empty = true;
}
@Override
public void modifyText(ModifyEvent e) {
String newText = ((Text) e.widget).getText();
result = NumberUtility.parseString(hexRadioButton.getSelection(), newText);
empty = newText.isEmpty();
validateResults();
}
public long getResult() {
return result;
}
public boolean isEmpty() {
return empty;
}
}
Shell shell;
private Composite compositeRadio;
private Composite compositeTexts;
private Composite compositeButtons;
Button hexRadioButton;
private Button decRadioButton;
private Button button;
private Button button1;
Text startText;
MyModifyListener startTextListener;
Text endText;
MyModifyListener endTextListener;
private Label label;
private Label statusLabel;
SelectionAdapter defaultSelectionAdapter = new SelectionAdapter() {
@Override
public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
startText.setFocus();
}
};
long finalStartResult = -1L;
long finalEndResult = -1L;
boolean lastHexButtonSelected = true;
String lastStartText;
String lastEndText;
private long limit = -1L;
public SelectBlockDialog(Shell aShell) {
super(aShell);
lastStartText = Texts.EMPTY;
lastEndText = Texts.EMPTY;
}
/**
* This method initializes composite1
*/
private void createComposite1() {
compositeRadio = new Composite(shell, SWT.NONE);
compositeRadio.setLayout(new GridLayout());
SelectionAdapter hexTextSelectionAdapter = new SelectionAdapter() {
@Override
public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
startText.setText(startText.getText()); // generate event
endText.setText(endText.getText()); // generate event
lastHexButtonSelected = e.widget == hexRadioButton;
/*
* Crashes when the text is not a number if (lastHexButtonSelected) return;
* String startTextNew = startText.getText(); String endTextNew =
* endText.getText(); startTextNew =
* Integer.toHexString(Integer.parseInt(startTextNew )).toUpperCase();
* endTextNew = Integer.toHexString(Integer.parseInt
* (endTextNew)).toUpperCase(); startText.setText(startTextNew); // generate
* event endText.setText(endTextNew); // generate event lastHexButtonSelected =
* true;
*/
}
};
/*
* Crashes when the text is not radix 16 SelectionAdapter
* decTextSelectionAdapter = new SelectionAdapter() { public void
* widgetSelected(org.eclipse.swt.events.SelectionEvent e) { if
* (!lastHexButtonSelected) return; String startTextNew = startText.getText();
* String endTextNew = endText.getText(); startTextNew =
* Integer.toString(Integer.parseInt(startTextNew, 16)); endTextNew =
* Integer.toString(Integer.parseInt(endTextNew, 16));
* startText.setText(startTextNew); // generate event
* endText.setText(endTextNew); // generate event lastHexButtonSelected = false;
* } };
*/
// Besides the crashes: the user always knows which number is entering,
// don't need any automatic
// conversion. What does sometimes happen is one enters the right number
// and the wrong hex or dec was
// selected. In that case automatic conversion is the wrong thing to do
// and very annoying.
hexRadioButton = new Button(compositeRadio, SWT.RADIO);
hexRadioButton.setText(Texts.SELECTION_BLOCK_DIALOG_HEX_LABEL);
hexRadioButton.addSelectionListener(defaultSelectionAdapter);
hexRadioButton.addSelectionListener(hexTextSelectionAdapter);
decRadioButton = new Button(compositeRadio, SWT.RADIO);
decRadioButton.setText(Texts.SELECTION_BLOCK_DIALOG_DEC_LABEL);
decRadioButton.addSelectionListener(defaultSelectionAdapter);
hexRadioButton.addSelectionListener(hexTextSelectionAdapter);
}
/**
* This method initializes composite2
*
*/
private void createComposite2() {
compositeTexts = new Composite(shell, SWT.NONE);
compositeTexts.setLayout(new GridLayout(2, false));
startText = new Text(compositeTexts, SWT.BORDER | SWT.SINGLE);
GridData gridData_startText = new GridData(SWT.FILL, SWT.CENTER, true, true);
startText.setTextLimit(30);
int columns = 35;
GC gc = new GC(startText);
int width = (int) (columns * SWTUtility.getAverageCharacterWidth(gc));
gc.dispose();
gridData_startText.widthHint = width;
startText.setLayoutData(gridData_startText);
startTextListener = new MyModifyListener();
startText.addModifyListener(startTextListener);
endText = new Text(compositeTexts, SWT.BORDER | SWT.SINGLE);
GridData gridData_endText = new GridData(SWT.FILL, SWT.CENTER, true, true);
endText.setTextLimit(30);
gc = new GC(endText);
width = (int) (columns * SWTUtility.getAverageCharacterWidth(gc));
gc.dispose();
gridData_endText.widthHint = width;
endText.setLayoutData(gridData_endText);
endTextListener = new MyModifyListener();
endText.addModifyListener(endTextListener);
}
/**
* This method initializes composite3
*
*/
private void createComposite3() {
compositeButtons = new Composite(shell, SWT.NONE);
compositeButtons.setLayout(new GridLayout());
button = new Button(compositeButtons, SWT.NONE);
button.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
button.setText(Texts.SELECTION_BLOCK_DIALOG_SELECT_BUTTON_LABEL);
button.addSelectionListener(defaultSelectionAdapter);
button.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
@Override
public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
lastStartText = startText.getText();
finalStartResult = startTextListener.getResult();
lastEndText = endText.getText();
finalEndResult = endTextListener.getResult();
shell.close();
}
});
shell.setDefaultButton(button);
button1 = new Button(compositeButtons, SWT.NONE);
button1.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
button1.setText(Texts.BUTTON_CLOSE_LABEL);
button1.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
@Override
public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
shell.close();
}
});
}
/**
* This method initializes the shell.
*
*/
private void createShell() {
shell = new Shell(getParent(), SWT.APPLICATION_MODAL | SWT.DIALOG_TRIM);
shell.setText(Texts.SELECTION_BLOCK_DIALOG_TITLE);
shell.setLayout(new GridLayout(3, false));
label = new Label(shell, SWT.NONE);
label.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 3, 1));
createComposite1();
createComposite2();
createComposite3();
statusLabel = new Label(shell, SWT.CENTER);
statusLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 3, 1));
}
public boolean open(Shell parentShell, RangeSelection rangeSelection, long aLimit) {
if (rangeSelection == null) {
throw new IllegalArgumentException("Parameter 'rangeSelection' must not be null.");
}
limit = aLimit;
finalStartResult = -1L;
finalEndResult = -1L;
if (shell == null || shell.isDisposed()) {
createShell();
}
SWTUtility.placeInCenterOf(shell, parentShell);
if (lastHexButtonSelected) {
hexRadioButton.setSelection(true);
} else {
decRadioButton.setSelection(true);
}
label.setText(
TextUtility.format(Texts.SELECTION_BLOCK_DIALOG_RANGE_LABEL, NumberUtility.getDecimalString(limit),
NumberUtility.getHexString(0), NumberUtility.getHexString(limit)));
if (rangeSelection.getLength() > 0) {
if (lastHexButtonSelected) {
lastStartText = NumberUtility.getHexString(rangeSelection.start);
lastEndText = NumberUtility.getHexString(rangeSelection.end);
} else {
lastStartText = NumberUtility.getDecimalString(rangeSelection.start);
lastEndText = NumberUtility.getDecimalString(rangeSelection.end);
}
}
startText.setText(lastStartText);
endText.setText(lastEndText);
startText.selectAll();
startText.setFocus();
shell.open();
Display display = getParent().getDisplay();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return finalStartResult >= 0 && finalEndResult >= 0;
}
public void validateResults() {
long result1 = startTextListener.getResult();
long result2 = endTextListener.getResult();
if ((result1 >= 0L) && (result1 <= limit) && (result2 >= 0L) && (result2 <= limit) && (result2 > result1)) {
button.setEnabled(true);
statusLabel.setText(Texts.EMPTY);
} else {
button.setEnabled(false);
if (startTextListener.isEmpty() || endTextListener.isEmpty()) {
statusLabel.setText(Texts.EMPTY);
} else if ((result1 < 0) || (result2 < 0)) {
statusLabel.setText(Texts.DIALOG_ERROR_NOT_A_NUMBER_MESSAGE);
} else if (result2 <= result1) {
statusLabel.setText(Texts.DIALOG_ERROR_END_SMALLER_THAN_OR_EQUAL_TO_START_MESSAGE);
} else {
statusLabel.setText(Texts.DIALOG_ERROR_LOCATION_OUT_OF_RANGE_MESSAGE);
}
}
}
public long getFinalStartResult() {
return finalStartResult;
}
public long getFinalEndResult() {
return finalEndResult;
}
}
================================================
FILE: net.sourceforge.javahexeditor/src/net/sourceforge/javahexeditor/StatusLine.java
================================================
/*
* javahexeditor, a java hex editor
* Copyright (C) 2006, 2009 Jordi Bergenthal, pestatije(-at_)users.sourceforge.net
* The official javahexeditor site is sourceforge.net/projects/javahexeditor
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package net.sourceforge.javahexeditor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import net.sourceforge.javahexeditor.BinaryContent.RangeSelection;
import net.sourceforge.javahexeditor.common.NumberUtility;
/**
* Status line component of the editor. Displays the current position, value at
* position, the insert/overwrite status and the file size.
*/
final class StatusLine extends Composite {
private Label valueLabel;
private Label insertModeLabel;
private Label sizeLabel;
/**
* Create a status line part
*
* @param parent parent in the widget hierarchy
* @param style not used
* @param withLeftSeparator so it can be put besides other status items (for
* plugin)
*/
public StatusLine(Composite parent, int style, boolean withLeftSeparator) {
super(parent, style);
initialize(withLeftSeparator);
}
private void initialize(boolean withSeparator) {
GridLayout statusLayout = new GridLayout(3, true);
statusLayout.marginHeight = 0;
statusLayout.marginWidth = 0;
setLayout(statusLayout);
Composite composite_left = new Composite(this, SWT.NONE);
composite_left.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
GridLayout gridLayout_composite_left = new GridLayout();
gridLayout_composite_left.numColumns = withSeparator ? 2 : 1;
gridLayout_composite_left.marginHeight = 0;
gridLayout_composite_left.marginWidth = 0;
composite_left.setLayout(gridLayout_composite_left);
if (withSeparator) {
new Label(composite_left, SWT.SEPARATOR);
}
insertModeLabel = new Label(composite_left, SWT.SHADOW_NONE);
insertModeLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
Composite composite_center = new Composite(this, SWT.NONE);
composite_center.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
GridLayout gridLayout_composite_center = new GridLayout(2, false);
gridLayout_composite_center.marginHeight = 0;
gridLayout_composite_center.marginWidth = 0;
composite_center.setLayout(gridLayout_composite_center);
new Label(composite_center, SWT.SEPARATOR);
valueLabel = new Label(composite_center, SWT.SHADOW_NONE);
valueLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
Composite composite_right = new Composite(this, SWT.NONE);
composite_right.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
GridLayout gridLayout_composite_right = new GridLayout(2, false);
gridLayout_composite_right.marginHeight = 0;
gridLayout_composite_right.marginWidth = 0;
composite_right.setLayout(gridLayout_composite_right);
new Label(composite_right, SWT.SEPARATOR);
sizeLabel = new Label(composite_right, SWT.SHADOW_NONE);
GC gc = new GC(sizeLabel);
double fontCharWidth = gc.getFontMetrics().getAverageCharacterWidth();
GridData gridData_sizeLabel = new GridData(SWT.FILL, SWT.FILL, true, true);
// Allocate 25 Chars of space. In combination with the equal column sizes, all
// columns are 25 Characters wide.
gridData_sizeLabel.widthHint = (int) (25 * fontCharWidth);
sizeLabel.setLayoutData(gridData_sizeLabel);
}
/**
* Update the insert/overwrite mode.
*
* @param insert true for insert mode, or false for
* overwrite
*/
public void updateInsertMode(boolean insert) {
if (isDisposed() || insertModeLabel.isDisposed()) {
return;
}
insertModeLabel.setText(insert ? Texts.STATUS_LINE_MODE_INSERT : Texts.STATUS_LINE_MODE_OVERWRITE);
}
/**
* Clear the value status.
*/
public void clearValue() {
if (isDisposed() || valueLabel.isDisposed()) {
return;
}
valueLabel.setText(Texts.EMPTY);
}
/**
* Update the value status. Displays its decimal, hex and binary value
*
* @param value value to display
*/
public void updateValue(byte value) {
if (isDisposed() || valueLabel.isDisposed()) {
return;
}
int unsignedValue = value & 0xff;
String binaryText = "0000000" + Integer.toBinaryString(unsignedValue);
binaryText = binaryText.substring(binaryText.length() - 8);
String text = NumberUtility.getHexString(unsignedValue) +
" = " +
NumberUtility.getDecimalString(unsignedValue) +
" = " +
binaryText;
valueLabel.setText(text);
}
/**
* Clear the size status.
*/
public void clearSize() {
if (isDisposed() || valueLabel.isDisposed()) {
return;
}
sizeLabel.setText(Texts.EMPTY);
}
public void updateSelectionAndSize(RangeSelection selection) {
if (isDisposed() || sizeLabel.isDisposed()) {
return;
}
sizeLabel.setText(NumberUtility.getDecimalAndHexRangeString(selection.start, selection.end));
}
public void updatePoitionAndSize(long caretPos, long size) {
if (isDisposed() || sizeLabel.isDisposed()) {
return;
}
sizeLabel.setText(NumberUtility.getDecimalAndHexString(caretPos) + " : " + NumberUtility.getDecimalAndHexString(size));
}
}
================================================
FILE: net.sourceforge.javahexeditor/src/net/sourceforge/javahexeditor/Texts.java
================================================
/*
* javahexeditor, a java hex editor
* Copyright (C) 2006, 2009 Jordi Bergenthal, pestatije(-at_)users.sourceforge.net
* The official javahexeditor site is sourceforge.net/projects/javahexeditor
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package net.sourceforge.javahexeditor;
import org.eclipse.osgi.util.NLS;
public final class Texts extends NLS {
public static final String EMPTY = "";
public static String BUTTON_OK_LABEL;
public static String BUTTON_RESET_LABEL;
public static String BUTTON_CANCEL_LABEL;
public static String BUTTON_CLOSE_LABEL;
// ByteArrayUtility
public static String BYTE_ARRAY_UTILITY_INVALID_HEX_STRING;
// Context Menu
public static String ContextMenu_copy;
public static String ContextMenu_cut;
public static String ContextMenu_openin;
public static String ContextMenu_paste;
public static String ContextMenu_redo;
public static String ContextMenu_undo;
// Copy Dialog
public static String CopyDialog_hex_or_text;
public static String CopyDialog_title;
public static String CopyDialog_to_long_for_clipboard;
public static String CopyDialog_cancel;
public static String DIALOG_ERROR_NOT_A_NUMBER_MESSAGE;
public static String DIALOG_ERROR_LOCATION_OUT_OF_RANGE_MESSAGE;
public static String DIALOG_ERROR_END_SMALLER_THAN_OR_EQUAL_TO_START_MESSAGE;
// Editor
public static String EDITOR_MESSAGE_SAVING_FILE_PLEASE_WAIT;
public static String EDITOR_MESSAGE_FILE_SAVED;
public static String EDITOR_SAVE_SELECTION_AS_MENU_ITEM_LABEL;
public static String EDITOR_TRIM_MENU_ITEM_LABEL;
public static String EDITOR_SELECT_BLOCK_MENU_ITEM_LABEL;
public static String EDITOR_GO_TO_MENU_ITEM_LABEL;
// Find Replace Dialog
public static String FIND_REPLACE_DIALOG_TITLE;
public static String FIND_REPLACE_DIALOG_FIND_GROUP_LABEL;
public static String FIND_REPLACE_DIALOG_REPLACE_GROUP_LABEL;
public static String FIND_REPLACE_DIALOG_HEX_RADIO_LABEL;
public static String FIND_REPLACE_DIALOG_TEXT_RADIO_LABEL;
public static String FIND_REPLACE_DIALOG_OPTIONS_GROUP_LABEL;
public static String FIND_REPLACE_DIALOG_DIRECTION_GROUP_LABEL;
public static String FIND_REPLACE_DIALOG_DIRECTION_BACKWARD_RADIO_LABEL;
public static String FIND_REPLACE_DIALOG_DIRECTION_FORWARD_RADIO_LABEL;
public static String FIND_REPLACE_DIALOG_IGNORE_CASE_CHECKBOX_LABEL;
public static String FIND_REPLACE_DIALOG_FIND_BUTTON_LABEL;
public static String FIND_REPLACE_DIALOG_REPLACE_BUTTON_LABEL;
public static String FIND_REPLACE_DIALOG_REPLACE_ALL_BUTTON_LABEL;
public static String FIND_REPLACE_DIALOG_MESSAGE_SPECIFY_VALUE_TO_FIND;
public static String FIND_REPLACE_DIALOG_MESSAGE_SEARCHING;
public static String FIND_REPLACE_DIALOG_STOP_SEARCHING_BUTTON_LABEL;
public static String FIND_REPLACE_DIALOG_MESSAGE_FOUND;
public static String FIND_REPLACE_DIALOG_MESSAGE_NOT_FOUND;
public static String FIND_REPLACE_DIALOG_MESSAGE_ERROR_WHILE_SEARCHING;
public static String FIND_REPLACE_DIALOG_MESSAGE_ONE_REPLACEMENT;
public static String FIND_REPLACE_DIALOG_MESSAGE_MANY_REPLACEMENTS;
public static String FIND_REPLACE_DIALOG_MESSAGE_ERROR_WHILE_REPLACING;
// GoTo Dialog
public static String GOTO_DIALOG_MESSAGE_ENTER_LOCATION;
public static String GOTO_DIALOG_SHOW_LOCATION_BUTTON_LABEL;
public static String GOTO_DIALOG_GOTO_LOCATION_BUTTON_LABEL;
public static String GOTO_DIALOG_GOTO_LOCATION_SHELL_LABEL;
public static String GOTO_DIALOG_HEX;
public static String GOTO_DIALOG_DECIMAL;
// Hex Texts
public static String HEX_TEXTS_TITLE_INCONSISTENT_CLIPBOARD_FILES;
public static String HEX_TEXTS_MESSAGE_INCONSISTENT_CLIPBOARD_FILES;
// Manager
public static String MANAGER_OPEN_MESSAGE_CANNOT_OPEN_FILE;
public static String MANAGER_OPEN_MESSAGE_CANNOT_DETERMINE_CHARSET_OF_FILE;
public static String MANAGER_OPEN_TITLE_FILE_FROM_HISTORY;
public static String MANAGER_SAVE_DIALOG_TITLE_SAVE_SELECTION_AS;
public static String MANAGER_SAVE_DIALOG_TITLE_SAVE_AS;
public static String MANAGER_SAVE_DIALOG_TITLE_FILE_ALREADY_EXISTS;
public static String MANAGER_SAVE_DIALOG_MESSAGE_FILE_ALREADY_EXISTS;
public static String MANAGER_SAVE_MESSAGE_CANNOT_WRITE_ON_TEMP_FILE;
public static String MANAGER_SAVE_MESSAGE_CANNOT_SAVE_FILE;
public static String MANAGER_SAVE_MESSAGE_CANNOT_READ_FROM_SAVED_FILE;
public static String MANAGER_SAVE_MESSAGE_CANNOT_OVERWRITE_FILE;
public static String MANAGER_SAVE_MESSAGE_CANNOT_OVERWRITE_FILE_IN_USE;
public static String MANAGER_SAVE_MESSAGE_CANNOT_CREATE_TEMP_FILE_WITH_UNIQUE_NAME;
// Open in handler
public static String OpenInTexteditor_error_Message;
public static String OpenInTexteditor_error_title;
public static String OpenInTexteditor_warning_message;
public static String OpenInTexteditor_warning_title;
// Paste Dialog
public static String PasteDialog_cancel;
public static String PasteDialog_hexOrText;
public static String PasteDialog_Information;
public static String PasteDialog_title;
// Preferences Manager
public static String PREFERENCES_MANAGER_DIALOG_TITLE;
public static String PREFERENCES_MANAGER_SAMPLE_TEXT;
public static String PREFERENCES_MANAGER_FONT_SELECTION_TITLE;
public static String PREFERENCES_MANAGER_FONT_NAME;
public static String PREFERENCES_MANAGER_FONT_STYLE;
public static String PREFERENCES_MANAGER_FONT_STYLE_BOLD;
public static String PREFERENCES_MANAGER_FONT_STYLE_BOLD_ITALIC;
public static String PREFERENCES_MANAGER_FONT_STYLE_ITALIC;
public static String PREFERENCES_MANAGER_FONT_STYLE_REGULAR;
public static String PREFERENCES_MANAGER_FONT_SIZE;
public static String PREFERENCES_MANAGER_DEFAULT_FONT_NAME;
// Selection Block Dialog
public static String SELECTION_BLOCK_DIALOG_TITLE;
public static String SELECTION_BLOCK_DIALOG_DEC_LABEL;
public static String SELECTION_BLOCK_DIALOG_HEX_LABEL;
public static String SELECTION_BLOCK_DIALOG_SELECT_BUTTON_LABEL;
public static String SELECTION_BLOCK_DIALOG_RANGE_LABEL;
// Status Line
public static String STATUS_LINE_MESSAGE_SELECTION;
public static String STATUS_LINE_MESSAGE_POSITION;
public static String STATUS_LINE_MESSAGE_VALUE;
public static String STATUS_LINE_MESSAGE_SIZE;
public static String STATUS_LINE_MODE_INSERT;
public static String STATUS_LINE_MODE_OVERWRITE;
/**
* Initializes the constants.
*/
static {
NLS.initializeMessages(Texts.class.getName(), Texts.class);
}
}
================================================
FILE: net.sourceforge.javahexeditor/src/net/sourceforge/javahexeditor/Texts.properties
================================================
# General
BUTTON_OK_LABEL=&OK
BUTTON_RESET_LABEL=&Reset
BUTTON_CANCEL_LABEL=&Cancel
BUTTON_CLOSE_LABEL=&Close
BYTE_ARRAY_UTILITY_INVALID_HEX_STRING='{0}' is not a valid hex value.
#Context Menu
ContextMenu_copy=Copy
ContextMenu_cut=Cut
ContextMenu_openin=Open with Texteditor
ContextMenu_paste=Paste
ContextMenu_redo=Redo
ContextMenu_undo=Undo
CopyDialog_hex_or_text=Copy the hex or text representation?
CopyDialog_title=Copy options
CopyDialog_to_long_for_clipboard=Selection cannot be copied to the clipboard because it is larger than 4 MB. Select less text or save the selection via "Edit" -> "Save selection as..." to a file for further processing.
CopyDialog_cancel=Cancel
DIALOG_ERROR_NOT_A_NUMBER_MESSAGE=Input is not a number.
DIALOG_ERROR_LOCATION_OUT_OF_RANGE_MESSAGE=Location is out of range.
DIALOG_ERROR_END_SMALLER_THAN_OR_EQUAL_TO_START_MESSAGE=End smaller than or equal to start.
# Editor
EDITOR_MESSAGE_SAVING_FILE_PLEASE_WAIT=Saving file, please wait.
EDITOR_MESSAGE_FILE_SAVED={0} saved.
EDITOR_SAVE_SELECTION_AS_MENU_ITEM_LABEL=Save S&election As...
EDITOR_TRIM_MENU_ITEM_LABEL=&Trim
EDITOR_SELECT_BLOCK_MENU_ITEM_LABEL=Select &Block...\tCtrl+E
EDITOR_GO_TO_MENU_ITEM_LABEL=Go To &Location...\tCtrl+L
# Find Replace Dialog
FIND_REPLACE_DIALOG_TITLE=Find/Replace
FIND_REPLACE_DIALOG_FIND_GROUP_LABEL=Find
FIND_REPLACE_DIALOG_REPLACE_GROUP_LABEL=Replace With
FIND_REPLACE_DIALOG_HEX_RADIO_LABEL=Hex
FIND_REPLACE_DIALOG_TEXT_RADIO_LABEL=Text
FIND_REPLACE_DIALOG_DIRECTION_GROUP_LABEL=Direction
FIND_REPLACE_DIALOG_DIRECTION_BACKWARD_RADIO_LABEL=&Backward
FIND_REPLACE_DIALOG_DIRECTION_FORWARD_RADIO_LABEL=F&orward
FIND_REPLACE_DIALOG_IGNORE_CASE_CHECKBOX_LABEL=&Ignore case
FIND_REPLACE_DIALOG_OPTIONS_GROUP_LABEL=Options
FIND_REPLACE_DIALOG_FIND_BUTTON_LABEL=&Find
FIND_REPLACE_DIALOG_REPLACE_BUTTON_LABEL=&Replace
FIND_REPLACE_DIALOG_REPLACE_ALL_BUTTON_LABEL=Replace &All
FIND_REPLACE_DIALOG_MESSAGE_SPECIFY_VALUE_TO_FIND=Specify the value to find.
FIND_REPLACE_DIALOG_MESSAGE_SEARCHING=Searching...
FIND_REPLACE_DIALOG_STOP_SEARCHING_BUTTON_LABEL=&Stop
FIND_REPLACE_DIALOG_MESSAGE_FOUND='{0}' found at position {1}.
FIND_REPLACE_DIALOG_MESSAGE_NOT_FOUND='{0}' not found.
FIND_REPLACE_DIALOG_MESSAGE_ERROR_WHILE_SEARCHING=Error while searching '{0}': {1}
FIND_REPLACE_DIALOG_MESSAGE_ONE_REPLACEMENT=1 occurrence of '{0}' replaced with '{1}' at position {2}.
FIND_REPLACE_DIALOG_MESSAGE_MANY_REPLACEMENTS={0} occurrences of '{1}' replaced with '{2}'.
FIND_REPLACE_DIALOG_MESSAGE_ERROR_WHILE_REPLACING=Error file replacing '{0}' with '{1}': {2}
# GoTo Dialog
GOTO_DIALOG_GOTO_LOCATION_SHELL_LABEL=Go to location
GOTO_DIALOG_MESSAGE_ENTER_LOCATION=Enter location number, {0}:
GOTO_DIALOG_SHOW_LOCATION_BUTTON_LABEL=Show location
GOTO_DIALOG_GOTO_LOCATION_BUTTON_LABEL=Go to location
GOTO_DIALOG_HEX=Hex
GOTO_DIALOG_DECIMAL=Decimal
# Hex Texts
HEX_TEXTS_TITLE_INCONSISTENT_CLIPBOARD_FILES=Inconsistent clipboard files
HEX_TEXTS_MESSAGE_INCONSISTENT_CLIPBOARD_FILES=Could not cleanup temporary clipboard files.\nClipboard files are stored in your temporary directory '{0}' as '{1}' and '{2}'.
# Manager
MANAGER_OPEN_MESSAGE_CANNOT_OPEN_FILE=Cannot open file '{0}'.
MANAGER_OPEN_MESSAGE_CANNOT_DETERMINE_CHARSET_OF_FILE=Cannot determine charset of file '{0}'.
MANAGER_OPEN_TITLE_FILE_FROM_HISTORY={0} (from history)
MANAGER_SAVE_DIALOG_TITLE_SAVE_SELECTION_AS=Save Selection As
MANAGER_SAVE_DIALOG_TITLE_SAVE_AS=Save As
MANAGER_SAVE_DIALOG_TITLE_FILE_ALREADY_EXISTS=File already exists
MANAGER_SAVE_DIALOG_MESSAGE_FILE_ALREADY_EXISTS=The file '{0}' already exists.\nOverwrite file?
MANAGER_SAVE_MESSAGE_CANNOT_WRITE_ON_TEMP_FILE=Cannot not write to temporary file '{0}'.
MANAGER_SAVE_MESSAGE_CANNOT_SAVE_FILE=Cannot not save file '{0}': {1}.
MANAGER_SAVE_MESSAGE_CANNOT_READ_FROM_SAVED_FILE=Cannot not read from saved file '{0}'. Try reopening the editor.
MANAGER_SAVE_MESSAGE_CANNOT_OVERWRITE_FILE=Cannot not overwrite file '{0}'. A temporary copy can be found in file '{1}'.
MANAGER_SAVE_MESSAGE_CANNOT_OVERWRITE_FILE_IN_USE=File '{0}' is currently being used and cannot be overwritten.
MANAGER_SAVE_MESSAGE_CANNOT_CREATE_TEMP_FILE_WITH_UNIQUE_NAME=Cannot not create temporary file with a unique name.
# Open in handler
OpenInTexteditor_error_Message=Texteditor could not be loaded
OpenInTexteditor_error_title=Texteditor not available
OpenInTexteditor_warning_message=Texteditor could not be loaded
OpenInTexteditor_warning_title=Texteditor could not be loaded
# Paste Dialog
PasteDialog_cancel=Cancel
PasteDialog_hexOrText=Paste the text or hex representation?
PasteDialog_Information=Text will paste the clipboard content as utf-8 characters.\nHex will paste the clipboard content as hexadecimal characters.\nOnly valid hexadecimal characters (0-9, a-f, A-F) will be pasted.
PasteDialog_title=Paste options
# Preferences Manager
PREFERENCES_MANAGER_DIALOG_TITLE=Font Preferences
PREFERENCES_MANAGER_SAMPLE_TEXT=ca fe ba be 00 00 01 2d
PREFERENCES_MANAGER_FONT_SELECTION_TITLE=Font Selection
PREFERENCES_MANAGER_FONT_NAME=Name
PREFERENCES_MANAGER_FONT_STYLE=Style
PREFERENCES_MANAGER_FONT_STYLE_BOLD=Bold
PREFERENCES_MANAGER_FONT_STYLE_BOLD_ITALIC=Bold Italic
PREFERENCES_MANAGER_FONT_STYLE_ITALIC=Italic
PREFERENCES_MANAGER_FONT_STYLE_REGULAR=Regular
PREFERENCES_MANAGER_FONT_SIZE=Size
PREFERENCES_MANAGER_DEFAULT_FONT_NAME=Default Font
# Selection Block Dialog
SELECTION_BLOCK_DIALOG_TITLE=Select Block
SELECTION_BLOCK_DIALOG_DEC_LABEL=Decimal
SELECTION_BLOCK_DIALOG_HEX_LABEL=Hex
SELECTION_BLOCK_DIALOG_SELECT_BUTTON_LABEL=&Select
SELECTION_BLOCK_DIALOG_RANGE_LABEL=Enter start and end position, 0 to {0} ({1} to {2}):
# Status Line
STATUS_LINE_MESSAGE_SELECTION=Selection: {0}
STATUS_LINE_MESSAGE_POSITION=Position: {0}
STATUS_LINE_MESSAGE_VALUE=Value: {0} = {1} = {2}
STATUS_LINE_MESSAGE_SIZE=Size: {0}
STATUS_LINE_MODE_INSERT=Insert
STATUS_LINE_MODE_OVERWRITE=Overwrite
================================================
FILE: net.sourceforge.javahexeditor/src/net/sourceforge/javahexeditor/Texts_de.properties
================================================
# General
BUTTON_OK_LABEL=&OK
BUTTON_RESET_LABEL=&Zurcksetzen
BUTTON_CANCEL_LABEL=&Abbrechen
BUTTON_CLOSE_LABEL=&Schlieen
BYTE_ARRAY_UTILITY_INVALID_HEX_STRING='{0}' ist kein gltiger Hex-Wert.
#Context Menu
ContextMenu_copy=Kopieren
ContextMenu_cut=Ausschneiden
ContextMenu_openin=ffnen mit Texteditor
ContextMenu_paste=Einfgen
ContextMenu_redo=Wiederholen
ContextMenu_undo=Rckgngig
CopyDialog_hex_or_text=Mchten Sie die Hex- oder Text-Reprsentation kopieren?
CopyDialog_title=Kopier-Optionen
CopyDialog_to_long_for_clipboard=Auswahl kann nicht in die Zwischenablage kopiert werden, da diese grer als 4 MB ist. Whlen Sie weniger Text aus oder speichern Sie die Auswahl ber "Bearbeiten" -> "Auswahl Speichern unter..." in einer Datei ab, um sie weiter zu verarbeiten.
CopyDialog_cancel=Abbrechen
DIALOG_ERROR_NOT_A_NUMBER_MESSAGE=Eingabe ist keine Zahl.
DIALOG_ERROR_LOCATION_OUT_OF_RANGE_MESSAGE=Position ist auerhalb des zulssigen Bereiches.
DIALOG_ERROR_END_SMALLER_THAN_OR_EQUAL_TO_START_MESSAGE=Endposition ist kleiner als Startposition.
# Editor
EDITOR_MESSAGE_SAVING_FILE_PLEASE_WAIT=Datei wird gespeichert, bitte warten.
EDITOR_MESSAGE_FILE_SAVED={0} gespeichert.
EDITOR_SAVE_SELECTION_AS_MENU_ITEM_LABEL=Aus&wahl Speichern Unter...
EDITOR_TRIM_MENU_ITEM_LABEL=&Trimmen
EDITOR_SELECT_BLOCK_MENU_ITEM_LABEL=&Bereich Auswhlen...\tCtrl+E
EDITOR_GO_TO_MENU_ITEM_LABEL=Gehe zu &Position...\tCtrl+L
# Find Replace Dialog
FIND_REPLACE_DIALOG_TITLE=Suchen/Ersetzen
FIND_REPLACE_DIALOG_FIND_GROUP_LABEL=Suchen
FIND_REPLACE_DIALOG_REPLACE_GROUP_LABEL=Ersetzen Durch
FIND_REPLACE_DIALOG_HEX_RADIO_LABEL=Hex
FIND_REPLACE_DIALOG_TEXT_RADIO_LABEL=Text
FIND_REPLACE_DIALOG_OPTIONS_GROUP_LABEL=Optionen
FIND_REPLACE_DIALOG_DIRECTION_GROUP_LABEL=Richtung
FIND_REPLACE_DIALOG_DIRECTION_BACKWARD_RADIO_LABEL=&Vorwrts
FIND_REPLACE_DIALOG_DIRECTION_FORWARD_RADIO_LABEL=&Rckwrts
FIND_REPLACE_DIALOG_IGNORE_CASE_CHECKBOX_LABEL=Gro-/Kleinschreibung &ignorieren
FIND_REPLACE_DIALOG_FIND_BUTTON_LABEL=&Suchen
FIND_REPLACE_DIALOG_REPLACE_BUTTON_LABEL=&Ersetzen
FIND_REPLACE_DIALOG_REPLACE_ALL_BUTTON_LABEL=&Alle Ersetzen
FIND_REPLACE_DIALOG_MESSAGE_SPECIFY_VALUE_TO_FIND=Geben Sie den zu suchenden Wert ein.
FIND_REPLACE_DIALOG_MESSAGE_SEARCHING=Suche luft...
FIND_REPLACE_DIALOG_STOP_SEARCHING_BUTTON_LABEL=&Stopp
FIND_REPLACE_DIALOG_MESSAGE_FOUND='{0}' gefunden an Position {1}.
FIND_REPLACE_DIALOG_MESSAGE_NOT_FOUND='{0}' nicht gefunden.
FIND_REPLACE_DIALOG_MESSAGE_ERROR_WHILE_SEARCHING=Fehler whrend der Suche nach '{0}': {1}
FIND_REPLACE_DIALOG_MESSAGE_ONE_REPLACEMENT=1 Vorkommen von '{0}' ersetzt durch '{1}' an Position {2}.
FIND_REPLACE_DIALOG_MESSAGE_MANY_REPLACEMENTS={0} Vorkommen von '{1}' ersetzt durch '{2}'.
FIND_REPLACE_DIALOG_MESSAGE_ERROR_WHILE_REPLACING=Fehler whrend des Ersetzens von '{0}' durch '{1}': {2}
# GoTo Dialog
GOTO_DIALOG_GOTO_LOCATION_SHELL_LABEL=Gehe Zu Position
GOTO_DIALOG_MESSAGE_ENTER_LOCATION=Geben Sie die Position ein, {0}:
GOTO_DIALOG_SHOW_LOCATION_BUTTON_LABEL=Zeige Position
GOTO_DIALOG_GOTO_LOCATION_BUTTON_LABEL=Gehe Zu Position
GOTO_DIALOG_HEX=Hex
GOTO_DIALOG_DECIMAL=Dezimal
# Hex Texts
HEX_TEXTS_TITLE_INCONSISTENT_CLIPBOARD_FILES=Dateien in der Zwischenablage sind inkonsistent
HEX_TEXTS_MESSAGE_INCONSISTENT_CLIPBOARD_FILES=Temporre Dateien fr die Zwischenablage konnten nich gelscht werden.\nDie Dateien fr die Zwischenablage sind in Ihrem temporren Ordner '{0}' als '{1}' und '{2}' gepspeichert.
# Manager
MANAGER_OPEN_MESSAGE_CANNOT_OPEN_FILE=Datei '{0}' kann nicht gefnet werden.
MANAGER_OPEN_MESSAGE_CANNOT_DETERMINE_CHARSET_OF_FILE=Zeichencodierung der Datei '{0}' kann nicht bestimmt werden.
MANAGER_OPEN_TITLE_FILE_FROM_HISTORY={0} (aus der Historie)
MANAGER_SAVE_DIALOG_TITLE_SAVE_SELECTION_AS=Auswahl Speichern unter
MANAGER_SAVE_DIALOG_TITLE_SAVE_AS=Speichern unter
MANAGER_SAVE_DIALOG_TITLE_FILE_ALREADY_EXISTS=Datei existiert bereits
MANAGER_SAVE_DIALOG_MESSAGE_FILE_ALREADY_EXISTS=Die Datei '{0}' existiert bereits.\nDatei berschreiben?
MANAGER_SAVE_MESSAGE_CANNOT_WRITE_ON_TEMP_FILE=Temporre Datei '{0}' konnte nicht geschrieben werden
MANAGER_SAVE_MESSAGE_CANNOT_SAVE_FILE=Datei '{0}' kann nicht gespeichert werden: {1}
MANAGER_SAVE_MESSAGE_CANNOT_READ_FROM_SAVED_FILE=Gespeicherte Datei '{0}' kann nicht gelesen werden. Versuchen Sie den Editor erneut zu ffnen
MANAGER_SAVE_MESSAGE_CANNOT_OVERWRITE_FILE=Datei '{0}' kann nicht berschrieben werden. Eine temporre Kopie kann in der Datei '{1}' gefunden werden.
MANAGER_SAVE_MESSAGE_CANNOT_OVERWRITE_FILE_IN_USE=Datei '{0}' wird gerade verwendet und kann nicht berschrieben werden.
MANAGER_SAVE_MESSAGE_CANNOT_CREATE_TEMP_FILE_WITH_UNIQUE_NAME=Es kann keine temporre Datei mit einem eindeutigen Namen erstellt werden.
#Open in handler
OpenInTexteditor_error_Message=Der Texteditor konnte nicht geladen werden
OpenInTexteditor_error_title=Texteditor nicht verfgbar
OpenInTexteditor_warning_message=Der Texteditor konnte nicht geladen werden.
OpenInTexteditor_warning_title=Texteditor konnte nicht geffnet werden
# Paste Dialog
PasteDialog_cancel=Abbrechen
PasteDialog_hexOrText=Text- oder Hexreprsentation einfgen?
PasteDialog_Information=Text fgt den Inhalt der Zwischenablage als UTF-8 Zeichen ein.\nHex fgt den Inhalt der Zwischenablage als hexadezimale Zeichen ein.\nNur zulssige hexadezimale Zeichen (0-9, a-f, A-F) werden eingefgt.
PasteDialog_title=Einfgeoptionen
# Preferences Manager
PREFERENCES_MANAGER_DIALOG_TITLE=Schriftart Einstellungen
PREFERENCES_MANAGER_SAMPLE_TEXT=ca fe ba be 00 00 01 2d
PREFERENCES_MANAGER_FONT_SELECTION_TITLE=Schriftart Auswahl
PREFERENCES_MANAGER_FONT_NAME=Name
PREFERENCES_MANAGER_FONT_STYLE=Stil
PREFERENCES_MANAGER_FONT_STYLE_BOLD=Fett
PREFERENCES_MANAGER_FONT_STYLE_BOLD_ITALIC=Fett Kursiv
PREFERENCES_MANAGER_FONT_STYLE_ITALIC=Kursiv
PREFERENCES_MANAGER_FONT_STYLE_REGULAR=Normal
PREFERENCES_MANAGER_FONT_SIZE=Gre
PREFERENCES_MANAGER_DEFAULT_FONT_NAME=Standard Schriftart
# Selection Block Dialog
SELECTION_BLOCK_DIALOG_TITLE=Bereich Auswhlen
SELECTION_BLOCK_DIALOG_DEC_LABEL=Dezimal
SELECTION_BLOCK_DIALOG_HEX_LABEL=Hex
SELECTION_BLOCK_DIALOG_SELECT_BUTTON_LABEL=&Auswhlen
SELECTION_BLOCK_DIALOG_RANGE_LABEL=Geben Sie Start- und Endposition an, 0 bis {0} ({1} bis {2}):
# Status Line
STATUS_LINE_MESSAGE_SELECTION=Auswahl: {0}
STATUS_LINE_MESSAGE_POSITION=Position: {0}
STATUS_LINE_MESSAGE_VALUE=Wert: {0} = {1} = {2}
STATUS_LINE_MESSAGE_SIZE=Gre: {0}
STATUS_LINE_MODE_INSERT=Einfgen
STATUS_LINE_MODE_OVERWRITE=berschreiben
================================================
FILE: net.sourceforge.javahexeditor/src/net/sourceforge/javahexeditor/common/ByteArrayUtility.java
================================================
/*
* javahexeditor, a java hex editor
* Copyright (C) 2006, 2009 Jordi Bergenthal, pestatije(-at_)users.sourceforge.net
* The official javahexeditor site is sourceforge.net/projects/javahexeditor
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package net.sourceforge.javahexeditor.common;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import net.sourceforge.javahexeditor.Texts;
/**
* Utility to handle byte array conversions.
*
* @author Peter Dell
*
*/
public final class ByteArrayUtility {
/**
* Creation is private.
*/
private ByteArrayUtility() {
}
/**
* Converts a hex String to byte[]. Ignores white spaces. Will convert full
* bytes only, odd number of hex characters per will have a leading '0' added.
*
* @param hexString an hex string (ie. "0fdA1").
* @return the byte[] value of the hex string
*/
public static byte[] parseString(String value) throws NumberFormatException {
List bytes = new ArrayList();
StringTokenizer st = new StringTokenizer(value);
while (st.hasMoreTokens()) {
String hexString = st.nextToken();
if ((hexString.length() & 1) == 1) {
hexString = '0' + hexString;
}
for (int i = 0; i < hexString.length(); i = i + 2) {
int high = Character.digit(hexString.charAt(i), 16);
int low = Character.digit(hexString.charAt(i + 1), 16);
if (high < 0 || low < 0) {
throw new NumberFormatException(
TextUtility.format(Texts.BYTE_ARRAY_UTILITY_INVALID_HEX_STRING, value));
}
bytes.add(Byte.valueOf((byte) ((high << 4) | low)));
}
}
byte[] result = new byte[bytes.size()];
for (int i = 0; i < result.length; i++) {
result[i] = bytes.get(i).byteValue();
}
return result;
}
}
================================================
FILE: net.sourceforge.javahexeditor/src/net/sourceforge/javahexeditor/common/NumberUtility.java
================================================
/*
* javahexeditor, a java hex editor
* Copyright (C) 2006, 2009 Jordi Bergenthal, pestatije(-at_)users.sourceforge.net
* The official javahexeditor site is sourceforge.net/projects/javahexeditor
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package net.sourceforge.javahexeditor.common;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Utility to handle number conversions.
*
* @author Peter Dell
*
*/
public final class NumberUtility {
static final Pattern PATTERN_DEC_DIGITS = Pattern.compile("[0-9]+");
static final Pattern PATTERN_HEX_DIGITS = Pattern.compile("[0-9a-fA-F]+");
private static String hexPrefix;
static {
hexPrefix = "0x";
}
/**
* Creation is private.
*/
private NumberUtility() {
}
public static void setHexPrefix(String hexPrefix) {
if (hexPrefix == null) {
throw new IllegalArgumentException("Parameter 'hexPrefix' must not be null.");
}
hexPrefix = hexPrefix.trim();
if (hexPrefix.length() == 0) {
throw new IllegalArgumentException("Parameter 'hexPrefix' must not be empty.");
}
NumberUtility.hexPrefix = hexPrefix;
}
public static String getDecimalString(long value) {
return Long.toString(value);
}
public static String getHexString(long value) {
return hexPrefix + Long.toHexString(value).toUpperCase();
}
public static String getDecimalAndHexString(long value) {
return getDecimalString(value) + " (" + getHexString(value) + ")";
}
public static String getDecimalAndHexRangeString(long from, long to) {
return getDecimalString(from) + " - " + getDecimalString(to) + " (" + getHexString(from) + " - "
+ getHexString(to) + ")";
}
public static long parseString(boolean hex, String value) {
int radix = 10;
Matcher numberMatcher;
if (hex) {
if (value.startsWith(hexPrefix)) {
value = value.substring(hexPrefix.length());
}
numberMatcher = PATTERN_HEX_DIGITS.matcher(value);
radix = 16;
} else {
numberMatcher = PATTERN_DEC_DIGITS.matcher(value);
}
if (numberMatcher.matches()) {
return Long.parseLong(value, radix);
}
return -1;
}
}
================================================
FILE: net.sourceforge.javahexeditor/src/net/sourceforge/javahexeditor/common/ResourceUtility.java
================================================
/**
* Copyright (C) 2013 - 2014 Peter Dell
*
* This file is part of a WUDSN software distribution.
*
* The!Cart Studio is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* The!Cart Studio distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the WUDSN software distribution. If not, see .
*/
package net.sourceforge.javahexeditor.common;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import org.jcryptool.core.logging.utils.LogUtil;
/**
* Utility class to access resources in the class path.
*
* @author Peter Dell
*/
public final class ResourceUtility {
/**
* Loads a resource as string.
*
* @param path
* The resource path, not empty, not null.
* @return The resource content or null if the resource was not
* found.
*/
public static String loadResourceAsString(String path) {
if (path == null) {
throw new IllegalArgumentException("Parameter 'path' must not be null.");
}
if (path.isEmpty()) {
throw new IllegalArgumentException("Parameter 'path' must not be empty.");
}
final InputStream inputStream = getInputStream(path);
if (inputStream == null) {
return null;
}
StringBuilder builder = new StringBuilder();
try {
InputStreamReader reader = new InputStreamReader(inputStream);
char[] buffer = new char[8192];
int actualLength;
while ((actualLength = reader.read(buffer, 0, buffer.length)) != -1) {
builder.append(buffer, 0, actualLength);
}
reader.close();
} catch (IOException ex) {
LogUtil.logError("Cannot load resource " + path , ex);
} finally {
try {
inputStream.close();
} catch (IOException ignore) {
}
}
return builder.toString();
}
/**
* Self implemented logic to bypass the bug described in
* JDK-4523159 :
* getResourceAsStream on jars in path with "!". Note that this is not the
* full logic. The rest was removed to reduced dependencies.
*
* @param path
* The path of the resource to load, not null.
* @return The input stream or null if the source was not found.
*/
private static InputStream getInputStream(String path) {
if (path == null) {
throw new IllegalArgumentException("Parameter 'path' must not be null.");
}
// If there is no loader, the program was launched using the Java
// boot class path and the system class loader must be used.
ClassLoader loader = ResourceUtility.class.getClassLoader();
URL url = (loader == null) ? ClassLoader.getSystemResource(path) : loader.getResource(path);
InputStream result = null;
try {
if (url != null) {
result = url.openStream();
}
} catch (IOException ex) {
LogUtil.logError("Cannot get input stream for path " + path, ex);
}
return result;
}
}
================================================
FILE: net.sourceforge.javahexeditor/src/net/sourceforge/javahexeditor/common/SWTUtility.java
================================================
/*
* javahexeditor, a java hex editor
* Copyright (C) 2006, 2009 Jordi Bergenthal, pestatije(-at_)users.sourceforge.net
* The official javahexeditor site is sourceforge.net/projects/javahexeditor
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package net.sourceforge.javahexeditor.common;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.graphics.FontMetrics;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
/**
* Utility class to handle SWT widgets.
*
* @author Peter Dell
*/
public final class SWTUtility {
/**
* Blocks the caller until the task is finished. Does not block the user
* interface thread.
*
* @param task
* independent of the user interface thread (no widgets used)
*/
public static void blockUntilFinished(Runnable task) {
Thread thread = new Thread(task);
thread.start();
Display display = Display.getCurrent();
final boolean[] pollerEnabled = { false };
while (thread.isAlive() && !display.isDisposed()) {
if (!display.readAndDispatch()) {
// awake periodically so it returns when task has finished
if (!pollerEnabled[0]) {
pollerEnabled[0] = true;
display.timerExec(300, new Runnable() {
@Override
public void run() {
pollerEnabled[0] = false;
}
});
}
display.sleep();
}
}
}
/**
* Helper method to make a center a shell or dialog in the center of another
* shell.
*
* * @param movingShell shell to be relocated, not null
*
* @param fixedShell
* shell to be used as reference, not null
*
*/
public static void placeInCenterOf(Shell movingShell, Shell fixedShell) {
if (movingShell == null) {
throw new IllegalArgumentException("Parameter 'movingShell' must not be null.");
}
if (fixedShell == null) {
throw new IllegalArgumentException("Parameter 'fixedShell' must not be null.");
}
movingShell.pack();
Rectangle fixedShellSize = fixedShell.getBounds();
Rectangle dialogSize = movingShell.getBounds();
int locationX, locationY;
locationX = (fixedShellSize.width - dialogSize.width) / 2 + fixedShellSize.x;
locationY = (fixedShellSize.height - dialogSize.height) / 2 + fixedShellSize.y;
movingShell.setLocation(new Point(locationX, locationY));
}
public static int showMessage(Shell shell, int style, String title, String message, String... parameters) {
MessageBox messageBox = new MessageBox(shell, style);
messageBox.setText(title);
messageBox.setMessage(TextUtility.format(message, parameters));
return messageBox.open();
}
public static int showErrorMessage(Shell shell, String title, String message, String... parameters) {
return showMessage(shell, SWT.ERROR | SWT.OK, title, message, parameters);
}
/**
* Compatibility between old and new SWT versions.
*
* @param gc
* The graphics context, not null
* @return The average character width, a positive integer.
*/
public static double getAverageCharacterWidth(GC gc) {
// if (gc == null) {
// throw new IllegalArgumentException();
// }
FontMetrics fm = gc.getFontMetrics();
return fm.getAverageCharacterWidth();
}
/**
* Compatibility between old and new SWT versions.
*
* @param styledText
* The styled text, not null
* @param point
* The point, not null
* @return The offset at location point.
*/
public static int getOffsetAtPoint(StyledText styledText, Point point) {
// final String GET_OFFSET_AT_POINT = "getOffsetAtPoint";
// final String GET_OFFSET_AT_LOCATION = "getOffsetAtLocation";
// if (styledText == null || point == null) {
// throw new IllegalArgumentException();
// }
return styledText.getOffsetAtPoint(point);
// if (styledText == null) {
// throw new IllegalArgumentException();
// }
// Method method = getMethod(StyledText.class, GET_OFFSET_AT_POINT, Point.class);
// if (method == null) {
// method = getMethod(StyledText.class, GET_OFFSET_AT_LOCATION, Point.class);
// }
// if (method == null) {
// throw new RuntimeException("None of the required methods '" + GET_OFFSET_AT_POINT + "' or '"
// + GET_OFFSET_AT_LOCATION + "' found");
// }
// Integer result = null;
// try {
// result = (Integer) method.invoke(styledText, point);
// } catch (IllegalAccessException ex) {
// throw new RuntimeException(ex);
// } catch (IllegalArgumentException ex) {
// throw new RuntimeException(ex);
// } catch (InvocationTargetException ex) {
// if (ex.getCause() instanceof IllegalArgumentException) {
// throw (IllegalArgumentException) ex.getCause();
// }
// throw new RuntimeException(ex);
// }
// return result.intValue();
}
// private static Method getMethod(Class> clazz, String methodName, Class>... parameterTypes) {
// Method method = null;
// try {
// method = clazz.getMethod(methodName, parameterTypes);
// } catch (NoSuchMethodException ex1) {
// method = null;
// }
// return method;
// }
}
================================================
FILE: net.sourceforge.javahexeditor/src/net/sourceforge/javahexeditor/common/TextUtility.java
================================================
/*
* javahexeditor, a java hex editor
* Copyright (C) 2006, 2009 Jordi Bergenthal, pestatije(-at_)users.sourceforge.net
* The official javahexeditor site is sourceforge.net/projects/javahexeditor
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package net.sourceforge.javahexeditor.common;
import net.sourceforge.javahexeditor.Texts;
/**
* Text formatting utility.
*
* @author Peter Dell
*/
public final class TextUtility {
/**
* Parameter variable tokens.
*/
private static final String[] PARAMETERS = { "{0}", "{1}", "{2}", "{3}", "{4}", "{5}", "{6}", "{7}", "{8}", "{9}" };
/**
* Creation is private.
*/
private TextUtility() {
}
/**
* Formats a text with parameters "{0}" to "{9}".
*
* @param text
* The text with the parameters "{0}" to "{9}", may be empty, not
* null.
* @param parameters
* The parameters, may be empty or null.
*
* @return The formatted text, may be empty, not null.
*/
public static String format(String text, String... parameters) {
if (text == null) {
throw new IllegalArgumentException("Parameter 'text' must not be null.");
}
if (parameters == null) {
parameters = new String[0];
}
for (int i = 0; i < parameters.length; i++) {
String parameter = parameters[i];
if (parameter == null) {
parameter = Texts.EMPTY;
}
text = text.replace(PARAMETERS[i], parameter);
}
return text;
}
}
================================================
FILE: net.sourceforge.javahexeditor/src/net/sourceforge/javahexeditor/plugin/HexEditorPlugin.java
================================================
/*
* javahexeditor, a java hex editor
* Copyright (C) 2006, 2009 Jordi Bergenthal, pestatije(-at_)users.sourceforge.net
* The official javahexeditor site is sourceforge.net/projects/javahexeditor
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package net.sourceforge.javahexeditor.plugin;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
import net.sourceforge.javahexeditor.FindReplaceHistory;
/**
* The main plugin class to be used in the desktop.
*/
public final class HexEditorPlugin extends AbstractUIPlugin {
public static final String ID = "net.sourceforge.javahexeditor";
// The shared instance.
private static HexEditorPlugin plugin;
private FindReplaceHistory findReplaceHistory;
/**
* The constructor.
*/
public HexEditorPlugin() {
findReplaceHistory = new FindReplaceHistory();
}
/**
* Returns the shared instance.
*
* @return The shared instance, not null.
*/
public static HexEditorPlugin getDefault() {
return plugin;
}
/**
* This method is called upon plug-in activation.
*/
@Override
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
}
/**
* This method is called when the plug-in is stopped.
*/
@Override
public void stop(BundleContext context) throws Exception {
super.stop(context);
plugin = null;
}
/**
* Gets the find-replace history.
*
* @return The modifiable find-replace history, not null.
*/
public FindReplaceHistory getFindReplaceHistory() {
return findReplaceHistory;
}
}
================================================
FILE: net.sourceforge.javahexeditor/src/net/sourceforge/javahexeditor/plugin/actions/FileOpenAction.java
================================================
package net.sourceforge.javahexeditor.plugin.actions;
import java.io.File;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IObjectActionDelegate;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.part.FileEditorInput;
import net.sourceforge.javahexeditor.plugin.editors.HexEditor;
public final class FileOpenAction implements IObjectActionDelegate {
private File[] files;
private IStructuredSelection currentSelection;
/**
* Creation is public.
*/
public FileOpenAction() {
super();
}
@Override
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
}
@Override
public void run(IAction action) {
if (!isEnabled()) {
throw new IllegalStateException("Action is not enabled");
}
for (int i = 0; i < files.length; i++) {
if (files[i] == null) {
continue;
}
IFile file = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(new Path(files[i].getPath()));
if (file == null) {
continue;
}
IEditorInput editorInput = new FileEditorInput(file);
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
IWorkbenchPage page = window.getActivePage();
try {
page.openEditor(editorInput, HexEditor.ID, true,
org.eclipse.ui.IWorkbenchPage.MATCH_INPUT | org.eclipse.ui.IWorkbenchPage.MATCH_ID);
} catch (PartInitException ex) {
throw new RuntimeException(ex);
}
}
}
@Override
public void selectionChanged(IAction action, ISelection selection) {
currentSelection = selection instanceof IStructuredSelection ? (IStructuredSelection) selection : null;
action.setEnabled(isEnabled());
}
private boolean isEnabled() {
boolean enabled = false;
if (currentSelection != null) {
Object[] selectedObjects = currentSelection.toArray();
files = new File[selectedObjects.length];
for (int i = 0; i < selectedObjects.length; i++) {
File file = getResource(selectedObjects[i]);
if (file != null && file.isFile()) {
files[i] = file;
enabled = true;
}
}
} else {
files = null;
}
return enabled;
}
private File getResource(Object object) {
if (object instanceof IResource) {
return ((IResource) object).getLocation().toFile();
}
if (object instanceof File) {
return (File) object;
}
if (object instanceof IAdaptable) {
IAdaptable adaptable = (IAdaptable) object;
IResource resource = adaptable.getAdapter(IResource.class);
if (resource != null) {
return resource.getLocation().toFile();
}
File file = adaptable.getAdapter(File.class);
if (file != null) {
return file;
}
}
return null;
}
}
================================================
FILE: net.sourceforge.javahexeditor/src/net/sourceforge/javahexeditor/plugin/editors/HexEditor.java
================================================
/*
* javahexeditor, a java hex editor
* Copyright (C) 2006, 2009 Jordi Bergenthal, pestatije(-at_)users.sourceforge.net
* The official javahexeditor site is sourceforge.net/projects/javahexeditor
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package net.sourceforge.javahexeditor.plugin.editors;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.HashSet;
import java.util.Set;
import java.util.regex.Pattern;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IStatusLineManager;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.IPathEditorInput;
import org.eclipse.ui.IStorageEditorInput;
import org.eclipse.ui.IURIEditorInput;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.ActionFactory;
import org.eclipse.ui.editors.text.ILocationProvider;
import org.eclipse.ui.part.EditorPart;
import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
import org.jcryptool.core.logging.utils.LogUtil;
import org.jcryptool.core.util.constants.IConstants;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleException;
import net.sourceforge.javahexeditor.BinaryContent;
import net.sourceforge.javahexeditor.BinaryContent.RangeSelection;
import net.sourceforge.javahexeditor.FileToucher;
import net.sourceforge.javahexeditor.HexTexts;
import net.sourceforge.javahexeditor.Manager;
import net.sourceforge.javahexeditor.Preferences;
import net.sourceforge.javahexeditor.Texts;
import net.sourceforge.javahexeditor.common.TextUtility;
import net.sourceforge.javahexeditor.plugin.HexEditorPlugin;
public final class HexEditor extends EditorPart implements ISelectionProvider {
private static class MyAction extends Action {
private Manager manager;
private String myId;
public MyAction(Manager manager, String id) {
if (manager == null) {
throw new IllegalArgumentException("Parameter 'manager' must not be null.");
}
if (id == null) {
throw new IllegalArgumentException("Parameter 'id' must not be null.");
}
this.manager = manager;
myId = id;
}
@Override
public void run() {
if (myId.equals(ActionFactory.UNDO.getId())) {
manager.doUndo();
} else if (myId.equals(ActionFactory.REDO.getId())) {
manager.doRedo();
} else if (myId.equals(ActionFactory.CUT.getId())) {
manager.doCut();
} else if (myId.equals(ActionFactory.COPY.getId())) {
manager.doCopy();
} else if (myId.equals(ActionFactory.PASTE.getId())) {
manager.doPaste();
} else if (myId.equals(ActionFactory.DELETE.getId())) {
manager.doDelete();
} else if (myId.equals(ActionFactory.SELECT_ALL.getId())) {
manager.doSelectAll();
} else if (myId.equals(ActionFactory.FIND.getId())) {
manager.doFind();
}
}
}
// Public id from the contributions.
public static final String ID = "net.sourceforge.javahexeditor"; //$NON-NLS-1$
// Private ids from the contributions.
private static final String OUTLINE_ELEMENT_ATTRIBUTE_CLASS = "class"; //$NON-NLS-1$
private static final String OUTLINE_ELEMENT_NAME = "outline"; //$NON-NLS-1$
private static final String OUTLINE_ID = "net.sourceforge.javahexeditor.outline"; //$NON-NLS-1$
Manager manager;
private IContentOutlinePage outlinePage;
private IPropertyChangeListener preferencesChangeListener;
Set selectionListeners;
private IStatusLineManager statusLineManager;
private HexEditorInput hexEditorInput;
private HexTexts hexTexts;
public HexEditor() {
super();
manager = new Manager(new FileToucher() {
@Override
public void touchFile(File contentFile, IProgressMonitor monitor) throws IOException {
IWorkspace workspace = ResourcesPlugin.getWorkspace();
Path p = new Path(contentFile.getAbsolutePath());
IWorkspaceRoot r = workspace.getRoot();
IFile file = r.getFile(p);
if (file.exists()) {
try {
file.appendContents(new ByteArrayInputStream(new byte[0]), true, true, monitor);
} catch (CoreException ex) {
throw new IOException(TextUtility.format(Texts.MANAGER_SAVE_MESSAGE_CANNOT_READ_FROM_SAVED_FILE,
contentFile.getAbsolutePath(), ex.getMessage()));
}
}
}
});
;
}
@Override
public void addSelectionChangedListener(ISelectionChangedListener listener) {
if (listener == null) {
return;
}
if (selectionListeners == null) {
selectionListeners = new HashSet();
}
selectionListeners.add(listener);
}
@Override
public void createPartControl(Composite parent) {
statusLineManager = getEditorSite().getActionBars().getStatusLineManager();
HexEditorPlugin plugin = HexEditorPlugin.getDefault();
getManager().setTextFont(HexEditorPreferences.getFontData());
manager.setFindReplaceHistory(plugin.getFindReplaceHistory());
hexTexts = manager.createEditorPart(parent);
// Free previously allocated temporary resources.
if (hexEditorInput != null) {
hexEditorInput.dispose();
}
hexEditorInput = new HexEditorInput();
try {
hexEditorInput.open(getEditorInput());
manager.openFile(hexEditorInput.getContentFile(), hexEditorInput.getCharset());
} catch (CoreException ex) {
LogUtil.logError(HexEditor.ID, ex);
// HexEditorPlugin.getDefault().getLog().log(ex.getStatus());
statusLineManager.setErrorMessage(ex.getMessage());
}
setPartName(hexEditorInput.getInputName());
// Register any global actions with the site's IActionBars.
IActionBars bars = getEditorSite().getActionBars();
String id = ActionFactory.UNDO.getId();
bars.setGlobalActionHandler(id, new MyAction(manager, id));
id = ActionFactory.REDO.getId();
bars.setGlobalActionHandler(id, new MyAction(manager, id));
id = ActionFactory.CUT.getId();
bars.setGlobalActionHandler(id, new MyAction(manager, id));
id = ActionFactory.COPY.getId();
bars.setGlobalActionHandler(id, new MyAction(manager, id));
id = ActionFactory.PASTE.getId();
bars.setGlobalActionHandler(id, new MyAction(manager, id));
id = ActionFactory.DELETE.getId();
bars.setGlobalActionHandler(id, new MyAction(manager, id));
id = ActionFactory.SELECT_ALL.getId();
bars.setGlobalActionHandler(id, new MyAction(manager, id));
id = ActionFactory.FIND.getId();
bars.setGlobalActionHandler(id, new MyAction(manager, id));
manager.addListener(new Listener() {
@Override
public void handleEvent(Event event) {
firePropertyChange(PROP_DIRTY);
updateActionsStatus();
}
});
bars.updateActionBars();
preferencesChangeListener = new IPropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent event) {
if (Preferences.FONT_DATA.equals(event.getProperty())) {
manager.setTextFont((FontData) event.getNewValue());
}
}
};
IPreferenceStore store = plugin.getPreferenceStore();
store.addPropertyChangeListener(preferencesChangeListener);
manager.addLongSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
LogUtil.logInfo(HexEditor.ID, "Long selection: " + e.toString());
if (selectionListeners == null) {
return;
}
long[] longSelection = manager.getLongSelection(e);
SelectionChangedEvent event = new SelectionChangedEvent(HexEditor.this, new StructuredSelection(
new Object[] { longSelection[0], longSelection[1] }));
for (ISelectionChangedListener listener : selectionListeners) {
listener.selectionChanged(event);
}
}
});
// Register the context help on this view
PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, ID + ".hexEditor"); //$NON-NLS-1$
}
@Override
public void dispose() {
IPreferenceStore store = HexEditorPlugin.getDefault().getPreferenceStore();
if (preferencesChangeListener != null) {
store.removePropertyChangeListener(preferencesChangeListener);
}
if (hexTexts != null) {
hexTexts.dispose();
}
if (hexEditorInput != null) {
hexEditorInput.dispose();
}
}
@Override
public void doSave(IProgressMonitor monitor) {
monitor.beginTask(Texts.EDITOR_MESSAGE_SAVING_FILE_PLEASE_WAIT, IProgressMonitor.UNKNOWN);
// Check if the editor name is unbenannt.txt oder unnamed.txt.
// Wenn das der Fall ist, muss der Nutzer zuvor eine Datei auswählen.
String name = getPartName();
if (Pattern.matches(net.sourceforge.javahexeditor.plugin.editors.Texts.HexEditor_unsaved, name) || Pattern.matches(IConstants.OUTPUT_REGEXP, name)) {
// Wenn die Datei unbenannt.txt oder unnamde.txt heist muss der Nutzer zuerst eine Datei auswählen.
doSaveAs();
} else {
// Wenn die Datei zuvor schonmal gespeichert wurde, überspeichere diese Datei.
try {
getManager().saveFile(monitor);
} catch (IOException ex) {
statusLineManager.setErrorMessage(ex.getMessage());
}
}
monitor.done();
}
@Override
public void doSaveAs() {
saveToFile(false);
}
@Override
public T getAdapter(Class required) {
Object result = null;
if (IContentOutlinePage.class.isAssignableFrom(required)) {
if (outlinePage == null) {
outlinePage = getOutlinePage();
}
result = outlinePage;
} else if (BinaryContent.class.isAssignableFrom(required)) {
result = getManager().getContent();
} else if (Manager.class.isAssignableFrom(required)) {
result = getManager();
} else {
result = super.getAdapter(required);
}
return (T) result;
}
/**
* Getter for the manager instance.
*
* @return the manager
*/
public Manager getManager() {
return manager;
}
IContentOutlinePage getOutlinePage() {
IExtensionRegistry registry = Platform.getExtensionRegistry();
IExtensionPoint point = registry.getExtensionPoint(OUTLINE_ID);
if (point == null) {
return null;
}
IExtension[] extensions = point.getExtensions();
if (extensions.length == 0) {
return null;
}
IConfigurationElement[] elements = extensions[0].getConfigurationElements();
String className = null;
for (int i = 0; i < elements.length; ++i) {
if (OUTLINE_ELEMENT_NAME.equals(elements[i].getName())) {
className = elements[i].getAttribute(OUTLINE_ELEMENT_ATTRIBUTE_CLASS);
break;
}
}
Bundle aBundle = Platform.getBundle(extensions[0].getNamespaceIdentifier());
IContentOutlinePage result = null;
if (aBundle != null) {
try {
aBundle.start();
} catch (BundleException e) {
return null;
}
try {
// throws IllegalAccessException, InstantiationException,
// ClassNotFoundException
result = (IContentOutlinePage) aBundle.loadClass(className).getConstructor().newInstance();
} catch (Exception e) {
return null;
}
}
return result;
}
@Override
public ISelection getSelection() {
RangeSelection rangeSelection = getManager().getSelection();
return new StructuredSelection(new Object[] { rangeSelection.start, rangeSelection.end });
}
@Override
public void init(IEditorSite site, final IEditorInput input) throws PartInitException {
LogUtil.logInfo(HexEditor.ID, "init starts with selection provider " + site.getSelectionProvider());
setSite(site);
if (!(input instanceof IPathEditorInput) && !(input instanceof ILocationProvider)
&& (!(input instanceof IURIEditorInput)) && (!(input instanceof IStorageEditorInput))) {
throw new PartInitException("Input '" + input.toString() + "'is not a file"); //$NON-NLS-1$ //$NON-NLS-2$
}
setInput(input);
// When opening an external file the workbench (Eclipse 3.1) calls
// HexEditorActionBarContributor.
// MyStatusLineContributionItem.fill() before
// HexEditorActionBarContributor.setActiveEditor()
// but we need an editor to fill the status bar.
site.getActionBarContributor().setActiveEditor(this);
site.setSelectionProvider(this);
}
@Override
public boolean isDirty() {
return getManager().isDirty();
}
@Override
public boolean isSaveAsAllowed() {
return true;
}
@Override
public void removeSelectionChangedListener(ISelectionChangedListener listener) {
if (selectionListeners != null) {
selectionListeners.remove(listener);
}
}
void saveToFile(final boolean selection) {
final File file = getManager().showSaveAsDialog(getEditorSite().getShell(), selection);
if (file == null) {
return;
}
IRunnableWithProgress runnable = new IRunnableWithProgress() {
@Override
public void run(IProgressMonitor monitor) {
saveToFile(file, selection, monitor);
}
};
ProgressMonitorDialog monitorDialog = new ProgressMonitorDialog(getEditorSite().getShell());
try {
monitorDialog.run(false, false, runnable);
} catch (InvocationTargetException ex) {
throw new RuntimeException(ex);
} catch (InterruptedException ex) {
throw new RuntimeException(ex);
}
}
void saveToFile(File file, boolean selection, IProgressMonitor monitor) {
monitor.beginTask(Texts.EDITOR_MESSAGE_SAVING_FILE_PLEASE_WAIT, IProgressMonitor.UNKNOWN);
try {
if (selection) {
manager.doSaveSelectionAs(file);
} else {
manager.saveAsFile(file, monitor);
}
} catch (IOException ex) {
monitor.done();
statusLineManager.setErrorMessage(ex.getMessage());
return;
}
monitor.done();
if (!selection) {
setPartName(file.getName());
firePropertyChange(PROP_DIRTY);
}
statusLineManager.setMessage(TextUtility.format(Texts.EDITOR_MESSAGE_FILE_SAVED, file.getAbsolutePath()));
}
@Override
public void setFocus() {
// useless. It is called before ActionBarContributor.setActiveEditor()
// so focusing is done there
hexTexts.setFocus();
}
@Override
public void setSelection(ISelection selection) {
if (selection.isEmpty()) {
return;
}
StructuredSelection aSelection = (StructuredSelection) selection;
long[] startEnd = (long[]) aSelection.getFirstElement();
long start = startEnd[0];
long end = start;
if (startEnd.length > 1) {
end = startEnd[1];
}
if (aSelection.size() > 1) {
startEnd = (long[]) aSelection.toArray()[1];
end = startEnd[0];
if (startEnd.length > 1) {
end = startEnd[1];
}
}
getManager().setSelection(new RangeSelection(start, end));
}
/**
* Updates the status of actions: enables/disables them depending on whether
* there is text selected and whether inserting or overwriting is active.
* Undo/redo actions are enabled/disabled as well.
*/
void updateActionsStatus() {
boolean textSelected = getManager().isTextSelected();
boolean lengthModifiable = textSelected && !manager.isOverwriteMode();
boolean filled = getManager().isFilled();
IActionBars bars = getEditorSite().getActionBars();
IAction action = bars.getGlobalActionHandler(ActionFactory.UNDO.getId());
if (action != null) {
action.setEnabled(manager.canUndo());
}
action = bars.getGlobalActionHandler(ActionFactory.REDO.getId());
if (action != null) {
action.setEnabled(manager.canRedo());
}
action = bars.getGlobalActionHandler(ActionFactory.CUT.getId());
if (action != null) {
action.setEnabled(lengthModifiable);
}
action = bars.getGlobalActionHandler(ActionFactory.COPY.getId());
if (action != null) {
action.setEnabled(textSelected);
}
action = bars.getGlobalActionHandler(ActionFactory.DELETE.getId());
if (action != null) {
action.setEnabled(lengthModifiable);
}
action = bars.getGlobalActionHandler(ActionFactory.SELECT_ALL.getId());
if (action != null) {
action.setEnabled(filled);
}
action = bars.getGlobalActionHandler(ActionFactory.FIND.getId());
if (action != null) {
action.setEnabled(filled);
}
bars.updateActionBars();
}
}
================================================
FILE: net.sourceforge.javahexeditor/src/net/sourceforge/javahexeditor/plugin/editors/HexEditorActionBarContributor.java
================================================
/*
* javahexeditor, a java hex editor
* Copyright (C) 2006, 2009 Jordi Bergenthal, pestatije(-at_)users.sourceforge.net
* The official javahexeditor site is sourceforge.net/projects/javahexeditor
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package net.sourceforge.javahexeditor.plugin.editors;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ContributionItem;
import org.eclipse.jface.action.IContributionItem;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IStatusLineManager;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IEditorActionBarContributor;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.part.EditorActionBarContributor;
import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
import net.sourceforge.javahexeditor.Manager;
import net.sourceforge.javahexeditor.Texts;
/**
* HexEditor contributor. Contributes status bar and menu bar items
*
* @author Jordi Bergenthal
*/
public final class HexEditorActionBarContributor extends EditorActionBarContributor {
private final class MyMenuContributionItem extends ContributionItem {
MenuItem myMenuItem;
MyMenuContributionItem(String id) {
super(id);
}
@Override
public void fill(Menu parent, int index) {
myMenuItem = new MenuItem(parent, SWT.PUSH, index);
myMenuItem.setEnabled(false);
if (MenuIds.SAVE_SELECTION_AS.equals(getId())) {
myMenuItem.setText(Texts.EDITOR_SAVE_SELECTION_AS_MENU_ITEM_LABEL);
myMenuItem.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
activeEditor.saveToFile(true);
}
});
} else if (MenuIds.TRIM.equals(getId())) {
myMenuItem.setText(Texts.EDITOR_TRIM_MENU_ITEM_LABEL);
myMenuItem.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
Manager manager = activeEditor.getManager();
if (manager.isValid()) {
activeEditor.getManager().doTrim();
}
}
});
} else if (MenuIds.SELECT_BLOCK.equals(getId())) {
myMenuItem.setText(Texts.EDITOR_SELECT_BLOCK_MENU_ITEM_LABEL);
// TODO This only works after the "Edit" menu was shown once
myMenuItem.setAccelerator(SWT.CONTROL | 'E');
myMenuItem.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
Manager manager = activeEditor.getManager();
if (manager.isValid()) {
manager.doSelectBlock();
}
}
});
}
}
}
private final class MyMenuListener implements IMenuListener {
public MyMenuListener() {
}
@Override
public void menuAboutToShow(IMenuManager menu) {
boolean textSelected = activeEditor.getManager().isTextSelected();
boolean lengthModifiable = textSelected && !activeEditor.getManager().isOverwriteMode();
boolean filled = activeEditor.getManager().isFilled();
// MenuItem menuItem = getMenuItem(IWorkbenchActionConstants.M_FILE, MenuIds.SAVE_SELECTION_AS);
MenuItem menuItem = getMenuItem(IWorkbenchActionConstants.M_EDIT, MenuIds.SAVE_SELECTION_AS);
if (menuItem != null) {
menuItem.setEnabled(textSelected);
}
menuItem = getMenuItem(IWorkbenchActionConstants.M_EDIT, MenuIds.TRIM);
if (menuItem != null) {
menuItem.setEnabled(lengthModifiable);
}
menuItem = getMenuItem(IWorkbenchActionConstants.M_EDIT, MenuIds.SELECT_BLOCK);
if (menuItem != null) {
menuItem.setEnabled(filled);
}
}
private MenuItem getMenuItem(String prefix, String menuId) {
IActionBars bars = getActionBars();
IContributionItem contributionItem = bars.getMenuManager().findUsingPath(prefix + '/' + menuId);
if (contributionItem != null && ((MyMenuContributionItem) contributionItem).myMenuItem != null
&& !((MyMenuContributionItem) contributionItem).myMenuItem.isDisposed()) {
return ((MyMenuContributionItem) contributionItem).myMenuItem;
}
return null;
}
}
private final class MyStatusLineContributionItem extends ContributionItem {
MyStatusLineContributionItem(String id) {
super(id);
}
@Override
public void fill(Composite parent) {
if (activeEditor != null) {
activeEditor.getManager().createStatusPart(parent, true);
}
}
}
private static final class MenuIds {
public static final String SAVE_SELECTION_AS = "saveSelectionAs";
public static final String TRIM = "trim";
public static final String SELECT_BLOCK = "selectBlock";
public static final String ADDITIONS = "additions";
}
private static final String STATUS_LINE_ITEM_ID = "AllHexEditorStatusItemsItem";
HexEditor activeEditor;
/**
* @see EditorActionBarContributor#contributeToMenu(org.eclipse.jface.action.IMenuManager)
*/
@Override
public void contributeToMenu(IMenuManager menuManager) {
IMenuManager menu;
IMenuListener myMenuListener = new MyMenuListener();
// menu = menuManager.findMenuUsingPath(IWorkbenchActionConstants.M_FILE);
menu = menuManager.findMenuUsingPath(IWorkbenchActionConstants.M_EDIT);
if (menu != null) {
// This is the correct place to add the menu contribution
// "Auswahl speichern unter" aber er findet die MenuID
// org.eclipse.ui.file.save aus unergründlichen Gründen nicht.
// Daher wird es am Ende der "Datei"-Menüs hinzugefügt.
// Das Problem ist mit der Migration auf Eclipse 2020-09
// gekommen. In Eclipse 2019-09 funktionierte es noch.
// menu.insertAfter(IWorkbenchCommandConstants.FILE_SAVE, new MyMenuContributionItem(MenuIds.SAVE_SELECTION_AS));
// menu.addMenuListener(myMenuListener);
menu.add(new MyMenuContributionItem(MenuIds.SAVE_SELECTION_AS));
menu.addMenuListener(myMenuListener);
}
menu = menuManager.findMenuUsingPath(IWorkbenchActionConstants.M_EDIT);
if (menu != null) {
menu.add(new MyMenuContributionItem(MenuIds.TRIM));
menu.addMenuListener(myMenuListener);
}
menu = menuManager.findMenuUsingPath(IWorkbenchActionConstants.M_EDIT);
if (menu != null) {
menu.add(new MyMenuContributionItem(MenuIds.SELECT_BLOCK));
menu.addMenuListener(myMenuListener);
}
menu = menuManager.findMenuUsingPath(IWorkbenchActionConstants.M_NAVIGATE);
if (menu != null) {
Action goToAction = new Action() {
@Override
public boolean isEnabled() {
return activeEditor.getManager().isFilled();
}
@Override
public void run() {
activeEditor.getManager().doGoTo();
}
};
// declared in org.eclipse.ui.workbench.text plugin.xml
goToAction.setActionDefinitionId(ITextEditorActionDefinitionIds.LINE_GOTO);
goToAction.setText(Texts.EDITOR_GO_TO_MENU_ITEM_LABEL);
// TODO This only works after the "Navigate" menu was shown once
// Eclipse standard even has the correct accelerator.
// goToAction.setAccelerator(SWT.CTRL + 'L');
menu.appendToGroup(MenuIds.ADDITIONS, goToAction);
}
}
/**
* @see EditorActionBarContributor#contributeToStatusLine(org.eclipse.jface.action.IStatusLineManager)
*/
@Override
public void contributeToStatusLine(IStatusLineManager statusLineManager) {
statusLineManager.add(new MyStatusLineContributionItem(STATUS_LINE_ITEM_ID));
}
/**
* @see IEditorActionBarContributor#setActiveEditor(org.eclipse.ui.IEditorPart)
*/
@Override
public void setActiveEditor(IEditorPart targetEditor) {
if (targetEditor instanceof HexEditor) {
if (activeEditor != null) {
Manager manager = ((HexEditor) targetEditor).getManager();
manager.reuseStatusLinelFrom(activeEditor.getManager());
}
activeEditor = (HexEditor) targetEditor;
activeEditor.getManager().setFocus();
activeEditor.updateActionsStatus();
}
}
}
================================================
FILE: net.sourceforge.javahexeditor/src/net/sourceforge/javahexeditor/plugin/editors/HexEditorInput.java
================================================
/*
* javahexeditor, a java hex editor
* Copyright (C) 2006, 2009 Jordi Bergenthal, pestatije(-at_)users.sourceforge.net
* The official javahexeditor site is sourceforge.net/projects/javahexeditor
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package net.sourceforge.javahexeditor.plugin.editors;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IPathEditorInput;
import org.eclipse.ui.IStorageEditorInput;
import org.eclipse.ui.IURIEditorInput;
import org.eclipse.ui.editors.text.ILocationProvider;
import org.eclipse.ui.part.FileEditorInput;
import net.sourceforge.javahexeditor.Texts;
import net.sourceforge.javahexeditor.common.TextUtility;
import net.sourceforge.javahexeditor.plugin.HexEditorPlugin;
/**
* Container for file backed input.
*
* @author Peter Dell
*
*/
public final class HexEditorInput {
private boolean valid;
private String inputName;
private File contentFile;
private boolean temporary;
private String charset;
public HexEditorInput() {
inputName = Texts.EMPTY;
}
public boolean isValid() {
return valid;
}
public String getInputName() {
return inputName;
}
public File getContentFile() {
return contentFile;
}
public String getCharset() {
return charset;
}
public void dispose() {
if (temporary) {
contentFile.delete();
}
contentFile = null;
charset = null;
inputName = Texts.EMPTY;
valid = false;
}
public void open(IEditorInput editorInput) throws CoreException {
IFile localFile;
localFile = null;
boolean fromHistory = false;
if (editorInput instanceof FileEditorInput) {
localFile = ((FileEditorInput) editorInput).getFile();
} else if (editorInput instanceof IPathEditorInput) { // eg.
// FileInPlaceEditorInput
IPathEditorInput file = (IPathEditorInput) editorInput;
contentFile = file.getPath().toFile();
} else if (editorInput instanceof ILocationProvider) {
ILocationProvider location = (ILocationProvider) editorInput;
IWorkspaceRoot rootWorkspace = ResourcesPlugin.getWorkspace().getRoot();
localFile = rootWorkspace.getFile(location.getPath(location));
} else if (editorInput instanceof IURIEditorInput) {
URI uri = ((IURIEditorInput) editorInput).getURI();
if (uri != null) {
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
IFile[] files = root.findFilesForLocationURI(uri);
if (files.length != 0) {
localFile = files[0];
} else {
contentFile = new File(uri);
}
}
} else if (editorInput instanceof IStorageEditorInput) {
// Entries opened from other editor inputs or the history are copied into a
// temporary file in a temporary folder which is deleted when copying
// fails, another file is opened or when then program is terminated.
IStorageEditorInput input = (IStorageEditorInput) editorInput;
try {
Path tmpDir = Files.createTempDirectory(null);
Path tmpFile = tmpDir.resolve(input.getStorage().getName());
contentFile = tmpFile.toFile();
contentFile.createNewFile();
contentFile.deleteOnExit(); // to be on the safe side
Files.copy(input.getStorage().getContents(), contentFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
} catch (IOException ex) {
contentFile.delete();
throw new CoreException(new Status(IStatus.ERROR, HexEditorPlugin.ID,
TextUtility.format(Texts.MANAGER_OPEN_MESSAGE_CANNOT_OPEN_FILE, contentFile.getAbsolutePath()),
ex));
} catch (CoreException ex) {
contentFile.delete();
throw ex;
}
if (input.getClass().getName().contains("FileRevisionEditorInput")) {
fromHistory = true;
}
}
// Determine charset from local file
if (localFile != null) {
contentFile = localFile.getLocation().toFile();
try {
charset = localFile.getCharset(true);
} catch (CoreException ex) {
throw new CoreException(new Status(IStatus.ERROR, HexEditorPlugin.ID,
TextUtility.format(Texts.MANAGER_OPEN_MESSAGE_CANNOT_DETERMINE_CHARSET_OF_FILE,
contentFile.getAbsolutePath()),
ex));
}
}
valid = true;
inputName = contentFile.getName();
if (fromHistory) {
inputName = TextUtility.format(Texts.MANAGER_OPEN_TITLE_FILE_FROM_HISTORY, inputName);
}
}
}
================================================
FILE: net.sourceforge.javahexeditor/src/net/sourceforge/javahexeditor/plugin/editors/HexEditorPreferences.java
================================================
/*
* javahexeditor, a java hex editor
* Copyright (C) 2006, 2009 Jordi Bergenthal, pestatije(-at_)users.sourceforge.net
* The official javahexeditor site is sourceforge.net/projects/javahexeditor
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package net.sourceforge.javahexeditor.plugin.editors;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.swt.graphics.FontData;
import net.sourceforge.javahexeditor.Preferences;
import net.sourceforge.javahexeditor.plugin.HexEditorPlugin;
public final class HexEditorPreferences {
/**
* Gets font data information common to all plugin editors. Data comes from the
* preferences store.
*
* @return Font data to be used by plugin editors, not null.
*/
public static FontData getFontData() {
IPreferenceStore store = HexEditorPlugin.getDefault().getPreferenceStore();
String name = store.getString(Preferences.FONT_NAME);
int style = store.getInt(Preferences.FONT_STYLE);
int size = store.getInt(Preferences.FONT_SIZE);
FontData fontData = null;
if (name != null && !name.isEmpty() && size > 0) {
fontData = new FontData(name, size, style);
} else {
fontData = Preferences.getDefaultFontData();
}
return fontData;
}
}
================================================
FILE: net.sourceforge.javahexeditor/src/net/sourceforge/javahexeditor/plugin/editors/HexEditorPreferencesPage.java
================================================
/*
* javahexeditor, a java hex editor
* Copyright (C) 2006, 2009 Jordi Bergenthal, pestatije(-at_)users.sourceforge.net
* The official javahexeditor site is sourceforge.net/projects/javahexeditor
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package net.sourceforge.javahexeditor.plugin.editors;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.osgi.service.prefs.BackingStoreException;
import net.sourceforge.javahexeditor.Preferences;
import net.sourceforge.javahexeditor.PreferencesManager;
import net.sourceforge.javahexeditor.plugin.HexEditorPlugin;
/**
* This class represents a preference page that is contributed to the
* Preferences dialog.
*