* (non-Javadoc)
*
* @see com.google.gwt.user.client.Command#execute()
*/
protected void performOperation( boolean feedback ) {
final SolutionFileActionEvent event = new SolutionFileActionEvent();
event.setAction( this.getClass().getName() );
VerticalPanel vp = new VerticalPanel();
String deleteMessage;
final PromptDialogBox deleteConfirmDialog;
if ( mode.equals( "purge" ) ) {
deleteMessage = Messages.getString( "deleteAllQuestion" );
deleteConfirmDialog =
new PromptDialogBox(
Messages.getString( "emptyTrash" ), Messages.getString( "yesEmptyTrash" ), Messages.getString( "no" ), false, true, vp ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
} else {
if ( MULTIPLE_DELETE_TYPE.equals( type ) ) {
deleteMessage = Messages.getString( "deleteMultiQuestion" );
} else {
deleteMessage = Messages.getString( "deleteQuestion", type );
}
deleteConfirmDialog =
new PromptDialogBox(
Messages.getString( "permDelete" ), Messages.getString( "yesPermDelete" ), Messages.getString( "no" ), false, true, vp ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
vp.add( new HTML( deleteMessage ) ); //$NON-NLS-1$
final IDialogCallback callback = new IDialogCallback() {
public void cancelPressed() {
deleteConfirmDialog.hide();
}
public void okPressed() {
String temp = "";
// Add js file list
temp = temp + fileList;
// remove trailing ","
temp = temp.substring( 0, temp.length() - 1 );
final String filesList = temp;
String deleteFilesURL = contextURL + "api/repo/files/deletepermanent"; //$NON-NLS-1$
RequestBuilder deleteFilesRequestBuilder = new RequestBuilder( RequestBuilder.PUT, deleteFilesURL );
deleteFilesRequestBuilder.setHeader( "Content-Type", "text/plain" ); //$NON-NLS-1$//$NON-NLS-2$
deleteFilesRequestBuilder.setHeader( "If-Modified-Since", "01 Jan 1970 00:00:00 GMT" );
try {
deleteFilesRequestBuilder.sendRequest( filesList, new RequestCallback() {
@Override
public void onError( Request request, Throwable exception ) {
MessageDialogBox dialogBox =
new MessageDialogBox( Messages.getString( "error" ), Messages.getString( "couldNotDeleteFile" ), //$NON-NLS-1$ //$NON-NLS-2$
false, false, true );
dialogBox.center();
event.setMessage( Messages.getString( "couldNotDeleteFile" ) );
EventBusUtil.EVENT_BUS.fireEvent( event );
}
@Override
public void onResponseReceived( Request request, Response response ) {
if ( response.getStatusCode() == 200 ) {
new RefreshRepositoryCommand().execute( false );
event.setMessage( "Success" );
FileChooserDialog.setIsDirty( Boolean.TRUE );
setBrowseRepoDirty( Boolean.TRUE );
EventBusUtil.EVENT_BUS.fireEvent( event );
} else {
event.setMessage( Messages.getString( "couldNotDeleteFile" ) );
EventBusUtil.EVENT_BUS.fireEvent( event );
}
}
} );
} catch ( RequestException e ) {
MessageDialogBox dialogBox =
new MessageDialogBox( Messages.getString( "error" ), Messages.getString( "couldNotDeleteFile" ), //$NON-NLS-1$ //$NON-NLS-2$
false, false, true );
dialogBox.center();
event.setMessage( Messages.getString( "couldNotDeleteFile" ) );
EventBusUtil.EVENT_BUS.fireEvent( event );
}
}
};
if ( !feedback ) {