blob: 8095b8741302aa814ed5efd320dfdab9792b1c91 [file] [log] [blame]
kchonge0590cf2006-04-19 14:44:09 +00001/*******************************************************************************
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 *******************************************************************************/
csaltera28ae452006-04-16 22:04:44 +000011package org.eclipse.wst.xsd.ui.internal.common.commands;
12
csaltera28ae452006-04-16 22:04:44 +000013import 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 */
kchong59966042006-08-21 21:09:18 +000019public class UpdateAttributeValueCommand extends BaseCommand
csaltera28ae452006-04-16 22:04:44 +000020{
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 {
kchong59966042006-08-21 21:09:18 +000035 try
36 {
37 beginRecording(element);
38 element.setAttribute(attributeName, attributeValue);
39 }
40 finally
41 {
42 endRecording();
43 }
csaltera28ae452006-04-16 22:04:44 +000044 }
45}