boolean commit =  (dialog.open() == Dialog.OK); String newDataSetName = processor.getStringValue(items); if(currentDataSetName != null && !currentDataSetName.equals(newDataSetName)) { commit = MessageDialog.openQuestion(null, Messages.getString("dataBinding.title.changeDataSet"), Messages.getString("dataBinding.message.changeDataSet")); } if(commit) { stack.commit(); } else { stack.rollback(); } } }
if ( dialog.open( ) == Dialog.OK ) { String newDataSetName = processor.getStringValue( items ); if ( !currentDataSetName.equals( newDataSetName ) ) { if ( StringUtil.isBlank( currentDataSetName ) || MessageDialog.openQuestion( UIUtil.getDefaultShell( ), Messages.getString( "dataBinding.title.changeDataSet" ), Messages.getString( "dataBinding.message.changeDataSet" ) ) ) { stack.commit( ); return; } } } stack.rollback( ); } }
    public void run()    {        //Get the first item in the list and pass the model object to the dialog        TableEditPart editPart = getTableEditPart();        if(editPart != null)        {            CommandStack stack = SessionHandleAdapter.getInstance( ).getReportDesign( ).getActivityStack( );            stack.startTrans(Messages.getString("DesignerActionBarContributor.menu.element.editDataBinding")); //$NON-NLS-1$            PropertyProcessor processor = new PropertyProcessor( ReportDesignConstants.TABLE_ITEM,                    ReportItem.DATA_SET_PROP );            ArrayList items = new ArrayList();            items.add(editPart.getModel());            String currentDataSetName = processor.getStringValue(items);            DataBindingDialog dialog = new DataBindingDialog(PlatformUI.getWorkbench( )                    .getDisplay( )                    .getActiveShell( ), (DesignElementHandle) editPart.getModel() );            boolean commit =  (dialog.open() == Dialog.OK);            String newDataSetName = processor.getStringValue(items);            if(currentDataSetName != null && !currentDataSetName.equals(newDataSetName))            {                commit = MessageDialog.openQuestion(null, Messages.getString("dataBinding.title.changeDataSet"), Messages.getString("dataBinding.message.changeDataSet")); //$NON-NLS-1$            }            if(commit)            {                stack.commit();            }            else            {                stack.rollback();            }        }    }