Author: bobtarling Date: 2010-03-24 11:12:32-0700 New Revision: 18154 Added: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/NavigateUpAction.java Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/SwingUIFactory.java
Log: Provide navigate up button on all panels Added: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/NavigateUpAction.java Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/NavigateUpAction.java?view=markup&pathrev=18154 ============================================================================== --- (empty file) +++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/NavigateUpAction.java 2010-03-24 11:12:32-0700 @@ -0,0 +1,46 @@ +/* $Id$ + ******************************************************************************* + * Copyright (c) 2010 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: + * Bob Tarling + ******************************************************************************* + */ + +package org.argouml.core.propertypanels.ui; + +import java.awt.event.ActionEvent; + +import javax.swing.AbstractAction; + +import org.argouml.application.helpers.ResourceLoaderWrapper; +import org.argouml.i18n.Translator; +import org.argouml.model.Model; +import org.argouml.ui.targetmanager.TargetManager; + +/** + * This action changes the target to the owning model element + * of the given element. + * + * @author Bob Tarling + */ +class NavigateUpAction extends AbstractAction { + + final Object modelElement; + + public NavigateUpAction(Object modelElement) { + super(Translator.localize("action.navigate-up"), + ResourceLoaderWrapper.lookupIcon("action.navigate-up")); + + this.modelElement = modelElement; + } + public void actionPerformed(ActionEvent arg0) { + TargetManager.getInstance().setTarget( + Model.getFacade().getModelElementContainer(modelElement)); + } + +} Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/SwingUIFactory.java Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/SwingUIFactory.java?view=diff&pathrev=18154&r1=18153&r2=18154 ============================================================================== --- trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/SwingUIFactory.java (original) +++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/SwingUIFactory.java 2010-03-24 11:12:32-0700 @@ -118,6 +118,7 @@ JToolBar tb = tbf.createToolBar(); tb.add(new JLabel(metaTypeName, ResourceLoaderWrapper.lookupIconResource(metaTypeName), JLabel.LEFT)); if (!Model.getModelManagementHelper().isReadOnly(target)) { + tb.add(new NavigateUpAction(target)); tb.add(new ActionDeleteModelElements()); // We only have this here until we have stereotypes // list on property panel ------------------------------------------------------ http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=2464466 To unsubscribe from this discussion, e-mail: [[email protected]].
