You will need to do two things.
1) Configure an interpreter that can import dolfin etc. I use a shell script that sources the correct files and then executes python (see below). You can also load fenics and then start eclipse from that shell as suggested by unberto.
2) Add dolfin to the forced builtins list in the interpreter. By default PyDev parses Python code to get auto completion. This does not work for compiled modules that need to be imported and inspected to see what they contain. Numpy etc should already be on the list, see http://www.pydev.org/manual_101_interpreter.html
Here is my shell script for wrapping python with fenics, named "frun-master-python".
#!/usr/bin/bash
# Build arguments for the program from our own arguments
# Convoluted mess from the internet. Shell sucks!
CMD="exec frun-master python"
for (( i = 1; i <= $# ; i++ )); do
eval ARG="\${$i}"
if [[ "$ARG" = "${ARG%[[:space:]]*}" ]]
then
CMD="$CMD $ARG"
else
CMD="$CMD \"$ARG\""
fi
done
eval $CMD
This depends on the following script "frun-master" that can be used with python, mpirun and other commands (instant-clean, ffc etc). You must change a path inside.
#!/usr/bin/bash
# Build arguments for the program from our own arguments
# Convoluted mess from the internet. Shell sucks!
CMD="exec"
for (( i = 1; i <= $# ; i++ )); do
eval ARG="\${$i}"
if [[ "$ARG" = "${ARG%[[:space:]]*}" ]]
then
CMD="$CMD $ARG"
else
CMD="$CMD \"$ARG\""
fi
done
echo "FEniCS Master running $CMD"
source SOME∕PATH∕HERE/fenics.conf
python <<EOF
import sys, os
for p in sys.path:
if os.path.isdir(os.path.join(p, 'dolfin')):
print 'Using dolfin from', p
EOF
eval $CMD