Search in sources :

Example 1 with CodeCharactersCase

use of org.exbin.deltahex.CodeCharactersCase in project deltahex-java by exbin.

the class CodeAreaOperationCommandHandler method copyAsCode.

@Override
public void copyAsCode() {
    SelectionRange selection = ((SelectionCapable) codeArea.getWorker()).getSelection();
    if (!selection.isEmpty()) {
        long first = selection.getFirst();
        long last = selection.getLast();
        BinaryData copy = codeArea.getData().copy(first, last - first + 1);
        CodeType codeType = ((CodeTypeCapable) codeArea.getWorker()).getCodeType();
        CodeCharactersCase charactersCase = ((CodeCharactersCaseCapable) codeArea.getWorker()).getCodeCharactersCase();
        CodeAreaUtils.CodeDataClipboardData binaryData = new CodeAreaUtils.CodeDataClipboardData(copy, binaryDataFlavor, codeType, charactersCase);
        setClipboardContent(binaryData);
    }
}
Also used : CodeAreaUtils(org.exbin.deltahex.CodeAreaUtils) CodeCharactersCase(org.exbin.deltahex.CodeCharactersCase) SelectionRange(org.exbin.deltahex.SelectionRange) CodeTypeCapable(org.exbin.deltahex.capability.CodeTypeCapable) CodeType(org.exbin.deltahex.CodeType) CodeCharactersCaseCapable(org.exbin.deltahex.capability.CodeCharactersCaseCapable) BinaryData(org.exbin.utils.binary_data.BinaryData) SelectionCapable(org.exbin.deltahex.capability.SelectionCapable)

Example 2 with CodeCharactersCase

use of org.exbin.deltahex.CodeCharactersCase in project deltahex-java by exbin.

the class DefaultCodeAreaCommandHandler method copyAsCode.

@Override
public void copyAsCode() {
    SelectionRange selection = ((SelectionCapable) codeArea.getWorker()).getSelection();
    if (!selection.isEmpty()) {
        BinaryData data = codeArea.getData();
        if (data == null) {
            return;
        }
        long first = selection.getFirst();
        long last = selection.getLast();
        BinaryData copy = data.copy(first, last - first + 1);
        CodeType codeType = ((CodeTypeCapable) codeArea.getWorker()).getCodeType();
        CodeCharactersCase charactersCase = ((CodeCharactersCaseCapable) codeArea.getWorker()).getCodeCharactersCase();
        CodeAreaUtils.CodeDataClipboardData binaryData = new CodeAreaUtils.CodeDataClipboardData(copy, binaryDataFlavor, codeType, charactersCase);
        setClipboardContent(binaryData);
    }
}
Also used : CodeAreaUtils(org.exbin.deltahex.CodeAreaUtils) CodeCharactersCase(org.exbin.deltahex.CodeCharactersCase) SelectionRange(org.exbin.deltahex.SelectionRange) CodeTypeCapable(org.exbin.deltahex.capability.CodeTypeCapable) CodeType(org.exbin.deltahex.CodeType) CodeCharactersCaseCapable(org.exbin.deltahex.capability.CodeCharactersCaseCapable) EditableBinaryData(org.exbin.utils.binary_data.EditableBinaryData) BinaryData(org.exbin.utils.binary_data.BinaryData) SelectionCapable(org.exbin.deltahex.capability.SelectionCapable)

Aggregations

CodeAreaUtils (org.exbin.deltahex.CodeAreaUtils)2 CodeCharactersCase (org.exbin.deltahex.CodeCharactersCase)2 CodeType (org.exbin.deltahex.CodeType)2 SelectionRange (org.exbin.deltahex.SelectionRange)2 CodeCharactersCaseCapable (org.exbin.deltahex.capability.CodeCharactersCaseCapable)2 CodeTypeCapable (org.exbin.deltahex.capability.CodeTypeCapable)2 SelectionCapable (org.exbin.deltahex.capability.SelectionCapable)2 BinaryData (org.exbin.utils.binary_data.BinaryData)2 EditableBinaryData (org.exbin.utils.binary_data.EditableBinaryData)1