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 ) {
callback.okPressed();
} else {
deleteConfirmDialog.setCallback( callback );
deleteConfirmDialog.center();
}
}