Author: bobtarling Date: 2011-03-22 15:23:21-0700 New Revision: 19118 Modified: trunk/src/argouml-app/src/org/argouml/ui/explorer/rules/GoStateMachineToState.java
Log: Prevent explorer from breaking when euml method not implemented Modified: trunk/src/argouml-app/src/org/argouml/ui/explorer/rules/GoStateMachineToState.java Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/ui/explorer/rules/GoStateMachineToState.java?view=diff&pathrev=19118&r1=19117&r2=19118 ============================================================================== --- trunk/src/argouml-app/src/org/argouml/ui/explorer/rules/GoStateMachineToState.java (original) +++ trunk/src/argouml-app/src/org/argouml/ui/explorer/rules/GoStateMachineToState.java 2011-03-22 15:23:21-0700 @@ -1,13 +1,14 @@ /* $Id$ ***************************************************************************** - * Copyright (c) 2009 Contributors - see below + * Copyright (c) 2009-2011 Contributors - see below * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * tfmorris + * Tom Morris + * Bob Tarling ***************************************************************************** * * Some portions of this file was previously release using the BSD License: @@ -45,6 +46,7 @@ import java.util.HashSet; import java.util.Set; +import org.apache.log4j.Logger; import org.argouml.i18n.Translator; import org.argouml.model.Model; @@ -56,6 +58,9 @@ */ public class GoStateMachineToState extends AbstractPerspectiveRule { + private static final Logger LOG = + Logger.getLogger(GoStateMachineToState.class); + /* * @see org.argouml.ui.explorer.rules.PerspectiveRule#getRuleName() */ @@ -91,9 +96,19 @@ if (Model.getFacade().isAStateMachine(parent)) { Set set = new HashSet(); set.add(parent); - if (Model.getFacade().getTop(parent) != null) { - set.add(Model.getFacade().getTop(parent)); - } + try { + if (Model.getFacade().getTop(parent) != null) { + set.add(Model.getFacade().getTop(parent)); + } + } catch (RuntimeException e) { + if (Model.getFacade().getUmlVersion().startsWith("2")) { + // TODO: Ignore and report exception until getTop + // implemented. + LOG.error("Explorer caught exception ", e); + } else { + throw e; + } + } return set; } return Collections.EMPTY_SET; ------------------------------------------------------ http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=2713286 To unsubscribe from this discussion, e-mail: [[email protected]].
