Search in sources :

Example 6 with IEncodingSupport

use of org.eclipse.ui.editors.text.IEncodingSupport in project dbeaver by dbeaver.

the class BinaryEditor method loadBinaryContent.

private void loadBinaryContent() {
    String charset = GeneralUtils.UTF8_ENCODING;
    IEditorInput editorInput = getEditorInput();
    if (editorInput instanceof IEncodingSupport) {
        charset = ((IEncodingSupport) editorInput).getEncoding();
    }
    File systemFile = null;
    if (editorInput instanceof IPathEditorInput) {
        systemFile = ((IPathEditorInput) editorInput).getPath().toFile();
    }
    if (systemFile != null) {
        // open file
        try {
            manager.openFile(systemFile, charset);
        } catch (IOException e) {
            log.error("Can't open binary content", e);
        }
        setPartName(systemFile.getName());
    }
}
Also used : IEncodingSupport(org.eclipse.ui.editors.text.IEncodingSupport) IOException(java.io.IOException) File(java.io.File)

Aggregations

IEncodingSupport (org.eclipse.ui.editors.text.IEncodingSupport)6 File (java.io.File)2 IOException (java.io.IOException)2 DefaultEncodingSupport (org.eclipse.ui.editors.text.DefaultEncodingSupport)2 IResource (org.eclipse.core.resources.IResource)1 Dialog (org.eclipse.jface.dialogs.Dialog)1 DialogPage (org.eclipse.jface.dialogs.DialogPage)1 MessageDialog (org.eclipse.jface.dialogs.MessageDialog)1 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)1 PreferenceStore (org.eclipse.jface.preference.PreferenceStore)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Button (org.eclipse.swt.widgets.Button)1 Composite (org.eclipse.swt.widgets.Composite)1 Shell (org.eclipse.swt.widgets.Shell)1 AbstractEncodingFieldEditor (org.eclipse.ui.ide.dialogs.AbstractEncodingFieldEditor)1 EncodingFieldEditor (org.eclipse.ui.ide.dialogs.EncodingFieldEditor)1 ResourceEncodingFieldEditor (org.eclipse.ui.ide.dialogs.ResourceEncodingFieldEditor)1