/** * Set the name of the port, and mirror the change in all the mirror ports. This method is * write-synchronized on the workspace, and increments the version of the workspace. * * @exception IllegalActionException If the name has a period. * @exception NameDuplicationException If there is already a port with the same name in the * container. */ @Override public void setName(String name) throws IllegalActionException, NameDuplicationException { boolean disableStatus = _mirrorDisable; try { _workspace.getWriteAccess(); if (_mirrorDisable || getContainer() == null) { // change sibling if (_hasSibling && isOutput() && getContainer() != null) { TransitionRefinement container = (TransitionRefinement) getContainer(); TransitionRefinementPort sibling = (TransitionRefinementPort) container.getPort(getName() + "_in"); sibling._mirrorDisable = true; sibling.setName(name + "_in"); sibling._mirrorDisable = false; } // Have already called the super class. // This time, process the request. super.setName(name); } else { _mirrorDisable = true; boolean success = false; Nameable container = getContainer(); if (container != null) { Nameable modal = container.getContainer(); if (modal instanceof ModalModel) { Port port = ((ModalModel) modal).getPort(getName()); if (port != null) { port.setName(name); success = true; } } } if (!success) { super.setName(name); } } } finally { _mirrorDisable = disableStatus; _workspace.doneWriting(); } }