private void reactToPartChange(IWorkbenchPartReference part) {
        if (!autoSync)
            return;
        if (!(part.getPart(false) instanceof IEditorPart))
            return;
        IEditorPart editorPart = (IEditorPart) part.getPart(false);
        if (!getViewSite().getPage().isPartVisible(editorPart))
            return;
        IGraphicalFileProvider graphicalSource = (IGraphicalFileProvider) editorPart
                .getAdapter(IGraphicalFileProvider.class);
        if (graphicalSource != null)
            selectedFile = graphicalSource.getGraphicalFile();
        else
            selectedFile = null;
        if (selectedFile == null) {
            IFile asFile = (IFile) editorPart.getAdapter(IFile.class);
            if (asFile == null)
                asFile = (IFile) editorPart.getEditorInput().getAdapter(IFile.class);
            if (asFile == null)
                return;
            selectedFile = asFile;
        }
        requestUpdate();
    }