The faster you "transform" the Middle-East (get women in full participation in society, establish minority rights, free press and free speech, Palestinian-Israeli compromise, etc...), then I think the war will have been won and the likelyhood of repressed anger bottled up due to state-sanctioned oppression won't be a driving force for anti-Jewish/anti-Western thought.
But these are the reasons why terrorist exist in the first place. How can we say we are fighting for the same thing, and the terrorists say they are fighting for the same thing?
The terrorists are clearly against the Saudi monarchy. This monarchy is responsible for the poverty, lack of education, human rights abuses, and pretty much all of the problems there. But the US has, in the past, supported them with money, weapons, and all the tool to keep these people in power. So the terrorists blame the US, in turn.
There were many years were people in Saudi Arabia sought to make peaceful, political changes to their current government, and in the past they've been squashed down because the Saudi government gets a lot of support from western countries (the US isn't the only nation to support them).
The same applies to Egypt. It's a better example because you see a more violent oppression of political activists.
Terrorism came only recently, and my analysis leads me to believe that it's because people were frustrated with the ineffectiveness of attempted dialogues, and now are thinking that violence is the only answer. Plus, take into consideration that Islamic beliefs state that armed conflict when being "oppressed" is justified and considered a noble cause. Terrorism enters the picture when the target is no longer a soldier, but an innocent person.
When we assist those who seek to make changes via peaceful means, we can show that there is a better way, and that terrorism is detrimental to their cause.
Palestine would be a good start, because if the US ever decided to establish a democracy there (because it would not only give them their own freedom [which is a keyword used over and over by the Bush Administration] it would also help stamp out corruption [Arafat and some members of the PLO]), it would really open the eyes of the Arab population.
I see a situation brewing in China, where the Xinjiang Muslims have lived under Communist rule that has oppressed their freedom of religion. Are we going to wait until we hear of news of suicide attack in Beijing? Obviously, we can take steps to eliminate terrorism now in some of these regions. Give people hope that the problem can be solved through non-violence.
The problem with that is the current administration's hasty invasion of Iraq sends the message that dialogue must take a backseat to violence. People will then think that the only language the US can speak, and the only language they can understand, is violence.