kchong | e0590cf | 2006-04-19 14:44:09 +0000 | [diff] [blame] | 1 | /******************************************************************************* |
| 2 | * Copyright (c) 2001, 2006 IBM Corporation and others. |
| 3 | * All rights reserved. This program and the accompanying materials |
| 4 | * are made available under the terms of the Eclipse Public License v1.0 |
| 5 | * which accompanies this distribution, and is available at |
| 6 | * http://www.eclipse.org/legal/epl-v10.html |
| 7 | * |
| 8 | * Contributors: |
| 9 | * IBM Corporation - initial API and implementation |
| 10 | *******************************************************************************/ |
csalter | a28ae45 | 2006-04-16 22:04:44 +0000 | [diff] [blame] | 11 | package org.eclipse.wst.xsd.ui.internal.common.commands; |
| 12 | |
csalter | a28ae45 | 2006-04-16 22:04:44 +0000 | [diff] [blame] | 13 | import org.w3c.dom.Element; |
| 14 | |
| 15 | /* |
| 16 | * This command is used from the extension view to edit extension elements |
| 17 | * and attributes which are implemented as DOM objects (not part of the EMF model) |
| 18 | */ |
kchong | 5996604 | 2006-08-21 21:09:18 +0000 | [diff] [blame^] | 19 | public class UpdateAttributeValueCommand extends BaseCommand |
csalter | a28ae45 | 2006-04-16 22:04:44 +0000 | [diff] [blame] | 20 | { |
| 21 | Element element; |
| 22 | String attributeName; |
| 23 | String attributeValue; |
| 24 | |
| 25 | public UpdateAttributeValueCommand(Element element, String attributeName, String attributeValue) |
| 26 | { |
| 27 | this.element = element; |
| 28 | this.attributeName = attributeName; |
| 29 | this.attributeValue = attributeValue; |
| 30 | } |
| 31 | |
| 32 | |
| 33 | public void execute() |
| 34 | { |
kchong | 5996604 | 2006-08-21 21:09:18 +0000 | [diff] [blame^] | 35 | try |
| 36 | { |
| 37 | beginRecording(element); |
| 38 | element.setAttribute(attributeName, attributeValue); |
| 39 | } |
| 40 | finally |
| 41 | { |
| 42 | endRecording(); |
| 43 | } |
csalter | a28ae45 | 2006-04-16 22:04:44 +0000 | [diff] [blame] | 44 | } |
| 45 | } |