[251727] [Properties] Provide an Advanced tab for the schema element
diff --git a/bundles/org.eclipse.wst.xsd.ui/plugin.xml b/bundles/org.eclipse.wst.xsd.ui/plugin.xml
index 69859b6..35ee61b 100644
--- a/bundles/org.eclipse.wst.xsd.ui/plugin.xml
+++ b/bundles/org.eclipse.wst.xsd.ui/plugin.xml
@@ -137,6 +137,12 @@
<input type="org.eclipse.xsd.XSDSchema">
</input>
</propertySection>
+ <propertySection tab="property.tab.advanced"
+ class="org.eclipse.wst.xsd.ui.internal.common.properties.sections.XSDSchemaAdvancedSection"
+ id="prop.section.XSDSchemaSection">
+ <input type="org.eclipse.xsd.XSDSchema">
+ </input>
+ </propertySection>
<propertySection tab="property.tab.general"
class="org.eclipse.wst.xsd.ui.internal.common.properties.sections.SchemaLocationSection"
id="prop.section.SchemaLocationSection">
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/actions/XSDEditNamespacesAction.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/actions/XSDEditNamespacesAction.java
index 9eff2e0..cacaeb1 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/actions/XSDEditNamespacesAction.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/actions/XSDEditNamespacesAction.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
@@ -24,11 +24,9 @@
import org.eclipse.wst.xml.core.internal.document.DocumentImpl;
import org.eclipse.wst.xml.ui.internal.actions.ReplacePrefixAction;
import org.eclipse.wst.xml.ui.internal.util.XMLCommonResources;
+import org.eclipse.wst.xsd.ui.internal.dialogs.XSDEditSchemaNS;
import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
import org.eclipse.wst.xsd.ui.internal.nsedit.SchemaPrefixChangeHandler;
-import org.eclipse.wst.xsd.ui.internal.nsedit.TargetNamespaceChangeHandler;
-import org.eclipse.wst.xsd.ui.internal.widgets.XSDEditSchemaInfoDialog;
-import org.eclipse.xsd.XSDForm;
import org.eclipse.xsd.XSDSchema;
import org.eclipse.xsd.util.XSDConstants;
import org.w3c.dom.Element;
@@ -59,12 +57,8 @@
if (element != null)
{
Shell shell = XMLCommonResources.getInstance().getWorkbench().getActiveWorkbenchWindow().getShell();
- String targetNamespace = null;
- if (xsdSchema != null) {
- targetNamespace = xsdSchema.getTargetNamespace();
- }
- XSDEditSchemaInfoDialog dialog = new XSDEditSchemaInfoDialog(shell, new Path(resourceLocation), targetNamespace);
-
+ XSDEditSchemaNS dialog = new XSDEditSchemaNS(shell, new Path(resourceLocation));
+
List namespaceInfoList = namespaceInfoManager.getNamespaceInfoList(element);
List oldNamespaceInfoList = NamespaceInfo.cloneNamespaceInfoList(namespaceInfoList);
@@ -77,22 +71,11 @@
NamespaceInfo oldCopy = new NamespaceInfo(info);
info.setProperty("oldCopy", oldCopy); //$NON-NLS-1$
}
-
- String currentElementFormQualified = "";
- String currentAttributeFormQualified = "";
-
- boolean hasElementForm = element.hasAttribute(XSDConstants.ELEMENTFORMDEFAULT_ATTRIBUTE);
- if (hasElementForm) currentElementFormQualified = element.getAttribute(XSDConstants.ELEMENTFORMDEFAULT_ATTRIBUTE);
-
- boolean hasAttributeForm = element.hasAttribute(XSDConstants.ATTRIBUTEFORMDEFAULT_ATTRIBUTE);
- if (hasAttributeForm) currentAttributeFormQualified = element.getAttribute(XSDConstants.ATTRIBUTEFORMDEFAULT_ATTRIBUTE);
dialog.setNamespaceInfoList(namespaceInfoList);
dialog.create();
dialog.getShell().setSize(500, 400);
dialog.getShell().setText(XMLCommonResources.getInstance().getString("_UI_MENU_EDIT_SCHEMA_INFORMATION_TITLE")); //$NON-NLS-1$
- dialog.setIsElementQualified(currentElementFormQualified);
- dialog.setIsAttributeQualified(currentAttributeFormQualified);
dialog.setBlockOnOpen(true);
dialog.open();
String xsdPrefix = ""; //$NON-NLS-1$
@@ -137,7 +120,6 @@
xsdSchema.setSchemaForSchemaQNamePrefix(xsdPrefix);
}
- xsdSchema.setTargetNamespace(dialog.getTargetNamespace());
xsdSchema.update();
SchemaPrefixChangeHandler spch = new SchemaPrefixChangeHandler(xsdSchema, xsdPrefix);
@@ -152,9 +134,6 @@
// don't need these any more?
ReplacePrefixAction replacePrefixAction = new ReplacePrefixAction(null, element, prefixMapping);
replacePrefixAction.run();
-
- TargetNamespaceChangeHandler targetNamespaceChangeHandler = new TargetNamespaceChangeHandler(xsdSchema, targetNamespace, dialog.getTargetNamespace());
- targetNamespaceChangeHandler.resolve();
}
catch (Exception e)
{
@@ -167,56 +146,6 @@
}
}
- String attributeFormQualified = dialog.getAttributeFormQualified();
- String elementFormQualified = dialog.getElementFormQualified();
-
- boolean elementFormChanged = true;
- boolean attributeFormChanged = true;
- if (elementFormQualified.equals(currentElementFormQualified))
- {
- elementFormChanged = false;
- }
- if (attributeFormQualified.equals(currentAttributeFormQualified))
- {
- attributeFormChanged = false;
- }
- if (elementFormChanged)
- {
- doc.getModel().beginRecording(this, XSDEditorPlugin.getXSDString("_UI_SCHEMA_ELEMENTFORMDEFAULT_CHANGE"));
- if (elementFormQualified.equals(XSDForm.QUALIFIED_LITERAL.getName()))
- {
- xsdSchema.setElementFormDefault(XSDForm.QUALIFIED_LITERAL);
- }
- else if (elementFormQualified.equals(XSDForm.UNQUALIFIED_LITERAL.getName()))
- {
- xsdSchema.setElementFormDefault(XSDForm.UNQUALIFIED_LITERAL);
- }
- else
- {
- // Model should allow us to remove the attribute
- xsdSchema.getElement().removeAttribute(XSDConstants.ELEMENTFORMDEFAULT_ATTRIBUTE);
- }
- doc.getModel().endRecording(this);
- }
- if (attributeFormChanged)
- {
- doc.getModel().beginRecording(this, XSDEditorPlugin.getXSDString("_UI_SCHEMA_ATTRIBUTEFORMDEFAULT_CHANGE"));
- if (attributeFormQualified.equals(XSDForm.QUALIFIED_LITERAL.getName()))
- {
- xsdSchema.setAttributeFormDefault(XSDForm.QUALIFIED_LITERAL);
- }
- else if (attributeFormQualified.equals(XSDForm.UNQUALIFIED_LITERAL.getName()))
- {
- xsdSchema.setAttributeFormDefault(XSDForm.UNQUALIFIED_LITERAL);
- }
- else
- {
- // Model should allow us to remove the attribute
- xsdSchema.getElement().removeAttribute(XSDConstants.ATTRIBUTEFORMDEFAULT_ATTRIBUTE);
- }
-
- doc.getModel().endRecording(this);
- }
}
}
@@ -261,26 +190,4 @@
}
return map;
}
-
-// private void updateAllNodes(Element element, String prefix)
-// {
-// element.setPrefix(prefix);
-// NodeList list = element.getChildNodes();
-// if (list != null)
-// {
-// for (int i=0; i < list.getLength(); i++)
-// {
-// Node child = list.item(i);
-// if (child != null && child instanceof Element)
-// {
-// child.setPrefix(prefix);
-// if (child.hasChildNodes())
-// {
-// updateAllNodes((Element)child, prefix);
-// }
-// }
-// }
-// }
-// }
-
}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/dialogs/XSDEditSchemaNS.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/dialogs/XSDEditSchemaNS.java
new file mode 100644
index 0000000..43e520d
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/dialogs/XSDEditSchemaNS.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.xsd.ui.internal.dialogs;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.wst.xml.ui.internal.XMLUIMessages;
+import org.eclipse.wst.xml.ui.internal.dialogs.EditSchemaInfoDialog;
+import org.eclipse.wst.xml.ui.internal.nsedit.CommonEditNamespacesDialog;
+
+public class XSDEditSchemaNS extends EditSchemaInfoDialog
+{
+ CommonEditNamespacesDialog editNamespacesControl;
+
+ public XSDEditSchemaNS(Shell parentShell, IPath resourceLocation)
+ {
+ super(parentShell, resourceLocation);
+ }
+
+ protected Control createDialogArea(Composite parent)
+ {
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ editNamespacesControl = new CommonEditNamespacesDialog(composite, resourceLocation, XMLUIMessages._UI_NAMESPACE_DECLARATIONS);
+
+ editNamespacesControl.setNamespaceInfoList(namespaceInfoList);
+ editNamespacesControl.updateErrorMessage(namespaceInfoList);
+
+ return composite;
+ }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/Messages.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/Messages.java
index a0c94e9..8cc4982 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/Messages.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/Messages.java
@@ -120,7 +120,9 @@
public static String _UI_ACTION_ADD_ATTRIBUTE_AFTER;
public static String _UI_ACTION_ADD_ATTRIBUTE_REF;
+ // TODO: TO REMOVE
public static String _UI_LABEL_ELEMENTFORMDEFAULT;
+ // TODO: TO REMOVE
public static String _UI_LABEL_ATTRIBUTEFORMDEFAULT;
public static String _UI_LABEL_CREATE_ANON_TYPE;
public static String _UI_STRUCTURED_TEXT_EDITOR_PREFS_LINK;
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDEditorCSHelpIds.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDEditorCSHelpIds.java
index fefdfef..332e199 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDEditorCSHelpIds.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDEditorCSHelpIds.java
@@ -87,6 +87,11 @@
public static final String GENERAL_TAB__SCHEMA__TARGETNAMESPACE = PLUGIN_NAME + ".xsdup0210";
public static final String GENERAL_TAB__SCHEMA__ADVANCED = PLUGIN_NAME + ".xsdup0220";
+ public static final String ADVANCE_TAB__SCHEMA_ELEMENT_FORM_DEFAULT = PLUGIN_NAME + ".xsdup0450";
+ public static final String ADVANCE_TAB__SCHEMA_ATTRIBUTE_FORM_DEFAULT = PLUGIN_NAME + ".xsdup0460";
+ public static final String ADVANCE_TAB__SCHEMA_BLOCK_DEFAULT = PLUGIN_NAME + ".xsdup0470";
+ public static final String ADVANCE_TAB__SCHEMA_FINAL_DEFAULT = PLUGIN_NAME + ".xsdup0480";
+
public static final String GENERAL_TAB__ELEMENT__NAME = PLUGIN_NAME + ".xsdup0230";
public static final String GENERAL_TAB__ELEMENT__TYPE = PLUGIN_NAME + ".xsdup0240";
public static final String GENERAL_TAB__ELEMENT__REFERENCE = PLUGIN_NAME + ".xsdup0250";
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/widgets/XSDEditSchemaInfoDialog.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/widgets/XSDEditSchemaInfoDialog.java
index 8001583..4062dcf 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/widgets/XSDEditSchemaInfoDialog.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/widgets/XSDEditSchemaInfoDialog.java
@@ -28,6 +28,10 @@
import org.eclipse.wst.xsd.ui.internal.editor.Messages;
import org.eclipse.xsd.XSDForm;
+/**
+ * @deprecated. To be removed
+ *
+ */
public class XSDEditSchemaInfoDialog extends EditSchemaInfoDialog implements SelectionListener {
String targetNamespace;
CommonEditNamespacesTargetFieldDialog editNamespacesControl;
@@ -40,27 +44,6 @@
super(parentShell, resourceLocation);
this.targetNamespace = targetNamespace;
}
-/*
- // in super
- protected CommonEditNamespacesDialog createCommonEditNamespacesDialog(Composite dialogArea)
- {
- return new CommonEditNamespacesDialog(dialogArea, resourceLocation, XMLUIPlugin.getResourceString("%_UI_NAMESPACE_DECLARATIONS"), false, true); //$NON-NLS-1$
- }
-
- // in super
- protected Control createDialogArea(Composite parent) {
- Composite dialogArea = (Composite) super.createDialogArea(parent);
- CommonEditNamespacesDialog editNamespacesControl = createCommonEditNamespacesDialog(dialogArea);
- editNamespacesControl.setNamespaceInfoList(namespaceInfoList);
- editNamespacesControl.updateErrorMessage(namespaceInfoList);
- return dialogArea;
- }
-
- // in this
- protected CommonEditNamespacesDialog createCommonEditNamespacesDialog(Composite dialogArea)
- {
- return new CommonEditNamespacesTargetFieldDialog(dialogArea, resourceLocation); //$NON-NLS-1$
- } */
// this is copy of ....
protected Control __internalCreateDialogArea(Composite parent) {
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDSchemaAdvancedSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDSchemaAdvancedSection.java
new file mode 100644
index 0000000..968d847
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDSchemaAdvancedSection.java
@@ -0,0 +1,208 @@
+/*******************************************************************************
+ * Copyright (c) 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.xsd.ui.internal.common.properties.sections;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.custom.CCombo;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.wst.xsd.ui.internal.common.commands.UpdateAttributeValueCommand;
+import org.eclipse.wst.xsd.ui.internal.common.util.Messages;
+import org.eclipse.wst.xsd.ui.internal.common.util.XSDCommonUIUtils;
+import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorCSHelpIds;
+import org.eclipse.xsd.XSDForm;
+import org.eclipse.xsd.util.XSDConstants;
+
+public class XSDSchemaAdvancedSection extends AbstractSection
+{
+ IWorkbenchPart part;
+ protected CLabel elementFormLabel, attributeFormLabel, blockDefaultLabel, finalDefaultLabel;
+ protected CCombo elementFormCombo, attributeFormCombo, blockDefaultCombo, finalDefaultCombo;
+
+ protected static final String emptyOption = ""; //$NON-NLS-1$
+
+ protected static final String [] formQualification = { emptyOption, XSDForm.QUALIFIED_LITERAL.getLiteral(),
+ XSDForm.UNQUALIFIED_LITERAL.getLiteral() }; //$NON-NLS-1$
+
+
+ protected static final String derivedByChoicesComboValues[] = { "", XSDConstants.RESTRICTION_ELEMENT_TAG, //$NON-NLS-1$
+ XSDConstants.EXTENSION_ELEMENT_TAG };
+
+ protected static final String blockDefaultValues[] = { emptyOption, "#" + XSDConstants.ALL_ELEMENT_TAG, //$NON-NLS-1$
+ XSDConstants.EXTENSION_ELEMENT_TAG, XSDConstants.RESTRICTION_ELEMENT_TAG,
+ "substitution"};
+
+ protected static final String finalDefaultValues[] = { emptyOption, "#" + XSDConstants.ALL_ELEMENT_TAG, //$NON-NLS-1$
+ XSDConstants.EXTENSION_ELEMENT_TAG, XSDConstants.RESTRICTION_ELEMENT_TAG,
+ XSDConstants.LIST_ELEMENT_TAG, XSDConstants.UNION_ELEMENT_TAG};
+
+ public XSDSchemaAdvancedSection()
+ {
+ super();
+ }
+
+ /**
+ * @see org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite,
+ * org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory)
+ */
+ public void createContents(Composite parent)
+ {
+ composite = getWidgetFactory().createFlatFormComposite(parent);
+
+ GridLayout gridLayout = new GridLayout();
+ gridLayout.marginTop = 0;
+ gridLayout.marginBottom = 0;
+ gridLayout.numColumns = 2;
+ composite.setLayout(gridLayout);
+
+ // Create elementFormDefault label and combo
+ elementFormLabel = XSDCommonUIUtils.getNewPropertiesLabel(composite,getWidgetFactory(),
+ Messages._UI_LABEL_ELEMENTFORMDEFAULT + ":");
+ elementFormCombo = XSDCommonUIUtils.getNewPropertiesCombo(composite,getWidgetFactory(),this,
+ formQualification,XSDEditorCSHelpIds.ADVANCE_TAB__SCHEMA_ELEMENT_FORM_DEFAULT);
+
+ // Create attributeFormDefault label and combo
+ attributeFormLabel = XSDCommonUIUtils.getNewPropertiesLabel(composite,getWidgetFactory(),
+ Messages._UI_LABEL_ATTRIBUTEFORMDEFAULT + ":");
+ attributeFormCombo = XSDCommonUIUtils.getNewPropertiesCombo(composite,getWidgetFactory(),this,
+ formQualification,XSDEditorCSHelpIds.ADVANCE_TAB__SCHEMA_ATTRIBUTE_FORM_DEFAULT);
+
+ // Create blockDefault label and combo
+ blockDefaultLabel = XSDCommonUIUtils.getNewPropertiesLabel(composite,getWidgetFactory(),
+ Messages._UI_LABEL_BLOCKDEFAULT + ":");
+ blockDefaultCombo = XSDCommonUIUtils.getNewPropertiesCombo(composite,getWidgetFactory(),this,
+ blockDefaultValues,XSDEditorCSHelpIds.ADVANCE_TAB__SCHEMA_BLOCK_DEFAULT);
+
+ // Create finalDefault label and combo
+ finalDefaultLabel = XSDCommonUIUtils.getNewPropertiesLabel(composite,getWidgetFactory(),
+ Messages._UI_LABEL_FINALDEFAULT + ":");
+ finalDefaultCombo = XSDCommonUIUtils.getNewPropertiesCombo(composite,getWidgetFactory(),this,
+ finalDefaultValues,XSDEditorCSHelpIds.ADVANCE_TAB__SCHEMA_FINAL_DEFAULT);
+
+ Dialog.applyDialogFont(parent);
+ }
+
+ /*
+ * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh()
+ */
+ public void refresh()
+ {
+ super.refresh();
+ setListenerEnabled(false);
+
+ if (xsdSchema != null)
+ {
+ if (elementFormCombo != null)
+ {
+ String text;
+ if (xsdSchema.getElement().hasAttribute(XSDConstants.ELEMENTFORMDEFAULT_ATTRIBUTE))
+ {
+ text = xsdSchema.getElementFormDefault().getName();
+ }
+ else
+ {
+ text = emptyOption;
+ }
+ elementFormCombo.setText(text);
+ }
+
+ if (attributeFormCombo != null)
+ {
+ String text;
+ if (xsdSchema.getElement().hasAttribute(XSDConstants.ATTRIBUTEFORMDEFAULT_ATTRIBUTE))
+ {
+ text = xsdSchema.getAttributeFormDefault().getName();
+ }
+ else
+ {
+ text = emptyOption;
+ }
+ attributeFormCombo.setText(text);
+ }
+
+ if (blockDefaultCombo != null)
+ {
+ String text;
+ if (xsdSchema.getElement().hasAttribute(XSDConstants.BLOCKDEFAULT_ATTRIBUTE))
+ {
+ text = xsdSchema.getElement().getAttribute(XSDConstants.BLOCKDEFAULT_ATTRIBUTE);
+ }
+ else
+ {
+ text = emptyOption;
+ }
+ blockDefaultCombo.setText(text);
+ }
+
+ if (finalDefaultCombo != null)
+ {
+ String text;
+ if (xsdSchema.getElement().hasAttribute(XSDConstants.FINALDEFAULT_ATTRIBUTE))
+ {
+ text = xsdSchema.getElement().getAttribute(XSDConstants.FINALDEFAULT_ATTRIBUTE);
+ }
+ else
+ {
+ text = emptyOption;
+ }
+ finalDefaultCombo.setText(text);
+ }
+ }
+ setListenerEnabled(true);
+ }
+
+ public void doWidgetSelected(SelectionEvent e)
+ {
+ if (xsdSchema != null)
+ {
+ if (e.widget == elementFormCombo && elementFormCombo != null)
+ {
+ String valueElementForm = elementFormCombo.getText();
+ UpdateAttributeValueCommand command = new UpdateAttributeValueCommand(xsdSchema.getElement(),
+ XSDConstants.ELEMENTFORMDEFAULT_ATTRIBUTE, valueElementForm,
+ Messages._UI_LABEL_ELEMENTFORMDEFAULT);
+ command.setDeleteIfEmpty(true);
+ getCommandStack().execute(command);
+ }
+
+ if (e.widget == attributeFormCombo && attributeFormCombo != null)
+ {
+ String valueAttributeForm = attributeFormCombo.getText();
+ UpdateAttributeValueCommand command = new UpdateAttributeValueCommand(xsdSchema.getElement(),
+ XSDConstants.ATTRIBUTEFORMDEFAULT_ATTRIBUTE, valueAttributeForm,
+ Messages._UI_LABEL_ATTRIBUTEFORMDEFAULT);
+ command.setDeleteIfEmpty(true);
+ getCommandStack().execute(command);
+ }
+
+ if (e.widget == blockDefaultCombo && blockDefaultCombo != null)
+ {
+ String valueBlockDefault = blockDefaultCombo.getText();
+ UpdateAttributeValueCommand command = new UpdateAttributeValueCommand(xsdSchema.getElement(),
+ XSDConstants.BLOCKDEFAULT_ATTRIBUTE, valueBlockDefault, Messages._UI_LABEL_BLOCKDEFAULT);
+ command.setDeleteIfEmpty(true);
+ getCommandStack().execute(command);
+ }
+
+ if(e.widget == finalDefaultCombo && finalDefaultCombo != null)
+ {
+ String finalBlockDefault = finalDefaultCombo.getText();
+ UpdateAttributeValueCommand command = new UpdateAttributeValueCommand(xsdSchema.getElement(),
+ XSDConstants.FINALDEFAULT_ATTRIBUTE, finalBlockDefault, Messages._UI_LABEL_FINALDEFAULT);
+ 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/XSDSchemaSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDSchemaSection.java
index b7cdcfc..8ef030c 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
@@ -110,7 +110,7 @@
XSDEditorCSHelpIds.GENERAL_TAB__SCHEMA__TARGETNAMESPACE);
// Advanced Button
- editButton = getWidgetFactory().createButton(composite, XSDEditorPlugin.getXSDString("_UI_SECTION_ADVANCED_ATTRIBUTES") + "...", SWT.PUSH); //$NON-NLS-1$ //$NON-NLS-2$
+ editButton = getWidgetFactory().createButton(composite, XSDEditorPlugin.getXSDString("_UI_ACTION_EDIT_NAMESPACES"), SWT.PUSH); //$NON-NLS-1$
data = new GridData(SWT.END, SWT.CENTER, true, false);
data.horizontalSpan = 2;
editButton.setLayoutData(data);
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 208c4fe..344d68e 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
@@ -77,6 +77,8 @@
public static String _UI_LABEL_MAXIMUM_VALUE;
public static String _UI_LABEL_CONTRAINTS_ON;
public static String _UI_LABEL_TYPE;
+ public static String _UI_LABEL_BLOCKDEFAULT;
+ public static String _UI_LABEL_FINALDEFAULT;
public static String _UI_ACTION_CONSTRAIN_LENGTH;
public static String _UI_ACTION_UPDATE_BOUNDS;
public static String _UI_ACTION_COLLAPSE_WHITESPACE;
@@ -127,4 +129,7 @@
public static String _UI_LABEL_VALUE;
public static String _UI_LABEL_FORM;
public static String _UI_LABEL_NILLABLE;
+ public static String _UI_LABEL_ELEMENTFORMDEFAULT;
+ public static String _UI_LABEL_ATTRIBUTEFORMDEFAULT;
+
}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/util/XSDCommonUIUtils.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/util/XSDCommonUIUtils.java
index 2cfe15d..7de1609 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/util/XSDCommonUIUtils.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/util/XSDCommonUIUtils.java
@@ -21,12 +21,19 @@
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.DecorationOverlayIcon;
import org.eclipse.jface.viewers.IDecoration;
+import org.eclipse.swt.custom.CCombo;
+import org.eclipse.swt.custom.CLabel;
import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
import org.eclipse.wst.sse.core.internal.format.IStructuredFormatProcessor;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
import org.eclipse.wst.xml.core.internal.provisional.format.FormatProcessorXML;
import org.eclipse.wst.xsd.ui.internal.adt.design.ImageOverlayDescriptor;
+import org.eclipse.wst.xsd.ui.internal.common.properties.sections.AbstractSection;
import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
import org.eclipse.xsd.XSDAnnotation;
import org.eclipse.xsd.XSDAttributeDeclaration;
@@ -555,4 +562,29 @@
}
}
+ public static CCombo getNewPropertiesCombo(Composite composite, TabbedPropertySheetWidgetFactory widgetFactory,
+ AbstractSection listener, String[] items, String helpID)
+ {
+ CCombo combo = widgetFactory.createCCombo(composite);
+ combo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ combo.setEditable(false);
+ combo.setItems(items);
+ combo.addSelectionListener(listener);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(combo, helpID);
+ return combo;
+ }
+
+ public static CLabel getNewPropertiesLabel(Composite composite, TabbedPropertySheetWidgetFactory widgetFactory,
+ String labelText)
+ {
+ // Create label
+ CLabel label;
+ label = widgetFactory.createCLabel(composite, labelText);
+ GridData data = new GridData();
+ data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
+ data.grabExcessHorizontalSpace = false;
+ label.setLayoutData(data);
+
+ return label;
+ }
}
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 6f3f636..341a12a 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
@@ -28,8 +28,12 @@
_UI_ACTION_CONSTRAIN_LENGTH=Constrain length
_UI_ACTION_BROWSE_WORKSPACE=Workspace
_UI_LABEL_NO_ITEMS_SELECTED=No items selected
+_UI_LABEL_ELEMENTFORMDEFAULT=Prefix for Elements
+_UI_LABEL_ATTRIBUTEFORMDEFAULT=Prefix for Attributes
+_UI_LABEL_BLOCKDEFAULT=Block default
_UI_LABEL_EXTENSION_DETAILS=Extension Details
_UI_LABEL_EXTENSION_CATEGORIES=Extension Categories:
+_UI_LABEL_FINALDEFAULT=Final default
_UI_LABEL_COLLAPSE_WHITESPACE=Collapse whitespace
_UI_LABEL_RESTRICT_VALUES_BY=Restrict values by:
_UI_LABEL_MINIMUM_LENGTH=Minimum length: