[158587] Fix Undo from property sheets
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDSubstitutionGroupEditManager.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDSubstitutionGroupEditManager.java
index a6f9641..1019a0d 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDSubstitutionGroupEditManager.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDSubstitutionGroupEditManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2001, 2006 IBM Corporation and others.
+ * Copyright (c) 2001, 2008 IBM Corporation and others.
* 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
@@ -59,13 +59,13 @@
}
if (elementDec != null)
{
- Command command = new UpdateAttributeValueCommand(concreteComponent.getElement(), XSDConstants.SUBSTITUTIONGROUP_ATTRIBUTE, elementDec.getQName(concreteComponent.getSchema()));
+ Command command = new UpdateAttributeValueCommand(concreteComponent.getElement(), XSDConstants.SUBSTITUTIONGROUP_ATTRIBUTE, elementDec.getQName(concreteComponent.getSchema()), org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_LABEL_SUBSTITUTION_GROUP);
command.execute();
}
}
else
{
- Command command = new UpdateAttributeValueCommand(concreteComponent.getElement(), XSDConstants.SUBSTITUTIONGROUP_ATTRIBUTE, ((XSDElementDeclaration)component.getObject()).getQName(concreteComponent.getSchema()));
+ Command command = new UpdateAttributeValueCommand(concreteComponent.getElement(), XSDConstants.SUBSTITUTIONGROUP_ATTRIBUTE, ((XSDElementDeclaration)component.getObject()).getQName(concreteComponent.getSchema()), org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_LABEL_SUBSTITUTION_GROUP);
command.execute();
}
}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateAttributeValueCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateAttributeValueCommand.java
index f6dbe81..cc443d3 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateAttributeValueCommand.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateAttributeValueCommand.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2001, 2006 IBM Corporation and others.
+ * Copyright (c) 2001, 2008 IBM Corporation and others.
* 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
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.wst.xsd.ui.internal.common.commands;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.wst.xsd.ui.internal.common.util.Messages;
import org.w3c.dom.Element;
/*
@@ -21,9 +23,9 @@
*/
public class UpdateAttributeValueCommand extends BaseCommand
{
- Element element;
- String attributeName;
- String attributeValue;
+ protected Element element;
+ protected String attributeName;
+ protected String attributeValue;
/** Whether the attribute should be deleted if value to
* be set is an empty String or null */
@@ -36,15 +38,27 @@
this.attributeValue = attributeValue;
this.deleteIfValueEmpty = deleteIfValueEmpty;
}
+
+ public UpdateAttributeValueCommand(Element element, String attributeName, String attributeValue, String label)
+ {
+ this(element, attributeName, attributeValue, false);
+ setLabel(NLS.bind(Messages._UI_ACTION_CHANGE, label));
+ }
public UpdateAttributeValueCommand(Element element, String attributeName, String attributeValue)
{
- this(element, attributeName, attributeValue, false);
+ this(element, attributeName, attributeValue, false);
+ setLabel(NLS.bind(Messages._UI_ACTION_CHANGE, attributeName));
}
public void setDeleteIfEmpty(boolean v)
{
- deleteIfValueEmpty = v;
+ deleteIfValueEmpty = v;
+ }
+
+ public void setAttributeName(String attributeName)
+ {
+ this.attributeName = attributeName;
}
public void execute()
@@ -61,10 +75,17 @@
{
element.setAttribute(attributeName, attributeValue);
}
+
+ doPostProcessing();
}
finally
{
endRecording();
}
- }
+ }
+
+ protected void doPostProcessing()
+ {
+
+ }
}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/AbstractExtensionsSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/AbstractExtensionsSection.java
index 4abc23d..8a80a25 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/AbstractExtensionsSection.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/AbstractExtensionsSection.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
+ * Copyright (c) 2001, 2008 IBM Corporation and others.
* 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
@@ -83,6 +83,12 @@
super();
}
+ public void setInput(IWorkbenchPart part, ISelection selection)
+ {
+ super.setInput(part, selection);
+ extensionDetailsViewer.setCommandStack(getCommandStack());
+ }
+
class InternalNodeAdapter implements INodeAdapter
{
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDAttributeDeclarationSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDAttributeDeclarationSection.java
index c9e132e..97987cd 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDAttributeDeclarationSection.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDAttributeDeclarationSection.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
+ * Copyright (c) 2001, 2008 IBM Corporation and others.
* 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
@@ -14,6 +14,7 @@
import org.eclipse.gef.commands.Command;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.window.Window;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CCombo;
import org.eclipse.swt.custom.CLabel;
@@ -32,6 +33,8 @@
import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification;
import org.eclipse.wst.xsd.ui.internal.adt.edit.ComponentReferenceEditManager;
import org.eclipse.wst.xsd.ui.internal.adt.edit.IComponentDialog;
+import org.eclipse.wst.xsd.ui.internal.common.commands.BaseCommand;
+import org.eclipse.wst.xsd.ui.internal.common.commands.UpdateAttributeValueCommand;
import org.eclipse.wst.xsd.ui.internal.common.commands.UpdateNameCommand;
import org.eclipse.wst.xsd.ui.internal.dialogs.NewTypeDialog;
import org.eclipse.wst.xsd.ui.internal.editor.Messages;
@@ -511,25 +514,38 @@
Element element = xsdAttribute.getElement();
if (e.widget == usageCombo)
{
- String newValue = usageCombo.getText();
-
+ final String newValue = usageCombo.getText();
if (element != null)
{
- if (newValue.length() == 0)
- element.removeAttribute(XSDConstants.USE_ATTRIBUTE);
- else
- element.setAttribute(XSDConstants.USE_ATTRIBUTE, newValue);
+ PropertiesChangeCommand command = new PropertiesChangeCommand(element, org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_USAGE)
+ {
+ protected void doExecuteSteps()
+ {
+ if (newValue.length() == 0)
+ element.removeAttribute(XSDConstants.USE_ATTRIBUTE);
+ else
+ element.setAttribute(XSDConstants.USE_ATTRIBUTE, newValue);
+ }
+ };
+ getCommandStack().execute(command);
}
}
else if (e.widget == formCombo)
{
- String newValue = formCombo.getText();
+ final String newValue = formCombo.getText();
if (element != null)
{
- if (newValue.length() == 0)
- element.removeAttribute(XSDConstants.FORM_ATTRIBUTE);
- else
- element.setAttribute(XSDConstants.FORM_ATTRIBUTE, newValue);
+ PropertiesChangeCommand command = new PropertiesChangeCommand(element, org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_LABEL_FORM)
+ {
+ protected void doExecuteSteps()
+ {
+ if (newValue.length() == 0)
+ element.removeAttribute(XSDConstants.FORM_ATTRIBUTE);
+ else
+ element.setAttribute(XSDConstants.FORM_ATTRIBUTE, newValue);
+ }
+ };
+ getCommandStack().execute(command);
}
}
else if (e.widget == defaultButton)
@@ -541,9 +557,17 @@
{
if (element.hasAttribute(XSDConstants.FIXED_ATTRIBUTE))
{
- String value = element.getAttribute(XSDConstants.FIXED_ATTRIBUTE);
- element.removeAttribute(XSDConstants.FIXED_ATTRIBUTE);
- element.setAttribute(XSDConstants.DEFAULT_ATTRIBUTE, value);
+ final String value = element.getAttribute(XSDConstants.FIXED_ATTRIBUTE);
+
+ PropertiesChangeCommand command = new PropertiesChangeCommand(element, org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_DEFAULT)
+ {
+ protected void doExecuteSteps()
+ {
+ element.removeAttribute(XSDConstants.FIXED_ATTRIBUTE);
+ element.setAttribute(XSDConstants.DEFAULT_ATTRIBUTE, value);
+ }
+ };
+ getCommandStack().execute(command);
}
}
}
@@ -557,9 +581,16 @@
{
if (element.hasAttribute(XSDConstants.DEFAULT_ATTRIBUTE))
{
- String value = element.getAttribute(XSDConstants.DEFAULT_ATTRIBUTE);
- element.removeAttribute(XSDConstants.DEFAULT_ATTRIBUTE);
- element.setAttribute(XSDConstants.FIXED_ATTRIBUTE, value);
+ final String value = element.getAttribute(XSDConstants.DEFAULT_ATTRIBUTE);
+ PropertiesChangeCommand command = new PropertiesChangeCommand(element, org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_FIXED)
+ {
+ protected void doExecuteSteps()
+ {
+ element.removeAttribute(XSDConstants.DEFAULT_ATTRIBUTE);
+ element.setAttribute(XSDConstants.FIXED_ATTRIBUTE, value);
+ }
+ };
+ getCommandStack().execute(command);
}
}
}
@@ -624,15 +655,41 @@
{
if (newValue.length() == 0)
{
- element.removeAttribute(XSDConstants.DEFAULT_ATTRIBUTE);
- element.removeAttribute(XSDConstants.FIXED_ATTRIBUTE);
+ PropertiesChangeCommand command = new PropertiesChangeCommand(element, org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_LABEL_VALUE)
+ {
+ protected void doExecuteSteps()
+ {
+ element.removeAttribute(XSDConstants.FIXED_ATTRIBUTE);
+ element.removeAttribute(XSDConstants.DEFAULT_ATTRIBUTE);
+ }
+ };
+ getCommandStack().execute(command);
}
else
{
- element.removeAttribute(fixedButton.getSelection()
- ? XSDConstants.DEFAULT_ATTRIBUTE : XSDConstants.FIXED_ATTRIBUTE);
- element.setAttribute(fixedButton.getSelection()
- ? XSDConstants.FIXED_ATTRIBUTE : XSDConstants.DEFAULT_ATTRIBUTE, newValue);
+ UpdateAttributeValueCommand command = null;
+ if (fixedButton.getSelection())
+ {
+ command = new UpdateAttributeValueCommand(element, XSDConstants.FIXED_ATTRIBUTE, newValue, org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_FIXED)
+ {
+ protected void doPostProcessing()
+ {
+ element.removeAttribute(XSDConstants.DEFAULT_ATTRIBUTE);
+ }
+ };
+ }
+ else
+ {
+ command = new UpdateAttributeValueCommand(element, XSDConstants.DEFAULT_ATTRIBUTE, newValue, org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_DEFAULT)
+ {
+ protected void doPostProcessing()
+ {
+ element.removeAttribute(XSDConstants.FIXED_ATTRIBUTE);
+ }
+ };
+ }
+ command.setDeleteIfEmpty(true);
+ getCommandStack().execute(command);
}
}
}
@@ -762,4 +819,31 @@
}
}
+ protected class PropertiesChangeCommand extends BaseCommand
+ {
+ protected Element element;
+ public PropertiesChangeCommand(Element element, String label)
+ {
+ super(NLS.bind(org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_ACTION_CHANGE, label));
+ this.element = element;
+ }
+
+ public void execute()
+ {
+ try
+ {
+ beginRecording(element);
+ doExecuteSteps();
+ }
+ finally
+ {
+ endRecording();
+ }
+ }
+
+ protected void doExecuteSteps()
+ {
+
+ }
+ }
}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDComplexTypeAdvancedSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDComplexTypeAdvancedSection.java
index ceff57c..c17a72f 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDComplexTypeAdvancedSection.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDComplexTypeAdvancedSection.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
+ * Copyright (c) 2001, 2008 IBM Corporation and others.
* 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
@@ -18,6 +18,7 @@
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.wst.xsd.ui.internal.common.commands.UpdateAttributeValueCommand;
+import org.eclipse.wst.xsd.ui.internal.common.util.Messages;
import org.eclipse.xsd.XSDComplexTypeDefinition;
import org.eclipse.xsd.XSDSchema;
import org.eclipse.xsd.util.XSDConstants;
@@ -56,8 +57,7 @@
data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
data.grabExcessHorizontalSpace = false;
- // TODO Should be a translatable string here
- CLabel abstractLabel = getWidgetFactory().createCLabel(composite, XSDConstants.ABSTRACT_ATTRIBUTE + ":");
+ CLabel abstractLabel = getWidgetFactory().createCLabel(composite, Messages._UI_LABEL_ABSTRACT + ":");
abstractLabel.setLayoutData(data);
// ------------------------------------------------------------------
@@ -80,8 +80,7 @@
data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
data.grabExcessHorizontalSpace = false;
- // TODO Should be a translatable string here
- CLabel blockLabel = getWidgetFactory().createCLabel(composite, XSDConstants.BLOCK_ATTRIBUTE + ":");
+ CLabel blockLabel = getWidgetFactory().createCLabel(composite, Messages._UI_LABEL_BLOCK + ":");
blockLabel.setLayoutData(data);
// ------------------------------------------------------------------
@@ -104,8 +103,7 @@
data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
data.grabExcessHorizontalSpace = false;
- // TODO Should be a translatable string here
- CLabel finalLabel = getWidgetFactory().createCLabel(composite, XSDConstants.FINAL_ATTRIBUTE + ":");
+ CLabel finalLabel = getWidgetFactory().createCLabel(composite, Messages._UI_LABEL_FINAL + ":");
finalLabel.setLayoutData(data);
// ------------------------------------------------------------------
@@ -128,8 +126,7 @@
data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
data.grabExcessHorizontalSpace = false;
- // TODO Should be a translatable string here
- CLabel mixedLabel = getWidgetFactory().createCLabel(composite, XSDConstants.MIXED_ATTRIBUTE + ":");
+ CLabel mixedLabel = getWidgetFactory().createCLabel(composite, Messages._UI_LABEL_MIXED + ":");
mixedLabel.setLayoutData(data);
// ------------------------------------------------------------------
@@ -153,46 +150,30 @@
if (e.widget == blockCombo)
{
String value = blockCombo.getText();
-
- UpdateAttributeValueCommand command = new UpdateAttributeValueCommand(complexType.getElement(), XSDConstants.BLOCK_ATTRIBUTE, value);
+ UpdateAttributeValueCommand command = new UpdateAttributeValueCommand(complexType.getElement(), XSDConstants.BLOCK_ATTRIBUTE, value, Messages._UI_LABEL_BLOCK);
command.setDeleteIfEmpty(true);
getCommandStack().execute(command);
}
else if (e.widget == finalCombo)
{
String value = finalCombo.getText();
-
- UpdateAttributeValueCommand command = new UpdateAttributeValueCommand(complexType.getElement(), XSDConstants.FINAL_ATTRIBUTE, value);
+ UpdateAttributeValueCommand command = new UpdateAttributeValueCommand(complexType.getElement(), XSDConstants.FINAL_ATTRIBUTE, value, Messages._UI_LABEL_FINAL);
command.setDeleteIfEmpty(true);
getCommandStack().execute(command);
}
else if (e.widget == abstractCombo)
{
String value = abstractCombo.getText();
-
- if (value.equals(EMPTY))
- complexType.getElement().removeAttribute(XSDConstants.ABSTRACT_ATTRIBUTE);
- else
- {
- if (value.equals(TRUE))
- complexType.setAbstract(true);
- else if (value.equals(FALSE))
- complexType.setAbstract(false);
- }
+ UpdateAttributeValueCommand command = new UpdateAttributeValueCommand(complexType.getElement(), XSDConstants.ABSTRACT_ATTRIBUTE, value, Messages._UI_LABEL_ABSTRACT);
+ command.setDeleteIfEmpty(true);
+ getCommandStack().execute(command);
}
else if (e.widget == mixedCombo)
{
String value = mixedCombo.getText();
-
- if (value.equals(EMPTY))
- complexType.getElement().removeAttribute(XSDConstants.MIXED_ATTRIBUTE);
- else
- {
- if (value.equals(TRUE))
- complexType.setMixed(true);
- else if (value.equals(FALSE))
- complexType.setMixed(false);
- }
+ UpdateAttributeValueCommand command = new UpdateAttributeValueCommand(complexType.getElement(), XSDConstants.MIXED_ATTRIBUTE, value, Messages._UI_LABEL_MIXED);
+ command.setDeleteIfEmpty(true);
+ getCommandStack().execute(command);
}
}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDElementDeclarationAdvancedSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDElementDeclarationAdvancedSection.java
index 2838317..5bdabcd 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDElementDeclarationAdvancedSection.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDElementDeclarationAdvancedSection.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
+ * Copyright (c) 2001, 2008 IBM Corporation and others.
* 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
@@ -65,8 +65,7 @@
data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
data.grabExcessHorizontalSpace = false;
- // TODO Should be a translatable string here
- CLabel abstractLabel = getWidgetFactory().createCLabel(composite, XSDConstants.ABSTRACT_ATTRIBUTE + ":");
+ CLabel abstractLabel = getWidgetFactory().createCLabel(composite, org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_LABEL_ABSTRACT + ":");
abstractLabel.setLayoutData(data);
// ------------------------------------------------------------------
@@ -89,8 +88,7 @@
data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
data.grabExcessHorizontalSpace = false;
- // TODO Should be a translatable string here
- CLabel blockLabel = getWidgetFactory().createCLabel(composite, XSDConstants.BLOCK_ATTRIBUTE + ":");
+ CLabel blockLabel = getWidgetFactory().createCLabel(composite, org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_LABEL_BLOCK + ":");
blockLabel.setLayoutData(data);
// ------------------------------------------------------------------
@@ -113,8 +111,7 @@
data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
data.grabExcessHorizontalSpace = false;
- // TODO Should be a translatable string here
- CLabel finalLabel = getWidgetFactory().createCLabel(composite, XSDConstants.FINAL_ATTRIBUTE + ":");
+ CLabel finalLabel = getWidgetFactory().createCLabel(composite, org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_LABEL_FINAL + ":");
finalLabel.setLayoutData(data);
// ------------------------------------------------------------------
@@ -137,8 +134,7 @@
data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
data.grabExcessHorizontalSpace = false;
- // TODO Should be a translatable string here
- CLabel subGroupLabel = getWidgetFactory().createCLabel(composite, XSDConstants.SUBSTITUTIONGROUP_ATTRIBUTE + ":");
+ CLabel subGroupLabel = getWidgetFactory().createCLabel(composite, org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_LABEL_SUBSTITUTION_GROUP + ":");
subGroupLabel.setLayoutData(data);
// ------------------------------------------------------------------
@@ -166,7 +162,7 @@
if (value.equals(oldValue))
return;
- UpdateAttributeValueCommand command = new UpdateAttributeValueCommand(eleDec.getElement(), XSDConstants.SUBSTITUTIONGROUP_ATTRIBUTE, value);
+ UpdateAttributeValueCommand command = new UpdateAttributeValueCommand(eleDec.getElement(), XSDConstants.SUBSTITUTIONGROUP_ATTRIBUTE, value, org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_LABEL_SUBSTITUTION_GROUP);
command.setDeleteIfEmpty(true);
getCommandStack().execute(command);
}
@@ -179,7 +175,7 @@
XSDElementDeclaration eleDec = (XSDElementDeclaration) input;
String value = blockCombo.getText();
- UpdateAttributeValueCommand command = new UpdateAttributeValueCommand(eleDec.getElement(), XSDConstants.BLOCK_ATTRIBUTE, value);
+ UpdateAttributeValueCommand command = new UpdateAttributeValueCommand(eleDec.getElement(), XSDConstants.BLOCK_ATTRIBUTE, value, org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_LABEL_BLOCK);
command.setDeleteIfEmpty(true);
getCommandStack().execute(command);
}
@@ -188,7 +184,7 @@
XSDElementDeclaration eleDec = (XSDElementDeclaration) input;
String value = finalCombo.getText();
- UpdateAttributeValueCommand command = new UpdateAttributeValueCommand(eleDec.getElement(), XSDConstants.FINAL_ATTRIBUTE, value);
+ UpdateAttributeValueCommand command = new UpdateAttributeValueCommand(eleDec.getElement(), XSDConstants.FINAL_ATTRIBUTE, value, org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_LABEL_FINAL);
command.setDeleteIfEmpty(true);
getCommandStack().execute(command);
}
@@ -196,16 +192,9 @@
{
XSDElementDeclaration eleDec = (XSDElementDeclaration) input;
String value = abstractCombo.getText();
-
- if (value.equals(EMPTY))
- eleDec.getElement().removeAttribute(XSDConstants.ABSTRACT_ATTRIBUTE);
- else
- {
- if (value.equals(TRUE))
- eleDec.setAbstract(true);
- else if (value.equals(FALSE))
- eleDec.setAbstract(false);
- }
+ UpdateAttributeValueCommand command = new UpdateAttributeValueCommand(eleDec.getElement(), XSDConstants.ABSTRACT_ATTRIBUTE, value, org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_LABEL_ABSTRACT);
+ command.setDeleteIfEmpty(true);
+ getCommandStack().execute(command);
}
else if (e.widget == substGroupCombo)
{
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDSchemaSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDSchemaSection.java
index 1bf7b19..b7cdcfc 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDSchemaSection.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDSchemaSection.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2001, 2006 IBM Corporation and others.
+ * Copyright (c) 2001, 2008 IBM Corporation and others.
* 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
@@ -35,6 +35,7 @@
import org.eclipse.wst.xml.core.internal.document.DocumentImpl;
import org.eclipse.wst.xsd.ui.internal.actions.XSDEditNamespacesAction;
import org.eclipse.wst.xsd.ui.internal.common.commands.UpdateNamespaceInformationCommand;
+import org.eclipse.wst.xsd.ui.internal.common.util.Messages;
import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorCSHelpIds;
import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
import org.eclipse.wst.xsd.ui.internal.nsedit.TargetNamespaceChangeHandler;
@@ -288,8 +289,8 @@
private void updateNamespaceInfo(String newPrefix, String newTargetNamespace)
{
- UpdateNamespaceInformationCommand command = new UpdateNamespaceInformationCommand("", xsdSchema, newPrefix, newTargetNamespace);
- command.execute();
+ UpdateNamespaceInformationCommand command = new UpdateNamespaceInformationCommand(Messages._UI_ACTION_NAMESPACE_INFORMATION_CHANGE, xsdSchema, newPrefix, newTargetNamespace);
+ getCommandStack().execute(command);
}
public void dispose()
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionDetailsViewer.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionDetailsViewer.java
index 5f5162d..c3641c5 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionDetailsViewer.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionDetailsViewer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
+ * Copyright (c) 2001, 2008 IBM Corporation and others.
* 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
@@ -12,6 +12,7 @@
import org.eclipse.draw2d.ColorConstants;
import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CommandStack;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.Viewer;
@@ -46,6 +47,7 @@
ExtensionDetailsContentProvider contentProvider;
TabbedPropertySheetWidgetFactory widgetFactory;
InternalControlListener internalControlListener;
+ CommandStack commandStack;
public ExtensionDetailsViewer(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory)
{
@@ -59,7 +61,11 @@
return control;
}
-
+ public void setCommandStack(CommandStack commandStack)
+ {
+ this.commandStack = commandStack;
+ }
+
public Object getInput()
{
// TODO Auto-generated method stub
@@ -237,8 +243,10 @@
Command command = item.getUpdateValueCommand(value);
if (command != null)
{
- // TODO (cs) add command stack handling stuff
- command.execute();
+ if (commandStack != null)
+ commandStack.execute(command);
+ else
+ command.execute();
}
}
}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/util/Messages.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/util/Messages.java
index 7ec09d4..8a755e8 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/util/Messages.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/util/Messages.java
@@ -116,4 +116,14 @@
public static String _UI_FIXED;
public static String _UI_DEFAULT;
public static String _UI_FORM;
+ public static String _UI_USAGE;
+ public static String _UI_ACTION_CHANGE;
+ public static String _UI_ACTION_NAMESPACE_INFORMATION_CHANGE;
+ public static String _UI_LABEL_ABSTRACT;
+ public static String _UI_LABEL_BLOCK;
+ public static String _UI_LABEL_FINAL;
+ public static String _UI_LABEL_SUBSTITUTION_GROUP;
+ public static String _UI_LABEL_MIXED;
+ public static String _UI_LABEL_VALUE;
+ public static String _UI_LABEL_FORM;
}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/util/messages.properties b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/util/messages.properties
index 2b20772..34f955c 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/util/messages.properties
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/util/messages.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2001, 2006 IBM Corporation and others.
+# Copyright (c) 2001, 2008 IBM Corporation and others.
# 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
@@ -81,8 +81,8 @@
_UI_ACTION_UPDATE_ELEMENT_REFERENCE=Update Element Reference
_UI_ACTION_UPDATE_MAXIMUM_OCCURRENCE=Update Maximum Occurrence
_UI_ACTION_UPDATE_MINIMUM_OCCURRENCE=Update Minimum Occurrence
-_UI_ACTION_CHANGE_MAXIMUM_OCCURRENCE=Change Maximum Occurrence
-_UI_ACTION_CHANGE_MINIMUM_OCCURRENCE=Change Minimum Occurrence
+_UI_ACTION_CHANGE_MAXIMUM_OCCURRENCE=Maximum Occurrence Change
+_UI_ACTION_CHANGE_MINIMUM_OCCURRENCE=Minimum Occurrence Change
_UI_LABEL_SPECIFIC_CONSTRAINT_VALUES=Specific constraint values
_UI_LABEL_AVAILABLE_COMPONENTS_TO_ADD=Available components to Add:
_UI_ACTION_CHANGE_CONTENT_MODEL=Change Content Model
@@ -100,3 +100,16 @@
_UI_FIXED=Fixed
_UI_DEFAULT=Default
_UI_FORM=Form qualification:
+# The following string will be used for the undo action. An
+# example label is: Undo Abstract Change
+_UI_ACTION_CHANGE={0} Change
+_UI_ACTION_NAMESPACE_INFORMATION_CHANGE=Namespace Information Change
+_UI_LABEL_ABSTRACT=Abstract
+_UI_LABEL_BLOCK=Block
+_UI_LABEL_FINAL=Final
+_UI_LABEL_SUBSTITUTION_GROUP=Substitution Group
+_UI_LABEL_MIXED=Mixed
+_UI_LABEL_VALUE=Value
+_UI_USAGE=Usage
+_UI_LABEL_FORM=Form
+