final FormStylePopup form = new FormStylePopup( images.ruleAsset(),
constants.CopyThisItem() );
final TextBox newName = new TextBox();
form.addAttribute( constants.NewName(),
newName );
final RulePackageSelector sel = new RulePackageSelector();
form.addAttribute( constants.NewPackage(),
sel );
Button ok = new Button( constants.CreateCopy() );
ok.addClickHandler( new ClickHandler() {
public void onClick(ClickEvent arg0) {
if ( newName.getText() == null
|| newName.getText().equals( "" ) ) {
Window.alert( constants.AssetNameMustNotBeEmpty() );
return;
}
String name = newName.getText().trim();
RepositoryServiceFactory.getAssetService().copyAsset( asset.getUuid(),
sel.getSelectedPackage(),
name,
new GenericCallback<String>() {
public void onSuccess(String data) {
eventBus.fireEvent( new RefreshModuleEditorEvent( asset.getMetaData().getPackageUUID() ) );
flushSuggestionCompletionCache(sel.getSelectedPackage(), null);
completedCopying( newName.getText(),
sel.getSelectedPackage(),
data );
form.hide();
}
@Override