private void COMM_COMM_NewClassParticipant(IStructuredSelection selection) { // Assign the context selection variables with the action context // Assign the context selection variable with the action context Object context = selection.iterator().next(); Communication_c v_comm = (Communication_c) context; PersistableModelComponent.ensureCoreDataTypesAvailable(v_comm.getModelRoot()); TransactionUtil.TransactionGroup transactionGroup = TransactionUtil.startTransactionsOnSelectedModelRoots("New Class Participant"); try { // Ensure that actions take place between Verifier Activity executions Ooaofooa.beginSaveOperation(); if (((v_comm != null))) { if (v_comm != null) { v_comm.Newclassparticipant(); } else { Throwable t = new Throwable(); t.fillInStackTrace(); CorePlugin.logError("Attempted to call an operation on a null instance.", t); } } // end critical section Ooaofooa.endSaveOperation(); // catch all exceptions and cancel the transactions } catch (Exception e) { Ooaofooa.endSaveOperation(); TransactionUtil.cancelTransactions(transactionGroup, e); CorePlugin.logError("Transaction: New Class Participant failed", e); // $NON-NLS-1$ } TransactionUtil.endTransactions(transactionGroup); }
private void CNST_CSP_NewConstant(IStructuredSelection selection) { // Assign the context selection variables with the action context // Assign the context selection variable with the action context Object context = selection.iterator().next(); ConstantSpecification_c v_csp = (ConstantSpecification_c) context; PersistableModelComponent.ensureCoreDataTypesAvailable(v_csp.getModelRoot()); TransactionUtil.TransactionGroup transactionGroup = TransactionUtil.startTransactionsOnSelectedModelRoots("New Constant"); boolean abortTransaction = false; try { // Ensure that actions take place between Verifier Activity executions Ooaofooa.beginSaveOperation(); if (v_csp != null) { v_csp.Newliteralsymbolicconstant(); } else { Throwable t = new Throwable(); t.fillInStackTrace(); CorePlugin.logError("Attempted to call an operation on a null instance.", t); } NonRootModelElement[] children = LiteralSymbolicConstant_c.getManyCNST_LSCsOnR1503( LeafSymbolicConstant_c.getManyCNST_LFSCsOnR1502( SymbolicConstant_c.getManyCNST_SYCsOnR1504(v_csp))); NonRootModelElement newElement = children[children.length - 1]; IPreferenceStore store = CorePlugin.getDefault().getPreferenceStore(); boolean option = store.getBoolean(BridgePointPreferencesStore.USE_DEFAULT_NAME_FOR_CREATION); if (!option) { String oldName = RenameActionUtil.getElementName(newElement); boolean performRename = UIUtil.inputDialog( null, "Element Creation", "Enter the name:", oldName, UIUtil.newRenameValidator(newElement)); if (performRename) { String proposedName = UIUtil.inputDialogResult; RenameActionUtil.setElementName(newElement, proposedName); newElement.setComponent(null); } else { abortTransaction = true; } } // end critical section Ooaofooa.endSaveOperation(); // catch all exceptions and cancel the transactions } catch (Exception e) { Ooaofooa.endSaveOperation(); TransactionUtil.cancelTransactions(transactionGroup, e); CorePlugin.logError("Transaction: New Constant failed", e); // $NON-NLS-1$ } if ((!CorePlugin.getDefault() .getPreferenceStore() .getBoolean(BridgePointPreferencesStore.USE_DEFAULT_NAME_FOR_CREATION)) && abortTransaction) { TransactionUtil.cancelTransactions(transactionGroup); } else { TransactionUtil.endTransactions(transactionGroup); } }