When Sinn Fein distanced itself from the IRA and became a political organisation that would condemn violence (and by its actions helping to reduce the level of violence in NI), it was able to enter negotiations with the UK government that was under international pressure, especially from the USA, to make the negotiations work.
Hamas have chosen the route of; violence will work, despite all the evidence it will not. Unless they are replaced by or become a political only organisation that condemns violence, they are doomed to fail and cause many deaths.
But the negotiation (GFA) was not between Sinn Fein and the UK and Irish governments, but the IRA a terrorist organisation and the governments. Sinn Fein was beholden to the IRA, they may have expressed non-violent intentions but the armalite was there if they stepped too far out of line. (A close friend was Martin McGuiness's PA so I have some info, including how IRA enforcers were present in negotiations with Sinn Fein.)
The governments were prepared to negotiate with terrorists whilst they were carrying out terrorist actions to end the violence. Peace may involve negotiation with those who want to kill you.