/** * This builds a CallAction with default attributes. But without Operation! * * @author MVW * @param s string representing the Script of the Action * @return The newly created CallAction. */ private Object buildNewCallAction(String s) { Object a = Model.getCommonBehaviorFactory().createCallAction(); Object ae = Model.getDataTypesFactory().createActionExpression(LANGUAGE, s); Model.getCommonBehaviorHelper().setScript(a, ae); Model.getCoreHelper().setName(a, "anon"); return a; }
/* * @see org.argouml.uml.ui.UMLExpressionModel2#setExpression(java.lang.Object) */ public void setExpression(Object expression) { Object target = TargetManager.getInstance().getTarget(); if (target == null) { throw new IllegalStateException("There is no target for " + getContainer()); } Model.getCommonBehaviorHelper().setRecurrence(target, expression); }
/* * @see org.tigris.gef.undo.UndoableAction#actionPerformed(java.awt.event.ActionEvent) */ @Override public void actionPerformed(ActionEvent e) { super.actionPerformed(e); Object context = getObjectToRemove(); if (context != null) { Object signal = getTarget(); if (Model.getFacade().isASignal(signal)) { Model.getCommonBehaviorHelper().removeContext(signal, context); } } }
/** @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) */ public void actionPerformed(ActionEvent e) { super.actionPerformed(e); Object source = e.getSource(); if (source instanceof UMLComboBox2) { Object selected = ((UMLComboBox2) source).getSelectedItem(); Object target = ((UMLComboBox2) source).getTarget(); if (Model.getFacade().isACallEvent(target) && Model.getFacade().isAOperation(selected)) { if (Model.getFacade().getOperation(target) != selected) { Model.getCommonBehaviorHelper().setOperation(target, selected); } } } }
/** * Update an existing Action with a new Script. * * @author MVW * @param old the Action * @param s a string representing a new Script for the ActionExpression */ private void updateAction(Object old, String s) { Object ae = Model.getFacade().getScript(old); // the ActionExpression String language = LANGUAGE; if (ae != null) { language = Model.getDataTypesHelper().getLanguage(ae); String body = (String) Model.getFacade().getBody(ae); if (body.equals(s)) { return; } } ae = Model.getDataTypesFactory().createActionExpression(language, s); Model.getCommonBehaviorHelper().setScript(old, ae); }
/** * Test setSignal(). * * @throws InvocationTargetException test failure * @throws InterruptedException test failure */ public void testSetSignal() throws InterruptedException, InvocationTargetException { Model.getCommonBehaviorHelper().setSignal(elem, signals[0]); ThreadHelper.synchronize(); // One can only do this by changing target, // so let's simulate that: Object dummy = Model.getCommonBehaviorFactory().createReception(); model.targetSet( new TargetEvent(this, TargetEvent.TARGET_SET, new Object[] {elem}, new Object[] {dummy})); model.targetSet( new TargetEvent(this, TargetEvent.TARGET_SET, new Object[] {dummy}, new Object[] {elem})); ThreadHelper.synchronize(); assertTrue(model.getSelectedItem() == signals[0]); }
/* * @see org.tigris.gef.undo.UndoableAction#actionPerformed(java.awt.event.ActionEvent) */ @Override public void actionPerformed(ActionEvent e) { super.actionPerformed(e); Object reception = getObjectToRemove(); if (reception != null) { Object signal = getTarget(); if (Model.getFacade().isASignal(signal)) { // TODO: Should we delete the Reception? A Reception // without a Signal violates the cardinality of 1 in // the metamodel - tfm - 20070308 Model.getCommonBehaviorHelper().removeReception(signal, reception); } } }
@Override protected void doIt(Collection selected) { Model.getCommonBehaviorHelper().setReception(getTarget(), selected); }