copied from eclipse