As long Hamas is there, there is a security threat and Hamas can hide behind civilians. But even if Israel dismantles the current Hamas structures, in a few years they or something similar will be back.
If the Israeli occupation of Palestine stops, Hamas will either disappear on its own, mellow out into a normal government or become just another terrorist organization like the IRA in Ireland. That's usually how it goes.