cloudfoundry/eclipse-integration-cloudfoundry — pull request #23 by liuhewei (2014-09-19 06:37:22+00:00)
Title: Support replacing unbound cloud application by local project

This PR follows [PR#22](https://github.com/cloudfoundry/eclipse-integration-cloudfoundry/pull/22). In this time, a dialog box is added to local project's drag-and-drop operation, and a new item "Replace" is added to the unbound cloud apps' context menu.

- Now local project's drag-and-drop operation will trigger a wizard for user to decide: publish directly or replace an existing unbounded cloud application:

![issue4_processchoicewizard](https://cloud.githubusercontent.com/assets/7316500/4324112/12e2db94-3f57-11e4-813d-5cb5b8cc4a59.PNG)

>If the user choose 'Publish...', the existing application publishing process follows; Otherwise, if the user choose 'Choose an existing ....', a replacement confirmation dialog is presented.

![issue4_confirmationdialog](https://cloud.githubusercontent.com/assets/7316500/4300597/9fdbeaf2-3e46-11e4-8b6e-31b746325b21.PNG)

>>If the user clicks 'Cancel' button, nothing happens; Otherwise, the replacing process is executed in background: The local corresponding CloudFoundryApplicationModule is deleted, and a new Module related to the dropped project is created. Then, the java project is packed into a '.war' and will replace
the cloud application through CloudFoundryClient.uploadApplication(appName, warFile) .

- In another way, if user right-clicks a cloud application which is not bound with any local project yet, a 'Replace' item will be shown in the context menu:

![issue4_rightmenu](https://cloud.githubusercontent.com/assets/7316500/4314759/290727a2-3ee6-11e4-9af9-12d7597e0026.PNG)

>If user clicks the 'Replace' menu item, a drop-list box for choosing one local unbound project is shown.

![issue4_rightmenuselectiondialog](https://cloud.githubusercontent.com/assets/7316500/4314763/36aa83f4-3ee6-11e4-800c-bc9c85202d83.PNG)

>>Then press 'OK' button a confirmation dialog is presented for ensuring this operation:

![issue4_rightmenuconfirmdialog](https://cloud.githubusercontent.com/assets/7316500/4314768/4657b056-3ee6-11e4-81c2-7cb92f21f0aa.PNG)

>>>If choosing 'OK', the background will do the same replacing thing as the drag-and-drop operation.

- In both above scenes, the new war file is pushed to remote CF and replaces the contents of the cloud application, and the relation between the local project and the cloud application is established. So the code modification in the future can be done through the 'Update and Restart' button.

![issue4_relationestablished](https://cloud.githubusercontent.com/assets/7316500/4316121/6f44c7d0-3f02-11e4-835b-f5fc06fcae9b.PNG)