public static void handleFileOpenEvent(IWorkbenchPartReference partRef) {
        // get preference store of this plugin
        IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore();

        IWorkbenchPart part = partRef.getPart(true);
        if (part instanceof IEditorPart) {
            /*
             * Some of the possible editor types and their input:
             * 
             * - Text editor:
             *   editorInput = org.eclipse.ui.part.FileEditorInput(/ProjectName/Example.txt)
             *     (when opening a file)
             *   editorInput = org.eclipse.ui.internal.editors.text.NonExistingFileEditorInput
             *     (after creating a new file with the new wizard)
             *   
             * - Java editor (JDT):
             *   part = org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor
             *   editorInput = org.eclipse.ui.part.FileEditorInput(/ProjectName/src/Example.java)
             *   
             * - XML editor (WTP):
             *   part = org.eclipse.wst.xml.ui.internal.tabletree.XMLMultiPageEditorPart
             *   editorInput = org.eclipse.ui.part.FileEditorInput(/ProjectName/Example.xml)
             * 
             */
            IEditorPart editorPart = (IEditorPart) part;

            // immediately activate word wrap when it is enabled for all files
            if (preferenceStore.getBoolean("de.cdhq.eclipse.wordwrap.autoenable.forall")) {
                WordWrapUtils.setWordWrap(editorPart, true);
                return;
            }

            // check if auto word wrap is enabled for file extensions
            if (!preferenceStore.getBoolean("de.cdhq.eclipse.wordwrap.autoenable.forextensions")) {
                return;
            }

            // get file name of editor's input
            IEditorInput input = editorPart.getEditorInput();
            IFile file = ResourceUtil.getFile(input);

            // file can be null if an empty file is created
            if (file != null) {
                String fileExtension = file.getFileExtension();

                // stop if file extension is empty (i.e. null)
                if (fileExtension == null) {
                    return;
                }

                // get extensions from preference store
                String[] extensions = ExtensionListFieldEditor.parseString(preferenceStore.getString("de.cdhq.eclipse.wordwrap.autoenable.forextensions.extensions"));

                // check if extension is covered by extensioned selected in preferences
                for (String ext : extensions) {
                    if (ext.equals(fileExtension)) {
                        // extension found: activate wrapping
                        WordWrapUtils.setWordWrap(editorPart, true);

                        // no further action necessary
                        return;
                    }
                }
            }
        }
    }