This commit was manufactured by cvs2svn to create tag
'v200603282200premerge'.
diff --git a/bundles/org.eclipse.wst.xsd.ui/.cvsignore b/bundles/org.eclipse.wst.xsd.ui/.cvsignore
new file mode 100644
index 0000000..7b94482
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/.cvsignore
@@ -0,0 +1,7 @@
+bin
+xsdeditor.jar
+build.xml
+temp.folder
+org.eclipse.wst.xsd.ui_1.0.0.jar
+@dot
+src.zip
diff --git a/bundles/org.eclipse.wst.xsd.ui/.project b/bundles/org.eclipse.wst.xsd.ui/.project
new file mode 100644
index 0000000..aab3824
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.eclipse.wst.xsd.ui</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.SchemaBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.eclipse.pde.PluginNature</nature>
+	</natures>
+</projectDescription>
diff --git a/bundles/org.eclipse.wst.xsd.ui/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.wst.xsd.ui/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..02e064f
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,69 @@
+#Mon Feb 27 17:20:28 EST 2006

+eclipse.preferences.version=1

+org.eclipse.jdt.core.builder.cleanOutputFolder=clean

+org.eclipse.jdt.core.builder.duplicateResourceTask=warning

+org.eclipse.jdt.core.builder.invalidClasspath=abort

+org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch

+org.eclipse.jdt.core.circularClasspath=error

+org.eclipse.jdt.core.classpath.exclusionPatterns=enabled

+org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled

+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled

+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2

+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve

+org.eclipse.jdt.core.compiler.compliance=1.4

+org.eclipse.jdt.core.compiler.debug.lineNumber=generate

+org.eclipse.jdt.core.compiler.debug.localVariable=generate

+org.eclipse.jdt.core.compiler.debug.sourceFile=generate

+org.eclipse.jdt.core.compiler.doc.comment.support=enabled

+org.eclipse.jdt.core.compiler.maxProblemPerUnit=100

+org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning

+org.eclipse.jdt.core.compiler.problem.deprecation=warning

+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled

+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled

+org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore

+org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning

+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore

+org.eclipse.jdt.core.compiler.problem.finalParameterBound=error

+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning

+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning

+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning

+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning

+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore

+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=ignore

+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled

+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled

+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private

+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore

+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning

+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore

+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled

+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public

+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore

+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled

+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private

+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning

+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning

+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning

+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore

+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning

+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore

+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled

+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning

+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore

+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore

+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore

+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore

+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore

+org.eclipse.jdt.core.compiler.problem.unsafeTypeOperation=error

+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore

+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled

+org.eclipse.jdt.core.compiler.problem.unusedImport=error

+org.eclipse.jdt.core.compiler.problem.unusedLocal=ignore

+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore

+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled

+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled

+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=ignore

+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=error

+org.eclipse.jdt.core.compiler.source=1.3

+org.eclipse.jdt.core.incompatibleJDKLevel=ignore

+org.eclipse.jdt.core.incompleteClasspath=error

diff --git a/bundles/org.eclipse.wst.xsd.ui/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.wst.xsd.ui/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 0000000..a232d89
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,3 @@
+#Mon Feb 27 17:20:24 EST 2006
+eclipse.preferences.version=1
+internal.default.compliance=default
diff --git a/bundles/org.eclipse.wst.xsd.ui/.settings/org.eclipse.pde.prefs b/bundles/org.eclipse.wst.xsd.ui/.settings/org.eclipse.pde.prefs
new file mode 100644
index 0000000..179abb3
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/.settings/org.eclipse.pde.prefs
@@ -0,0 +1,12 @@
+#Fri Dec 10 00:50:26 EST 2004

+compilers.p.unused-element-or-attribute=0

+compilers.p.unresolved-ex-points=0

+compilers.p.unknown-element=0

+compilers.p.unknown-resource=0

+compilers.p.unknown-class=0

+compilers.p.unknown-attribute=0

+compilers.p.no-required-att=0

+eclipse.preferences.version=1

+compilers.p.unresolved-import=0

+compilers.p.illegal-att-value=0

+compilers.use-project=true

diff --git a/bundles/org.eclipse.wst.xsd.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.wst.xsd.ui/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..23de916
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/META-INF/MANIFEST.MF
@@ -0,0 +1,89 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %_UI_PLUGIN_NAME
+Bundle-SymbolicName: org.eclipse.wst.xsd.ui; singleton:=true
+Bundle-Version: 1.0.100.qualifier
+Bundle-Activator: org.eclipse.wst.xsd.editor.XSDEditorPlugin
+Bundle-Vendor: %Bundle-Vendor.0
+Bundle-Localization: plugin
+Export-Package: org.eclipse.wst.xsd.adt.actions,
+ org.eclipse.wst.xsd.adt.design,
+ org.eclipse.wst.xsd.adt.design.directedit,
+ org.eclipse.wst.xsd.adt.design.editparts,
+ org.eclipse.wst.xsd.adt.design.editparts.model,
+ org.eclipse.wst.xsd.adt.design.editpolicies,
+ org.eclipse.wst.xsd.adt.design.figures,
+ org.eclipse.wst.xsd.adt.edit,
+ org.eclipse.wst.xsd.adt.editor,
+ org.eclipse.wst.xsd.adt.facade,
+ org.eclipse.wst.xsd.adt.outline,
+ org.eclipse.wst.xsd.adt.properties,
+ org.eclipse.wst.xsd.adt.typeviz.design.figures,
+ org.eclipse.wst.xsd.adt.typeviz.design.layouts,
+ org.eclipse.wst.xsd.editor,
+ org.eclipse.wst.xsd.editor.internal.actions,
+ org.eclipse.wst.xsd.editor.internal.adapters,
+ org.eclipse.wst.xsd.editor.internal.design.editparts,
+ org.eclipse.wst.xsd.editor.internal.design.editparts.model,
+ org.eclipse.wst.xsd.editor.internal.design.figures,
+ org.eclipse.wst.xsd.editor.internal.design.layouts,
+ org.eclipse.wst.xsd.editor.internal.dialogs,
+ org.eclipse.wst.xsd.editor.internal.icons,
+ org.eclipse.wst.xsd.editor.internal.navigation,
+ org.eclipse.wst.xsd.editor.internal.preferences,
+ org.eclipse.wst.xsd.editor.internal.search,
+ org.eclipse.wst.xsd.editor.internal.utils,
+ org.eclipse.wst.xsd.ui.common.actions,
+ org.eclipse.wst.xsd.ui.common.commands,
+ org.eclipse.wst.xsd.ui.common.properties.providers,
+ org.eclipse.wst.xsd.ui.common.properties.sections,
+ org.eclipse.wst.xsd.ui.common.properties.sections.appinfo,
+ org.eclipse.wst.xsd.ui.common.util,
+ org.eclipse.wst.xsd.ui.internal.actions,
+ org.eclipse.wst.xsd.ui.internal.nsedit;x-internal:=true,
+ org.eclipse.wst.xsd.ui.internal.refactor,
+ org.eclipse.wst.xsd.ui.internal.refactor.actions;x-internal:=true,
+ org.eclipse.wst.xsd.ui.internal.refactor.rename,
+ org.eclipse.wst.xsd.ui.internal.refactor.structure;x-internal:=true,
+ org.eclipse.wst.xsd.ui.internal.refactor.util;x-internal:=true,
+ org.eclipse.wst.xsd.ui.internal.refactor.wizard;x-internal:=true,
+ org.eclipse.wst.xsd.ui.internal.search;x-internal:=true,
+ org.eclipse.wst.xsd.ui.internal.search.actions;x-internal:=true,
+ org.eclipse.wst.xsd.ui.internal.text;x-internal:=true,
+ org.eclipse.wst.xsd.ui.internal.util;x-internal:=true,
+ org.eclipse.wst.xsd.ui.internal.validation;x-internal:=true,
+ org.eclipse.wst.xsd.ui.internal.widgets;x-internal:=true,
+ org.eclipse.wst.xsd.ui.internal.wizards;x-internal:=true
+Require-Bundle: org.eclipse.ui.views.properties.tabbed,
+ org.apache.xerces,
+ org.eclipse.core.runtime,
+ org.eclipse.wst.common.uriresolver,
+ org.eclipse.wst.sse.ui,
+ org.eclipse.wst.sse.core,
+ org.eclipse.wst.common.core,
+ org.eclipse.wst.xml.core,
+ org.eclipse.wst.xml.ui,
+ org.eclipse.wst.common.ui,
+ org.eclipse.jface.text,
+ org.eclipse.xsd,
+ org.eclipse.gef,
+ org.eclipse.draw2d,
+ org.eclipse.xsd,
+ org.eclipse.jface,
+ org.eclipse.ui.editors,
+ org.eclipse.ui.workbench.texteditor,
+ org.eclipse.ui,
+ org.eclipse.ui.views,
+ org.eclipse.ui.ide,
+ org.eclipse.emf.ecore.edit,
+ org.eclipse.core.resources,
+ org.eclipse.xsd.edit,
+ org.eclipse.emf.edit,
+ org.eclipse.emf.edit.ui,
+ org.eclipse.wst.validation,
+ org.eclipse.ltk.core.refactoring,
+ org.eclipse.ltk.ui.refactoring,
+ org.eclipse.wst.xsd.core,
+ org.eclipse.search,
+ com.ibm.icu
+Eclipse-LazyStart: true
diff --git a/bundles/org.eclipse.wst.xsd.ui/about.html b/bundles/org.eclipse.wst.xsd.ui/about.html
new file mode 100644
index 0000000..6f6b96c
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/about.html
@@ -0,0 +1,22 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<html>
+<head>
+<title>About</title>
+<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+ 
+<p>February 24, 2005</p>	
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;).  Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;).  A copy of the EPL is available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content.  Check the Redistributor's license that was provided with the Content.  If no such license exists, contact the Redistributor.  Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content.</p>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/build.properties b/bundles/org.eclipse.wst.xsd.ui/build.properties
new file mode 100644
index 0000000..2df31de
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/build.properties
@@ -0,0 +1,26 @@
+###############################################################################
+# Copyright (c) 2001, 2004 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
+###############################################################################
+source.. = src-validation/,\
+           src-search/,\
+           src-refactor/,\
+           src-adt/,\
+           src-adt-xsd/,\
+           src-adt-xsd-typeviz/,\
+           src-common/
+bin.includes = .,\
+               plugin.xml,\
+               icons/,\
+               plugin.properties,\
+               META-INF/,\
+               about.html
+src.includes = build.properties,\
+               component.xml
+output.. = bin/
diff --git a/bundles/org.eclipse.wst.xsd.ui/component.xml b/bundles/org.eclipse.wst.xsd.ui/component.xml
new file mode 100644
index 0000000..294443a
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/component.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<component xmlns="http://eclipse.org/wtp/releng/tools/component-model"
+	name="org.eclipse.wst.xsd">
+	<component-depends unrestricted="true"></component-depends>
+	<plugin	id="org.eclipse.wst.xsd.ui" fragment="false" />
+	<plugin	id="org.eclipse.wst.xsd.core" fragment="false" />
+</component>
\ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/XSDAttributeGroupRef.gif b/bundles/org.eclipse.wst.xsd.ui/icons/XSDAttributeGroupRef.gif
new file mode 100644
index 0000000..a89fa8f
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/icons/XSDAttributeGroupRef.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/XSDElementRef.gif b/bundles/org.eclipse.wst.xsd.ui/icons/XSDElementRef.gif
new file mode 100644
index 0000000..8712930
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/icons/XSDElementRef.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/XSDFile.gif b/bundles/org.eclipse.wst.xsd.ui/icons/XSDFile.gif
new file mode 100644
index 0000000..3900f1b
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/icons/XSDFile.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/XSDGroupRef.gif b/bundles/org.eclipse.wst.xsd.ui/icons/XSDGroupRef.gif
new file mode 100644
index 0000000..34a7fb3
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/icons/XSDGroupRef.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/blank.gif b/bundles/org.eclipse.wst.xsd.ui/icons/blank.gif
new file mode 100644
index 0000000..1936e21
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/icons/blank.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/browsebutton.gif b/bundles/org.eclipse.wst.xsd.ui/icons/browsebutton.gif
new file mode 100644
index 0000000..13dae59
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/icons/browsebutton.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/collapse_attr.gif b/bundles/org.eclipse.wst.xsd.ui/icons/collapse_attr.gif
new file mode 100644
index 0000000..b872bee
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/icons/collapse_attr.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/delete_obj.gif b/bundles/org.eclipse.wst.xsd.ui/icons/delete_obj.gif
new file mode 100644
index 0000000..b6922ac
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/icons/delete_obj.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/dlcl16/showproperties_obj.gif b/bundles/org.eclipse.wst.xsd.ui/icons/dlcl16/showproperties_obj.gif
new file mode 100644
index 0000000..d94ff10
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/icons/dlcl16/showproperties_obj.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/dtool16/showproperties_obj.gif b/bundles/org.eclipse.wst.xsd.ui/icons/dtool16/showproperties_obj.gif
new file mode 100644
index 0000000..d94ff10
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/icons/dtool16/showproperties_obj.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/elcl16/showproperties_obj.gif b/bundles/org.eclipse.wst.xsd.ui/icons/elcl16/showproperties_obj.gif
new file mode 100644
index 0000000..1dc19a3
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/icons/elcl16/showproperties_obj.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/etool16/showproperties_obj.gif b/bundles/org.eclipse.wst.xsd.ui/icons/etool16/showproperties_obj.gif
new file mode 100644
index 0000000..1dc19a3
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/icons/etool16/showproperties_obj.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/expand_attr.gif b/bundles/org.eclipse.wst.xsd.ui/icons/expand_attr.gif
new file mode 100644
index 0000000..5c287e9
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/icons/expand_attr.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/filter.gif b/bundles/org.eclipse.wst.xsd.ui/icons/filter.gif
new file mode 100644
index 0000000..6fe6f0e
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/icons/filter.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/newChoice.gif b/bundles/org.eclipse.wst.xsd.ui/icons/newChoice.gif
new file mode 100644
index 0000000..eca1446
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/icons/newChoice.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/newSequence2.gif b/bundles/org.eclipse.wst.xsd.ui/icons/newSequence2.gif
new file mode 100644
index 0000000..9e3968c
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/icons/newSequence2.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/annotationsheader.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/annotationsheader.gif
new file mode 100644
index 0000000..9bfb682
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/annotationsheader.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/attributeGroupRef.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/attributeGroupRef.gif
new file mode 100644
index 0000000..0ea47d2
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/attributeGroupRef.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/attributegroupsheader.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/attributegroupsheader.gif
new file mode 100644
index 0000000..e618a25
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/attributegroupsheader.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/attributesheader.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/attributesheader.gif
new file mode 100644
index 0000000..9254879
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/attributesheader.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/directivesheader.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/directivesheader.gif
new file mode 100644
index 0000000..6000cb8
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/directivesheader.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/elementsheader.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/elementsheader.gif
new file mode 100644
index 0000000..26f7206
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/elementsheader.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/error_marker.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/error_marker.gif
new file mode 100644
index 0000000..61e1e25
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/error_marker.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/groupsheader.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/groupsheader.gif
new file mode 100644
index 0000000..c9745f0
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/groupsheader.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/notationsheader.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/notationsheader.gif
new file mode 100644
index 0000000..e05c645
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/notationsheader.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/smpl_list_obj.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/smpl_list_obj.gif
new file mode 100644
index 0000000..6e2cd93
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/smpl_list_obj.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/smpl_restrict_obj.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/smpl_restrict_obj.gif
new file mode 100644
index 0000000..1ebd546
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/smpl_restrict_obj.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/smpl_union_obj.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/smpl_union_obj.gif
new file mode 100644
index 0000000..0b01f8c
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/smpl_union_obj.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/typesheader.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/typesheader.gif
new file mode 100644
index 0000000..3267542
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/typesheader.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/ovr16/attributeoverlay.gif b/bundles/org.eclipse.wst.xsd.ui/icons/ovr16/attributeoverlay.gif
new file mode 100644
index 0000000..1931f92
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/icons/ovr16/attributeoverlay.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/ovr16/textoverlay.gif b/bundles/org.eclipse.wst.xsd.ui/icons/ovr16/textoverlay.gif
new file mode 100644
index 0000000..d455c2b
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/icons/ovr16/textoverlay.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/sample.gif b/bundles/org.eclipse.wst.xsd.ui/icons/sample.gif
new file mode 100644
index 0000000..34fb3c9
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/icons/sample.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/plugin.properties b/bundles/org.eclipse.wst.xsd.ui/plugin.properties
new file mode 100644
index 0000000..bb3d093
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/plugin.properties
@@ -0,0 +1,837 @@
+###############################################################################
+# Copyright (c) 2001, 2004 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
+###############################################################################
+! Properties file for component: XMSCH - XML Tools -  XML Schema Editor
+! Packaged for translation in:  xml.zip
+
+!
+! Plugin
+!
+_UI_PLUGIN_NAME             = XML Schema Editor
+_UI_EDITOR_NAME             = XML Schema Editor
+
+_UI_ACTION_EXT_GENERATE      = &Generate
+_UI_ACTION_EXT_GENERATE_DDL  = &DDL...
+_UI_ACTION_EXT_GENERATE_DTD  = D&TD...
+_UI_ACTION_EXT_GENERATE_JAVA = &Java Beans...
+
+_UI_ACTION_EXT_GENERATE_XSD = &Generate XML Schema
+_UI_WIZARD_NAME_NEW_XSD     = XML Schema
+
+_UI_XML_TOOLS_PREFERENCE_PAGE  = XML
+_UI_XML_SCHEMA_PREFERENCE      = XML Schema Files
+
+_UI_WIZARD_NEW_XSD             = XML Schema
+_UI_CREATE_A_NEW_SCHEMA        = Create a new XML schema file
+
+! New property tabs
+_UI_LABEL_GENERAL          = General
+_UI_LABEL_ATTRIBUTES       = Attributes
+_UI_LABEL_DOCUMENTATION    = Documentation
+_UI_LABEL_TYPE_CONSTRAINTS = Constraints
+_UI_LABEL_APPLICATION_INFO = Application Info
+_UI_LABEL_EXTENSIONS       = Extensions
+_UI_LABEL_FACETS           = Facets
+_UI_LABEL_ENUMERATIONS     = Enumerations
+_UI_LABEL_NAMESPACE        = Namespace
+_UI_LABEL_ADVANCED         = Advanced
+
+_UI_LABEL_READ_ONLY     = read-only
+_UI_LABEL_KIND          = Kind:
+_UI_LABEL_VARIETY       = Variety:
+
+_UI_LABEL_APP_INFO      = App Info
+
+!
+! Schema File Window
+!
+_UI_LABEL_FILE_NAME              = File name:
+_UI_LABEL_VERSION                = Version:
+_UI_TOOLTIP_VERSION              = Convenient attribute to store version number
+_UI_LABEL_LANGUAGE               = Language:
+_UI_TOOLTIP_LANGUAGE             = Represents natural language identifiers
+_UI_GROUP_NAMESPACE              = Namespace
+_UI_LABEL_SCHEMA_PREFIX          = Prefix:
+_UI_TOOLTIP_SCHEMA_PREFIX        = The prefix associated with the current namespace.
+_UI_LABEL_TARGET_NAME_SPACE      = Target namespace:
+_UI_TOOLTIP_TARGET_NAME_SPACE    = The namespace for this schema.
+_UI_BUTTON_APPLY                 = Apply
+_UI_LABEL_ATTRIBUTE_FORM_DEFAULT = Attribute form default:
+_UI_TOOLTIP_ATTRIBUTE_FORM       = Indicates if all attributes in a schema must be qualified or not in the instance document
+_UI_LABEL_ELEMENT_FORM_DEFAULT   = Element form default:
+_UI_TOOLTIP_ELEMENT_FORM_DEFAULT = Indicates if all elements in a schema must be qualified or not in the instance document
+_UI_LABEL_BLOCK_DEFAULT          = Block default:
+_UI_TOOLTIP_BLOCK_DEFAULT        = Control derivations for every type and element in the schema
+_UI_LABEL_FINAL_DEFAULT          = Final default:
+_UI_TOOLTIP_FINAL_DEFAULT        = Control derivations for every type and element in the schema
+_UI_ACTION_DELETE_INCLUDE        = Delete
+_UI_ACTION_DELETE_NODES          = Delete Nodes
+! Note to translators: The following is the acronym for Uniform Resource Indicator
+_UI_LABEL_URI                    = URI:
+
+
+_UI_LABEL_ADD              = Add...
+_UI_LABEL_EDIT             = Edit...
+_UI_LABEL_PATTERNS         = Patterns
+_ERROR_FILE_ALREADY_EXISTS = The file name already exists: {0}
+
+!
+! Any Section
+!
+! Note to translators - translate only the word and
+_UI_LABEL_NAMESPACE_AND_PROCESS_CONTENTS = namespace and processContents
+
+!
+! minOccurs and maxOccurs section
+!
+! Note to translators - translate only the word and
+_UI_LABEL_MINOCCURS_AND_MAXOCCURS = minOccurs and maxOccurs
+
+!
+! Value Information Section
+!
+_UI_LABEL_VALUE_INFORMATION   = Value Information
+
+!
+! Notation window
+!
+_UI_NOTATION_NAME                = Name:
+_UI_NOTATION_PUBLIC              = Public:
+_UI_NOTATION_SYSTEM              = System:
+_UI_TOOLTIP_PUBLIC               = An optional public identifier
+_UI_TOOLTIP_SYSTEM               = An optional URI reference
+
+!
+! Complex Type Window
+!
+_UI_NAME                         = Name:
+_UI_ABSTRACT                     = Abstract:
+_UI_MIXED                        = Mixed:
+_UI_BLOCK                        = Block:
+_UI_FINAL                        = Final:
+
+_UI_CT_TOOLTIP_MIXED             = Indicates if type may contain mixed content
+_UI_CT_TOOLTIP_ABSTRACT          = When a complex type is declared abstract, it cannot be used in an instance document
+_UI_CT_TOOLTIP_FINAL             = You can use this to prevent further derivations
+_UI_CT_TOOLTIP_BLOCK             = You can use this to block any derivations
+
+!
+! SimpleContent and ComplexContent Window
+! 
+_UI_LABEL_DERIVED_BY            = Derived by:
+_UI_TOOLTIP_DERIVED_BY          = Derive by extension to inherit from a base type content model and add to it. Derive by restriction to restrict the content model of an existing type.
+
+!
+! Combo box items - no need to translate
+!
+_UI_COMBO_RESTRICTION           = restriction
+_UI_COMBO_EXTENSION             = extension
+
+!
+! Element & Element Ref Window
+!
+_UI_ELEMENT_NAME                 = Name:
+_UI_CHECKBOX_NILLABLE            = Nillable
+_UI_CHECKBOX_ABSTRACT            = Abstract
+_UI_SUBSTITUTION                 = Substitution group:
+_UI_MINIMUM                      = Minimum:
+_UI_MAXIMUM                      = Maximum:
+_UI_REFERENCE_NAME               = Reference name:
+
+_UI_TOOLTIP_ELEMENT_MINIMUM      = A non-negative integer that specifies the minimum number of times an element can occur.
+_UI_TOOLTIP_ELEMENT_MAXIMUM      = A non-negative integer or unbounded if there is no upper limit on the number of times the element can occur.
+_UI_TOOLTIP_ELEMENT_ABSTRACT     = When an element is declared abstract, a member of its equivalent class must appear in the instance document,
+_UI_TOOLTIP_ELEMENT_NIL          = If selected, an attribute can be included in the instance document to indicate that the element has a nil value.
+_UI_TOOLTIP_ELEMENT_SUBSTITUTION = Select the element that can be substituted by this element
+_UI_TOOLTIP_ELEMENT_FORM         = Indicates if the element is qualifed in the instance document
+_UI_TOOLTIP_ELEMENT_VALUE        = Provides a default or fixed value for the element.
+
+
+!
+! Attribute Window
+!    _UI_COMBO_BOX strings are used in code generation. 
+!    Probably don't need to be translated
+!
+_UI_COMBO_BOX_REQUIRED           = required
+_UI_COMBO_BOX_OPTIONAL           = optional
+_UI_COMBO_BOX_PROHIBITED         = prohibited
+
+_UI_FIXED                        = Fixed
+_UI_DEFAULT                      = Default
+_UI_ATTRIBUTE_NAME               = Attribute name:
+_UI_USAGE                        = Usage:
+_UI_FORM                         = Form qualification:
+_UI_VALUE                        = Value
+
+_UI_LABEL_OTHER_ATTRIBUTES       = Other Attributes
+
+_UI_TOOLTIP_ATTRIBUTE_USE        = Indicates if the attribute is required, optional, or prohibited
+_UI_TOOLTIP_ATTRIBUTE_FORM       = Indicates if the attribute is qualifed or not in the instance document
+_UI_TOOLTIP_ATTRIBUTE_VALUE      = Provides default or fixed value for the attribute. Default value only valid if Usage value is set to optional.
+
+_UI_PROCESS_CONTENTS             = Process contents:
+
+!
+! Annotation - Doc & AppInfo Window
+!
+_UI_COMMENT                      = Comment
+_UI_TOOLTIP_COMMENT              = Information useful to the user or application
+_UI_SOURCE                       = Source:
+_UI_TOOLTIP_SOURCE               = An optional URI reference to supplement the local information
+_UI_LANGUAGE                     = Language:
+_UI_TOOLTIP_LANGUAGE_ANNOTATION  = Indicate the language in which the annotation is expressed
+
+!
+! Group
+! 
+_UI_CONTENT_MODEL               = Content model
+_UI_SEQUENCE                    = Sequence
+_UI_CHOICE                      = Choice
+_UI_ALL                         = All
+
+
+!
+! Simple Type Related Facets  - appear as entries in a table - restriction on simple type
+!
+_UI_GROUP_FACETS                = Facets
+_UI_LENGTH                      = Length
+_UI_MINIMUM_LENGTH              = Minimum Length
+_UI_MAXIMUM_LENGTH              = Maximum Length
+_UI_MINIMUM_INCLUSIVE           = Minimum Inclusive
+_UI_MAXIMUM_INCLUSIVE           = Maximum Inclusive
+_UI_MINIMUM_EXCLUSIVE           = Minimum Exclusive
+_UI_MAXIMUM_EXCLUSIVE           = Maximum Exclusive
+_UI_TOTAL_DIGITS                = Total Digits
+_UI_FRACTION_DIGITS             = Fraction Digits
+_UI_WHITE_SPACE                 = White Space
+_UI_FACET_NAME                  = Name
+_UI_FACET_VALUE                 = Value
+_UI_FACET_FIXED                 = Fixed
+
+_UI_TOOLTIP_LENGTH              = The number of units of length. Must be a non-negative integer.
+_UI_TOOLTIP_MIN_LEN             = The minimum number of units of length. Must be a non-negative integer.
+_UI_TOOLTIP_MAX_LEN             = The maximum number of units of length. Must be a non-negative integer.
+_UI_TOOLTIP_MAX_INCLUSIVE       = The upper bound of the value space. The value is itself included.
+_UI_TOOLTIP_MAX_EXCLUSIVE       = The upper bound of the value space. The value is itself excluded.
+_UI_TOOLTIP_MIN_INCLUSIVE       = The lower bound of the value space. The value is itself included.
+_UI_TOOLTIP_MIN_EXCLUSIVE       = The lower bound of the value space. The value is itself excluded.
+_UI_TOOLTIP_TOTAL_DIGITS        = The maximum number of decimal digits. Must be a positive integer.
+_UI_TOOLTIP_FRACTION_DIGITS     = The maximum number of decimal digits in the fractional part. Must be a non-negative integer.
+_UI_TOOLTIP_WHITE_SPACE         = Indicates if white space should be preserved, replaced or collapsed. 
+
+_UI_TOOLTIP_PATTERN             = Constrains the value to match a specific pattern. The pattern must be a regular expression. 
+_UI_TOOLTIP_ENUM                = Constrains the value to a specified set of values. 
+
+!
+! Simple/Complex Type Selection 
+!
+_UI_LABEL_TYPE_INFORMATION          = Type information
+_UI_LABEL_BASE_TYPE                 = Base type
+_UI_LABEL_BASE_TYPE_WITH_COLON      = Base type:
+_UI_LABEL_SET_BASE_TYPE             = Set Base Type
+_UI_ACTION_SET_BASE_TYPE            = Set Base Type...
+_UI_RADIO_NONE                      = None
+_UI_RADIO_BUILT_IN_SIMPLE_TYPE      = Built-in simple type
+_UI_RADIO_USER_DEFINED_SIMPLE_TYPE  = User-defined simple type
+_UI_RADIO_USER_DEFINED_COMPLEX_TYPE = User-defined complex type
+_UI_LABEL_NEW_COMPLEX_TYPE          = New Complex Type
+_UI_LABEL_NEW_SIMPLE_TYPE           = New Simple Type
+_UI_LABEL_SET_TYPE				    = Set Type
+_UI_LABEL_SET_EXISTING_TYPE 		= Set Existing Type...
+_UI_NO_TYPE                         = **none**
+_UI_LABEL_COMPONENTS				= Components:
+_UI_LABEL_QUALIFIER					= Qualifier:
+
+_UI_LABEL_COMPONENT_NAME			   = Component Name:
+_UI_LABEL_MATCHING_COMPONENTS		   = Matching Components:
+_UI_LABEL_MATCHING_TYPES		   	   = Matching Types:
+_UI_LABEL_TYPE_NAME					   = Type Name:
+_UI_LABEL_SPECIFIED_FILE			   = Specified File
+_UI_LABEL_ENCLOSING_PROJECT			   = Enclosing Project
+_UI_LABEL_WORKSPACE					   = Workspace
+_UI_LABEL_CURRENT_RESOURCE			   = Current Resource
+_UI_LABEL_SEARCH_SCOPE				   = Search Scope
+_UI_LABEL_NARROW_SEARCH_SCOPE_RESOURCE = Use resource view to narrow search scope
+_UI_LABEL_AVAILABLE_TYPES			   = Available Types
+
+
+!
+! Combo-box value 
+! NOTE TO TRANSLATOR: Do not translate following line
+_UI_DEFAULT_ANONYMOUS               = **anonymous**
+
+!
+! Unique, Key and KeyRef window
+!
+_UI_REFERENCE_KEY                   = Reference key
+_UI_SELECTOR                        = Selector
+_UI_FIELDS                          = Fields
+
+_UI_TOOLTIP_SELECTOR_TEXT           = Specifies an XPath expression relative to instances of the current element
+_UI_TOOLTIP_FIELD_TEXT              = Specifies an XPath expression relative to each element selected by the selector
+
+_UI_ADD_BUTTON                      = Add>>
+_UI_REMOVE_BUTTON                   = <<Remove
+
+!
+! Include & Imports
+!
+_UI_LABEL_PREFIX                = Prefix:
+_UI_LABEL_NAMESPACE             = Namespace:
+
+_UI_SCHEMA_INCLUDE_DESC         = Select a schema file so that the definitions in the schema file will be available in the current schema. The target namespace of the included schema must be the same as the target namespace of the current schema.
+_UI_LABEL_SCHEMA_IMPORT_DESC    = Select a schema file from a different namespace so that its definitions can be referenced by the current schema. You must associate a prefix with the new namespace for use in the current schema.
+
+_UI_LABEL_SCHEMA_LOCATION        = Schema location:
+_UI_BUTTON_SELECT                = Select
+_UI_FILEDIALOG_SELECT_XML_SCHEMA = Select XML schema file
+_UI_FILEDIALOG_SELECT_XML_DESC   = Select an XML schema file from the Workbench projects
+_UI_FILEDIALOG_SELECT_XML_URL    = Select an XML schema file from HTTP
+
+_UI_LABEL_LOADING_XML_SCHEMA     = Loading XML Schema
+_UI_LABEL_FINISH_LOADING         = Finish Loading
+_UI_LABEL_NO_LOCATION_SPECIFIED  = No Location Specified
+
+!
+! XSD Editor
+!
+_UI_TAB_SOURCE                  = Source
+_UI_TAB_DESIGN                  = Design
+!  Note to translators: Graph is the graphic view of the XML schema
+_UI_TAB_GRAPH                   = Graph
+_UI_MENU_UNDO                   = &Undo @Ctrl+Z
+_UI_MENU_REDO                   = &Redo @Ctrl+Y
+
+!
+! Task List Related Message
+!
+_UI_REF_FILE_ERROR_DESCRIPTION      = The errors below were detected when validating the file "{0}" via the file "{1}".  In most cases these errors can be detected by validating "{2}" directly.  However it is possible that errors will only occur when {2} is validated in the context of {3}.
+_UI_REF_FILE_ERROR_PUSH_HELP        = Push the help button below to read more.
+_UI_REF_FILE_ERROR_MESSAGE          = Referenced file contains errors ({0}).  For more information, right click on the message and select "Show Details..."
+_UI_REF_FILE_SHOW_DETAILS           = Show Details...
+
+
+!
+! XSDEditor Menu bar contributor
+!
+_UI_MENU_GENERATE_JAVA              = Generate &Java Beans...
+_UI_MENU_GENERATE_DTD               = Generate &DTD...
+_UI_MENU_GENERATE_SAMPLE_XML        = Generate XM&L...
+_UI_MENU_XSD_EDITOR                 = &XSD
+_UI_MENU_VALIDATE_XML               = &Validate XML Schema
+_UI_MENU_VALIDATE_XML_TOOLTIP       = Validate the current state of the XML Schema
+_UI_MENU_GENERATE_JAVA_TOOLTIP      = Generate Java beans for the XML Schema
+_UI_MENU_GENERATE_DTD_TOOLTIP       = Generate a DTD from the XML Schema
+_UI_MENU_GENERATE_SAMPLE_XML_TOOLTIP = Generate an XML from the XML Schema
+_UI_MENU_RELOAD_DEPENDENCIES_TOOLTIP = Reload Dependencies
+_UI_MENU_RELOAD_DEPENDENCIES = &Reload Dependencies
+
+!
+! Preference Page
+!
+_UI_TEXT_INDENT_LABEL                 = Indentation
+_UI_TEXT_INDENT_SPACES_LABEL          = &Number of spaces: 
+_UI_TEXT_XSD_NAMESPACE_PREFIX         = XML schema language
+_UI_TEXT_XSD_DEFAULT_PREFIX           = XML schema language constructs &prefix:
+_UI_QUALIFY_XSD                       = &Qualify XML schema language constructs
+_UI_SEPARATE_DESIGN_AND_SOURCE_VIEW   = Separate Source, Design and Graph view
+_UI_COMBINED_DESIGN_AND_SOURCE_VIEW   = Combined Source or Graph view with Design view 
+_UI_LABEL_EDITOR_LAYOUT               = Editor Layout
+_UI_PREF_DESIGN_VIEW_LAYOUT           = Design View Location
+_UI_PREF_DESIGN_BOTTOM                = Below
+_UI_PREF_DESIGN_RIGHT                 = Right
+_UI_TEXT_XSD_DEFAULT_TARGET_NAMESPACE = Default Target Namespace:
+
+!
+! Content Outline View action
+! NOTE TO TRANSLATOR: Do not translate the word(s) following "Add" on each line in
+!   this section i.e. Annotation, Documentation, AppInfo  These words are XML Schema keywords.
+_UI_ACTION_DELETE                  = D&elete
+_UI_ACTION_ADD_ANNOTATION          = Add &Annotation
+_UI_ACTION_ADD_DOC                 = Add &Documentation
+_UI_ACTION_ADD_APP_INFO            = Add A&ppInfo
+_UI_ACTION_ADD_GLOBAL_ELEMENT      = Add Glob&al Element
+_UI_ACTION_ADD_KEY                 = Add &Key
+_UI_ACTION_ADD_KEY_REF             = Add Key Re&f
+_UI_ACTION_ADD_UNIQUE              = Add Uni&que
+_UI_ACTION_ADD_GROUP               = Add G&roup
+_UI_ADD_GROUP_REF                  = Add Gr&oup Ref
+_UI_ACTION_ADD_CONTENT_MODEL       = Add Content &Model
+_UI_ACTION_ADD_ELEMENT             = Add &Element
+_UI_ACTION_ADD_ELEMENT_REF         = Add E&lement Ref
+_UI_ACTION_ADD_SIMPLE_TYPE         = Add &Simple Type
+_UI_ACTION_ADD_PATTERN             = Add &Pattern
+_UI_ACTION_ADD_ENUM                = Add En&umeration
+_UI_ACTION_ADD_ENUMS               = Add Enu&merations...
+_UI_ACTION_ADD_COMPLEX_TYPE        = Add Complex &Type
+_UI_ACTION_ADD_COMPLEX_CONTENT     = Add Comple&x Content
+_UI_ACTION_ADD_SIMPLE_CONTENT      = Add Simple &Content
+_UI_ACTION_ADD_ATTRIBUTE           = Add Attri&bute
+_UI_ACTION_ADD_ATTRIBUTE_GROUP     = Add Attr&ibute Group
+_UI_ACTION_ADD_ATTRIBUTE_GROUP_REF = Add A&ttribute Group Ref
+_UI_ACTION_ADD_INCLUDE             = Add In&clude
+_UI_ACTION_ADD_IMPORT              = Add &Import
+_UI_ACTION_ADD_REDEFINE            = Add Re&define
+_UI_ACTION_ADD_NOTATION            = Add &Notation
+_UI_ACTION_ADD_ANY_ELEMENT         = Add An&y
+_UI_ACTION_ADD_ANY_ATTRIBUTE       = Add &Any Attribute
+_UI_ACTION_ADD_GLOBAL_ATTRIBUTE    = Add &Global Attribute
+_UI_ACTION_ADD_ATTRIBUTE_REFERENCE = Add Attrib&ute Ref
+_UI_ACTION_ADD_RESTRICTION         = Add Re&striction
+_UI_ACTION_ADD_UNION               = Add U&nion
+_UI_ACTION_ADD_LIST                = Add &List
+_UI_ACTION_DELETE_GROUP_SCOPE      = D&elete
+_UI_ACTION_ADD_CHOICE              = Add &Choice
+_UI_ACTION_ADD_SEQUENCE            = Add Se&quence
+_UI_ACTION_ADD_ALL                 = Add &All
+_UI_ACTION_ADD_EXTENSION           = Add E&xtension
+_UI_ACTION_ADD_SELECTOR            = Add &Selector
+_UI_ACTION_ADD_FIELD               = Add &Field
+! NOTE TO TRANSLATOR: Translate Add and Node
+_UI_ACTION_ADD_SCHEMA_NODE         = Add &Schema Node
+! NOTE TO TRANSLATOR: TRANSLATE Add and Local
+_UI_ACTION_ADD_LOCAL_SIMPLE_TYPE   = Add Local &Simple Type
+_UI_ACTION_ADD_LOCAL_COMPLEX_TYPE  = Add Local &Complex Type
+_UI_ACTION_BACK_TO_SCHEMA_VIEW     = Back To Schema
+_UI_HOVER_BACK_TO_SCHEMA_VIEW     = Back to schema
+
+_UI_ACTION_MAKE_ANONYMOUS_TYPE_GLOBAL = Make Anonymous Type Global
+_UI_ACTION_OPEN_SCHEMA                = Open Schema
+
+_UI_ACTION_INSERT_BEFORE           = Insert Before
+_UI_ACTION_INSERT_AFTER            = Insert After
+
+_UI_OUTLINE_SORT                   = Sort alphabetically
+_UI_OUTLINE_DO_NOT_SORT            = Do not sort alphabetically
+
+_UI_OUTLINE_SHOW_COMPLEX_TYPE      = Show Complex Types Only
+_UI_OUTLINE_SHOW_SIMPLE_TYPE       = Show Simple Types Only
+_UI_OUTLINE_SHOW_ATTRIBUTE_GROUP   = Show Attribute Groups Only
+_UI_OUTLINE_SHOW_GROUP             = Show Groups Only
+_UI_OUTLINE_SHOW_GLOBAL_ELEMENT    = Show Global Elements Only
+_UI_OUTLINE_SHOW_REFERENCES        = Show Reference Content
+_UI_OUTLINE_SHOW_INHERITED         = Show Inherited Content
+
+_UI_ACTION_SET_MULTIPLICITY		   = Set Multiplicity
+
+!
+! New XML Schema Wizard
+!
+_UI_WIZARD_CREATE_XSD_MODEL_TITLE    = Create XML Schema
+
+! NOTE TO TRANSLATOR: Do not translate following line
+_UI_CREATEXSD                        = createXSD
+_UI_NEW_XML_SCHEMA_TITLE             = New XML Schema
+_UI_CREATE_A_NEW_XML_SCHEMA_DESC     = Create a new XML schema.
+
+! NOTE TO TRANSLATOR: Do not translate following line
+_UI_NEW_XML_SCHEMA_FILENAME          = NewXMLSchema.xsd
+
+!
+! XSD From RDB Schema Wizard
+!
+_UI_WIZARD_CREATE_XSD_FROM_RDB_TITLE = Create XSD from RDB Table
+
+
+!
+! Regular Expression Wizard
+!
+_UI_REGEX_WIZARD_CREATE_BUTTON = Create Regular Expression...
+_UI_TOOLTIP_REGEX_WIZARD_BUTTON = Launch the Regular Expression Wizard
+_UI_REGEX_WIZARD_TITLE = Regular Expression Wizard
+_UI_REGEX_WIZARD_COMPOSITION_PAGE_TITLE = Compose Regular Expression
+_UI_REGEX_WIZARD_COMPOSITION_PAGE_DESCRIPTION = To add a token, specify its contents and occurrence, then click Add.
+_UI_REGEX_WIZARD_INVALID_REGEX_ERROR_PREFIX = The current regular expression is not valid.  Reason:  
+_UI_REGEX_WIZARD_INVALID_TOKEN_ERROR_PREFIX = The current token is not valid.  Reason:  
+_UI_REGEX_WIZARD_INVALID_REGEX_ERROR = The current regular expression is not valid.
+_UI_REGEX_WIZARD_INVALID_TOKEN_ERROR = The current token is not valid.
+_UI_REGEX_WIZARD_INVALID_MIN_ERROR_SUFFIX = Invalid minimum range value.  The value must be a positive integer less than the maximum value.
+_UI_REGEX_WIZARD_MISSING_MIN_ERROR_SUFFIX = Invalid minimum range value.  A minimum range must be specified if a maximum range is specified.
+_UI_REGEX_WIZARD_INVALID_MAX_ERROR_SUFFIX = Invalid maximum range value.  The value must be a positive integer greater than the minimum value.
+_UI_REGEX_WIZARD_INVALID_REPEAT_ERROR_SUFFIX = Invalid repeat value.  The value must be a positive integer.
+_UI_REGEX_WIZARD_INVALID_SELECTION_ERROR = Nothing is currently selected.  Either make a selection or choose a different token. 
+_UI_REGEX_WIZARD_TOKEN_LABEL = Token contents:
+_UI_REGEX_WIZARD_AUTO_ESCAPE_CHECKBOX_LABEL = Auto escape
+_UI_REGEX_WIZARD_OCCURENCE_LABEL = Occurrence
+! Instructions for translators: The following label is used in a phrase to identify a range of values.
+! For example:  5 to 10.
+! The values are text fields that are initially blank so the user has to enter in values
+! For example:   _______ to ________
+_UI_REGEX_WIZARD_TO_LABEL = to
+_UI_REGEX_WIZARD_ADD_BUTTON_LABEL = Add 
+_UI_REGEX_WIZARD_CURRENT_REGEX_LABEL = Current regular expression:
+_UI_TOOLTIP_REGEX_WIZARD_TERMS = Content of new token
+_UI_TOOLTIP_REGEX_WIZARD_AUTO_ESCAPE_CHECKBOX = Insert escape characters to match metacharacter literals (e.g. converts \"*\" to \"\\*\")
+_UI_TOOLTIP_REGEX_WIZARD_ADD_BUTTON = Add this token to the regular expression
+_UI_TOOLTIP_REGEX_WIZARD_CURRENT_REGEX = The current regular expression
+_UI_TOOLTIP_REGEX_WIZARD_REPEAT = The number of times that the token must occur.
+_UI_TOOLTIP_REGEX_WIZARD_MIN = The minimum number of times that the token can occur.
+_UI_TOOLTIP_REGEX_WIZARD_MAX = The maximum number of times that the token can occur.
+_UI_TOOLTIP_REGEX_WIZARD_CARET_LABEL = The location where the new token will be inserted.
+_UI_REGEX_WIZARD_TESTING_PAGE_TITLE = Test Regular Expression
+_UI_REGEX_WIZARD_TESTING_PAGE_DESCRIPTION = To test the regular expression, enter sample text that you wish to match.  The success of the match will be indicated above.
+_UI_REGEX_WIZARD_REGEX_LABEL = Regular expression: 
+_UI_REGEX_WIZARD_SAMPLE_TEXT =  Sample text: 
+_UI_REGEX_WIZARD_MATCHES = The text matches the regular expression.
+_UI_REGEX_WIZARD_DOES_NOT_MATCH = The text does not match the regular expression.
+_UI_REGEX_WIZARD_TERM_ANY_CHAR = Any character
+_UI_REGEX_WIZARD_TERM_ALPHANUMERIC_CHAR = Alphanumeric character
+_UI_REGEX_WIZARD_TERM_WHITESPACE = Whitespace
+_UI_REGEX_WIZARD_TERM_DIGIT = Digit
+_UI_REGEX_WIZARD_TERM_UPPER = Upper case
+_UI_REGEX_WIZARD_TERM_LOWER = Lower case
+_UI_REGEX_WIZARD_TERM_SELECTION = Current selection
+_UI_REGEX_WIZARD_QUANTIFIER_SINGLE = Just once
+_UI_REGEX_WIZARD_QUANTIFIER_STAR = Zero or more
+_UI_REGEX_WIZARD_QUANTIFIER_PLUS = One or more
+_UI_REGEX_WIZARD_QUANTIFIER_OPTIONAL = Optional
+_UI_REGEX_WIZARD_QUANTIFIER_REPEAT = Repeat
+_UI_REGEX_WIZARD_QUANTIFIER_RANGE = Range
+
+!
+! Select Include File Wizard
+_UI_LABEL_INCLUDE_URL_FILE    = Select schema from:
+_UI_RADIO_URL                 = HTTP
+_UI_RADIO_FILE                = Workbench projects
+_UI_WIZARD_INCLUDE_FILE_TITLE = Include Another Schema
+_UI_WIZARD_INCLUDE_FILE_DESC  = Select another schema from workbench projects or from HTTP.
+_UI_LABEL_URL                 = URL:
+_UI_URL_START_WITH            = The URL must start with http://
+_UI_SPECIFY_URL               = Please specify a URL
+
+!
+! Enumerations Dialog
+_UI_ENUMERATIONS_DIALOG_TITLE = Add Enumerations
+_UI_LABEL_DELIMITER_CHAR      = &Delimiter characters:
+_UI_LABEL_PRESERVE_WHITESPACE = &Preserve leading and trailing whitespace
+
+_UI_ACTION_DELETE_ENUMERATION = Delete Enumeration
+
+!
+! Validate Schema 
+!
+_UI_DIALOG_XML_SCHEMA_INVALID_TITLE       = Validation Failed
+_UI_DIALOG_XML_SCHEMA_VALID_TITLE         = Validation Succeeded
+_UI_DIALOG_XML_SCHEMA_VALID_TEXT          = The XML schema file is valid.
+_UI_DIALOG_XML_SCHEMA_VALID_WITH_WARNINGS = The XML schema file is valid however warnings have been issued. See the Problems view for the warning messages.
+_UI_DIALOG_XML_SCHEMA_INVALID_TEXT        = The XML schema file is not valid. See the Problems view for the error messages.
+
+!
+! Combo-box choices 
+!
+! NOTE TO TRANSLATOR: Do not translate following 10 lines
+_UI_COMBO_QUALIFIED             = qualified
+_UI_COMBO_UNQUALIFIED           = unqualified
+_UI_COMBO_EXTENSION             = extension
+_UI_COMBO_RESTRICTION           = restriction
+_UI_COMBO_ALL                   = all
+_UI_COMBO_TRUE                  = true
+_UI_COMBO_FALSE                 = false
+_UI_COMBO_LAX                   = lax
+_UI_COMBO_SKIP                  = skip
+_UI_COMBO_STRICT                = strict
+
+! Generate DTD - pass as title and description for wizard page
+_UI_GENERATE_DTD_TITLE          = Generate DTD
+_UI_GENERATE_DTD_DESCRIPTION    = Generate a DTD from the selected XML schema file.
+
+! Generate DDL - pass as title and description for wizard page
+_UI_GENERATE_DDL_TITLE          = Generate DDL
+_UI_GENERATE_DDL_DESCRIPTION    = Generate DDL from the selected XML schema file.
+
+_UI_XML_SCHEMA_VALIDATOR            = XML Schema Validator
+
+! Generation from the Schema model - pre-condition check
+_UI_DIALOG_TITLE_GRAMMAR_ERROR      = Invalid Grammar
+_UI_DIALOG_INFO_SCHEMA_INVALID      = The schema file contains errors. Open it in the XML Schema editor and validate it for details.
+_UI_DIALOG_TITLE_NO_GLOBAL_ELEMENTS = No Global Elements
+_UI_DIALOG_INFO_NO_GLOBAL_ELEMENTS  = The selected schema has no global elements. Global elements are required to generate anything from an XML schema.
+
+! Section title for other attributes
+_UI_SECTION_ADVANCED_ATTRIBUTES   = Advanced
+
+! For undo action menus
+! Note to Translators: For the following "Change" phrases,
+! maxOccurs, minOccurs, lang, xpath are keywords so please
+! do no translate them.  These are for the undo action menus.
+! For example, if the user makes a change in the name of an
+! element, then the undo action would be Undo Element Name Change
+_UI_NAMESPACE_CHANGE           = Namespace Change
+_UI_PROCESSCONTENTS_CHANGE     = Process Contents Change
+_UI_MAXOCCURS_CHANGE           = maxOccurs Change
+_UI_MINOCCURS_CHANGE           = minOccurs Change
+_UI_SOURCE_ATTRIBUTE_CHANGE    = Source Change
+_UI_COMMENT_CHANGE             = Comment Change
+_UI_PREFIX_CHANGE              = Prefix Change
+_UI_ATTRIBUTEGROUP_REF_CHANGE  = Attribute Group Reference Change
+_UI_ATTRIBUTEGROUP_NAME_CHANGE = Attribute Group Name Change
+_UI_ATTRIBUTE_FIXED_CHANGE     = Attribute Fixed Change
+_UI_ATTRIBUTE_DEFAULT_CHANGE   = Attribute Default Change
+_UI_ATTRIBUTE_NAME_CHANGE      = Attribute Name Change
+_UI_ATTRIBUTE_VALUE_CHANGE     = Attribute Value Change
+_UI_ATTRIBUTE_USE_CHANGE       = Attribute Use Change
+_UI_ATTRIBUTE_FORM_CHANGE      = Attribute Form Change
+_UI_COMPLEXTYPE_NAME_CHANGE    = Complex Type Name Change
+_UI_COMPLEXTYPE_ABSTRACT_CHANGE = Complex Type Abstract Change
+_UI_COMPLEXTYPE_MIXED_CHANGE   = Complex Type Mixed Change
+_UI_COMPLEXTYPE_BLOCK_CHANGE   = Complex Type Block Change
+_UI_COMPLEXTYPE_FINAL_CHANGE   = Complex Type Final Change
+_UI_DOCUMENTATION_SOURCE_CHANGE = Documentation Source Change
+_UI_DOCUMENTATION_LANG_CHANGE   = Documentation lang Change
+_UI_DOCUMENTATION_COMMENT_CHANGE = Documentation Comment Change
+_UI_ELEMENT_NAME_CHANGE          = Element Name Change
+_UI_ELEMENT_VALUE_CHANGE         = Element Value Change
+_UI_ELEMENT_TYPE_CHANGE          = Element Type Change
+_UI_ENUM_VALUE_CHANGE            = Enum Value Change
+_UI_FIELD_XPATH_CHANGE           = Field xpath Change
+_UI_GROUP_REF_CHANGE             = Group Reference Change
+_UI_GROUP_SCOPE_CHANGE           = Content Model Change
+_UI_GROUP_NAME_CHANGE            = Group Name Change
+_UI_IMPORT_CHANGE                = Import Change
+_UI_KEY_NAME_CHANGE              = Key Name Change
+_UI_KEYREF_NAME_CHANGE           = Key Reference Name Change
+! Note to translators
+! For the following item, Refer is the keyref attribute to refer to some other key
+_UI_KEYREF_REFER_CHANGE          = Key Reference Refer Change
+_UI_NOTATION_NAME_CHANGE         = Notation Name Change
+_UI_NOTATION_PUBLIC_CHANGE       = Notation Public Change
+_UI_NOTATION_SYSTEM_CHANGE       = Notation System Change
+_UI_PATTERN_VALUE_CHANGE         = Pattern Value Change
+_UI_SCHEMA_VERSION_CHANGE        = Schema Version Change
+_UI_SCHEMA_LANG_CHANGE           = Schema lang Change
+_UI_SELECTOR_XPATH_CHANGE        = Selector xpath Change
+_UI_TYPE_CHANGE                  = Type Change
+_UI_DERIVEDBY_CHANGE             = Derivation Change
+_UI_FACET_CHANGE                 = Facet Change
+_UI_SIMPLETYPE_NAME_CHANGE       = SimpleType Name Change
+_UI_UNIQUE_NAME_CHANGE           = Unique Name Change
+_UI_SCHEMA_ATTRIBUTEFORMDEFAULT_CHANGE = Attribute Form Default Change
+_UI_SCHEMA_ELEMENTFORMDEFAULT_CHANGE = Element Form Default Change
+_UI_SCHEMA_BLOCKDEFAULT_CHANGE   = Block Default Change
+_UI_SCHEMA_FINALDEFAULT_CHANGE   = Final Default Change
+_UI_ELEMENT_SUBSTITUTIONGROUP_CHANGE = Substitution Group Change
+_UI_ELEMENT_FORM_CHANGE          = Form Change
+_UI_ELEMENT_BLOCK_CHANGE         = Block Change
+_UI_ELEMENT_FINAL_CHANGE         = Final Change
+_UI_ELEMENT_ABSTRACT_CHANGE      = Abstract Change
+_UI_ELEMENT_NILLABLE_CHANGE      = Nillable Change
+_UI_TARGETNAMESPACE_CHANGE       = Target Namespace Change
+
+! Window Headings for Flat View
+_UI_PAGE_HEADING_ANYATTRIBUTE = Any Attribute
+_UI_PAGE_HEADING_ANYELEMENT   = Any Element
+_UI_PAGE_HEADING_APPINFO            = AppInfo
+_UI_PAGE_HEADING_ATTRIBUTEGROUP_REF = Attribute Group Reference
+_UI_PAGE_HEADING_ATTRIBUTEGROUP     = Attribute Group
+_UI_PAGE_HEADING_ATTRIBUTE_REF      = Attribute Reference
+_UI_PAGE_HEADING_ATTRIBUTE          = Attribute
+_UI_PAGE_HEADING_COMPLEXTYPE        = Complex Type
+_UI_PAGE_HEADING_DOCUMENTATION      = Documentation
+_UI_PAGE_HEADING_ELEMENT     = Element
+_UI_PAGE_HEADING_ELEMENT_REF = Element Reference
+_UI_PAGE_HEADING_ENUM        = Enumeration
+_UI_PAGE_HEADING_FIELD       = Field
+_UI_PAGE_HEADING_GROUP_REF   = Group Reference
+_UI_PAGE_HEADING_CONTENTMODEL  = Content Model
+_UI_PAGE_HEADING_GROUP         = Group
+_UI_PAGE_HEADING_IMPORT        = Import
+_UI_PAGE_HEADING_INCLUDE       = Include
+_UI_PAGE_HEADING_KEYREF        = Key Reference
+_UI_PAGE_HEADING_KEY           = Key
+_UI_PAGE_HEADING_NOTATION      = Notation
+_UI_PAGE_HEADING_PATTERN       = Pattern
+_UI_PAGE_HEADING_REDEFINE      = Redefine
+_UI_PAGE_HEADING_SCHEMA        = Schema
+_UI_PAGE_HEADING_SELECTOR      = Selector
+_UI_PAGE_HEADING_LIST          = List
+_UI_PAGE_HEADING_UNION         = Union
+_UI_PAGE_HEADING_SIMPLECONTENT = Simple Content
+_UI_PAGE_HEADING_COMPLEXCONTENT = Complex Content
+_UI_PAGE_HEADING_RESTRICTION   = Restriction
+_UI_PAGE_HEADING_EXTENSION     = Extension
+_UI_PAGE_HEADING_SIMPLETYPE    = Simple Type
+_UI_PAGE_HEADING_UNIQUE        = Unique
+_UI_PAGE_HEADING_REFERENCE     = reference
+
+!
+! Graph page
+!
+_UI_GRAPH_SIMPLE_TYPES         = Simple Types
+_UI_GRAPH_COMPLEX_TYPES        = Complex Types
+_UI_GRAPH_GROUPS               = Groups
+_UI_GRAPH_GLOBAL_ATTRIBUTES    = Global Attributes
+_UI_GRAPH_GLOBAL_ELEMENTS      = Global Elements
+_UI_GRAPH_XSDSCHEMA            = Schema
+_UI_GRAPH_XSDSCHEMA_NO_NAMESPACE = (no target namespace specified)
+_UI_GRAPH_XSDCOMPLEXTYPEDEFINITION = XSD Complex Type Definition:
+_UI_GRAPH_XSDMODELGROUP        = XSD Model Group
+_UI_GRAPH_XSDPARTICLE          = XSD Particle
+_UI_GRAPH_VIEW_NOT_AVAILABLE   = View is not available for selected object.
+_UI_GRAPH_UNKNOWN_OBJECT       = Unknown object
+
+! Additional Categories
+_UI_GRAPH_TYPES                = Types
+_UI_GRAPH_ELEMENTS             = Elements
+_UI_GRAPH_ATTRIBUTES           = Attributes
+_UI_GRAPH_ATTRIBUTE_GROUPS     = Attribute Groups
+_UI_GRAPH_NOTATIONS            = Notations
+_UI_GRAPH_IDENTITY_CONSTRAINTS = Identity Constraints
+_UI_GRAPH_ANNOTATIONS          = Annotations
+_UI_GRAPH_DIRECTIVES           = Directives
+
+! For Union MemberTypes Dialog
+_UI_LABEL_SELECT_MEMBERTYPES   = Select from the available types and add to the memberTypes list
+_UI_LABEL_MEMBERTYPES_CHANGE   = Member Types Change
+_UI_LABEL_MEMBERTYPES_VALUE    = Member Types Value:
+_UI_LABEL_MEMBERTYPES          = Member types:
+
+_UI_LABEL_VARIETY_CHANGE       = Variety Change
+
+_UI_LABEL_FIXEDORDEFAULT_VALUE = Fixed/Default Value
+
+_UI_LABEL_ITEM_TYPE_CHANGE     = Item Type Change
+
+_UI_LABEL_AVAILABLE_TYPES      = Available Types
+
+_UI_LABEL_INCLUDE_CHANGE       = Include Change
+
+_UI_LABEL_ITEM_TYPE            = Item type:
+_UI_LABEL_BASE_TYPE            = Base Type
+_UI_LABEL_TYPE                 = Type
+_UI_LABEL_MODEL_GROUP          = Model Group
+
+_UI_LABEL_ABSENT               = absent
+
+_UI_WARNING_RESET_ATTRGRP_REF  = Reset attribute group reference <{0}>
+_UI_WARNING_REMOVE_ATTRGRP_REF = Remove attribute group reference <{0}>
+_UI_WARNING_RESET_ATTR_REF     = Reset attribute reference <{0}>
+_UI_WARNING_REMOVE_ATTR_REF    = Remove attribute reference <{0}>
+
+!======================================================================================
+!
+! Here is the list of Error string that have message IDs - make sure they are unique
+!  Range for XSDEditor messageIDs: IWAX1001E - IWAX1200E
+!
+!======================================================================================
+! These three errors appear in the select include wizard
+! The name of the file will be substituted in
+_UI_DIFFERENT_NAME_SPACE  = {0} is in a different namespace 
+_UI_SAME_NAME_SPACE       = {0} is in the same namespace
+_UI_INCORRECT_XML_SCHEMA  = {0} is an invalid XML schema file
+
+_ERROR_SCHEMA_NOT_EXIST         = IWAX1003E does not exist.
+_ERROR_LABEL_INVALID_PREFIX     = IWAX1004E Invalid prefix. A prefix must not be empty or contain any space.
+
+! The name of the file will be substituted in
+_ERROR_SCHEMA_NAME_THE_SAME  = IWAX1005E {0} is the current schema. A schema cannot include itself. Reset to the last valid schema.
+
+_ERROR_XSD_GENERATION                = IWAX1006E Error generating XML schema
+_ERROR_NO_CONTAINER                  = IWAX1007E No folder selected
+_ERROR_NO_FILE_NAME                  = IWAX1008E No file name provided
+_ERROR_FILENAME_MUST_END_XSD         = IWAX1011E The file name must end in .xsd
+
+
+!
+! For schema that has too many errors, an extended message. 
+!
+_ERROR_DIALOG_XML_SCHEMA_INVALID_TEXT  = IWAX100d9E The XML schema file is not valid.  
+_ERROR_MORE_ERRORS                    = There are more errors in the schema than are displayed in the Tasks view.  Correct the first {0} errors and re-validate the schema file.
+
+! DDL Generation Failed Dialog
+_UI_DIALOG_DDL_GEN_FAILED_TITLE     = DDL Generation Failed
+_ERROR_DIALOG_DDL_NOT_GENEREATED    = IWAX1010E DDL has not been generated
+_UI_DIALOG_DDL_GEN_FAILED_REASON    = The selected schema has no global elements
+_UI_DIALOG_DDL_GEN_FAILED_REASON2   = None of the global elements in the schema have a complex type or they reference complex types that cannot be found.
+
+_EXC_OPEN_XSD = IWAX1011E Cannot open XML Schema editor
+
+_ERROR_LABEL_PREFIX_EXISTS     = IWAX1012E Prefix already exists
+
+_ERROR_REMOVE_LOCAL_SIMPLETYPE  = IWAX1013E Remove local simple type from extension
+
+_WARN_INVALID_TARGET_NAMESPACE = IWAX1014E The target namespace is not well-formed
+
+_ERROR_TARGET_NAMESPACE_AND_PREFIX = IWAX1015E A target namespace must be associated with a prefix
+
+
+_UI_CONTAINMENT = Containment
+_UI_INHERITANCE = Inheritance
+_UI_SUBSTITUTION_GROUPS = Substitution Groups
+_UI_ANONYMOUS = **anonymous**
+_UI_VALUE = Value
+_UI_ANY_ELEMENT = Any Element
+_UI_SORT = Sort
+
+_UI_ACTION_EDIT_NAMESPACES = Edit Namespaces...
+
+
+_UI_CreateChild_text = {0}
+_UI_CreateChild_text2 = {1} {0}
+_UI_CreateChild_tooltip = Create New {0} Under {1} Feature
+_UI_CreateChild_description = Create a new child of type {0} for the {1} feature of the selected {2}.
+_UI_CreateSibling_description = Create a new sibling of type {0} for the selected {2}, under the {1} feature of their parent.
+
+!======================================================================================
+!
+! Used by org.eclipse.wst.common.ui.internal.viewers.SelectSingleFileView
+!
+!======================================================================================
+_UI_LABEL_SOURCE_FILES   = Workbench Files
+_UI_LABEL_SELECTED_FILES = Selected Files
+
+_UI_IMPORT_BUTTON          = Import Files...
+_UI_IMPORT_BUTTON_TOOL_TIP = Import files from file system
+
+
+!======================================================================================
+!
+! refactoring
+!
+!======================================================================================
+refactoringActionSet.label=Refactor
+refactoringActionSet.description=XSD Editor refactoring actions
+refactoring.menu.label=Refactor
+refactoring.renameAction.label=Re&name...
+context.text.editor.xsd.name=Editing XSD context
+command.xsd.refactor.rename.element.name=Rename XSD element
+command.xsd.refactor.rename.element.description=Rename XSD element
+command.xsd.refactor.makeElementGlobal.element.name=Make local element global
+command.xsd.refactor.makeElementGlobal.element.description=Promotes local element to global level and replaces its references
+command.xsd.refactor.makeTypeGlobal.element.name=Make anonymous type global
+command.xsd.refactor.makeTypeGlobal.element.description=Promotes anonymous type to global level and replaces its references
+
+! Copied from sse
+23concat_EXC_=Resource {0} does not exist.
+32concat_EXC_=Editor could not be open on {0}
+An_error_has_occurred_when1_ERROR_=An error has occurred when initializing the input for the the editor's source page.
+OpenFileFromSource.label=Op&en Selection
+OpenFileFromSource.tooltip=Open an editor on the selected link
+OpenFileFromSource.image=
+OpenFileFromSource.description=Open an editor on the selected link
+
+AddBookmark.label=Add Boo&kmark...
+SelectRuler.label=Select Ruler
+
+_ZERO_OR_MORE = Zero or More
+_ZERO_OR_ONE  = Zero or One
+_ONE_OR_MORE  = One or More
+
+# For translators, as in structured DOM tree
+_UI_LABEL_STRUCTURED           = Structured
+
+_UI_LABEL_MOVE   				       = Move
+_UI_LABEL_RENAME 				       = Rename
+_UI_LABEL_TARGETNAMESPACE_CHANGE       = Target Namespace Change
+_INFO_RESET_ATTRIBUTE_GROUP_REFERENCE  = Reset attribute group reference
+_INFO_REMOVE_ATTRIBUTE_GROUP_REFERENCE = Remove attribute group reference
+
+Bundle-Vendor.0 = Eclipse.org
+search.declarations.label = Declarations
+search.references.label = References
\ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/plugin.xml b/bundles/org.eclipse.wst.xsd.ui/plugin.xml
new file mode 100644
index 0000000..90c3e76
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/plugin.xml
@@ -0,0 +1,451 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin>
+
+	<extension point="org.eclipse.ui.editors">
+		<editor
+			name="%_UI_EDITOR_NAME"
+			extensions="xsd"
+			default="true"
+			icon="icons/XSDFile.gif"
+            contributorClass="org.eclipse.wst.xsd.editor.XSDMultiPageEditorContributor"
+            class="org.eclipse.wst.xsd.editor.InternalXSDMultiPageEditor"
+            id="org.eclipse.wst.xsd.editor.InternalXSDMultiPageEditor">
+<!--            <contentTypeBinding
+                contentTypeId="org.eclipse.wst.xsd.core.xsdsource" />
+                -->
+		</editor>
+	</extension>
+
+	<extension point="org.eclipse.ui.editorActions">
+        <editorContribution
+            targetID="org.eclipse.wst.xsd.core.xsdsource.source"
+            id="org.eclipse.wst.xsd.core.xsdsource.ruler.actions">
+         <action
+               label="%AddBookmark.label"
+               helpContextId="org.eclipse.ui.bookmark_action_context"
+               class="org.eclipse.ui.texteditor.BookmarkRulerAction"
+               actionID="RulerDoubleClick"
+               id="org.eclipse.ui.texteditor.BookmarkRulerAction"/>
+         <action
+               label="%SelectRuler.label"
+               class="org.eclipse.ui.texteditor.SelectRulerAction"
+               actionID="RulerClick"
+               id="org.eclipse.ui.texteditor.SelectRulerAction"/>
+        </editorContribution>
+	</extension>
+
+	<extension point="org.eclipse.ui.newWizards">
+		<wizard
+			id="org.eclipse.wst.xsd.ui.internal.wizards.NewXSDWizard"
+			name="%_UI_WIZARD_NEW_XSD"
+			class="org.eclipse.wst.xsd.ui.internal.wizards.NewXSDWizard"
+			category="org.eclipse.wst.XMLCategory"
+			icon="icons/XSDFile.gif">
+			<description>%_UI_CREATE_A_NEW_SCHEMA</description>
+			<selection class="org.eclipse.core.resources.IResource" />
+		</wizard>
+	</extension>
+
+	<extension point="org.eclipse.ui.preferencePages">
+		<page
+			name="%_UI_XML_SCHEMA_PREFERENCE"
+			category="org.eclipse.wst.sse.ui.internal.provisional.preferences"
+			class="org.eclipse.wst.xsd.editor.internal.preferences.XSDPreferencePage"
+			id="org.eclipse.wst.xsd.editor.internal.preferences.XSDPreferencePage">
+		</page>
+	</extension>
+<!--
+	<extension point="org.eclipse.wst.sse.ui.editorConfiguration">
+		<provisionalDefinition
+			type="preferencepages"
+			value="org.eclipse.wst.xsd.ui.internal.preferences.XSDPreferencePage"
+			target="org.eclipse.wst.xsd.ui.internal.XSDEditor.source" />
+     		<sourceViewerConfiguration
+			class="org.eclipse.wst.xsd.ui.internal.StructuredTextViewerConfigurationXSD"
+			target="org.eclipse.wst.xsd.core.xsdsource" />
+		<contentOutlineConfiguration
+			class="org.eclipse.wst.xsd.ui.internal.XSDContentOutlineConfiguration"
+			target="org.eclipse.wst.xsd.core.xsdsource" /> 
+	</extension>  -->
+
+	<!-- ==================================================== -->
+	<!-- Support help on the tags                             -->
+	<!-- ==================================================== -->
+	<!--   <extension
+		point="org.eclipse.wst.xml.core.internal.contentmodel.annotationFiles">
+		<annotationFile
+		location="/w3c/schemaForCodeAssist-annotations.xml"
+		publicId="http://www.w3.org/2001/XMLSchema">
+		</annotationFile>
+		</extension>
+	-->
+	
+	
+   <extension 
+   		point="org.eclipse.ui.views.properties.tabbed.propertyContributor">
+     <propertyContributor
+           contributorId="org.eclipse.wst.xsd.editor"
+           labelProvider="org.eclipse.wst.xsd.ui.common.properties.providers.XSDSectionLabelProvider">
+         <propertyCategory category="General"/>
+   		 <propertyCategory category="Documentation"/>
+         <propertyCategory category="Advanced"/>
+     </propertyContributor>
+   </extension>
+
+   <extension 
+    	point="org.eclipse.ui.views.properties.tabbed.propertyTabs">
+      <propertyTabs 
+            contributorId="org.eclipse.wst.xsd.editor">
+			<propertyTab
+				label="%_UI_LABEL_GENERAL"
+				category="General"
+				id="property.tab.general">
+			</propertyTab>
+			<propertyTab
+				label="%_UI_LABEL_TYPE_CONSTRAINTS"
+				category="General"
+				afterTab="property.tab.general"
+				id="property.tab.typeconstraints">
+			</propertyTab>
+			<propertyTab
+				label="%_UI_LABEL_ENUMERATIONS"
+				category="General"
+				afterTab="property.tab.general"
+				id="property.tab.enumerations">
+			</propertyTab>
+			<propertyTab
+				label="%_UI_LABEL_DOCUMENTATION"
+				category="Documentation"
+				afterTab="property.tab.general"
+				id="property.tab.documentation">
+			</propertyTab>
+			<propertyTab
+				label="%_UI_LABEL_EXTENSIONS"
+				category="Documentation"
+				afterTab="property.tab.general"
+				id="property.tab.extensions">
+			</propertyTab>
+    </propertyTabs>
+ </extension>
+
+
+<extension point="org.eclipse.ui.views.properties.tabbed.propertySections">
+   <propertySections contributorId="org.eclipse.wst.xsd.editor">
+	 <propertySection tab="property.tab.general" 
+        class="org.eclipse.wst.xsd.ui.common.properties.sections.XSDSchemaSection"  
+	 	id="prop.section.XSDSchemaSection">
+	    <input type="org.eclipse.xsd.XSDSchema">
+	    </input>
+	 </propertySection>
+	 <propertySection tab="property.tab.general" 
+        class="org.eclipse.wst.xsd.ui.common.properties.sections.SchemaLocationSection" 
+	 	id="prop.section.SchemaLocationSection">
+	    <input type="org.eclipse.xsd.XSDSchemaCompositor">
+	    </input>
+	 </propertySection>
+	 <propertySection tab="property.tab.general" 
+        class="org.eclipse.wst.xsd.ui.common.properties.sections.XSDComplexTypeSection"  
+	 	id="prop.section.XSDComplexTypeSection">
+	    <input type="org.eclipse.xsd.XSDComplexTypeDefinition">
+	    </input>
+	 </propertySection>
+	 <propertySection tab="property.tab.general" 
+        class="org.eclipse.wst.xsd.ui.common.properties.sections.XSDElementDeclarationSection"  
+	 	id="prop.section.XSDElementDeclarationSection">
+	    <input type="org.eclipse.xsd.XSDElementDeclaration">
+	    </input>
+	 </propertySection>
+	 <propertySection tab="property.tab.general" 
+        class="org.eclipse.wst.xsd.ui.common.properties.sections.XSDAttributeDeclarationSection"
+	 	id="prop.section.XSDAttributeDeclarationSection">
+	    <input type="org.eclipse.xsd.XSDAttributeDeclaration">
+	    </input>
+	 </propertySection>
+	 <propertySection tab="property.tab.general" 
+        class="org.eclipse.wst.xsd.ui.common.properties.sections.XSDAttributeGroupDefinitionSection"  
+	 	id="prop.section.XSDAttributeGroupDefinitionSection">
+	    <input type="org.eclipse.xsd.XSDAttributeGroupDefinition">
+	    </input>
+	 </propertySection>	
+	 <propertySection tab="property.tab.general" 
+        class="org.eclipse.wst.xsd.ui.common.properties.sections.XSDModelGroupSection"  
+	 	id="prop.section.XSDModelGroupSection">
+	    <input type="org.eclipse.xsd.XSDModelGroup">
+	    </input>
+	 </propertySection>
+	 <propertySection tab="property.tab.general" 
+        class="org.eclipse.wst.xsd.ui.common.properties.sections.XSDModelGroupDefinitionSection"  
+	 	id="prop.section.XSDModelGroupDefinitionSection">
+	    <input type="org.eclipse.xsd.XSDModelGroupDefinition">
+	    </input>
+	 </propertySection>
+	 <propertySection tab="property.tab.general" 
+        class="org.eclipse.wst.xsd.ui.common.properties.sections.XSDSimpleTypeSection"
+	 	id="prop.section.XSDSimpleTypeSection">
+	    <input type="org.eclipse.xsd.XSDSimpleTypeDefinition">
+	    </input>
+	 </propertySection>
+	 <propertySection tab="property.tab.typeconstraints" 
+        class="org.eclipse.wst.xsd.ui.common.properties.sections.XSDFacetSection"
+        filter="org.eclipse.wst.xsd.ui.common.properties.sections.XSDFacetSectionFilter"
+	 	id="prop.section.XSDFacetSection">
+	    <input type="org.eclipse.xsd.XSDConcreteComponent">
+	    </input>
+	 </propertySection>
+	 <propertySection tab="property.tab.documentation" 
+	 	class="org.eclipse.wst.xsd.ui.common.properties.sections.AnnotationSection" 
+	 	id="prop.section.AnnotationSection">
+	    <input type="org.eclipse.xsd.XSDConcreteComponent">
+	    </input>
+	 </propertySection>
+	 <propertySection tab="property.tab.extensions" 
+	 	class="org.eclipse.wst.xsd.ui.common.properties.sections.ApplicationInfoSection" 
+	 	id="prop.section.ExtensionsSection">
+	    <input type="org.eclipse.xsd.XSDConcreteComponent">
+	    </input>
+	 </propertySection>
+  </propertySections>
+</extension>
+
+  <extension-point id="ApplicationInformationDescription" name="ApplicationInformationDescription"/>
+
+  <extension-point id="XSDEditorExtensionConfiguration" name="XSDEditorExtensionConfiguration"/>
+
+	<extension
+		point="org.eclipse.wst.xml.core.catalogContributions">
+		<catalogContribution id="default">
+		
+			<uri
+				name="http://www.w3.org/2001/XMLSchema"
+				uri="platform:/plugin/org.eclipse.xsd/cache/www.w3.org/2001/XMLSchema.xsd" />
+			<system
+				systemId="http://www.w3.org/2001/xml.xsd"
+				uri="platform:/plugin/org.eclipse.xsd/cache/www.w3.org/2001/xml.xsd"/>				
+		</catalogContribution>
+	</extension>
+
+
+	<!-- intialize xsd reconcile validator -->
+	<extension point="org.eclipse.wst.sse.ui.sourcevalidation">
+		<validator
+			scope="total"
+			class="org.eclipse.wst.xsd.ui.internal.validation.DelegatingSourceValidatorForXSD"
+			id="org.eclipse.wst.xsd.ui.internal.validation.DelegatingSourceValidatorForXSD">
+			<contentTypeIdentifier
+				id="org.eclipse.wst.xsd.core.xsdsource">
+				<partitionType id="org.eclipse.wst.xml.XML_DEFAULT">
+				</partitionType>
+			</contentTypeIdentifier>
+		</validator>
+	</extension>
+
+	<extension point="org.eclipse.ui.contexts">
+		<context
+			id="org.eclipse.wst.xsd.ui.text.editor.context"
+			name="%context.text.editor.xsd.name"
+			parentId="org.eclipse.ui.textEditorScope" />
+	</extension>
+
+	<!-- this extension point is used to augment the ModelQuery to provide schema specific guided editing -->
+	<extension point="org.eclipse.wst.xml.core.modelQueryExtensions">
+		<modelQueryExtension
+			class="org.eclipse.wst.xsd.ui.internal.text.XSDModelQueryExtension"
+			contentType="org.eclipse.wst.xsd.core.xsdsource">
+		</modelQueryExtension>
+	</extension>
+
+	<!-- ====================================================== -->
+	<!-- Define Assign Validate action on .xsd file             -->
+	<!-- ====================================================== -->
+	<extension point="org.eclipse.ui.popupMenus">
+		<objectContribution
+			objectClass="org.eclipse.core.resources.IFile"
+			nameFilter="*.xsd"
+			id="org.eclipse.wst.xsd.validation.xsdvalidationaction">
+			<action
+				label="%_UI_MENU_VALIDATE_XML"
+				class="org.eclipse.wst.xsd.ui.internal.validation.ValidateSchemaActionDelegate"
+				enablesFor="1"
+				id="org.eclipse.wst.xsd.ui.internal.validation.ValidateSchemaActionDelegate">
+			</action>
+		</objectContribution>
+	</extension>
+
+	<!-- ====================================================== -->
+	<!-- Register the XSD validator with the validation 		-->
+	<!-- framework. 										    -->
+	<!-- ====================================================== -->
+	<extension
+		id="xsdValidator"
+		name="%_UI_XML_SCHEMA_VALIDATOR"
+		point="org.eclipse.wst.validation.validator">
+		<validator>
+			<filter
+				objectClass="org.eclipse.core.resources.IFile"
+				caseSensitive="false"
+				nameFilter="*.xsd">
+			</filter>
+			<helper
+				class="org.eclipse.wst.xml.core.internal.validation.core.Helper">
+			</helper>
+			<run
+				class="org.eclipse.wst.xsd.ui.internal.validation.Validator">
+			</run>
+		</validator>
+	</extension>
+
+	<!-- ============================================================================== -->
+	<!-- Register the XSDSearchParticpant against for XMLComponentSearchPatterns 		-->
+	<!-- ============================================================================== -->	
+	 <extension   
+		point="org.eclipse.wst.common.core.searchParticipants">
+		<searchParticipant
+			id="org.eclipse.wst.xsd.search.XSDSearchParticipant"
+			class="org.eclipse.wst.xsd.ui.internal.search.XSDSearchParticipant">
+			<enablement>
+			   <or>
+			      <with variable="pattern">
+					<instanceof value="org.eclipse.wst.xml.core.internal.search.XMLComponentSearchPattern"/>			   
+				  </with>
+				</or>
+			</enablement>
+		</searchParticipant>
+	</extension>
+
+	<!-- ============================================================================== -->	 
+    <!-- Register a 'rename' participant this enables us to provide refactoring for     --> 
+    <!-- renamed XML Schema components (e.g. elements, types etc.)                      --> 
+	<!-- ============================================================================== -->	 
+	<extension
+		point="org.eclipse.ltk.core.refactoring.renameParticipants">
+		<renameParticipant
+			name="%xsd.resource.rename.participant.name"
+			class="org.eclipse.wst.xsd.ui.internal.refactor.rename.XSDComponentRenameParticipant"
+			id="org.eclipse.wst.xsd.refactoring.XSDComponentRenameParticipant">
+			<enablement>
+				<with variable="element">
+					<instanceof
+						value="org.eclipse.xsd.XSDNamedComponent">
+					</instanceof>
+				</with>
+			</enablement>
+		</renameParticipant>
+		
+	</extension>
+	
+	<!-- ============================================================================== -->	 
+    <!-- Register a 'rename' participant this enables us to provide refactoring for     --> 
+    <!-- renamed resources.                                                             --> 
+	<!-- ============================================================================== -->	 
+<!--
+    <extension
+		point="org.eclipse.ltk.core.refactoring.renameParticipants">
+		<renameParticipant
+			name="%xsd.resource.rename.participant.name"
+			class="org.eclipse.wst.xsd.ui.internal.refactor.rename.ResourceRenameParticipant"
+			id="org.eclipse.wst.xsd.refactoring.XSDResourceRenameParticipant">
+			<enablement>
+				<with variable="element">
+					<instanceof value="org.eclipse.core.resources.IResource"/>
+				</with>
+			</enablement>
+		</renameParticipant>
+	</extension>
+	-->
+	<!-- ============================================================================================== -->
+	<!-- Register the  'Refactor', 'References' and 'Declarations' items to the design view	            -->
+	<!-- ============================================================================================== -->	    
+   <extension point="org.eclipse.ui.popupMenus"> 
+      <objectContribution 
+         id="org.eclipse.wst.xsd.ui.refactoring.menu.objectContrib" 
+         objectClass="org.eclipse.wst.xsd.editor.internal.adapters.XSDBaseAdapter">  
+         <action
+            id="org.eclipse.wst.xsd.ui.search.declarations.action" 
+            enablesFor="1"
+            style="pulldown"
+            menubarPath="search-slot"
+            label="%search.declarations.label"
+            class="org.eclipse.wst.xsd.ui.internal.search.actions.XSDSearchDeclarationsGroupActionDelegate"> 
+         </action>          
+         <action
+            id="org.eclipse.wst.xsd.ui.search.references.action" 
+            enablesFor="1"
+            style="pulldown"
+            menubarPath="search-slot"
+            label="%search.references.label"
+            class="org.eclipse.wst.xsd.ui.internal.search.actions.XSDSearchReferencesGroupActionDelegate"> 
+         </action>
+         <action
+            id="org.eclipse.wst.xsd.ui.refactoring.menu.refactorGroup.object" 
+            enablesFor="1"
+            style="pulldown"
+            menubarPath="refactoring-slot"
+            label="%refactoringActionSet.label" 
+            class="org.eclipse.wst.xsd.ui.internal.refactor.actions.XSDRefactorGroupActionDelegate"> 
+         </action>   
+      </objectContribution>         
+      <!-- here we add the 'refactor' menu item to the source view -->
+      <viewerContribution
+        id="org.eclipse.wst.xsd.ui.refactoring.menu.source"
+        targetID="org.eclipse.wst.xsd.core.xsdsource.source.EditorContext">
+	    <action id="org.eclipse.wst.xsd.ui.refactoring.menu.refactorGroup.source"
+       		style="pulldown"
+            menubarPath="additions"
+            label="%refactoring.menu.label" 
+            class="org.eclipse.wst.xsd.ui.internal.refactor.actions.XSDRefactorGroupActionDelegate"> 
+  	    </action>
+       </viewerContribution>       
+     </extension>
+
+	
+	<!-- 
+		The following extension to the file context menu is temporary until resource 
+		navigator will provide allow to extend refactor menu        
+	-->
+	
+	<!--extension point="org.eclipse.ui.popupMenus">
+	 <objectContribution
+		objectClass="org.eclipse.core.resources.IFile"
+		nameFilter="*.xsd"
+		id="org.wst.xsd.ui.rename">
+		<menu id="refactorXSDResource" path="additions" label="%refactoring.menu.label">
+		  <separator name="refactor"/>
+		</menu>
+	<action
+		label="%refactoring.renameAction.label"
+		menubarPath="refactorXSDResource/refactor"
+		class="org.eclipse.wst.xsd.ui.internal.refactor.actions.RenameResourceActionDelegate"
+		enablesFor="1"
+		id="org.eclipse.wst.xsd.ui.refactoring.actions.RenameResource">
+	 </action>
+	 </objectContribution>
+	</extension-->	
+
+	<extension point="org.eclipse.ui.commands">
+		<command
+			name="%command.xsd.refactor.rename.element.name"
+			description="%command.xsd.refactor.rename.element.description"
+			categoryId="org.eclipse.ui.category.edit"
+			id="org.eclipse.wst.xsd.ui.refactor.rename.element">
+		</command>
+		<command
+			name="%command.xsd.refactor.makeElementGlobal.element.name"
+			description="%command.xsd.refactor.makeElementGlobal.element.description"
+			categoryId="org.eclipse.ui.category.edit"
+			id="org.eclipse.wst.xsd.ui.refactor.makeElementGlobal">
+		</command>
+		<command
+			name="%command.xsd.refactor.makeTypeGlobal.element.name"
+			description="%command.xsd.refactor.makeTypeGlobal.element.description"
+			categoryId="org.eclipse.ui.category.edit"
+			id="org.eclipse.wst.xsd.ui.refactor.makeTypeGlobal">
+		</command>
+		<command
+			name="%command.xsd.refactor.renameTargetNamespace.name"
+			description="%command.xsd.refactor.renameTargetNamespace.description"
+			categoryId="org.eclipse.ui.category.edit"
+			id="org.eclipse.wst.xsd.ui.refactor.renameTargetNamespace">
+		</command>
+	</extension>
+</plugin>
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/adt/typeviz/design/figures/BoxFigure.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/adt/typeviz/design/figures/BoxFigure.java
new file mode 100644
index 0000000..a41d899
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/adt/typeviz/design/figures/BoxFigure.java
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.typeviz.design.figures;
+
+import java.util.Iterator;
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.ToolbarLayout;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.wst.xsd.adt.typeviz.design.layouts.ColumnData;
+
+public class BoxFigure extends Figure
+{
+  protected ColumnData columnData = new ColumnData();  
+  public HeadingFigure headingFigure;
+  Figure contentPane;
+  
+  public boolean isSelected = false;
+
+  public BoxFigure()
+  {
+    super();
+    headingFigure = new HeadingFigure();   
+    add(headingFigure);
+
+    contentPane = new Figure()
+    {
+      public void paint(Graphics graphics)
+      {
+        super.paint(graphics);
+        boolean isFirst = false;
+        for (Iterator i = getChildren().iterator(); i.hasNext();)
+        {
+          Figure figure = (Figure) i.next();
+          if (isFirst)
+          {
+            isFirst = false;
+          }
+          else
+          {
+            Rectangle r = figure.getBounds();
+            graphics.drawLine(r.x, r.y + 1, r.x + r.width, r.y + 1);
+          }
+        }
+      }
+    };
+    contentPane.setLayoutManager(new ToolbarLayout());
+    add(contentPane);
+    headingFigure.setForegroundColor(ColorConstants.black); 
+  }
+
+  public void paint(Graphics graphics)
+  {
+    super.paint(graphics);
+    /*
+    // Fill for the header section
+    //
+    Rectangle r = getBounds().getCopy();
+    graphics.setBackgroundColor(ColorConstants.darkGray);
+    Color gradient1 = ColorConstants.lightGray;
+    if (isSelected)
+    {
+      gradient1 = ColorConstants.lightBlue;
+    }
+    Color gradient2 = ColorConstants.white;
+    graphics.setForegroundColor(gradient1);
+    graphics.setBackgroundColor(gradient2);
+    graphics.fillGradient(r.x + 1, r.y + 1, r.width - 2, nodeNameLabel.getBounds().height - 1, true);
+    nodeNameLabel.paint(graphics);
+    */
+  }
+
+  public IFigure getContentPane()
+  {
+    return contentPane;
+  }
+
+  public Label getNameLabel()
+  {
+    return headingFigure.getLabel();
+  }
+  
+  public HeadingFigure getHeadingFigure()
+  {
+    return headingFigure;
+  }
+  
+  public ColumnData getColumnData()
+  {
+    return columnData;
+  }  
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/adt/typeviz/design/figures/CompartmentFigure.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/adt/typeviz/design/figures/CompartmentFigure.java
new file mode 100644
index 0000000..7e329bc
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/adt/typeviz/design/figures/CompartmentFigure.java
@@ -0,0 +1,144 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.typeviz.design.figures;
+
+import java.util.Iterator;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.ToolbarLayout;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.EditPart;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.wst.xsd.adt.design.editparts.StructureEditPart;
+import org.eclipse.wst.xsd.adt.design.figures.ICompartmentFigure;
+import org.eclipse.wst.xsd.adt.design.figures.IStructureFigure;
+import org.eclipse.wst.xsd.adt.typeviz.design.layouts.RowLayout;
+
+public class CompartmentFigure extends Figure implements ICompartmentFigure
+{
+  public Label nodeNameLabel;
+  protected Figure contentPane;
+  protected Figure annotationArea;
+  public Figure rowFigure;
+
+  public CompartmentFigure()
+  {
+    super();
+
+    rowFigure = new Figure();
+    add(rowFigure);
+
+    annotationArea = new Figure();
+    ToolbarLayout annotationLayout = new ToolbarLayout(false);
+    annotationLayout.setStretchMinorAxis(true);
+    annotationArea.setLayoutManager(annotationLayout);
+
+    // Need this to show content model structure on the left side of the figure
+    rowFigure.add(annotationArea);
+
+    contentPane = new Figure()
+    {
+      public void paint(Graphics graphics)
+      {
+        super.paint(graphics);
+        graphics.pushState();
+        try
+        {
+          boolean isFirst = true;
+          Color oldColor = graphics.getForegroundColor();
+          graphics.setForegroundColor(ColorConstants.lightGray);
+          for (Iterator i = getChildren().iterator(); i.hasNext();)
+          {
+            Figure figure = (Figure) i.next();
+            Rectangle r = figure.getBounds();
+//            if (figure instanceof FieldFigure)
+//            {
+//               Rectangle rChild = ((FieldFigure)figure).getNameFigure().getBounds();
+//               graphics.drawLine(rChild.right(), rChild.y, rChild.right(), rChild.bottom());
+//               graphics.setForegroundColor(ColorConstants.darkGray);
+//            }
+            if (isFirst)
+            {
+              isFirst = false;
+//               graphics.drawLine(r.x, r.y, r.x, r.y + r.height);
+            }
+            else
+            {
+              graphics.setForegroundColor(ColorConstants.white);
+              graphics.setBackgroundColor(ColorConstants.lightGray);              
+              graphics.fillGradient(r.x, r.y, r.width, 1, false);    
+//              graphics.drawLine(r.x, r.y, r.x + r.width, r.y);
+//            graphics.drawLine(r.x, r.y, r.x, r.y + r.height);
+            }
+          }
+          graphics.setForegroundColor(oldColor);
+        }
+        finally
+        {
+          graphics.popState();
+        }
+      }
+    };
+    contentPane.setLayoutManager(new ToolbarLayout());
+    rowFigure.add(contentPane);
+
+    RowLayout rowLayout = new RowLayout();
+    rowFigure.setLayoutManager(rowLayout);
+    rowLayout.setConstraint(annotationArea, "annotation");
+    rowLayout.setConstraint(contentPane, "contentPane");
+  }
+
+  public IFigure getContentPane()
+  {
+    return contentPane;
+  }
+
+  public IFigure getAnnotationPane()
+  {
+    return annotationArea;
+  }
+  
+  public void editPartAttached(EditPart owner)
+  {   
+    StructureEditPart structureEditPart = null;
+    for (EditPart parent = owner.getParent(); parent != null; parent = parent.getParent())
+    {
+      if (parent instanceof StructureEditPart)
+      {
+        structureEditPart = (StructureEditPart) parent;
+        break;
+      }
+    }
+    RowLayout rowLayout = (RowLayout)rowFigure.getLayoutManager();
+    IStructureFigure typeFigure = structureEditPart.getStructureFigure();    
+    Assert.isTrue(typeFigure instanceof StructureFigure, "Expected object of type StructureFigure");    
+    rowLayout.setColumnData(((StructureFigure)typeFigure).getColumnData());            
+  }
+
+  public void addSelectionFeedback()
+  {
+  }
+
+  public void removeSelectionFeedback()
+  {
+  }   
+  
+  public void refreshVisuals(Object model)
+  {
+    // TODO Auto-generated method stub
+    
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/adt/typeviz/design/figures/FieldFigure.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/adt/typeviz/design/figures/FieldFigure.java
new file mode 100644
index 0000000..2a90266
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/adt/typeviz/design/figures/FieldFigure.java
@@ -0,0 +1,251 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.typeviz.design.figures;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.MarginBorder;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.ToolbarLayout;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.gef.EditPart;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.xsd.adt.design.editparts.StructureEditPart;
+import org.eclipse.wst.xsd.adt.design.figures.IFieldFigure;
+import org.eclipse.wst.xsd.adt.design.figures.IStructureFigure;
+import org.eclipse.wst.xsd.adt.typeviz.design.layouts.RowLayout;
+
+public class FieldFigure extends Figure implements IFieldFigure
+{
+  // TODO: put this color is some common class
+  public static final Color cellColor = new Color(null, 224, 233, 246);
+  
+  // Formatting constraints
+  public static final int TOP_MARGIN = 2; // pixels
+  public static final int BOTTOM_MARGIN = TOP_MARGIN + 1; // extra pixel for the
+                                                          // footer line
+  public static final int LEFT_MARGIN = 2;
+  public static final int RIGHT_MARGIN = LEFT_MARGIN;
+  public static final int RIGHT_SIDE_PADDING = 6;
+
+  // States requiring decorators, and their icons
+  // protected static final Image errorIcon = ICON_ERROR;
+
+  // Labels which handle presentation of name and type
+  public Figure rowFigure;
+  protected Label nameLabel;
+  protected Label nameAnnotationLabel;  // for occurrence text, or error icons
+  protected Label typeLabel;
+  protected Label typeAnnotationLabel;  // for occurrence text, or error icons
+  protected Label toolTipLabel;
+
+  public FieldFigure()
+  {
+    super();
+    setLayoutManager(new ToolbarLayout());
+//    setOpaque(true);
+    rowFigure = new Figure();
+//    rowFigure.setOpaque(true);
+    RowLayout rowLayout = new RowLayout();
+    rowFigure.setLayoutManager(rowLayout);
+
+    add(rowFigure);
+
+    nameLabel = new Label();
+    nameLabel.setBorder(new MarginBorder(3, 5, 3, 5));
+    nameLabel.setLabelAlignment(PositionConstants.LEFT);
+    nameLabel.setOpaque(true);
+    rowFigure.add(nameLabel);
+    
+    nameAnnotationLabel = new Label();
+    nameAnnotationLabel.setBorder(new MarginBorder(3, 5, 3, 5));
+    nameAnnotationLabel.setLabelAlignment(PositionConstants.LEFT);
+    nameAnnotationLabel.setOpaque(true);
+    rowFigure.add(nameAnnotationLabel);
+    
+    toolTipLabel = new Label();
+    nameLabel.setToolTip(toolTipLabel);
+    typeLabel = new Label();
+    
+    // cs : we need to add some additional padding to the right
+    // so that when we edit the field there's room for the combobox's arrow
+    // and the type name won't be partially obscured
+    //
+    typeLabel.setBorder(new MarginBorder(3, 5, 3, 20));
+    typeLabel.setLabelAlignment(PositionConstants.LEFT);
+    typeLabel.setOpaque(true);
+    rowFigure.add(typeLabel);
+
+    typeAnnotationLabel = new Label() {
+      
+      public Dimension getPreferredSize(int wHint, int hHint)
+      {
+        if (getText() == null || getText().equals(""))
+        {
+          return new Dimension(0, 0);
+        }
+        return super.getPreferredSize(wHint, hHint);
+      };
+    };
+    typeAnnotationLabel.setBorder(new MarginBorder(3, 5, 3, 5));
+    typeAnnotationLabel.setLabelAlignment(PositionConstants.LEFT);
+    typeAnnotationLabel.setOpaque(true);
+    rowFigure.add(typeAnnotationLabel);
+    typeAnnotationLabel.setToolTip(toolTipLabel);
+    
+    rowLayout.setConstraint(nameLabel, "name");
+    rowLayout.setConstraint(nameAnnotationLabel, "nameAnnotation");
+    rowLayout.setConstraint(typeLabel, "type");
+    rowLayout.setConstraint(typeAnnotationLabel, "typeAnnotation");
+  }
+
+  /**
+   * @return Returns the "name" string used by this figure.
+   */
+  public String getName()
+  {
+    return nameLabel.getText();
+  }
+
+  /**
+   * @return Returns the figure representing the attribute name
+   */
+  public Label getNameLabel()
+  {
+    return nameLabel;
+  }
+
+  /**
+   * @return Returns the "type" string used by this figure.
+   */
+  public String getType()
+  {
+    return typeLabel.getText();
+  }
+
+  /**
+   * @return Returns the figure representing the attribute's type
+   */
+  public Label getTypeLabel()
+  {
+    return typeLabel;
+  }
+
+  /**
+   * @param name
+   *          Set the "name" string used by this figure.
+   */
+  public void setName(String name)
+  {
+    nameLabel.setText(name);
+  }
+
+  /**
+   * @param type
+   *          Set the "type" string used by this figure.
+   */
+  public void setType(String type)
+  {
+    typeLabel.setText(type);
+  }
+  
+  public void setTypeToolTipText(String toolTip)
+  {
+    setNameToolTipText(toolTip);
+  }
+
+  public void setNameToolTipText(String toolTip)
+  {
+    if (toolTip.length() > 0)
+    {
+      nameLabel.setToolTip(toolTipLabel);
+      toolTipLabel.setText(toolTip);
+    }
+    else
+    {
+      nameLabel.setToolTip(null);
+    }
+  }
+  
+  public void setNameAnnotationLabel(String text)
+  {
+    nameAnnotationLabel.setText(text);
+  }
+
+  public void setNameAnnotationLabelIcon(Image icon)
+  {
+    nameAnnotationLabel.setIcon(icon);
+  }
+  
+  public Label getNameAnnotationLabel()
+  {
+    return nameAnnotationLabel;
+  }
+  
+  public void setTypeAnnotationLabel(String text)
+  {
+    typeAnnotationLabel.setText(text);
+  }
+
+  public void setTypeAnnotationLabelIcon(Image icon)
+  {
+    typeAnnotationLabel.setIcon(icon);
+  }
+
+  public Label getTypeAnnotationLabel()
+  {
+    return typeAnnotationLabel;
+  }
+  
+  public void recomputeLayout()
+  {
+    RowLayout layout = (RowLayout)rowFigure.getLayoutManager();
+    if (layout != null && layout.getColumnData() != null)
+    {
+      layout.getColumnData().clearColumnWidths();
+    }    
+  }
+  
+  public void editPartAttached(EditPart owner)
+  {
+    StructureEditPart structureEditPart = null;
+    for (EditPart parent = owner.getParent(); parent != null; parent = parent.getParent())
+    {
+      if (parent instanceof StructureEditPart)
+      {
+        structureEditPart = (StructureEditPart) parent;
+        break;
+      }
+    }
+    RowLayout rowLayout = (RowLayout)rowFigure.getLayoutManager();
+    IStructureFigure typeFigure = structureEditPart.getStructureFigure();    
+    Assert.isTrue(typeFigure instanceof StructureFigure, "Expected object of type StructureFigure");    
+    rowLayout.setColumnData(((StructureFigure)typeFigure).getColumnData());   
+  }
+  
+  public void addSelectionFeedback()
+  {
+    rowFigure.setBackgroundColor(cellColor); 
+  }
+  
+  public void removeSelectionFeedback()
+  {
+    rowFigure.setBackgroundColor(getBackgroundColor());   
+  }
+  
+  public void refreshVisuals(Object model)
+  {
+    // TODO Auto-generated method stub
+    
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/adt/typeviz/design/figures/HeadingFigure.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/adt/typeviz/design/figures/HeadingFigure.java
new file mode 100644
index 0000000..041396b
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/adt/typeviz/design/figures/HeadingFigure.java
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.typeviz.design.figures;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.MarginBorder;
+import org.eclipse.draw2d.ToolbarLayout;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.swt.graphics.Color;
+
+public class HeadingFigure extends Figure
+{
+  public static final Color headerColor = new Color(null, 224, 233, 246);
+  Label label;
+  Color[] gradientColor = {ColorConstants.white,  
+                           ColorConstants.lightGray,
+                           ColorConstants.lightBlue,
+                           ColorConstants.gray};
+  boolean isSelected = false;
+  boolean isReadOnly = false;
+  
+  public HeadingFigure()
+  {
+    label = new Label();
+    label.setBorder(new MarginBorder(2));
+    ToolbarLayout toolbarLayout = new ToolbarLayout(false);
+    toolbarLayout.setMinorAlignment(ToolbarLayout.ALIGN_CENTER);
+    setLayoutManager(toolbarLayout);
+    add(label);
+  }
+  
+  public void setGradientColors(Color[] colors)
+  {
+    this.gradientColor = colors;
+  }
+  
+  public void setSelected(boolean isSelected)
+  {
+    this.isSelected = isSelected;
+  }
+
+  public void setIsReadOnly(boolean isReadOnly)
+  {
+    this.isReadOnly = isReadOnly;
+  }
+  
+  public void paint(Graphics graphics)
+  {
+    super.paint(graphics);
+    
+    graphics.pushState();
+    try
+    {
+      // Fill for the header section
+      //
+      Rectangle r = getBounds().getCopy();
+      graphics.setBackgroundColor(ColorConstants.lightGray);
+  
+      Color gradient1 = isReadOnly ? gradientColor[1] : headerColor;
+      if (isSelected && isReadOnly) gradient1 = gradientColor[3];
+      else if (isSelected && !isReadOnly) gradient1 = gradientColor[2];
+      Color gradient2 = gradientColor[0];
+      graphics.setForegroundColor(gradient1);
+      graphics.setBackgroundColor(gradient2);
+      Rectangle labelBounds = label.getBounds();
+      graphics.fillGradient(r.x+1, r.y+1, r.width-2, labelBounds.height - 2, true);    
+      graphics.setForegroundColor(ColorConstants.darkGray);
+      label.paint(graphics);    
+    }
+    finally
+    {
+      graphics.popState();
+    }
+  }
+
+  public Label getLabel()
+  {
+    return label;
+  }  
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/adt/typeviz/design/figures/RoundedLineBorder.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/adt/typeviz/design/figures/RoundedLineBorder.java
new file mode 100644
index 0000000..aac092b
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/adt/typeviz/design/figures/RoundedLineBorder.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.typeviz.design.figures;
+
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.LineBorder;
+import org.eclipse.draw2d.geometry.Insets;
+import org.eclipse.swt.graphics.Color;
+
+public class RoundedLineBorder extends LineBorder
+{
+  protected int arcLength;   
+  protected int lineStyle = Graphics.LINE_SOLID;
+
+  public RoundedLineBorder(Color c, int width, int arcLength)
+  {
+    super(c, width);     
+    this.arcLength = arcLength;
+  }
+
+  public RoundedLineBorder(int width, int arcLength)
+  {
+    super(width);     
+    this.arcLength = arcLength;
+  }
+  
+  public RoundedLineBorder(Color c, int width, int arcLength, int lineStyle)
+  {
+    super(c, width);
+    this.arcLength = arcLength;
+    this.lineStyle = lineStyle;
+  }
+
+  public RoundedLineBorder(int width, int arcLength, int lineStyle)
+  {
+    super(width);
+    this.arcLength = arcLength;
+    this.lineStyle = lineStyle;
+  }
+
+  public void paint(IFigure figure, Graphics graphics, Insets insets)
+  {
+    int rlbWidth = getWidth();
+    tempRect.setBounds(getPaintRectangle(figure, insets));
+    if (rlbWidth%2 == 1)
+    {
+      tempRect.width--;
+      tempRect.height--;
+    }
+    tempRect.shrink(rlbWidth/2,rlbWidth/2);
+    graphics.setLineWidth(rlbWidth);
+    graphics.setLineStyle(lineStyle);
+    if (getColor() != null)
+      graphics.setForegroundColor(getColor());
+    graphics.drawRoundRectangle(tempRect, arcLength, arcLength);
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/adt/typeviz/design/figures/StructureFigure.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/adt/typeviz/design/figures/StructureFigure.java
new file mode 100644
index 0000000..8d3d14d
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/adt/typeviz/design/figures/StructureFigure.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.typeviz.design.figures;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.LineBorder;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.EditPart;
+import org.eclipse.wst.xsd.adt.design.figures.IStructureFigure;
+import org.eclipse.wst.xsd.adt.facade.IStructure;
+
+
+public class StructureFigure extends BoxFigure implements IStructureFigure
+{
+  public void editPartAttached(EditPart owner)
+  {
+    // nothing to do here :-)
+  }
+
+  public void addSelectionFeedback()
+  {
+    LineBorder boxFigureLineBorder = (LineBorder)getBorder();
+    boxFigureLineBorder.setWidth(2);
+    // TODO (cs) need to fix this
+    //boxFigureLineBorder.setColor(getComplexType().isReadOnly() ? ColorConstants.darkGray : ColorConstants.darkBlue);  
+    getHeadingFigure().setSelected(true);
+    repaint();
+  }
+
+  public void removeSelectionFeedback()
+  {
+    LineBorder boxFigureLineBorder = (LineBorder)getBorder();
+    boxFigureLineBorder.setWidth(1);
+    getHeadingFigure().setSelected(false);
+    repaint();
+  }  
+  
+  public boolean hitTestHeader(Point location)
+  {
+    IFigure target = getHeadingFigure();
+    Rectangle b = target.getBounds().getCopy();
+    target.translateToAbsolute(b);  
+    return b.contains(location);
+  }
+  
+  public void refreshVisuals(Object model)
+  {
+    IStructure structure = (IStructure)model;
+    getNameLabel().setText(structure.getName());    
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/adt/typeviz/design/figures/TypeVizFigureFactory.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/adt/typeviz/design/figures/TypeVizFigureFactory.java
new file mode 100644
index 0000000..b0e977a
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/adt/typeviz/design/figures/TypeVizFigureFactory.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.typeviz.design.figures;
+
+import org.eclipse.draw2d.LineBorder;
+import org.eclipse.draw2d.MarginBorder;
+import org.eclipse.draw2d.ToolbarLayout;
+import org.eclipse.wst.xsd.adt.design.figures.ICompartmentFigure;
+import org.eclipse.wst.xsd.adt.design.figures.IFieldFigure;
+import org.eclipse.wst.xsd.adt.design.figures.IStructureFigure;
+import org.eclipse.wst.xsd.adt.outline.ITreeElement;
+import org.eclipse.wst.xsd.editor.internal.design.figures.IExtendedFigureFactory;
+import org.eclipse.wst.xsd.editor.internal.design.figures.IModelGroupFigure;
+import org.eclipse.wst.xsd.editor.internal.design.figures.ModelGroupFigure;
+
+public class TypeVizFigureFactory implements IExtendedFigureFactory
+{  
+  public IStructureFigure createStructureFigure(Object model)
+  {
+    StructureFigure figure = new StructureFigure();
+    figure.setBorder(new LineBorder(1));    
+    ToolbarLayout toolbarLayout = new ToolbarLayout();
+    toolbarLayout.setStretchMinorAxis(true);
+    figure.setLayoutManager(toolbarLayout);
+
+    if (model instanceof ITreeElement)
+    {
+      figure.getNameLabel().setIcon(((ITreeElement)model).getImage());
+    }    
+    //figure.getHeadingFigure().setIsReadOnly(getComplexType().isReadOnly());
+    // we should organize ITreeElement and integrate it with the facade    
+    return figure;
+  }
+
+  public IFieldFigure createFieldFigure(Object model)
+  {
+    // TODO Auto-generated method stub
+    return new FieldFigure();
+  }
+  
+  public ICompartmentFigure createCompartmentFigure(Object model)
+  {
+    CompartmentFigure figure = new CompartmentFigure();
+    figure.setBorder(new MarginBorder(1));
+    ToolbarLayout toolbarLayout = new ToolbarLayout(false);
+    toolbarLayout.setStretchMinorAxis(true);
+    figure.setLayoutManager(toolbarLayout);
+    return figure;
+  }  
+  
+  public IModelGroupFigure createModelGroupFigure(Object model)
+  {
+    // TODO Auto-generated method stub
+    return new ModelGroupFigure();
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/adt/typeviz/design/layouts/ColumnData.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/adt/typeviz/design/layouts/ColumnData.java
new file mode 100644
index 0000000..5c82e84
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/adt/typeviz/design/layouts/ColumnData.java
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.typeviz.design.layouts;
+
+import java.util.HashMap;
+import java.util.Iterator;
+
+public class ColumnData
+{
+  HashMap map = new HashMap();
+  
+  class Entry
+  {
+    int width = 0;
+    int weight = 1;
+  }
+  
+  public void clearColumnWidths()
+  {
+    for (Iterator i = map.values().iterator(); i.hasNext();)
+    {
+      Entry entry = (Entry)i.next();
+      entry.width = 0;
+    }  
+  }  
+  
+  private Entry lookupOrCreateColumnEntry(String identifier)
+  {
+    Entry entry = (Entry)map.get(identifier);
+    if (entry == null)
+    {
+      entry = new Entry();
+      map.put(identifier, entry);
+    }  
+   return entry; 
+  }  
+  
+  void stretchColumnWidthIfNeeded(String identifier, int width)
+  {
+    Entry entry = lookupOrCreateColumnEntry(identifier);
+    entry.width = Math.max(entry.width, width);
+  }
+  
+  int getColumnWidth(String identifier)
+  {
+    Entry entry = (Entry)map.get(identifier);
+    if (entry != null)
+    {
+      return entry.width;
+    }  
+    else
+    {
+      return 0;//hmm should we return -1 ?
+    }  
+  }
+  
+  int getColumnWeight(String identifier)
+  {
+    Entry entry = (Entry)map.get(identifier);
+    if (entry != null)
+    {
+      return entry.weight;
+    }  
+    else
+    {
+      return 0;
+    }  
+  }
+  
+  public void setColumnWeight(String identifier, int weight)
+  {
+    Entry entry = lookupOrCreateColumnEntry(identifier);
+    entry.weight = weight;
+  }
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/adt/typeviz/design/layouts/RowLayout.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/adt/typeviz/design/layouts/RowLayout.java
new file mode 100644
index 0000000..21fc9bf
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/adt/typeviz/design/layouts/RowLayout.java
@@ -0,0 +1,183 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.typeviz.design.layouts;
+
+import java.util.HashMap;
+import java.util.List;
+import org.eclipse.draw2d.AbstractLayout;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Rectangle;
+
+public class RowLayout extends AbstractLayout
+{
+  // layout is associated with a parent context
+  // any layout manager under the parent context is connected
+  // column rows are maintained accross container boundaries  
+  protected ColumnData columnData;
+  protected HashMap figureToContstraintMap = new HashMap();
+  
+  public RowLayout()
+  {
+    super();
+  }
+  
+
+  // this method computes the minimum size required to display the figures
+  //
+  private Dimension calculateChildrenSize(IFigure container, List children, int wHint, int hHint, boolean preferred)
+  {
+    Dimension childSize;
+    IFigure child;
+    int height = 0;
+    int width = 0;
+    
+    //IRowFigure figure = (IRowFigure)container;
+    
+    // for each cell in the row
+    //
+    for (int i = 0; i < children.size(); i++)
+    {
+      child = (IFigure) children.get(i);
+      String columnIdenifier = (String)getConstraint(child);
+             
+      // first we compute the child size without regard for columnData
+      //
+      childSize = child.getPreferredSize(wHint, hHint);// : child.getMinimumSize(wHint, hHint);
+        
+      // now that the columnData has been populated we can consider if the row needs to be larger
+      //
+      int effectiveWidth = childSize.width;
+      if (columnIdenifier != null)
+      {  
+        columnData.stretchColumnWidthIfNeeded(columnIdenifier, childSize.width);
+        effectiveWidth = columnData.getColumnWidth(columnIdenifier);
+      }                       
+      height = Math.max(childSize.height, height);
+      width += effectiveWidth;
+    }  
+    return new Dimension(width, height);
+  }
+  
+  
+  
+  protected Dimension calculatePreferredSize(IFigure container, int wHint, int hHint)
+  {    
+    List children = container.getChildren();
+    Dimension prefSize = calculateChildrenSize(container, children, wHint, hHint, true);
+    //System.out.println("preferredSize=" + prefSize);
+    return prefSize;
+  }
+
+  public void layout(IFigure parent)
+  {
+    // layout a table with the columns aligned      
+    //IRowFigure rowFigure = (IRowFigure)parent;    
+    Rectangle clientArea = parent.getClientArea();   
+    List children = parent.getChildren();
+    Rectangle r = new Rectangle();
+    r.x = clientArea.x;
+    r.y = clientArea.y;
+    r.height = clientArea.height;
+    
+    int childrenSize = children.size();
+    Rectangle[] bounds = new Rectangle[childrenSize];
+    
+    // for each cell in the row
+    //
+    int requiredWidth = 0;
+    int totalColumnWeight = 0;
+    for (int i = 0; i < childrenSize; i++)
+    {
+      IFigure child = (IFigure) children.get(i);
+      //String columnIdenifier = figure.getColumnIdentifier(child);             
+      // first we compute the child size without regard for columnData
+      //
+      Dimension childSize = child.getPreferredSize(-1, -1);
+      
+      int columnWidth = -1;
+      //String columnIdentifier = rowFigure.getColumnIdentifier(child);
+      String columnIdentifier = (String)getConstraint(child);
+      if (columnIdentifier != null)
+      {
+        //columnData.stretchColumnWidthIfNeeded(columnIdentifier, childSize.width);        
+        columnWidth = columnData.getColumnWidth(columnIdentifier);
+        totalColumnWeight += columnData.getColumnWeight(columnIdentifier);
+        //System.out.println("columnWidth(" + columnIdentifier + ")=" + columnWidth);        
+      }  
+      r.width = Math.max(childSize.width, columnWidth);
+      requiredWidth += r.width;
+      bounds[i] = new Rectangle(r);      
+      r.x += r.width;
+    }          
+    if (totalColumnWeight < 1)
+    {
+      totalColumnWeight = 1;
+    }
+    //System.out.println("clientArea.width=" + clientArea.width + ", " + r.x);
+    int extraWidth = Math.max(clientArea.width - requiredWidth, 0);    
+    //System.out.println("extraWidth=" + extraWidth + " totalColumnWeight=" + totalColumnWeight);  
+    int extraWidthAllocated = 0;
+    for (int i = 0; i < childrenSize; i++)
+    {
+      IFigure child = (IFigure) children.get(i);      
+      Rectangle b = bounds[i];    
+      if (extraWidth > 0)
+      {  
+        String columnIdentifier = (String)getConstraint(child);
+        if (columnIdentifier != null)
+        {        
+          int weight = columnData.getColumnWeight(columnIdentifier);
+          float fraction = (float)weight / (float)totalColumnWeight;
+          int extraWidthForChild = (int)(extraWidth * fraction);
+          //System.out.println("extraWidthForChild(" + fraction + ")=" + extraWidthForChild);        
+          b.width += extraWidthForChild;        
+          b.x += extraWidthAllocated;
+          extraWidthAllocated += extraWidthForChild;
+        }  
+        else
+        {
+          b.x += extraWidthAllocated;
+        }
+      }
+      child.setBounds(new Rectangle(b));  
+    }  
+  }
+
+  public ColumnData getColumnData()
+  {
+    return columnData;
+  }
+
+  public void setColumnData(ColumnData columnData)
+  {
+    this.columnData = columnData;
+  }    
+  
+  public Object getConstraint(IFigure child)
+  {
+    return figureToContstraintMap.get(child);
+  }
+  
+  public void setConstraint(IFigure child, Object constraint)
+  {
+    figureToContstraintMap.put(child, constraint);
+  }
+  
+  public void invalidate()
+  {
+    //figureToContstraintMap.clear();
+    //this.columnData.clearColumnWidths();
+    super.invalidate();
+    //System.out.println("invalidate");    
+  }
+}
+
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/ISelectionMapper.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/ISelectionMapper.java
new file mode 100644
index 0000000..516cf7f
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/ISelectionMapper.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor;
+
+import org.eclipse.jface.viewers.ISelection;
+
+public interface ISelectionMapper
+{
+  ISelection mapSelection(ISelection selectedObject);
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/InternalXSDMultiPageEditor.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/InternalXSDMultiPageEditor.java
new file mode 100644
index 0000000..b00f1d3
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/InternalXSDMultiPageEditor.java
@@ -0,0 +1,895 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPartFactory;
+import org.eclipse.gef.RootEditPart;
+import org.eclipse.gef.ui.actions.ActionRegistry;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.IPostSelectionProvider;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.INavigationLocation;
+import org.eclipse.ui.INavigationLocationProvider;
+import org.eclipse.ui.IPropertyListener;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor;
+import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier;
+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
+import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
+import org.eclipse.wst.sse.core.internal.provisional.StructuredModelManager;
+import org.eclipse.wst.sse.ui.StructuredTextEditor;
+import org.eclipse.wst.sse.ui.internal.contentoutline.ConfigurableContentOutlinePage;
+import org.eclipse.wst.xml.core.internal.document.NodeImpl;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
+import org.eclipse.wst.xsd.adt.actions.AddFieldAction;
+import org.eclipse.wst.xsd.adt.actions.BaseSelectionAction;
+import org.eclipse.wst.xsd.adt.actions.DeleteAction;
+import org.eclipse.wst.xsd.adt.actions.SetInputToGraphView;
+import org.eclipse.wst.xsd.adt.actions.ShowPropertiesViewAction;
+import org.eclipse.wst.xsd.adt.design.editparts.RootContentEditPart;
+import org.eclipse.wst.xsd.adt.editor.ADTMultiPageEditor;
+import org.eclipse.wst.xsd.adt.facade.IModel;
+import org.eclipse.wst.xsd.editor.internal.adapters.CategoryAdapter;
+import org.eclipse.wst.xsd.editor.internal.adapters.XSDAdapterFactory;
+import org.eclipse.wst.xsd.editor.internal.adapters.XSDBaseAdapter;
+import org.eclipse.wst.xsd.editor.internal.design.editparts.XSDEditPartFactory;
+import org.eclipse.wst.xsd.editor.internal.navigation.DesignViewNavigationLocation;
+import org.eclipse.wst.xsd.editor.internal.navigation.MultiPageEditorTextSelectionNavigationLocation;
+import org.eclipse.wst.xsd.editor.internal.utils.OpenOnSelectionHelper;
+import org.eclipse.wst.xsd.ui.common.actions.AddXSDAttributeDeclarationAction;
+import org.eclipse.wst.xsd.ui.common.actions.AddXSDAttributeGroupDefinitionAction;
+import org.eclipse.wst.xsd.ui.common.actions.AddXSDComplexTypeDefinitionAction;
+import org.eclipse.wst.xsd.ui.common.actions.AddXSDElementAction;
+import org.eclipse.wst.xsd.ui.common.actions.AddXSDModelGroupAction;
+import org.eclipse.wst.xsd.ui.common.actions.AddXSDModelGroupDefinitionAction;
+import org.eclipse.wst.xsd.ui.common.actions.AddXSDSimpleTypeDefinitionAction;
+import org.eclipse.wst.xsd.ui.common.actions.DeleteXSDConcreteComponentAction;
+import org.eclipse.wst.xsd.ui.common.actions.OpenInNewEditor;
+import org.eclipse.wst.xsd.ui.common.actions.SetMultiplicityAction;
+import org.eclipse.wst.xsd.ui.common.actions.SetTypeAction;
+import org.eclipse.wst.xsd.ui.internal.text.XSDModelReconcileAdapter;
+import org.eclipse.xsd.XSDComponent;
+import org.eclipse.xsd.XSDCompositor;
+import org.eclipse.xsd.XSDConcreteComponent;
+import org.eclipse.xsd.XSDNamedComponent;
+import org.eclipse.xsd.XSDPackage;
+import org.eclipse.xsd.XSDSchema;
+import org.eclipse.xsd.impl.XSDSchemaImpl;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+public class InternalXSDMultiPageEditor extends ADTMultiPageEditor implements ITabbedPropertySheetPageContributor, IPropertyListener, INavigationLocationProvider
+{
+  ResourceSet resourceSet;
+  Resource xsdResource;
+  // IModel model;
+  IStructuredModel structuredModel;
+  XSDSchema xsdSchema;
+  private OutlineTreeSelectionChangeListener fOutlineListener;
+  private SourceEditorSelectionListener fSourceEditorSelectionListener;
+  private XSDSelectionManagerSelectionListener fXSDSelectionListener;
+  private StructuredTextEditor structuredTextEditor;
+
+  public IModel buildModel(IFileEditorInput editorInput)
+  {
+    try
+    {
+      EPackage.Registry reg = EPackage.Registry.INSTANCE;
+      XSDPackage xsdPackage = (XSDPackage) reg.getEPackage(XSDPackage.eNS_URI);
+      xsdSchema = xsdPackage.getXSDFactory().createXSDSchema();
+      resourceSet = XSDSchemaImpl.createResourceSet();
+      IFile resourceFile = editorInput.getFile();
+      structuredModel = StructuredModelManager.getModelManager().getModelForEdit(resourceFile);
+      // If the resource is in the workspace....
+      // otherwise the user is trying to open an external file
+      if (resourceFile != null)
+      {
+        String pathName = resourceFile.getFullPath().toString();
+        xsdResource = resourceSet.getResource(URI.createPlatformResourceURI(pathName), true);
+        resourceSet.getResources().add(xsdResource);
+        Object obj = xsdResource.getContents().get(0);
+        if (obj instanceof XSDSchema)
+        {
+          xsdSchema = (XSDSchema) obj;
+          xsdSchema.setElement(((IDOMModel) structuredModel).getDocument().getDocumentElement());
+          model = (IModel) XSDAdapterFactory.getInstance().adapt(xsdSchema);
+        }
+        
+        // If the input schema is from the WSDL Editor, then use that inline schema
+        if (editorInput instanceof XSDFileEditorInput)
+        {
+          xsdSchema = ((XSDFileEditorInput) editorInput).getSchema();
+          model = (IModel) XSDAdapterFactory.getInstance().adapt(xsdSchema);
+        }
+        if (xsdSchema.getElement() != null)
+          
+          // TODO (cs) ... we need to look into performance issues when we add elements
+          // seems to be that formatting is causig lots of notification and things get terribly slow
+          // I'm specializing the method below to add an isModelStateChanging check that should
+          // help here ... but we need to investigate further
+          new XSDModelReconcileAdapter(xsdSchema.getElement().getOwnerDocument(), xsdSchema)
+          {
+            public void handleNotifyChange(INodeNotifier notifier, int eventType, Object feature, Object oldValue, Object newValue, int index)
+            {
+              if (notifier instanceof NodeImpl)
+              {
+                NodeImpl nodeImpl = (NodeImpl)notifier;
+                if (!nodeImpl.getModel().isModelStateChanging())
+                {  
+                  //System.out.println("handleNotifyChange " + eventType);
+                  super.handleNotifyChange(notifier, eventType, feature, oldValue, newValue, index);
+                }  
+              }
+            }
+          };
+        xsdResource.setModified(false);
+      }
+    }
+    catch (StackOverflowError e)
+    {
+    }
+    catch (Exception ex)
+    {
+    }
+    return model;
+  }
+
+  public void dispose()
+  {
+    structuredModel.releaseFromEdit();
+    if (fOutlinePage != null)
+    {
+      if (fOutlinePage instanceof ConfigurableContentOutlinePage && fOutlineListener != null)
+      {
+        ((ConfigurableContentOutlinePage) fOutlinePage).removeDoubleClickListener(fOutlineListener);
+      }
+      if (fOutlineListener != null)
+      {
+        fOutlinePage.removeSelectionChangedListener(fOutlineListener);
+      }
+    }
+    getSelectionManager().removeSelectionChangedListener(fXSDSelectionListener);
+    super.dispose();
+  }
+
+  protected void configureGraphicalViewer()
+  {
+    super.configureGraphicalViewer();
+    // get edit part factory from extension
+    EditPartFactory editPartFactory = XSDEditorPlugin.getDefault().getXSDEditorConfiguration().getEditPartFactory();
+    if (editPartFactory != null)
+    {
+      graphicalViewer.setEditPartFactory(editPartFactory);
+    }
+    else
+    {
+      // otherwise use default
+      graphicalViewer.setEditPartFactory(new XSDEditPartFactory());
+    }
+  }
+
+  public Object getAdapter(Class type)
+  {
+    if (type == org.eclipse.ui.views.properties.IPropertySheetPage.class)
+    {
+      XSDTabbedPropertySheetPage page = new XSDTabbedPropertySheetPage(this);
+      return page;
+    }
+    else if (type == ISelectionProvider.class)
+    {
+      return selectionManager;
+    }  
+    else if (type == XSDSchema.class)
+    {
+      return xsdSchema;
+    }
+    else if (type == IContentOutlinePage.class)
+    {
+      Object adapter = super.getAdapter(type);
+      if (adapter != null)
+      {
+        IContentOutlinePage page = (IContentOutlinePage) adapter;
+        fOutlineListener = new OutlineTreeSelectionChangeListener();
+        page.addSelectionChangedListener(fOutlineListener);
+        if (page instanceof ConfigurableContentOutlinePage)
+        {
+          ((ConfigurableContentOutlinePage) page).addDoubleClickListener(fOutlineListener);
+        }
+        return page;
+      }
+    }
+    else if (type == XSDElementReferenceEditManager.class)
+    {
+    	IEditorInput editorInput = getEditorInput();
+    	if (editorInput instanceof IFileEditorInput)
+    	{
+    		IFileEditorInput fileEditorInput = (IFileEditorInput) editorInput;
+    		// TODO (cs) currently we assume the schema editor will only ever edit a
+    		// single schema
+    		/// but if we want to enable the schema editor to edit wsdl files we
+    		// should pass in
+    		// an array of schemas
+    		// hmm.. perhaps just pass in a ResourceSet
+    		XSDSchema[] schemas = {xsdSchema};
+    		return new XSDElementReferenceEditManager(fileEditorInput.getFile(), schemas);
+    	}
+    }
+    else if (type == XSDTypeReferenceEditManager.class)
+    {
+      IEditorInput editorInput = getEditorInput();
+      if (editorInput instanceof IFileEditorInput)
+      {
+        IFileEditorInput fileEditorInput = (IFileEditorInput) editorInput;
+        // TODO (cs) currently we assume the schema editor will only ever edit a
+        // single schema
+        // but if we want to enable the schema editor to edit wsdl files we
+        // should pass in
+        // an array of schemas
+        // hmm.. perhaps just pass in a ResourceSet
+        XSDSchema[] schemas = {xsdSchema};
+        return new XSDTypeReferenceEditManager(fileEditorInput.getFile(), schemas);
+      }
+    }
+    else if (type == ITextEditor.class)
+    {
+      return getTextEditor();
+    }
+    else if (type == ISelectionMapper.class)
+    {
+      return new XSDSelectionMapper();
+    }  
+    return super.getAdapter(type);
+  }
+
+  public String getContributorId()
+  {
+    return "org.eclipse.wst.xsd.editor";
+  }
+
+  public XSDSchema getXSDSchema()
+  {
+    return xsdSchema;
+  }
+
+  public StructuredTextEditor getTextEditor()
+  {
+    return structuredTextEditor;
+  }
+
+  protected void createSourcePage()
+  {
+    try
+    {
+      structuredTextEditor = new StructuredTextEditor();
+      int index = addPage(structuredTextEditor, getEditorInput());
+      setPageText(index, "Source");
+      structuredTextEditor.update();
+      structuredTextEditor.setEditorPart(this);
+      structuredTextEditor.addPropertyListener(this);
+      firePropertyChange(PROP_TITLE);
+    }
+    catch (PartInitException e)
+    {
+      ErrorDialog.openError(getSite().getShell(), "Error creating nested text editor", null, e.getStatus());
+    }
+  }
+
+  /**
+   * Method openOnGlobalReference. The comp argument is a resolved xsd schema
+   * object from another file. This is created and called from another schema
+   * model to allow F3 navigation to open a new editor and choose the referenced
+   * object within that editor context
+   * 
+   * @param comp
+   */
+  public void openOnGlobalReference(XSDConcreteComponent comp)
+  {
+    XSDNamedComponent namedComponent = openOnSelectionHelper.openOnGlobalReference(comp);
+    
+    if (namedComponent != null)
+    {
+      XSDBaseAdapter adapter = (XSDBaseAdapter) XSDAdapterFactory.getInstance().adapt(namedComponent);
+      getSelectionManager().setSelection(new StructuredSelection(adapter));
+      IAction action = getActionRegistry().getAction(SetInputToGraphView.ID);
+      if (action != null)
+      {
+        action.run();
+      }
+    }
+  }
+  
+  protected OpenOnSelectionHelper openOnSelectionHelper;
+
+  public OpenOnSelectionHelper getOpenOnSelectionHelper()
+  {
+    return openOnSelectionHelper;
+  }
+
+  /**
+   * Creates the pages of the multi-page editor.
+   */
+  protected void createPages()
+  {
+    model = buildModel((IFileEditorInput) getEditorInput());
+    selectionProvider = getSelectionManager();
+    getEditorSite().setSelectionProvider(selectionProvider);
+    createGraphPage();
+    createSourcePage();
+    openOnSelectionHelper = new OpenOnSelectionHelper(getTextEditor(), getXSDSchema());
+    ISelectionProvider provider = getTextEditor().getSelectionProvider();
+    fSourceEditorSelectionListener = new SourceEditorSelectionListener();
+    if (provider instanceof IPostSelectionProvider)
+    {
+      ((IPostSelectionProvider) provider).addPostSelectionChangedListener(fSourceEditorSelectionListener);
+    }
+    else
+    {
+      provider.addSelectionChangedListener(fSourceEditorSelectionListener);
+    }
+    fXSDSelectionListener = new XSDSelectionManagerSelectionListener();
+    getSelectionManager().addSelectionChangedListener(fXSDSelectionListener);
+  }
+
+  protected void createActions()
+  {
+    super.createActions();
+    ActionRegistry registry = getActionRegistry();
+    BaseSelectionAction action = new AddFieldAction(this);
+    action.setSelectionProvider(getSelectionManager());
+    registry.registerAction(action);
+    action = new DeleteAction(this);
+    action.setSelectionProvider(getSelectionManager());
+    registry.registerAction(action);
+    action = new AddXSDElementAction(this, AddXSDElementAction.ID, "Add Element", false);
+    action.setSelectionProvider(getSelectionManager());
+    registry.registerAction(action);
+    action = new AddXSDElementAction(this, AddXSDElementAction.REF_ID, "Add Element Ref", true);
+    action.setSelectionProvider(getSelectionManager());
+    registry.registerAction(action);
+    action = new AddXSDModelGroupAction(this, XSDCompositor.SEQUENCE_LITERAL, AddXSDModelGroupAction.SEQUENCE_ID);
+    action.setSelectionProvider(getSelectionManager());
+    registry.registerAction(action);
+    action = new AddXSDModelGroupAction(this, XSDCompositor.CHOICE_LITERAL, AddXSDModelGroupAction.CHOICE_ID);
+    action.setSelectionProvider(getSelectionManager());
+    registry.registerAction(action);
+    action = new AddXSDModelGroupAction(this, XSDCompositor.ALL_LITERAL, AddXSDModelGroupAction.ALL_ID);
+    action.setSelectionProvider(getSelectionManager());
+    registry.registerAction(action);
+    action = new AddXSDModelGroupDefinitionAction(this, false);
+    action.setId(AddXSDModelGroupDefinitionAction.MODELGROUPDEFINITION_ID);
+    action.setSelectionProvider(getSelectionManager());
+    registry.registerAction(action);
+    action = new AddXSDModelGroupDefinitionAction(this, true);
+    action.setId(AddXSDModelGroupDefinitionAction.MODELGROUPDEFINITIONREF_ID);
+    action.setSelectionProvider(getSelectionManager());
+    registry.registerAction(action);
+    action = new AddXSDComplexTypeDefinitionAction(this);
+    action.setSelectionProvider(getSelectionManager());
+    registry.registerAction(action);
+    action = new AddXSDSimpleTypeDefinitionAction(this);
+    action.setSelectionProvider(getSelectionManager());
+    registry.registerAction(action);
+    action = new AddXSDAttributeDeclarationAction(this);
+    action.setSelectionProvider(getSelectionManager());
+    registry.registerAction(action);
+    action = new OpenInNewEditor(this);
+    action.setSelectionProvider(getSelectionManager());
+    registry.registerAction(action);
+    action = new ShowPropertiesViewAction(this);
+    registry.registerAction(action);
+    action = new AddXSDAttributeGroupDefinitionAction(this);
+    action.setSelectionProvider(getSelectionManager());
+    registry.registerAction(action);
+    action = new DeleteXSDConcreteComponentAction(this);
+    action.setSelectionProvider(getSelectionManager());
+    registry.registerAction(action);
+    
+    SetTypeAction setNewComplexTypeAction = new SetTypeAction("New...", SetTypeAction.SET_NEW_TYPE_ID, this);
+    setNewComplexTypeAction.setSelectionProvider(getSelectionManager());
+    registry.registerAction(setNewComplexTypeAction);
+        
+    SetTypeAction setExistingTypeAction = new SetTypeAction("Browse...", SetTypeAction.SELECT_EXISTING_TYPE_ID, this);
+    setExistingTypeAction.setSelectionProvider(getSelectionManager());
+    registry.registerAction(setExistingTypeAction);
+
+    addMultiplicityMenu(registry);
+  }
+  
+  protected void addMultiplicityMenu(ActionRegistry registry)
+  {
+    SetMultiplicityAction oneMultiplicity = new SetMultiplicityAction(this, "1..1 (" + "Required" + ")", SetMultiplicityAction.REQUIRED_ID);
+    oneMultiplicity.setMaxOccurs(1);
+    oneMultiplicity.setMinOccurs(1);
+    oneMultiplicity.setSelectionProvider(getSelectionManager());
+    registry.registerAction(oneMultiplicity);
+
+    SetMultiplicityAction zeroOrMoreMultiplicity = new SetMultiplicityAction(this, "0..* (" + "Zero or more" + ")", SetMultiplicityAction.ZERO_OR_MORE_ID);
+    zeroOrMoreMultiplicity.setMaxOccurs(-1);
+    zeroOrMoreMultiplicity.setMinOccurs(0);
+    zeroOrMoreMultiplicity.setSelectionProvider(getSelectionManager());
+    registry.registerAction(zeroOrMoreMultiplicity);
+    
+    SetMultiplicityAction zeroOrOneMultiplicity = new SetMultiplicityAction(this, "0..1 (" + "Optional" + ")", SetMultiplicityAction.ZERO_OR_ONE_ID);
+    zeroOrOneMultiplicity.setMaxOccurs(1);
+    zeroOrOneMultiplicity.setMinOccurs(0);
+    zeroOrOneMultiplicity.setSelectionProvider(getSelectionManager());
+    registry.registerAction(zeroOrOneMultiplicity);
+
+    SetMultiplicityAction oneOrMoreMultiplicity = new SetMultiplicityAction(this, "1..* (" + "One or more" + ")", SetMultiplicityAction.ONE_OR_MORE_ID);
+    oneOrMoreMultiplicity.setMaxOccurs(-1);
+    oneOrMoreMultiplicity.setMinOccurs(1);
+    oneOrMoreMultiplicity.setSelectionProvider(getSelectionManager());
+    registry.registerAction(oneOrMoreMultiplicity);
+    
+  }
+
+
+  /**
+   * Closes all project files on project close.
+   */
+  public void resourceChanged(final IResourceChangeEvent event)
+  {
+    if (event.getType() == IResourceChangeEvent.PRE_CLOSE)
+    {
+      Display.getDefault().asyncExec(new Runnable()
+      {
+        public void run()
+        {
+          IWorkbenchPage[] pages = getSite().getWorkbenchWindow().getPages();
+          for (int i = 0; i < pages.length; i++)
+          {
+            if (((FileEditorInput) structuredTextEditor.getEditorInput()).getFile().getProject().equals(event.getResource()))
+            {
+              IEditorPart editorPart = pages[i].findEditor(structuredTextEditor.getEditorInput());
+              pages[i].closeEditor(editorPart, true);
+            }
+          }
+        }
+      });
+    }
+  }
+
+  /**
+   * Returns <code>true</code> if the command stack is dirty
+   * 
+   * @see org.eclipse.ui.ISaveablePart#isDirty()
+   */
+  public boolean isDirty()
+  {
+    super.isDirty();
+    return structuredTextEditor.isDirty() || getCommandStack().isDirty();
+  }
+
+  /*
+   * This method is just to make firePropertyChanged accessbible from some
+   * (anonomous) inner classes.
+   */
+  protected void _firePropertyChange(int property)
+  {
+    super.firePropertyChange(property);
+  }
+
+  /**
+   * Posts the update code "behind" the running operation.
+   */
+  protected void postOnDisplayQue(Runnable runnable)
+  {
+    IWorkbench workbench = PlatformUI.getWorkbench();
+    IWorkbenchWindow[] windows = workbench.getWorkbenchWindows();
+    if (windows != null && windows.length > 0)
+    {
+      Display display = windows[0].getShell().getDisplay();
+      display.asyncExec(runnable);
+    }
+    else
+      runnable.run();
+  }
+
+  /**
+   * Indicates that a property has changed.
+   * 
+   * @param source
+   *          the object whose property has changed
+   * @param propId
+   *          the id of the property which has changed; property ids are
+   *          generally defined as constants on the source class
+   */
+  public void propertyChanged(Object source, int propId)
+  {
+    switch (propId)
+    {
+      // had to implement input changed "listener" so that
+      // strucutedText could tell it containing editor that
+      // the input has change, when a 'resource moved' event is
+      // found.
+      case IEditorPart.PROP_INPUT :
+      case IEditorPart.PROP_DIRTY : {
+        if (source == structuredTextEditor)
+        {
+          if (structuredTextEditor.getEditorInput() != getEditorInput())
+          {
+            setInput(structuredTextEditor.getEditorInput());
+            // title should always change when input changes.
+            // create runnable for following post call
+            Runnable runnable = new Runnable()
+            {
+              public void run()
+              {
+                _firePropertyChange(IWorkbenchPart.PROP_TITLE);
+              }
+            };
+            // Update is just to post things on the display queue
+            // (thread). We have to do this to get the dirty
+            // property to get updated after other things on the
+            // queue are executed.
+            postOnDisplayQue(runnable);
+          }
+        }
+        break;
+      }
+      case IWorkbenchPart.PROP_TITLE : {
+        // update the input if the title is changed
+        if (source == structuredTextEditor)
+        {
+          if (structuredTextEditor.getEditorInput() != getEditorInput())
+          {
+            setInput(structuredTextEditor.getEditorInput());
+          }
+        }
+        break;
+      }
+      default : {
+        // propagate changes. Is this needed? Answer: Yes.
+        if (source == structuredTextEditor)
+        {
+          firePropertyChange(propId);
+        }
+        break;
+      }
+    }
+  }
+  /**
+   * Listener on SSE's outline page's selections that converts DOM selections
+   * into xsd selections and notifies XSD selection manager
+   */
+  class OutlineTreeSelectionChangeListener implements ISelectionChangedListener, IDoubleClickListener
+  {
+    public OutlineTreeSelectionChangeListener()
+    {
+    }
+
+    private ISelection getXSDSelection(ISelection selection)
+    {
+      ISelection sel = null;
+      if (selection instanceof IStructuredSelection)
+      {
+        IStructuredSelection structuredSelection = (IStructuredSelection) selection;
+        Object o = structuredSelection.getFirstElement();
+        if (o != null)
+          sel = new StructuredSelection(o);
+      }
+      return sel;
+    }
+
+    /**
+     * Determines DOM node based on object (xsd node)
+     * 
+     * @param object
+     * @return
+     */
+    private Object getObjectForOtherModel(Object object)
+    {
+      Node node = null;
+      if (object instanceof Node)
+      {
+        node = (Node) object;
+      }
+      else if (object instanceof XSDComponent)
+      {
+        node = ((XSDComponent) object).getElement();
+      }
+      else if (object instanceof CategoryAdapter)
+      {
+        node = ((CategoryAdapter) object).getXSDSchema().getElement();
+      }
+      else if (object instanceof XSDBaseAdapter)
+      {
+        if (((XSDBaseAdapter) object).getTarget() instanceof XSDConcreteComponent)
+        {
+          node = ((XSDConcreteComponent) ((XSDBaseAdapter) object).getTarget()).getElement();
+        }
+      }
+      // the text editor can only accept sed nodes!
+      //
+      if (!(node instanceof IDOMNode))
+      {
+        node = null;
+      }
+      return node;
+    }
+
+    public void doubleClick(DoubleClickEvent event)
+    {
+      /*
+       * Selection in outline tree changed so set outline tree's selection into
+       * editor's selection and say it came from outline tree
+       */
+      if (getSelectionManager() != null && getSelectionManager().getEnableNotify())
+      {
+        ISelection selection = getXSDSelection(event.getSelection());
+        if (selection != null)
+        {
+          getSelectionManager().setSelection(selection, fOutlinePage);
+        }
+        if (getTextEditor() != null && selection instanceof IStructuredSelection)
+        {
+          int start = -1;
+          int length = 0;
+          Object o = ((IStructuredSelection) selection).getFirstElement();
+          if (o != null)
+            o = getObjectForOtherModel(o);
+          if (o instanceof IndexedRegion)
+          {
+            start = ((IndexedRegion) o).getStartOffset();
+            length = ((IndexedRegion) o).getEndOffset() - start;
+          }
+          if (start > -1)
+          {
+            getTextEditor().selectAndReveal(start, length);
+          }
+        }
+      }
+    }
+
+    public void selectionChanged(SelectionChangedEvent event)
+    {
+      /*
+       * Selection in outline tree changed so set outline tree's selection into
+       * editor's selection and say it came from outline tree
+       */
+      if (getSelectionManager() != null && getSelectionManager().getEnableNotify())
+      {
+        ISelection selection = getXSDSelection(event.getSelection());
+        if (selection != null)
+        {
+          getSelectionManager().setSelection(selection, fOutlinePage);
+        }
+      }
+    }
+  }
+  /**
+   * Listener on SSE's source editor's selections that converts DOM selections
+   * into xsd selections and notifies XSD selection manager
+   */
+  private class SourceEditorSelectionListener implements ISelectionChangedListener
+  {
+    /**
+     * Determines XSD node based on object (DOM node)
+     * 
+     * @param object
+     * @return
+     */
+    private Object getXSDNode(Object object)
+    {
+      // get the element node
+      Element element = null;
+      if (object instanceof Node)
+      {
+        Node node = (Node) object;
+        if (node != null)
+        {
+          if (node.getNodeType() == Node.ELEMENT_NODE)
+          {
+            element = (Element) node;
+          }
+          else if (node.getNodeType() == Node.ATTRIBUTE_NODE)
+          {
+            element = ((Attr) node).getOwnerElement();
+          }
+        }
+      }
+      Object o = element;
+      if (element != null)
+      {
+        Object modelObject = getXSDSchema().getCorrespondingComponent(element);
+        if (modelObject != null)
+        {
+          o = modelObject;
+          o = XSDAdapterFactory.getInstance().adapt((Notifier) modelObject);
+        }
+      }
+      return o;
+    }
+
+    public void selectionChanged(SelectionChangedEvent event)
+    {
+      if (getSelectionManager().getEnableNotify() && getActivePage() == 1)
+      {
+        ISelection selection = event.getSelection();
+        if (selection instanceof IStructuredSelection)
+        {
+          List xsdSelections = new ArrayList();
+          for (Iterator i = ((IStructuredSelection) selection).iterator(); i.hasNext();)
+          {
+            Object domNode = i.next();
+            Object xsdNode = getXSDNode(domNode);
+            if (xsdNode != null)
+            {
+              xsdSelections.add(xsdNode);
+            }
+          }
+          if (!xsdSelections.isEmpty())
+          {
+            StructuredSelection xsdSelection = new StructuredSelection(xsdSelections);
+            getSelectionManager().setSelection(xsdSelection, getTextEditor().getSelectionProvider());
+          }
+        }
+      }
+    }
+  }
+  /**
+   * Listener on XSD's selection manager's selections that converts XSD
+   * selections into DOM selections and notifies SSE's selection provider
+   */
+  private class XSDSelectionManagerSelectionListener implements ISelectionChangedListener
+  {
+    /**
+     * Determines DOM node based on object (xsd node)
+     * 
+     * @param object
+     * @return
+     */
+    private Object getObjectForOtherModel(Object object)
+    {
+      Node node = null;
+      if (object instanceof Node)
+      {
+        node = (Node) object;
+      }
+      else if (object instanceof XSDComponent)
+      {
+        node = ((XSDComponent) object).getElement();
+      }
+      else if (object instanceof CategoryAdapter)
+      {
+        node = ((CategoryAdapter) object).getXSDSchema().getElement();
+      }
+      else if (object instanceof XSDBaseAdapter)
+      {
+        if (((XSDBaseAdapter) object).getTarget() instanceof XSDConcreteComponent)
+        {
+          node = ((XSDConcreteComponent) ((XSDBaseAdapter) object).getTarget()).getElement();
+        }
+      }
+      // the text editor can only accept sed nodes!
+      //
+      if (!(node instanceof IDOMNode))
+      {
+        node = null;
+      }
+      return node;
+    }
+
+    public void selectionChanged(SelectionChangedEvent event)
+    {
+      // do not fire selection in source editor if selection event came
+      // from source editor
+      if (event.getSource() != getTextEditor().getSelectionProvider())
+      {
+        ISelection selection = event.getSelection();
+        if (selection instanceof IStructuredSelection)
+        {
+          List otherModelObjectList = new ArrayList();
+          for (Iterator i = ((IStructuredSelection) selection).iterator(); i.hasNext();)
+          {
+            Object modelObject = i.next();
+            Object otherModelObject = getObjectForOtherModel(modelObject);
+            if (otherModelObject != null)
+            {
+              otherModelObjectList.add(otherModelObject);
+            }
+          }
+          if (!otherModelObjectList.isEmpty())
+          {
+            // here's an ugly hack... if we allow text selections to fire during
+            // SetInputToGraphView action we screw up the navigation history!
+            //            
+            //TODO (cs) ... we need to prevent the source editor from messing up the navigation history
+            //
+            if (getActivePage() == 1)
+            {  
+              StructuredSelection nodeSelection = new StructuredSelection(otherModelObjectList);
+              getTextEditor().getSelectionProvider().setSelection(nodeSelection);
+            }  
+          }
+        }
+      }
+    }
+  }
+
+  public INavigationLocation createEmptyNavigationLocation()
+  {
+    if (getActivePage() == 0)
+    {
+      return new DesignViewNavigationLocation(this);
+    }
+    else
+    {
+      return new MultiPageEditorTextSelectionNavigationLocation(getTextEditor(), false);
+    }
+  }
+
+  public INavigationLocation createNavigationLocation()
+  {
+    if (getActivePage() == 0)
+    {
+      try
+      {
+        RootEditPart rootEditPart = graphicalViewer.getRootEditPart();
+        EditPart editPart = rootEditPart.getContents();
+        if (editPart instanceof RootContentEditPart)
+        {
+          RootContentEditPart rootContentEditPart = (RootContentEditPart)editPart;
+          Object input = rootContentEditPart.getInput();      
+          if (input instanceof Adapter)
+          {
+            XSDConcreteComponent concreteComponent = (XSDConcreteComponent)((Adapter)input).getTarget();
+            return new DesignViewNavigationLocation(this, concreteComponent);
+          }
+        }   
+      }
+      catch (Exception e)
+      {
+        e.printStackTrace();
+      }
+      return null;
+    }
+    else
+    {
+      return new MultiPageEditorTextSelectionNavigationLocation(getTextEditor(), true);
+    }
+  }
+}  
\ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/Messages.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/Messages.java
new file mode 100644
index 0000000..0c335f7
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/Messages.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS
+{
+  static 
+  {
+    NLS.initializeMessages("org.eclipse.wst.xsd.editor" + ".Messages", Messages.class);
+  }
+
+  public Messages()
+  {
+    super();
+  }
+  
+  public static String UI_LABEL_BASE_TYPE;
+  public static String UI_LABEL_DERIVED_BY;
+  public static String UI_LABEL_INHERIT_FROM;
+  public static String UI_LABEL_INHERIT_BY;
+  public static String UI_LABEL_DOCUMENTATION;
+  public static String UI_LABEL_APP_INFO;
+  public static String UI_LABEL_SET_TYPE;
+  public static String UI_LABEL_TYPE;
+  public static String UI_LABEL_MINOCCURS;
+  public static String UI_LABEL_MAXOCCURS;
+  public static String UI_NO_TYPE;
+  public static String UI_PAGE_HEADING_REFERENCE;
+  public static String UI_LABEL_READ_ONLY;
+  public static String UI_LABEL_COMPONENTS;
+
+
+}
+
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/Messages.properties b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/Messages.properties
new file mode 100644
index 0000000..82f42e0
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/Messages.properties
@@ -0,0 +1,32 @@
+###############################################################################
+# Copyright (c) 2001, 2006 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
+###############################################################################
+
+UI_LABEL_BASE_TYPE = Base Type:
+UI_LABEL_DERIVED_BY = Derived By:
+
+UI_LABEL_INHERIT_FROM = Inherit From:
+UI_LABEL_INHERIT_BY = Inherit By:
+
+UI_LABEL_DOCUMENTATION = Documentation
+UI_LABEL_APP_INFO = App Info
+
+UI_LABEL_SET_TYPE = Set Type
+UI_LABEL_TYPE = Type:
+
+UI_LABEL_MINOCCURS = Minimum Occurrence:
+UI_LABEL_MAXOCCURS = Maximum Occurrence:
+
+UI_PAGE_HEADING_REFERENCE = Reference
+UI_LABEL_READ_ONLY = Read-Only
+
+UI_NO_TYPE = No Type
+
+UI_LABEL_COMPONENTS				= Components:
\ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/XSDEditorConfiguration.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/XSDEditorConfiguration.java
new file mode 100644
index 0000000..1ba155b
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/XSDEditorConfiguration.java
@@ -0,0 +1,187 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.gef.EditPartFactory;
+import org.eclipse.wst.xsd.editor.internal.actions.IXSDToolbarAction;
+import org.eclipse.wst.xsd.editor.internal.adapters.XSDAdapterFactory;
+import org.eclipse.wst.xsd.editor.internal.design.figures.IExtendedFigureFactory;
+
+public class XSDEditorConfiguration
+{
+  public static final String XSDEDITORCONFIGURATIONEXTENSIONID = "org.eclipse.wst.xsd.ui.XSDEditorExtensionConfiguration";
+  public static final String CLASSNAME = "class";
+  public static final String ADAPTERFACTORY = "adapterFactory";
+  public static final String TOOLBARACTION = "toolbarAction";
+  public static final String FIGUREFACTORY = "figureFactory";
+  public static final String EDITPARTFACTORY = "editPartFactory";
+
+  List definedExtensionsList = null;
+
+  public XSDEditorConfiguration()
+  {
+
+  }
+
+  public XSDAdapterFactory getAdapterFactory()
+  {
+    if (definedExtensionsList == null)
+    {
+      readXSDConfigurationRegistry();
+    }
+    if (!definedExtensionsList.isEmpty())
+    {
+      return ((XSDEditorExtensionProperties) definedExtensionsList.get(0)).getAdapterFactory();
+    }
+    return null;
+  }
+
+  public EditPartFactory getEditPartFactory()
+  {
+    if (definedExtensionsList == null)
+    {
+      readXSDConfigurationRegistry();
+    }
+    if (!definedExtensionsList.isEmpty())
+    {
+      return ((XSDEditorExtensionProperties) definedExtensionsList.get(0)).getEditPartFactory();
+    }
+    return null;
+  }
+
+  public IExtendedFigureFactory getFigureFactory()
+  {
+    if (definedExtensionsList == null)
+    {
+      readXSDConfigurationRegistry();
+    }
+    if (!definedExtensionsList.isEmpty())
+    {
+      return ((XSDEditorExtensionProperties) definedExtensionsList.get(0)).getFigureFactory();
+    }
+    return null;
+  }
+
+  public List getToolbarActions()
+  {
+    if (definedExtensionsList == null)
+    {
+      readXSDConfigurationRegistry();
+    }
+    if (!definedExtensionsList.isEmpty())
+    {
+      return ((XSDEditorExtensionProperties) definedExtensionsList.get(0)).getActionList();
+    }
+    return Collections.EMPTY_LIST;
+  }
+
+  protected Object loadClass(IConfigurationElement element, String classString)
+  {
+    String pluginId = element.getDeclaringExtension().getContributor().getName();
+
+    try
+    {
+      Class theClass = Platform.getBundle(pluginId).loadClass(classString);
+      Object instance = theClass.newInstance();
+
+      return instance;
+    }
+    catch (Exception e)
+    {
+
+    }
+    return null;
+  }
+
+  public void readXSDConfigurationRegistry()
+  {
+    IConfigurationElement[] xsdEditorExtensionList = Platform.getExtensionRegistry().getConfigurationElementsFor(XSDEDITORCONFIGURATIONEXTENSIONID);
+
+    boolean definedExtensionsExist = (xsdEditorExtensionList != null && xsdEditorExtensionList.length > 0);
+
+    definedExtensionsList = new ArrayList();
+
+    if (definedExtensionsExist)
+    {
+      for (int i = 0; i < xsdEditorExtensionList.length; i++)
+      {
+        XSDEditorExtensionProperties properties = new XSDEditorExtensionProperties();
+        definedExtensionsList.add(properties);
+
+        IConfigurationElement element = xsdEditorExtensionList[i];
+        String adapterFactoryClass = element.getAttribute(ADAPTERFACTORY);
+        if (adapterFactoryClass != null)
+        {
+          Object object = loadClass(element, adapterFactoryClass);
+          XSDAdapterFactory adapterFactory = null;
+          if (object instanceof XSDAdapterFactory)
+          {
+            adapterFactory = (XSDAdapterFactory) object;
+            properties.setAdapterFactory(adapterFactory);
+          }
+        }
+
+        String figureFactoryClass = element.getAttribute(FIGUREFACTORY);
+        if (figureFactoryClass != null)
+        {
+          Object object = loadClass(element, figureFactoryClass);
+          IExtendedFigureFactory figureFactory = null;
+          if (object instanceof IExtendedFigureFactory)
+          {
+            figureFactory = (IExtendedFigureFactory) object;
+            properties.setFigureFactoryList(figureFactory);
+          }
+        }
+
+        IConfigurationElement[] toolbarActions = element.getChildren(TOOLBARACTION);
+        List actionList = new ArrayList();
+        if (toolbarActions != null)
+        {
+          for (int j = 0; j < toolbarActions.length; j++)
+          {
+            IConfigurationElement actionElement = toolbarActions[j];
+            String actionClass = actionElement.getAttribute(CLASSNAME);
+            IXSDToolbarAction action = null;
+            if (actionClass != null)
+            {
+              Object object = loadClass(actionElement, actionClass);
+              if (object instanceof IXSDToolbarAction)
+              {
+                action = (IXSDToolbarAction) object;
+                actionList.add(action);
+              }
+            }
+          }
+        }
+        properties.setActionList(actionList);
+
+        String editPartFactoryClass = element.getAttribute(EDITPARTFACTORY);
+        if (editPartFactoryClass != null)
+        {
+          Object object = loadClass(element, editPartFactoryClass);
+          EditPartFactory editPartFactory = null;
+          if (object instanceof EditPartFactory)
+          {
+            editPartFactory = (EditPartFactory) object;
+            properties.setEditPartFactoryList(editPartFactory);
+          }
+        }
+
+      }
+    }
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/XSDEditorContextIds.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/XSDEditorContextIds.java
new file mode 100644
index 0000000..1e4bfc5
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/XSDEditorContextIds.java
@@ -0,0 +1,460 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 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.editor;
+
+/**
+ * Context help id constants.
+ */
+public interface XSDEditorContextIds 
+{
+  public static final String PLUGIN_NAME = "org.eclipse.wst.xsd.ui.internal";
+
+  /* CONTEXT_IDs New XSD Wizard uses the WizardNewFileCreationPage from org.eclipse.ui.dialogs */
+ 
+  /* CONTEXT_IDs for XSDEditor follow the xsdexxx context IDs */
+
+  /* CONTEXT_ID xsde0010 for XSD Editor Design View */
+  public static final String XSDE_SCHEMA_DESIGN_VIEW      = PLUGIN_NAME + ".xsde0010";
+  /* no CONTEXT_ID for File Name Text Edit (not editable) */
+  /* CONTEXT_ID xsde0020 for Version Text Edit */
+  public static final String XSDE_SCHEMA_VERSION          = PLUGIN_NAME + ".xsde0020";
+  /* CONTEXT_ID xsde0030 for Language Text Edit */
+  public static final String XSDE_SCHEMA_LANGUAGE         = PLUGIN_NAME + ".xsde0030";
+  /* CONTEXT_ID xsde0040 for Namespace Group */
+  public static final String XSDE_SCHEMA_NAMESPACE_GROUP  = PLUGIN_NAME + ".xsde0040";
+  /* CONTEXT_ID xsde0050 for Prefix Text Edit */
+  public static final String XSDE_SCHEMA_PREFIX           = PLUGIN_NAME + ".xsde0050";
+  /* CONTEXT_ID xsde0060 for Target namespace Text Edit */
+  public static final String XSDE_SCHEMA_TARGET_NAMESPACE = PLUGIN_NAME + ".xsde0060";
+  /* CONTEXT_ID xsde0070 for Apply Push Button */
+  public static final String XSDE_SCHEMA_APPLY            = PLUGIN_NAME + ".xsde0070";
+  /* CONTEXT_ID xsde0080 for Attribute form default Combo Box */
+  public static final String XSDE_SCHEMA_ATTRIBUTE        = PLUGIN_NAME + ".xsde0080";
+  /* CONTEXT_ID xsde0090 for Element form default Combo Box */
+  public static final String XSDE_SCHEMA_ELEMENT          = PLUGIN_NAME + ".xsde0090";
+  /* CONTEXT_ID xsde0100 for Block default Combo Box */
+  public static final String XSDE_SCHEMA_BLOCK            = PLUGIN_NAME + ".xsde0100";
+  /* CONTEXT_ID xsde0110 for Final Default Combo Box */
+  public static final String XSDE_SCHEMA_FINAL            = PLUGIN_NAME + ".xsde0110";
+
+  
+  /* CONTEXT_ID xsde0200 for Annotations Comment Group - only used generically */
+  /* CONTEXT_ID      - used in Documentation Design View */
+  /* CONTEXT_ID      - used in App Info Design View */
+  public static final String XSDE_ANNOTATION_COMMENT_GROUP = PLUGIN_NAME + ".xsde0200";
+  /* CONTEXT_ID xsde0210 for Annotations Comment Group - only used generically */
+  /* CONTEXT_ID      - used in Documentation Design View */
+  /* CONTEXT_ID      - used in App Info Design View */
+  public static final String XSDE_ANNOTATION_COMMENT       = PLUGIN_NAME + ".xsde0210";
+  
+  /* CONTEXT_ID xsde0300 for Documentation Design View */
+  public static final String XSDE_DOCUMENTATION_DESIGN_VIEW   = PLUGIN_NAME + ".xsde0300";
+  /* CONTEXT_ID xsde0310 for Source Text Edit */
+  public static final String XSDE_DOCUMENTATION_SOURCE        = PLUGIN_NAME + ".xsde0310";
+  /* CONTEXT_ID xsde0320 for Language Text Edit */
+  public static final String XSDE_DOCUMENTATION_LANGUAGE      = PLUGIN_NAME + ".xsde0320";
+  /* CONTEXT_ID Comment Group is from Annotations Window xsde0200 */
+  /* CONTEXT_ID Comment Multi-line Edit is from Annotations Window xsd0210 */
+
+  /* CONTEXT_ID xsde0400 for App Info Design View */
+  public static final String XSDE_APP_INFO_DESIGN_VIEW = PLUGIN_NAME + ".xsde0400";
+  /* CONTEXT_ID xsde0410 for App Info Source Text Edit */
+  public static final String XSDE_APP_INFO_SOURCE = PLUGIN_NAME + ".xsde0410";
+  /* CONTEXT_ID Comment Group is from Annotations Window xsde0200 */
+  /* CONTEXT_ID Comment Multi-line Edit is from Annotations Window xsd0210 */
+
+  /* CONTEXT_ID xsde0500 for Complex Type Design View */
+  public static final String XSDE_COMPLEX_DESIGN_VIEW = PLUGIN_NAME + ".xsde0500";
+  /* CONTEXT_ID xsde0510 for Name Text Edit */
+  public static final String XSDE_COMPLEX_NAME        = PLUGIN_NAME + ".xsde0510";
+  /* CONTEXT_ID xsde0520 for Abstract Combo Box */
+  public static final String XSDE_COMPLEX_ABSTRACT    = PLUGIN_NAME + ".xsde0520";
+  /* CONTEXT_ID xsde0530 for Mixed Combo Box */
+  public static final String XSDE_COMPLEX_MIXED       = PLUGIN_NAME + ".xsde0530";
+  /* CONTEXT_ID xsde0540 for Block Combo Box */
+  public static final String XSDE_COMPLEX_BLOCK       = PLUGIN_NAME + ".xsde0540";
+  /* CONTEXT_ID xsde0550 for Final Combo Box */
+  public static final String XSDE_COMPLEX_FINAL       = PLUGIN_NAME + ".xsde0550";
+
+  /* CONTEXT_ID xsde0600 for Simple Type Design View */
+  public static final String XSDE_SIMPLE_DESIGN_VIEW = PLUGIN_NAME + ".xsde0600";
+  /* CONTEXT_ID xsde0610 for Name Text Edit */
+  public static final String XSDE_SIMPLE_NAME        = PLUGIN_NAME + ".xsde0610";
+
+  /* CONTEXT_ID for Global Element and Element Design Views are the same */
+  /* CONTEXT_ID xsde0700 for Element Design View */
+  public static final String XSDE_ELEMENT_DESIGN_VIEW = PLUGIN_NAME + ".xsde0700";
+  /* CONTEXT_ID xsde0710 for Element Name Text Edit */
+  public static final String XSDE_ELEMENT_NAME         = PLUGIN_NAME + ".xsde0710";
+  /* CONTEXT_ID Type Information Group is from Type Helper xsde0900 */
+  /* CONTEXT_ID Built-in simple type Radio Button is from Type Helper xsde0920 */
+  /* CONTEXT_ID User-defined simple type Radio Button is from Type Helper xsde0930 */
+  /* CONTEXT_ID User-defined complex type Radio Button is from Type Helper xsde0940 */
+  /* CONTEXT_ID Type information Combo Box is from Type Helper xsde0950 */
+  /* CONTEXT_ID xsde0720 for Abstract Check Box */
+  public static final String XSDE_ELEMENT_ABSTRACT     = PLUGIN_NAME + ".xsde0720";
+  /* CONTEXT_ID xsde0730 for Nillable Check Box */
+  public static final String XSDE_ELEMENT_NILLABLE     = PLUGIN_NAME + ".xsde0730";
+  /* CONTEXT_ID xsde0740 for Value Group */
+  public static final String XSDE_ELEMENT_VALUE        = PLUGIN_NAME + ".xsde0740";
+  /* CONTEXT_ID xsde0750 for Fixed Radio Button */
+  public static final String XSDE_ELEMENT_FIXED        = PLUGIN_NAME + ".xsde0750";
+  /* CONTEXT_ID xsde0760 for Default Radio Button */
+  public static final String XSDE_ELEMENT_DEFAULT      = PLUGIN_NAME + ".xsde0760";
+  /* CONTEXT_ID xsde0770 for Value Group */
+  public static final String XSDE_ELEMENT_VALUE_GROUP  = PLUGIN_NAME + ".xsde0770";
+  /* CONTEXT_ID xsde0780 for Minimum Text Edit */
+  public static final String XSDE_ELEMENT_MINIMUM      = PLUGIN_NAME + ".xsde0780";
+  /* CONTEXT_ID xsde0790 for Maximum Text Edit */
+  public static final String XSDE_ELEMENT_MAXIMUM      = PLUGIN_NAME + ".xsde0790";
+  /* CONTEXT_ID xsde0800 for Block Combo Box */
+  public static final String XSDE_ELEMENT_BLOCK        = PLUGIN_NAME + ".xsde0800";
+  /* CONTEXT_ID xsde0810 for Final Combo Box */
+  public static final String XSDE_ELEMENT_FINAL        = PLUGIN_NAME + ".xsde0810";
+  /* CONTEXT_ID xsde0820 for Substitution Group Combo Box */
+  public static final String XSDE_ELEMENT_SUBSTITUTION = PLUGIN_NAME + ".xsde0820";
+  /* CONTEXT_ID xsde0830 for Form Qualification Combo Box */                    
+  public static final String XSDE_ELEMENT_FORM         = PLUGIN_NAME + ".xsde0830";
+
+  /* CONTEXT_ID xsde0900 for Type Helper Group - only used generically */
+  /* CONTEXT_ID      - used in Global Element Design View */
+  /* CONTEXT_ID      - used in Global Attribute Design View */
+  /* CONTEXT_ID      - used in Simple Content Design View */
+  /* CONTEXT_ID      - used in Restriction Design View */
+  /* CONTEXT_ID      - used in List Design View */
+  /* CONTEXT_ID      - used in Union Design View */
+  public static final String XSDE_TYPE_HELPER_GROUP    = PLUGIN_NAME + ".xsde0900";
+  /* CONTEXT_ID xsde0910 for None Radio Button - only used generically */
+  /* CONTEXT_ID      - used in Simple Content Design View */
+  /* CONTEXT_ID      - used in Restriction Design View */
+  /* CONTEXT_ID      - used in List Design View */
+  /* CONTEXT_ID      - used in Union Design View */
+  public static final String XSDE_TYPE_HELPER_NONE     = PLUGIN_NAME + ".xsde0910";
+  /* CONTEXT_ID xsde0920 for Built-in simple type Radio Button - only used generically */
+  /* CONTEXT_ID      - used in Global Element Design View */
+  /* CONTEXT_ID      - used in Global Attribute Design View */
+  /* CONTEXT_ID      - used in Simple Content Design View */
+  /* CONTEXT_ID      - used in Restriction Design View */
+  /* CONTEXT_ID      - used in List Design View */
+  /* CONTEXT_ID      - used in Union Design View */
+  public static final String XSDE_TYPE_HELPER_BUILT_IN = PLUGIN_NAME + ".xsde0920";
+  /* CONTEXT_ID xsde0930 for User-defined simple type Radio Button - only used generically */
+  /* CONTEXT_ID      - used in Global Element Design View */
+  /* CONTEXT_ID      - used in Global Attribute Design View */
+  /* CONTEXT_ID      - used in Simple Content Design View */
+  /* CONTEXT_ID      - used in Restriction Design View */
+  /* CONTEXT_ID      - used in List Design View */
+  /* CONTEXT_ID      - used in Union Design View */
+  public static final String XSDE_TYPE_HELPER_USER_DEFINED_SIMPLE = PLUGIN_NAME + ".xsde0930";
+  /* CONTEXT_ID xsde0940 for User-defined complex type Radio Button - only used generically */
+  /* CONTEXT_ID      - used in Global Element Design View */
+  public static final String XSDE_TYPE_HELPER_USER_DEFINED_COMPLEX = PLUGIN_NAME + ".xsde0940";
+  /* CONTEXT_ID xsde0950 for Type information Combo Box - only used generically */
+  /* CONTEXT_ID      - used in Global Element Design View */
+  /* CONTEXT_ID      - used in Global Attribute Design View */
+  /* CONTEXT_ID      - used in Simple Content Design View */
+  /* CONTEXT_ID      - used in Restriction Design View */
+  /* CONTEXT_ID      - used in List Design View */
+  public static final String XSDE_TYPE_HELPER_TYPE = PLUGIN_NAME + ".xsde0950";
+
+  /* CONTEXT_ID xsde1000 for Attribute Design View */
+  public static final String XSDE_ATTRIBUTE_DESIGN_VIEW = PLUGIN_NAME + ".xsde1000";
+  /* CONTEXT_ID xsde1010 for Attribute Name Text Edit */
+  public static final String XSDE_ATTRIBUTE_NAME        = PLUGIN_NAME + ".xsde1010";
+  /* CONTEXT_ID Type Information Group is from Type Helper xsde0900 */
+  /* CONTEXT_ID Built-in simple type Radio Button is from Type Helper xsde0920 */
+  /* CONTEXT_ID User-defined simple type Radio Button is from Type Helper xsde0930 */
+  /* CONTEXT_ID Type information Combo Box is from Type Helper xsde0950 */
+  /* CONTEXT_ID xsde1020 for Value Group */
+  public static final String XSDE_ATTRIBUTE_VALUE_GROUP = PLUGIN_NAME + ".xsde1020";
+  /* CONTEXT_ID xsde1030 for Fixed Radio Button */
+  public static final String XSDE_ATTRIBUTE_FIXED       = PLUGIN_NAME + ".xsde1030";
+  /* CONTEXT_ID xsde1040 for Default Radio Button */
+  public static final String XSDE_ATTRIBUTE_DEFAULT     = PLUGIN_NAME + ".xsde1040";
+  /* CONTEXT_ID xsde1050 for Value Text Edit */
+  public static final String XSDE_ATTRIBUTE_VALUE       = PLUGIN_NAME + ".xsde1050";
+  /* CONTEXT_ID xsde1060 for Usage Combo Box */
+  public static final String XSDE_ATTRIBUTE_USAGE       = PLUGIN_NAME + ".xsde1060";
+  /* CONTEXT_ID xsde1070 for Form qualificaiton Combo Box */
+  public static final String XSDE_ATTRIBUTE_FORM        = PLUGIN_NAME + ".xsde1070";
+
+  /* CONTEXT_ID xsde1100 for Element Ref Window Design View */
+  public static final String XSDE_ELEMENT_REF_DESIGN_VIEW = PLUGIN_NAME + ".xsde1100";
+  /* CONTEXT_ID xsde1110 for Reference Name Combo Box */
+  public static final String XSDE_ELEMENT_REF_REFERENCE   = PLUGIN_NAME + ".xsde1110";
+  /* CONTEXT_ID xsde1120 for Minimum Text Edit */
+  public static final String XSDE_ELEMENT_REF_MINIMUM     = PLUGIN_NAME + ".xsde1120";
+  /* CONTEXT_ID xsde1130 for Maximum Text Edit */
+  public static final String XSDE_ELEMENT_REF_MAXIMUM     = PLUGIN_NAME + ".xsde1130";
+  
+  /* CONTEXT_ID xsde1200 for Simple Content Design View - used generically */
+  /* CONTEXT_ID      - used in Simple Content Design View */ 
+  /* CONTEXT_ID      - used in Complex Content Design View */
+    public static final String XSDE_SIMPLE_CONTENT_DESIGN_VIEW = PLUGIN_NAME + ".xsde1200";
+  /* CONTEXT_ID Base Type Group is from Type Helper xsde0900 */
+  /* CONTEXT_ID None Radio Button is from Type Helper xsde0910 */
+  /* CONTEXT_ID Built-in simple type Radio Button is from Type Helper xsde0920 */
+  /* CONTEXT_ID User-defined simple type Radio Button is from Type Helper xsde0930 */
+  /* CONTEXT_ID Type information Combo Box is from Type Helper xsde0950 */
+  /* CONTEXT_ID xsde1210 for Derived by Combo Box - used generically */
+  /* CONTEXT_ID      - used in Simple Content Design View */ 
+  /* CONTEXT_ID      - used in Complex Content Design View */
+  public static final String XSDE_SIMPLE_CONTENT_DERIVED = PLUGIN_NAME + ".xsde1210";
+
+  /* CONTEXT_ID xsde1300 for Restriction Design View */
+  public static final String XSDE_RESTRICTION_DESIGN_VIEW  = PLUGIN_NAME + ".xsde1300";
+  /* CONTEXT_ID Base Type Group is from Type Helper xsde0900 */
+  /* CONTEXT_ID None Radio Button is from Type Helper xsde0910 */
+  /* CONTEXT_ID Built-in simple type Radio Button is from Type Helper xsde0920 */
+  /* CONTEXT_ID User-defined simple type Radio Button is from Type Helper xsde0930 */
+  /* CONTEXT_ID Type information Combo Box is from Type Helper xsde0950 */
+  /* CONTEXT_ID xsde1310 for Facets Group */
+  public static final String XSDE_RESTRICTION_FACETS_GROUP = PLUGIN_NAME + ".xsde1310";
+  /* CONTEXT_ID xsde1320 for Facets Table */
+  public static final String XSDE_RESTRICTION_FACETS       = PLUGIN_NAME + ".xsde1320";
+
+  /* CONTEXT_ID xsde1400 for List Design View */
+  public static final String XSDE_LIST_DESIGN_VIEW  = PLUGIN_NAME + ".xsde1400";
+  /* CONTEXT_ID Base Type Group is from Type Helper xsde0900 */
+  /* CONTEXT_ID None Radio Button is from Type Helper xsde0910 */
+  /* CONTEXT_ID Built-in simple type Radio Button is from Type Helper xsde0920 */
+  /* CONTEXT_ID User-defined simple type Radio Button is from Type Helper xsde0930 */
+  /* CONTEXT_ID Type information Combo Box is from Type Helper xsde0950 */
+
+  /* CONTEXT_ID xsde1500 for Attribute Group Design View */
+  public static final String XSDE_ATTRIBUTE_GROUP_DESIGN_VIEW = PLUGIN_NAME + ".xsde1500";
+  /* CONTEXT_ID xsde1510 for Name Text Edit */
+  public static final String XSDE_ATTRIBUTE_GROUP_NAME = PLUGIN_NAME + ".xsde1510";
+
+  /* CONTEXT_ID for Global Attribute and Attribute Design Views are the same */
+  /* CONTEXT_ID xsde1600 for Attribute Group Reference Design View */
+  public static final String XSDE_ATTRIBUTE_GROUP_REF_DESIGN_VIEW = PLUGIN_NAME + ".xsde1600";
+  /* CONTEXT_ID xsde1610 for Reference Name Combo Box */
+  public static final String XSDE_ATTRIBUTE_GROUP_REF_NAME = PLUGIN_NAME + ".xsde1610";
+
+  /* CONTEXT_ID xsde1700 for Attribute Reference Design View */
+  public static final String XSDE_ATTRIBUTE_REF_DESIGN_VIEW = PLUGIN_NAME + ".xsde1700";
+  /* CONTEXT_ID xsde1710 for Reference Name Combo Box */
+  public static final String XSDE_ATTRIBUTE_REF_NAME = PLUGIN_NAME + ".xsde1710";
+
+  /* CONTEXT_ID xsde1800 for Pattern Design View */
+  public static final String XSDE_PATTERN_DESIGN_VIEW = PLUGIN_NAME + ".xsde1800";
+  /* CONTEXT_ID xsde1810 for Value Text Edit */
+  public static final String XSDE_PATTERN_VALUE   = PLUGIN_NAME + ".xsde1810";
+  /* CONTEXT_ID xsde1820 for Create Regular Expression Push Button */
+  public static final String XSDE_PATTERN_REGULAR = PLUGIN_NAME + ".xsde1820";
+
+  /* CONTEXT_ID xsde1900 for Enum Design View */
+  public static final String XSDE_ENUM_DESIGN_VIEW = PLUGIN_NAME + ".xsde1900";
+  /* CONTEXT_ID xsde1910 for Value Text Edit */
+  public static final String XSDE_ENUM_VALUE       = PLUGIN_NAME + ".xsde1910";
+  
+  /* CONTEXT_ID xsde2000 for Include Design Page */
+  public static final String XSDE_INCLUDE_DESIGN_VIEW = PLUGIN_NAME + ".xsde2000";
+  /* no CONTEXT_ID for Schema Location Text Edit (not editable) */
+  /* CONTEXT_ID Select Push Button is from Include Helper xsde2100 */ 
+  
+  /* CONTEXT_ID xsde2100 for Include Helper Select Push Button - used generically */
+  /* CONTEXT_ID      - used in Include Design View */
+  /* CONTEXT_ID      - used in Import Design View */
+  public static final String XSDE_INCLUDE_HELPER_SELECT = PLUGIN_NAME + ".xsde2100";
+
+  /* CONTEXT_ID xsde2200 for Import Design Page */
+  public static final String XSDE_IMPORT_DESIGN_VIEW = PLUGIN_NAME + ".xsde2200";
+  /* no CONTEXT_ID for Schema Location Text Edit (not editable) */
+  /* CONTEXT_ID Select Push Button is from Include Helper xsde2100 */
+  /* CONTEXT_ID xsde2210 for Prefix Text Edit */
+  public static final String XSDE_IMPORT_PREFIX      = PLUGIN_NAME + ".xsde2210";
+  /* no CONTEXT_ID for Namespace Text Edit (not editable) */
+
+  /* CONTEXT_ID xsde2300 for Redefine Design View */
+  public static final String XSDE_REDEFINE_DESIGN_VIEW = PLUGIN_NAME + ".xsde2300";
+  /* no CONTEXT_ID for Schema Location Text Edit (not editable) */
+  /* CONTEXT_ID Select Push Button is from Include Helper xsde2100 */
+
+  /* CONTEXT_ID xsde2400 for Group Design View */
+  public static final String XSDE_GROUP_DESIGN_VIEW = PLUGIN_NAME + ".xsde2400";
+  /* CONTEXT_ID xsde2410 for Name Text Edit */
+  public static final String XSDE_GROUP_NAME        = PLUGIN_NAME + ".xsde2410";
+
+  /* CONTEXT_ID xsde2500 for Group Scope Design View */
+  public static final String XSDE_GROUP_SCOPE_DESIGN_VIEW   = PLUGIN_NAME + ".xsde2500";
+  /* CONTEXT_ID xsde2510 for Content model Group */
+  public static final String XSDE_GROUP_SCOPE_CONTENT_GROUP = PLUGIN_NAME + ".xsde2510";
+  /* CONTEXT_ID xsde2520 for Sequence Radio Button */
+  public static final String XSDE_GROUP_SCOPE_SEQUENCE = PLUGIN_NAME + ".xsde2520";
+  /* CONTEXT_ID xsde2530 for Choice Radio Button */
+  public static final String XSDE_GROUP_SCOPE_CHOICE   = PLUGIN_NAME + ".xsde2530";
+  /* CONTEXT_ID xsde2540 for All Radio Button */
+  public static final String XSDE_GROUP_SCOPE_ALL      = PLUGIN_NAME + ".xsde2540";
+  /* CONTEXT_ID xsde2550 for Minimum Text Edit */
+  public static final String XSDE_GROUP_SCOPE_MINIMUM  = PLUGIN_NAME + ".xsde2550";
+  /* CONTEXT_ID xsde2560 for Maximum Text Edit*/
+  public static final String XSDE_GROUP_SCOPE_MAXIMUM  = PLUGIN_NAME + ".xsde2560";
+
+  /* CONTEXT_ID xsde2600 for Group Ref Design View */
+  public static final String XSDE_GROUP_REF_DESIGN_VIEW = PLUGIN_NAME + ".xsde2600";
+  /* CONTEXT_ID xsde2610 for Reference name Combo Box */
+  public static final String XSDE_GROUP_REF_REFERENCE   = PLUGIN_NAME + ".xsde2610";
+  /* CONTEXT_ID xsde2620 for Minimum Text Edit */
+  public static final String XSDE_GROUP_REF_MINIMUM     = PLUGIN_NAME + ".xsde2620";
+  /* CONTEXT_ID xsde2630 for Maximum Text Edit */
+  public static final String XSDE_GROUP_REF_MAXIMUM     = PLUGIN_NAME + ".xsde2630";
+
+  /* CONTEXT_ID xsde2700 for Unique Design View */
+  public static final String XSDE_UNIQUE_DESIGN_VIEW = PLUGIN_NAME + ".xsde2700";
+  /* CONTEXT_ID Name Text Edit is from Unique Base xsde2800 */
+  /* CONTEXT_ID Selector Group is from Unique Base xsde2810 */
+  /* CONTEXT_ID Selector Mulit-line Edit is from Unique Base xsde2820 */
+  /* CONTEXT_ID Fields Group is from Unique Base xsde2830 */
+  /* CONTEXT_ID Source Text Edit is from Unique Base xsde2840 */
+  /* CONTEXT_ID Add Push Button is from Unique Base xsde2850 */
+  /* CONTEXT_ID Remove Push Button is from Unique Base xsde2860 */
+  /* CONTEXT_ID Target List Box is from Unique Base xsde2870 */
+  
+  /* CONTEXT_ID xsde2800 for Unique Base Name Text Edit - used generically */
+  /* CONTEXT_ID      - used in Unique Design View */
+  /* CONTEXT_ID      - used in Key Design View */
+  /* CONTEXT_ID      - used in Key Ref Design View */
+  public static final String XSDE_UNIQUE_BASE_NAME = PLUGIN_NAME + ".xsde2800";
+  /* CONTEXT_ID xsde2810 for Selector Group - used generically */
+  /* CONTEXT_ID      - used in Unique Design View */
+  /* CONTEXT_ID      - used in Key Design View */
+  /* CONTEXT_ID      - used in Key Ref Design View */
+  public static final String XSDE_UNIQUE_BASE_SELECTOR_GROUP = PLUGIN_NAME + ".xsde2810";
+  /* CONTEXT_ID xsde2820 for Selector Multi-line Edit - used generically */
+  /* CONTEXT_ID      - used in Unique Design View */
+  /* CONTEXT_ID      - used in Key Design View */
+  /* CONTEXT_ID      - used in Key Ref Design View */
+  public static final String XSDE_UNIQUE_BASE_SELECTOR       = PLUGIN_NAME + ".xsde2820";
+  /* CONTEXT_ID xsde2830 for Fields Group - used generically */
+  /* CONTEXT_ID      - used in Unique Design View */
+  /* CONTEXT_ID      - used in Key Design View */
+  /* CONTEXT_ID      - used in Key Ref Design View */
+  public static final String XSDE_UNIQUE_BASE_FIELDS_GROUP   = PLUGIN_NAME + ".xsde2830";
+  /* CONTEXT_ID xsde2840 for Source Text Edit - used generically */
+  /* CONTEXT_ID      - used in Unique Design View */
+  /* CONTEXT_ID      - used in Key Design View */
+  /* CONTEXT_ID      - used in Key Ref Design View */
+  public static final String XSDE_UNIQUE_BASE_SOURCE         = PLUGIN_NAME + ".xsde2840";
+  /* CONTEXT_ID xsde2850 for Add Push Button - used generically */
+  /* CONTEXT_ID      - used in Unique Design View */
+  /* CONTEXT_ID      - used in Key Design View */
+  /* CONTEXT_ID      - used in Key Ref Design View */
+  public static final String XSDE_UNIQUE_BASE_ADD            = PLUGIN_NAME + ".xsde2850";
+  /* CONTEXT_ID xsde2860 for Remove Push Button - used generically */
+  /* CONTEXT_ID      - used in Unique Design View */
+  /* CONTEXT_ID      - used in Key Design View */
+  /* CONTEXT_ID      - used in Key Ref Design View */
+  public static final String XSDE_UNIQUE_BASE_REMOVE         = PLUGIN_NAME + ".xsde2860";
+  /* CONTEXT_ID xsde2870 for Target List Box - used generically */
+  /* CONTEXT_ID      - used in Unique Design View */
+  /* CONTEXT_ID      - used in Key Design View */
+  /* CONTEXT_ID      - used in Key Ref Design View */
+  public static final String XSDE_UNIQUE_BASE_TARGET         = PLUGIN_NAME + ".xsde2870";
+
+  /* CONTEXT_ID xsde2900 for Key Design View */
+  public static final String XSDE_KEY_DESIGN_VIEW = PLUGIN_NAME + ".xsde2900";
+  /* CONTEXT_ID Name Text Edit is from Unique Base xsde2800 */
+  /* CONTEXT_ID Selector Group is from Unique Base xsde2810 */
+  /* CONTEXT_ID Selector Mulit-line Edit is from Unique Base xsde2820 */
+  /* CONTEXT_ID Fields Group is from Unique Base xsde2830 */
+  /* CONTEXT_ID Source Text Edit is from Unique Base xsde2840 */
+  /* CONTEXT_ID Add Push Button is from Unique Base xsde2850 */
+  /* CONTEXT_ID Remove Push Button is from Unique Base xsde2860 */
+  /* CONTEXT_ID Target List Box is from Unique Base xsde2870 */
+  /* CONTEXT_ID xsde2900 for Key Design View */
+  
+  /* CONTEXT_ID xsde2950 for Key Ref Design View */
+  public static final String XSDE_KEY_REF_DESIGN_VIEW = PLUGIN_NAME + ".xsde2950";
+  /* CONTEXT_ID Name Text Edit is from Unique Base xsde2800 */
+  /* CONTEXT_ID xsde2960 for Reference Key Combo Box */
+  public static final String XSDE_KEY_REF_REFERENCE = PLUGIN_NAME + ".xsde2960";
+  /* CONTEXT_ID Selector Group is from Unique Base xsde2810 */
+  /* CONTEXT_ID Selector Mulit-line Edit is from Unique Base xsde2820 */
+  /* CONTEXT_ID Fields Group is from Unique Base xsde2830 */
+  /* CONTEXT_ID Source Text Edit is from Unique Base xsde2840 */
+  /* CONTEXT_ID Add Push Button is from Unique Base xsde2850 */
+  /* CONTEXT_ID Remove Push Button is from Unique Base xsde2860 */
+  /* CONTEXT_ID Target List Box is from Unique Base xsde2870 */
+
+  /* CONTEXT_ID xsde3000 for Any Element Design View */
+  public static final String XSDE_ANY_ELEMENT_VIEW = PLUGIN_NAME + ".xsde3000";
+  /* CONTEXT_ID xsde3010 for Namespace Text Edit */
+  public static final String XSDE_ANY_ELEMENT_NAMESPACE = PLUGIN_NAME + ".xsde3010";
+  /* CONTEXT_ID xsde3020 for Process Contents Combo Box */
+  public static final String XSDE_ANY_ELEMENT_PROCESS   = PLUGIN_NAME + ".xsde3020";
+  /* CONTEXT_ID xsde3030 for Minimum Text Edit */
+  public static final String XSDE_ANY_ELEMENT_MINIMUM   = PLUGIN_NAME + ".xsde3030";
+  /* CONTEXT_ID xsde3040 for Maximum Text Edit */
+  public static final String XSDE_ANY_ELEMENT_MAXIMUM   = PLUGIN_NAME + ".xsde3040";
+
+  /* CONTEXT_ID xsde3100 for Any Attribute Design View */
+  public static final String XSDE_ANY_ATTRIBUTE_VIEW = PLUGIN_NAME + ".xsde3100";
+  /* CONTEXT_ID xsde3110 for Namespace Text Edit */
+  public static final String XSDE_ANY_ATTRIBUTE_NAMESPACE = PLUGIN_NAME + ".xsde3110";
+  /* CONTEXT_ID xsde3120 for Process Contents Combo Box */
+  public static final String XSDE_ANY_ATTRIBUTE_PROCESS   = PLUGIN_NAME + ".xsde3120";
+
+  /* no CONTEXT_ID for Union Design View - uses a generic interface */
+  /* CONTEXT_ID Type Information Group is from Type Helper xsde0900 */
+  /* CONTEXT_ID Built-in simple type Radio Button is from Type Helper xsde0920 */
+  /* CONTEXT_ID User-defined simple type Radio Button is from Type Helper xsde0930 */
+  /* CONTEXT_ID Type information Combo Box is from Type Helper xsde0950 */
+
+  /* CONTEXT_ID xsde3200 for Notation Design View */
+  public static final String XSDE_NOTATION_VIEW = PLUGIN_NAME + ".xsde3200";
+
+  /* CONTEXT_ID xsde4000 for Source View */
+  public static final String XSDE_SOURCE_VIEW = PLUGIN_NAME + ".xsde4000";
+
+  /* CONTEXT_IDs for Regular Expression Wizard follow the xsdrxxx context IDs */
+  
+  /* CONTEXT_ID xsdr0010 for Compose Regular Expression Page */
+  public static final String XSDR_COMPOSITION_PAGE         = PLUGIN_NAME + ".xsdr0010";
+  /* CONTEXT_ID xsdr0015 for Token Contents Combo Box */
+  public static final String XSDR_COMPOSITION_TOKEN = PLUGIN_NAME + ".xsdr0015";
+  /* CONTEXT_ID xsdr0020 for Occurrece Group */
+  public static final String XSDR_COMPOSITION_OCCURRENCE_GROUP = PLUGIN_NAME + ".xsdr0020";
+  /* CONTEXT_ID xsdr0030 for Just once Radio Button */
+  public static final String XSDR_COMPOSITION_JUST_ONCE    = PLUGIN_NAME + ".xsdr0030";
+  /* CONTEXT_ID xsdr0040 for Zero or more Radio Button */
+  public static final String XSDR_COMPOSITION_ZERO_OR_MORE = PLUGIN_NAME + ".xsdr0040";
+  /* CONTEXT_ID xsdr0050 for One or more Radio Button */
+  public static final String XSDR_COMPOSITION_ONE_OR_MORE  = PLUGIN_NAME + ".xsdr0050";
+  /* CONTEXT_ID xsdr0060 for Optional Radio Button */
+  public static final String XSDR_COMPOSITION_OPTIONAL     = PLUGIN_NAME + ".xsdr0060";
+  /* CONTEXT_ID xsdr0070 for Repeat Radio Button */
+  public static final String XSDR_COMPOSITION_REPEAT       = PLUGIN_NAME + ".xsdr0070";
+  /* CONTEXT_ID xsdr0080 for Range Radio Button */
+  public static final String XSDR_COMPOSITION_RANGE        = PLUGIN_NAME + ".xsdr0080";
+  /* CONTEXT_ID xsdr0090 for Repeat Text Edit */
+  public static final String XSDR_COMPOSITION_REPEAT_TEXT  = PLUGIN_NAME + ".xsdr0090";
+  /* CONTEXT_ID xsdr0100 for Range Minimum Text Edit */
+  public static final String XSDR_COMPOSITION_RANGE_MIN    = PLUGIN_NAME + ".xsdr0100";
+  /* CONTEXT_ID xsdr0110 for Range Maximum Text Edit */
+  public static final String XSDR_COMPOSITION_RANGE_MAX    = PLUGIN_NAME + ".xsdr0110";
+  /* CONTEXT_ID xsdr0120 for Add Push Button */
+  public static final String XSDR_COMPOSITION_ADD          = PLUGIN_NAME + ".xsdr0120";
+  /* CONTEXT_ID xsdr0130 for Current Regular Expression Text Edit */
+  public static final String XSDR_COMPOSITION_CURRENT      = PLUGIN_NAME + ".xsdr0130";
+
+  /* CONTEXT_ID xsdr0200 for Test Regular Expression Page */
+  public static final String XSDR_TEST_PAGE   = PLUGIN_NAME + ".xsdr0200";
+  /* no CONTEXT_ID for Regular Expression Text Edit (not editable) */
+  /* CONTEXT_ID xsdr0210 for Sample Text Text Edit */
+  public static final String XSDR_TEST_SAMPLE = PLUGIN_NAME + ".xsdr0210";
+
+  /* CONTEXT_IDs for Preferences Page follows the xsdpxxx context IDs */
+  
+  /* CONTEXT_ID xsdp0010 for XML Schema Preferences Page */
+  public static final String XSDP_PREFERENCE_PAGE = PLUGIN_NAME + ".xsdp0010";
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/XSDEditorExtensionProperties.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/XSDEditorExtensionProperties.java
new file mode 100644
index 0000000..f0464ea
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/XSDEditorExtensionProperties.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor;
+
+import java.util.List;
+
+import org.eclipse.gef.EditPartFactory;
+import org.eclipse.wst.xsd.editor.internal.adapters.XSDAdapterFactory;
+import org.eclipse.wst.xsd.editor.internal.design.figures.IExtendedFigureFactory;
+
+public class XSDEditorExtensionProperties
+{
+  XSDAdapterFactory adapterFactory;
+  IExtendedFigureFactory figureFactory;
+  EditPartFactory editPartFactory;
+  List actionList;
+
+  public XSDEditorExtensionProperties()
+  {
+
+  }
+
+  public void setActionList(List actionList)
+  {
+    this.actionList = actionList;
+  }
+
+  public void setAdapterFactory(XSDAdapterFactory adapterFactory)
+  {
+    this.adapterFactory = adapterFactory;
+  }
+
+  public void setEditPartFactoryList(EditPartFactory editPartFactory)
+  {
+    this.editPartFactory = editPartFactory;
+  }
+
+  public void setFigureFactoryList(IExtendedFigureFactory figureFactory)
+  {
+    this.figureFactory = figureFactory;
+  }
+
+  public List getActionList()
+  {
+    return actionList;
+  }
+
+  public XSDAdapterFactory getAdapterFactory()
+  {
+    return adapterFactory;
+  }
+
+  public EditPartFactory getEditPartFactory()
+  {
+    return editPartFactory;
+  }
+
+  public IExtendedFigureFactory getFigureFactory()
+  {
+    return figureFactory;
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/XSDEditorPlugin.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/XSDEditorPlugin.java
new file mode 100644
index 0000000..25580d1
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/XSDEditorPlugin.java
@@ -0,0 +1,272 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor;
+
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.plugin.*;
+import org.eclipse.wst.xsd.ui.common.properties.sections.appinfo.ApplicationInformationPropertiesRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.osgi.framework.BundleContext;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.text.MessageFormat;
+import java.util.*;
+
+public class XSDEditorPlugin extends AbstractUIPlugin
+{
+  public static final String PLUGIN_ID = "org.eclipse.wst.xsd.ui";
+  public static final String CONST_XSD_DEFAULT_PREFIX_TEXT = "org.eclipse.wst.xmlschema.xsdDefaultPrefixText";
+  public static final String CONST_PREFERED_BUILT_IN_TYPES = "org.eclipse.wst.xmlschema.preferedBuiltInTypes"; 
+  public static final String CUSTOM_LIST_SEPARATOR = "\n";
+  public static final String APPINFO_EXTENSIONID = "org.eclipse.wst.xsd.ui.ApplicationInformationDescription";
+  public final static String DEFAULT_TARGET_NAMESPACE = "http://www.example.org";
+  
+	//The shared instance.
+	private static XSDEditorPlugin plugin;
+	//Resource bundle.
+	private ResourceBundle resourceBundle;
+  private ApplicationInformationPropertiesRegistry registry;
+  private XSDEditorConfiguration xsdEditorConfiguration = null;
+  
+  public static final String CONST_USE_SIMPLE_EDIT_MODE = PLUGIN_ID + ".useSimpleEditMode";
+  public static final String CONST_SHOW_INHERITED_CONTENT = PLUGIN_ID + ".showInheritedContent";
+
+  public static final String CONST_XSD_LANGUAGE_QUALIFY = "org.eclipse.wst.xmlschema.xsdQualify";
+  public static final String CONST_DEFAULT_TARGET_NAMESPACE = "org.eclipse.wst.xmlschema.defaultTargetnamespaceText";
+	/**
+	 * The constructor.
+	 */
+	public XSDEditorPlugin() {
+		super();
+		plugin = this;
+	}
+
+	/**
+	 * This method is called upon plug-in activation
+	 */
+	public void start(BundleContext context) throws Exception {
+		super.start(context);
+	}
+
+	/**
+	 * This method is called when the plug-in is stopped
+	 */
+	public void stop(BundleContext context) throws Exception {
+		super.stop(context);
+		plugin = null;
+		resourceBundle = null;
+	}
+
+	/**
+	 * Returns the shared instance.
+	 */
+	public static XSDEditorPlugin getDefault() {
+		return plugin;
+	}
+
+	/**
+	 * Returns the string from the plugin's resource bundle,
+	 * or 'key' if not found.
+	 */
+	public static String getResourceString(String key) {
+		ResourceBundle bundle = XSDEditorPlugin.getDefault().getResourceBundle();
+		try {
+			return (bundle != null) ? bundle.getString(key) : key;
+		} catch (MissingResourceException e) {
+			return key;
+		}
+	}
+  
+  public static String getResourceString(String key, Object o)
+  {
+      return getResourceString(key, new Object[] { o});
+  }
+
+  public static String getResourceString(String key, Object[] objects)
+  {
+      return MessageFormat.format(getResourceString(key), objects);
+  }
+	
+  public static String getResourceString(String key, Object o1, Object o2)
+  {
+      return getResourceString(key, new Object[] { o1, o2});
+  }
+
+	/**
+	 * Returns the plugin's resource bundle,
+	 */
+	public ResourceBundle getResourceBundle() {
+		try {
+			if (resourceBundle == null)
+				// resourceBundle = ResourceBundle.getBundle("org.eclipse.wst.xsd.editor.EditorPluginResources");
+        resourceBundle = Platform.getResourceBundle(getBundle());
+		} catch (MissingResourceException x) {
+			resourceBundle = null;
+		}
+		return resourceBundle;
+	}
+
+	/**
+	 * Returns an image descriptor for the image file at the given
+	 * plug-in relative path.
+	 *
+	 * @param path the path
+	 * @return the image descriptor
+	 */
+	public static ImageDescriptor getImageDescriptor(String path) {
+		return AbstractUIPlugin.imageDescriptorFromPlugin("org.eclipse.wst.xsd.ui", path);
+	}
+	
+	public static ImageDescriptor getImageDescriptor(String name, boolean getBaseURL) {
+		try {
+			URL installURL = getDefault().getBundle().getEntry("/"); //$NON-NLS-1$
+			String imageString = getBaseURL ? "icons/" + name : name;
+
+			URL imageURL = new URL(installURL, imageString);
+			return ImageDescriptor.createFromURL(imageURL);
+		} catch (MalformedURLException e) {
+			return null;
+		}
+	}
+
+	
+	public static XSDEditorPlugin getPlugin() {
+		return plugin;
+	}
+
+	public static String getXSDString(String key) {
+		return getResourceString(key);
+	}
+
+  /**
+   * This gets the string resource and does one substitution.
+   */
+  public String getString(String key, Object s1) {
+    return MessageFormat.format(Platform.getResourceBundle(getBundle()).getString(key), new Object[]{s1});
+  }
+  
+	public static Image getXSDImage(String iconName) {
+		return getDefault().getImage("internal/" + iconName);
+	}
+
+	public Image getImage(String iconName) {
+		ImageRegistry imageRegistry = getImageRegistry();
+
+		if (imageRegistry.get(iconName) != null) {
+			return imageRegistry.get(iconName);
+		}
+		else {
+			imageRegistry.put(iconName, ImageDescriptor.createFromFile(getClass(), iconName));
+			return imageRegistry.get(iconName);
+		}
+	}
+	
+	public URL getBaseURL() {
+		return getDescriptor().getInstallURL();
+	}
+
+	public Image getIconImage(String object) {
+		try {
+			return ExtendedImageRegistry.getInstance().getImage(new URL(getBaseURL() + "icons/" + object + ".gif"));
+		}
+		catch (MalformedURLException exception) {
+			System.out.println("Failed to load image for '" + object + "'");
+		}
+		return null;
+	}
+
+  public boolean getShowInheritedContent()
+  {
+    return getPreferenceStore().getBoolean(CONST_SHOW_INHERITED_CONTENT);
+  }
+  
+  protected void initializeDefaultPreferences(IPreferenceStore store)
+  {
+    store.setDefault(CONST_SHOW_INHERITED_CONTENT, false);
+    store.setDefault(CONST_XSD_DEFAULT_PREFIX_TEXT, "xsd");
+    
+    //Even the last item in the list must contain a trailing List separator
+    store.setDefault(CONST_PREFERED_BUILT_IN_TYPES,     		
+    		"boolean"+ CUSTOM_LIST_SEPARATOR +
+    		"date" + CUSTOM_LIST_SEPARATOR +
+    		"dateTime" + CUSTOM_LIST_SEPARATOR +
+    		"double" + CUSTOM_LIST_SEPARATOR +
+    		"float" + CUSTOM_LIST_SEPARATOR +
+    		"hexBinary" + CUSTOM_LIST_SEPARATOR +
+    		"int" + CUSTOM_LIST_SEPARATOR +
+    		"string" + CUSTOM_LIST_SEPARATOR +
+    		"time" + CUSTOM_LIST_SEPARATOR);
+  }
+
+  public ApplicationInformationPropertiesRegistry getApplicationInformationPropertiesRegistry()
+  {
+    if (registry == null)
+    {
+      registry = new ApplicationInformationPropertiesRegistry(APPINFO_EXTENSIONID);
+    }
+    return registry;
+  }
+
+  public XSDEditorConfiguration getXSDEditorConfiguration()
+  {
+    if (xsdEditorConfiguration == null)
+    {
+      xsdEditorConfiguration = new XSDEditorConfiguration();
+    }
+    return xsdEditorConfiguration;
+  }
+
+  /**
+   * Get the xml schema default namespace prefix
+   */
+  public String getXMLSchemaPrefix()
+  {
+    return getPreferenceStore().getString(CONST_XSD_DEFAULT_PREFIX_TEXT);
+  }
+
+  
+  
+  
+  
+  
+  
+  
+  
+
+  /**
+   * Get the xml schema default target namespace
+   */
+  public String getXMLSchemaTargetNamespace() {
+    String targetNamespace = getPreferenceStore().getString(CONST_DEFAULT_TARGET_NAMESPACE);
+    if (!targetNamespace.endsWith("/")) {
+      targetNamespace = targetNamespace + "/";
+    }
+    return targetNamespace;
+  }
+
+  /**
+   * Get the xml schema language qualification
+   */
+  public boolean isQualifyXMLSchemaLanguage() {
+    return getPreferenceStore().getBoolean(CONST_XSD_LANGUAGE_QUALIFY);
+  }
+
+  public static Shell getShell() {
+    return getPlugin().getWorkbench().getActiveWorkbenchWindow().getShell();
+  }
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/XSDElementReferenceEditManager.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/XSDElementReferenceEditManager.java
new file mode 100644
index 0000000..105f206
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/XSDElementReferenceEditManager.java
@@ -0,0 +1,117 @@
+package org.eclipse.wst.xsd.editor;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification;
+import org.eclipse.wst.common.ui.internal.search.dialogs.IComponentDescriptionProvider;
+import org.eclipse.wst.xsd.adt.edit.ComponentReferenceEditManager;
+import org.eclipse.wst.xsd.adt.edit.IComponentDialog;
+import org.eclipse.wst.xsd.editor.internal.search.XSDSearchListDialogDelegate;
+import org.eclipse.wst.xsd.ui.common.commands.AddXSDElementCommand;
+import org.eclipse.wst.xsd.ui.common.commands.UpdateElementReferenceAndManageDirectivesCommand;
+import org.eclipse.wst.xsd.ui.common.commands.UpdateElementReferenceCommand;
+import org.eclipse.wst.xsd.ui.internal.search.IXSDSearchConstants;
+import org.eclipse.xsd.XSDConcreteComponent;
+import org.eclipse.xsd.XSDElementDeclaration;
+import org.eclipse.xsd.XSDSchema;
+
+public class XSDElementReferenceEditManager implements ComponentReferenceEditManager
+{  
+  protected IFile currentFile;
+  protected XSDSchema[] schemas;
+  
+  public XSDElementReferenceEditManager(IFile currentFile, XSDSchema[] schemas)
+  {
+    this.currentFile = currentFile;
+    this.schemas = schemas;
+  }
+  
+  public void addToHistory(ComponentSpecification component)
+  {
+    // TODO (cs) implement me!    
+  }
+
+  public IComponentDialog getBrowseDialog()
+  {
+    //XSDSetExistingTypeDialog dialog = new XSDSetExistingTypeDialog(currentFile, schemas);
+    //return dialog;
+    XSDSearchListDialogDelegate dialogDelegate = 
+    	new XSDSearchListDialogDelegate(XSDSearchListDialogDelegate.ELEMENT_META_NAME, currentFile, schemas);
+    return dialogDelegate;
+  }
+
+  public IComponentDescriptionProvider getComponentDescriptionProvider()
+  {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  public ComponentSpecification[] getHistory()
+  {
+    // TODO (cs) implement this properly - should this history be global or local to each editor?
+    // This is something we should play around with ourselves to see what feels right.
+    //
+    List list = new ArrayList();
+    ComponentSpecification result[] = new ComponentSpecification[list.size()];
+    list.toArray(result);
+    return result;
+  }
+
+  public IComponentDialog getNewDialog()
+  {
+    return null;
+  }
+
+  public ComponentSpecification[] getQuickPicks()
+  {
+    // TODO (cs) implement this properly - we should be providing a list of the 
+    // most 'common' built in schema types here
+    // I believe Trung will be working on a perference page to give us this list
+    // for now let's hard code some values
+    //
+    List list = new ArrayList();
+    
+    ComponentSpecification result[] = new ComponentSpecification[list.size()];
+    list.toArray(result);
+    return result;
+  }
+  
+//TODO not changed yet
+  public void modifyComponentReference(Object referencingObject, ComponentSpecification component)
+  {    
+    if (referencingObject instanceof Adapter)
+    {
+      Adapter adapter = (Adapter)referencingObject;
+      if (adapter.getTarget() instanceof XSDConcreteComponent)
+      {
+        XSDElementDeclaration concreteComponent = (XSDElementDeclaration)adapter.getTarget();
+        if (component.isNew())
+        {  
+          XSDElementDeclaration elementDec = null;
+          if (component.getMetaName() == IXSDSearchConstants.ELEMENT_META_NAME)
+          {  
+            AddXSDElementCommand command = new AddXSDElementCommand("Add Element", concreteComponent.getSchema());
+            command.setNameToAdd(component.getName());
+            command.execute();
+            elementDec = (XSDElementDeclaration) command.getAddedComponent();
+          }
+          if (elementDec != null && elementDec instanceof XSDElementDeclaration)
+          {
+            Command command = new UpdateElementReferenceCommand("Update Element reference",
+            		concreteComponent, elementDec);
+            command.execute();
+          }  
+        }  
+        else
+        {
+          Command command = new UpdateElementReferenceAndManageDirectivesCommand(concreteComponent, component.getName(), component.getQualifier(), component.getFile());
+          command.execute();
+        }  
+      }
+    }
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/XSDFileEditorInput.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/XSDFileEditorInput.java
new file mode 100644
index 0000000..7c8ee0a
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/XSDFileEditorInput.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.xsd.XSDSchema;
+
+public class XSDFileEditorInput extends FileEditorInput
+{
+  private IFile file;
+  private XSDSchema schema;
+  private String editorName;
+
+  public XSDFileEditorInput(IFile file, XSDSchema schema) {
+    super(file);
+    if (file == null) {
+      throw new IllegalArgumentException();
+    }
+    this.file = file;
+    this.schema = schema;
+    editorName = file.getName();
+  }
+
+  public IFile getFile()
+  {
+    return file;
+  }
+
+  public XSDSchema getSchema()
+  {
+    return schema;
+  }
+
+  public void setEditorName(String name)
+  {
+    editorName = name;
+  }
+ 
+  public String getName()
+  {
+    if (editorName != null)
+    {
+      return editorName;
+    }
+    return super.getName();
+  }
+  
+  public String getToolTipText()
+  {
+    if (schema != null)
+    {
+      String ns = schema.getTargetNamespace();
+      if (ns != null && ns.length() > 0)
+        return "Target Namespace: " + ns;
+      else
+        return "No Namespace";
+    }
+    return super.getToolTipText();
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/XSDMultiPageEditorContributor.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/XSDMultiPageEditorContributor.java
new file mode 100644
index 0000000..6eeaa05
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/XSDMultiPageEditorContributor.java
@@ -0,0 +1,157 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.gef.editparts.ZoomManager;
+import org.eclipse.gef.ui.actions.ActionRegistry;
+import org.eclipse.gef.ui.actions.ZoomComboContributionItem;
+import org.eclipse.gef.ui.actions.ZoomInRetargetAction;
+import org.eclipse.gef.ui.actions.ZoomOutRetargetAction;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.ide.IDEActionFactory;
+import org.eclipse.ui.part.MultiPageEditorActionBarContributor;
+import org.eclipse.ui.part.MultiPageEditorPart;
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.eclipse.ui.texteditor.ITextEditorActionConstants;
+import org.eclipse.wst.xsd.editor.internal.actions.IXSDToolbarAction;
+
+/**
+ * Manages the installation/deinstallation of global actions for multi-page
+ * editors. Responsible for the redirection of global actions to the active
+ * editor. Multi-page contributor replaces the contributors for the individual
+ * editors in the multi-page editor.
+ */
+public class XSDMultiPageEditorContributor extends MultiPageEditorActionBarContributor
+{
+  private IEditorPart activeEditorPart;
+
+  /**
+   * Creates a multi-page contributor.
+   */
+  public XSDMultiPageEditorContributor()
+  {
+    super();
+  }
+
+  /**
+   * Returns the action registed with the given text editor.
+   * 
+   * @return IAction or null if editor is null.
+   */
+  protected IAction getAction(ITextEditor editor, String actionID)
+  {
+    return (editor == null ? null : editor.getAction(actionID));
+  }
+
+  /*
+   * (non-JavaDoc) Method declared in
+   * AbstractMultiPageEditorActionBarContributor.
+   */
+
+  public void setActivePage(IEditorPart part)
+  {
+    if (activeEditorPart == part)
+      return;
+
+    activeEditorPart = part;
+
+    IActionBars actionBars = getActionBars();
+
+    if (part != null)
+    {
+      Object adapter = part.getAdapter(ActionRegistry.class);
+      if (adapter instanceof ActionRegistry)
+      {
+        ActionRegistry registry = (ActionRegistry) adapter;
+        actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(), registry.getAction(ActionFactory.UNDO.getId()));
+        actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(), registry.getAction(ActionFactory.REDO.getId()));
+        actionBars.updateActionBars();
+      }
+    }
+
+    if (actionBars != null)
+    {
+
+      ITextEditor editor = (part instanceof ITextEditor) ? (ITextEditor) part : null;
+
+      actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), getAction(editor, ITextEditorActionConstants.DELETE));
+      actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(), getAction(editor, ITextEditorActionConstants.UNDO));
+      actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(), getAction(editor, ITextEditorActionConstants.REDO));
+      actionBars.setGlobalActionHandler(ActionFactory.CUT.getId(), getAction(editor, ITextEditorActionConstants.CUT));
+      actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), getAction(editor, ITextEditorActionConstants.COPY));
+      actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(), getAction(editor, ITextEditorActionConstants.PASTE));
+      actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), getAction(editor, ITextEditorActionConstants.SELECT_ALL));
+      actionBars.setGlobalActionHandler(ActionFactory.FIND.getId(), getAction(editor, ITextEditorActionConstants.FIND));
+      actionBars.setGlobalActionHandler(IDEActionFactory.BOOKMARK.getId(), getAction(editor, IDEActionFactory.BOOKMARK.getId()));
+
+      actionBars.updateActionBars();
+    }
+  }
+
+  public void setActiveEditor(IEditorPart part)
+  {
+    IEditorPart activeNestedEditor = null;
+    if (part instanceof MultiPageEditorPart)
+    {
+      activeNestedEditor = ((MultiPageEditorPart) part);
+    }
+    setActivePage(activeNestedEditor);
+    List list = XSDEditorPlugin.getPlugin().getXSDEditorConfiguration().getToolbarActions();
+    for (Iterator i = list.iterator(); i.hasNext(); )
+    {
+      ((IXSDToolbarAction)i.next()).setEditorPart(activeNestedEditor);
+    }
+  }
+
+  public void contributeToMenu(IMenuManager manager)
+  {
+    IMenuManager menu = new MenuManager("&XSD Editor");
+    manager.prependToGroup(IWorkbenchActionConstants.MB_ADDITIONS, menu);
+
+    // Add extension menu actions
+    List list = XSDEditorPlugin.getPlugin().getXSDEditorConfiguration().getToolbarActions();
+    for (Iterator i = list.iterator(); i.hasNext(); )
+    {
+      menu.add((IXSDToolbarAction)i.next());
+    }
+
+    menu.add((new ZoomInRetargetAction()));
+    menu.add((new ZoomOutRetargetAction()));
+
+    menu.updateAll(true);
+  }
+
+  public void contributeToToolBar(IToolBarManager manager)
+  {
+    manager.add(new Separator());
+    // Add extension toolbar actions
+    List list = XSDEditorPlugin.getPlugin().getXSDEditorConfiguration().getToolbarActions();
+    for (Iterator i = list.iterator(); i.hasNext(); )
+    {
+      manager.add((IXSDToolbarAction)i.next());
+    }
+
+    manager.add(new Separator());
+    String[] zoomStrings = new String[] { ZoomManager.FIT_ALL, ZoomManager.FIT_HEIGHT, ZoomManager.FIT_WIDTH };
+    manager.add(new ZoomComboContributionItem(getPage(), zoomStrings));
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/XSDSelectionMapper.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/XSDSelectionMapper.java
new file mode 100644
index 0000000..792e0e4
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/XSDSelectionMapper.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+
+public class XSDSelectionMapper implements ISelectionMapper
+{
+  public ISelection mapSelection(ISelection selection)
+  {
+    List list = new ArrayList();
+    if (selection instanceof StructuredSelection)
+    {  
+      StructuredSelection structuredSelection = (StructuredSelection)selection;
+      for (Iterator i = structuredSelection.iterator(); i.hasNext(); )
+      {
+        Object o = i.next();
+        if (o instanceof Adapter)
+        {
+          list.add(((Adapter)o).getTarget());
+        }  
+        else
+        {
+          list.add(o);
+        }  
+      }  
+    }
+    return new StructuredSelection(list);
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/XSDTabbedPropertySheetPage.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/XSDTabbedPropertySheetPage.java
new file mode 100644
index 0000000..d7a4f55
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/XSDTabbedPropertySheetPage.java
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
+import org.eclipse.wst.xsd.adt.facade.IADTObjectListener;
+import org.eclipse.wst.xsd.editor.internal.adapters.XSDAdapterFactory;
+import org.eclipse.wst.xsd.editor.internal.adapters.XSDBaseAdapter;
+import org.eclipse.wst.xsd.editor.internal.adapters.XSDElementDeclarationAdapter;
+import org.eclipse.wst.xsd.editor.internal.adapters.XSDParticleAdapter;
+import org.eclipse.xsd.XSDConcreteComponent;
+import org.eclipse.xsd.XSDElementDeclaration;
+
+public class XSDTabbedPropertySheetPage extends TabbedPropertySheetPage implements IADTObjectListener
+{
+  XSDBaseAdapter oldSelection;
+  public XSDTabbedPropertySheetPage(ITabbedPropertySheetPageContributor tabbedPropertySheetPageContributor)
+  {
+    super(tabbedPropertySheetPageContributor);
+  }
+  
+  /* (non-Javadoc)
+   * @see org.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
+   */
+  public void selectionChanged(IWorkbenchPart part, ISelection selection) {
+
+      Object selected = ((StructuredSelection)selection).getFirstElement();
+      System.out.println(selected);
+      if (selected instanceof XSDBaseAdapter)
+      {
+        XSDBaseAdapter adapter = (XSDBaseAdapter)selected;
+        if (oldSelection != null)
+        {
+          oldSelection.unregisterListener(this);
+          if (oldSelection instanceof XSDElementDeclarationAdapter)
+          {
+            XSDElementDeclaration elem = (XSDElementDeclaration)((XSDElementDeclarationAdapter)oldSelection).getTarget();
+            Adapter adap = XSDAdapterFactory.getInstance().adapt(elem.getContainer());
+            if (adap instanceof XSDParticleAdapter)
+            {
+              XSDParticleAdapter particleAdapter = (XSDParticleAdapter)adap;
+              particleAdapter.unregisterListener(this);
+            }
+          }
+        }
+        if (adapter instanceof XSDElementDeclarationAdapter)
+        {
+          XSDElementDeclaration elem = (XSDElementDeclaration)((XSDElementDeclarationAdapter)adapter).getTarget();
+          Adapter adap = XSDAdapterFactory.getInstance().adapt(elem.getContainer());
+          if (adap instanceof XSDParticleAdapter)
+          {
+            XSDParticleAdapter particleAdapter = (XSDParticleAdapter)adap;
+            particleAdapter.registerListener(this);
+          }
+          if (elem.isElementDeclarationReference())
+          {
+            XSDElementDeclarationAdapter resolvedElementAdapter = (XSDElementDeclarationAdapter)XSDAdapterFactory.getInstance().adapt(elem.getResolvedElementDeclaration());
+            resolvedElementAdapter.registerListener(this);
+          }
+        }
+        adapter.registerListener(this);
+        oldSelection = adapter;
+        Object model = adapter.getTarget();
+        if (model instanceof XSDConcreteComponent)
+        {
+          selection = new StructuredSelection((XSDConcreteComponent)model);
+        }
+        super.selectionChanged(part, selection);
+        return;
+      }
+      super.selectionChanged(part, selection);
+  }
+  
+  public void propertyChanged(Object object, String property)
+  {
+    if (getCurrentTab() != null)
+    {
+      refresh();
+    }
+  }
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/XSDTypeReferenceEditManager.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/XSDTypeReferenceEditManager.java
new file mode 100644
index 0000000..f4c4777
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/XSDTypeReferenceEditManager.java
@@ -0,0 +1,151 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification;
+import org.eclipse.wst.common.ui.internal.search.dialogs.IComponentDescriptionProvider;
+import org.eclipse.wst.xsd.adt.edit.ComponentReferenceEditManager;
+import org.eclipse.wst.xsd.adt.edit.IComponentDialog;
+import org.eclipse.wst.xsd.editor.internal.dialogs.NewTypeDialog;
+import org.eclipse.wst.xsd.editor.internal.search.XSDSearchListDialogDelegate;
+import org.eclipse.wst.xsd.ui.common.commands.AddXSDComplexTypeDefinitionCommand;
+import org.eclipse.wst.xsd.ui.common.commands.AddXSDSimpleTypeDefinitionCommand;
+import org.eclipse.wst.xsd.ui.common.commands.UpdateTypeReferenceAndManageDirectivesCommand;
+import org.eclipse.wst.xsd.ui.common.commands.UpdateTypeReferenceCommand;
+import org.eclipse.wst.xsd.ui.internal.search.IXSDSearchConstants;
+import org.eclipse.xsd.XSDConcreteComponent;
+import org.eclipse.xsd.XSDSchema;
+import org.eclipse.xsd.XSDTypeDefinition;
+import org.eclipse.xsd.util.XSDConstants;
+
+public class XSDTypeReferenceEditManager implements ComponentReferenceEditManager
+{  
+  protected IFile currentFile;
+  protected XSDSchema[] schemas;
+  
+  public XSDTypeReferenceEditManager(IFile currentFile, XSDSchema[] schemas)
+  {
+    this.currentFile = currentFile;
+    this.schemas = schemas;
+  }
+  
+  public void addToHistory(ComponentSpecification component)
+  {
+    // TODO (cs) implement me!    
+  }
+
+  public IComponentDialog getBrowseDialog()
+  {
+    //XSDSetExistingTypeDialog dialog = new XSDSetExistingTypeDialog(currentFile, schemas);
+    //return dialog;
+    XSDSearchListDialogDelegate dialogDelegate = new XSDSearchListDialogDelegate(XSDSearchListDialogDelegate.TYPE_META_NAME, currentFile, schemas);
+    return dialogDelegate;
+  }
+
+  public IComponentDescriptionProvider getComponentDescriptionProvider()
+  {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  public ComponentSpecification[] getHistory()
+  {
+    // TODO (cs) implement this properly - should this history be global or local to each editor?
+    // This is something we should play around with ourselves to see what feels right.
+    //
+    List list = new ArrayList();
+    ComponentSpecification result[] = new ComponentSpecification[list.size()];
+    list.toArray(result);
+    return result;
+  }
+
+  public IComponentDialog getNewDialog()
+  {
+    return new NewTypeDialog();
+  }
+
+  public ComponentSpecification[] getQuickPicks()
+  {
+    // TODO (cs) implement this properly - we should be providing a list of the 
+    // most 'common' built in schema types here
+    // I believe Trung will be working on a perference page to give us this list
+    // for now let's hard code some values
+    //
+    List list = new ArrayList();
+    list.add(new ComponentSpecification(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, "boolean", null));
+    list.add(new ComponentSpecification(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, "date", null));
+    list.add(new ComponentSpecification(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, "dateTime", null));    
+    list.add(new ComponentSpecification(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, "double", null));
+    list.add(new ComponentSpecification(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, "float", null)); 
+    list.add(new ComponentSpecification(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, "hexBinary", null));
+    list.add(new ComponentSpecification(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, "int", null));    
+    list.add(new ComponentSpecification(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, "string", null));
+    list.add(new ComponentSpecification(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, "time", null));       
+    ComponentSpecification result[] = new ComponentSpecification[list.size()];
+    list.toArray(result);
+    return result;
+  }
+  
+
+  public void modifyComponentReference(Object referencingObject, ComponentSpecification component)
+  {
+    XSDConcreteComponent concreteComponent = null;
+    if (referencingObject instanceof Adapter)
+    {
+      Adapter adpater = (Adapter)referencingObject;
+      if (adpater.getTarget() instanceof XSDConcreteComponent)
+      {
+        concreteComponent = (XSDConcreteComponent)adpater.getTarget();
+      }
+    }
+    else if (referencingObject instanceof XSDConcreteComponent)
+    {
+      concreteComponent = (XSDConcreteComponent) referencingObject;
+    }
+    
+    if (concreteComponent != null)
+    {
+      if (component.isNew())
+      {  
+        XSDTypeDefinition td = null;
+        if (component.getMetaName() == IXSDSearchConstants.COMPLEX_TYPE_META_NAME)
+        {  
+          AddXSDComplexTypeDefinitionCommand command = new AddXSDComplexTypeDefinitionCommand("Add Complex Type", concreteComponent.getSchema());
+          command.setNameToAdd(component.getName());
+          command.execute();
+          td = command.getCreatedComplexType();
+        }
+        else
+        {
+          AddXSDSimpleTypeDefinitionCommand command = new AddXSDSimpleTypeDefinitionCommand("Add Simple Type", concreteComponent.getSchema());
+          command.setNameToAdd(component.getName());
+          command.execute();
+          td = command.getCreatedSimpleType();
+        }  
+        if (td != null)
+        {
+          Command command = new UpdateTypeReferenceCommand(concreteComponent, td);
+          command.execute();
+        }  
+      }  
+      else
+      {  
+        Command command = new UpdateTypeReferenceAndManageDirectivesCommand(concreteComponent, component.getName(), component.getQualifier(), component.getFile());
+        command.execute();
+      }  
+    }  
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/actions/IXSDToolbarAction.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/actions/IXSDToolbarAction.java
new file mode 100644
index 0000000..d5c6ca8
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/actions/IXSDToolbarAction.java
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.actions;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.ui.IEditorPart;
+
+public interface IXSDToolbarAction extends IAction
+{
+  public void setEditorPart(IEditorPart editorPart);
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/CategoryAdapter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/CategoryAdapter.java
new file mode 100644
index 0000000..6ba89c3
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/CategoryAdapter.java
@@ -0,0 +1,143 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.adapters;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.xsd.adt.design.editparts.model.IActionProvider;
+import org.eclipse.wst.xsd.adt.facade.IADTObjectListener;
+import org.eclipse.wst.xsd.adt.outline.ITreeElement;
+import org.eclipse.wst.xsd.ui.common.actions.AddXSDAttributeDeclarationAction;
+import org.eclipse.wst.xsd.ui.common.actions.AddXSDAttributeGroupDefinitionAction;
+import org.eclipse.wst.xsd.ui.common.actions.AddXSDComplexTypeDefinitionAction;
+import org.eclipse.wst.xsd.ui.common.actions.AddXSDElementAction;
+import org.eclipse.wst.xsd.ui.common.actions.AddXSDModelGroupDefinitionAction;
+import org.eclipse.wst.xsd.ui.common.actions.AddXSDSimpleTypeDefinitionAction;
+import org.eclipse.xsd.XSDSchema;
+
+public class CategoryAdapter extends XSDBaseAdapter implements IActionProvider, IADTObjectListener
+{
+  protected String text;
+  protected Image image;
+  protected Object parent;
+  protected int groupType;
+  Collection children;
+  XSDSchema xsdSchema;
+
+  public CategoryAdapter(String label, Image image, Collection children, XSDSchema xsdSchema, int groupType)
+  {
+    this.text = label;
+    this.image = image;
+    this.parent = xsdSchema;
+    this.xsdSchema = xsdSchema;
+    this.target = xsdSchema;
+    this.children = children;
+    this.groupType = groupType;
+  }
+
+  public final static int ATTRIBUTES = 1;
+  public final static int ELEMENTS = 2;
+  public final static int TYPES = 3;
+  public final static int GROUPS = 5;
+  public final static int DIRECTIVES = 6;
+  public final static int NOTATIONS = 7;
+  public final static int ATTRIBUTE_GROUPS = 8;
+  public final static int IDENTITY_CONSTRAINTS = 9;
+  public final static int ANNOTATIONS = 10;
+
+  public XSDSchema getXSDSchema()
+  {
+    return xsdSchema;
+  }
+
+  public int getGroupType()
+  {
+    return groupType;
+  }
+
+  public Image getImage()
+  {
+    return image;
+  }
+
+  public String getText()
+  {
+    return text;
+  }
+
+  public ITreeElement[] getChildren()
+  {
+    return (ITreeElement[]) children.toArray(new ITreeElement[0]);
+  }
+
+  public void setChildren(Collection list)
+  {
+    children = list;
+  }
+
+  public Object getParent(Object element)
+  {
+    return xsdSchema;
+  }
+
+  public boolean hasChildren(Object element)
+  {
+    return true;
+  }
+
+  public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
+  {
+
+  }
+
+  public String[] getActions(Object object)
+  {    
+    Collection actionIDs = new ArrayList();
+    
+    switch (groupType)
+    {
+      case TYPES : {
+        actionIDs.add(AddXSDComplexTypeDefinitionAction.ID);
+        actionIDs.add(AddXSDSimpleTypeDefinitionAction.ID);
+        break;
+      }
+      case ELEMENTS : {
+        actionIDs.add(AddXSDElementAction.ID);
+        break;
+      }
+      case GROUPS : {
+        actionIDs.add(AddXSDModelGroupDefinitionAction.MODELGROUPDEFINITION_ID);
+        break;
+      }
+      case ATTRIBUTES : {
+        actionIDs.add(AddXSDAttributeDeclarationAction.ID);
+        break;
+      }
+      case ATTRIBUTE_GROUPS : {
+        actionIDs.add(AddXSDAttributeGroupDefinitionAction.ID);
+        break;
+      }
+      case DIRECTIVES : {
+        break;
+      }
+    }
+    return (String [])actionIDs.toArray(new String[0]);
+  }
+  
+  public void propertyChanged(Object object, String property)
+  {
+    if (getText().equals(property))
+      notifyListeners(this, property);
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDAdapterFactory.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDAdapterFactory.java
new file mode 100644
index 0000000..7273e03
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDAdapterFactory.java
@@ -0,0 +1,143 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.adapters;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+import org.eclipse.xsd.XSDAttributeDeclaration;
+import org.eclipse.xsd.XSDAttributeGroupDefinition;
+import org.eclipse.xsd.XSDAttributeUse;
+import org.eclipse.xsd.XSDComplexTypeDefinition;
+import org.eclipse.xsd.XSDElementDeclaration;
+import org.eclipse.xsd.XSDModelGroup;
+import org.eclipse.xsd.XSDModelGroupDefinition;
+import org.eclipse.xsd.XSDParticle;
+import org.eclipse.xsd.XSDSchema;
+import org.eclipse.xsd.XSDSchemaDirective;
+import org.eclipse.xsd.XSDSimpleTypeDefinition;
+import org.eclipse.xsd.XSDWildcard;
+import org.eclipse.xsd.util.XSDSwitch;
+
+public class XSDAdapterFactory extends AdapterFactoryImpl
+{
+  protected static XSDAdapterFactory instance;
+  
+  public static XSDAdapterFactory getInstance()
+  {
+    if (instance == null)
+    {
+      // first use the one defined by the configuration
+      instance = XSDEditorPlugin.getPlugin().getXSDEditorConfiguration().getAdapterFactory();
+      // if there isn't one, then use the default
+      if (instance == null)
+        instance = new XSDAdapterFactory();
+    }
+    return instance;
+  }
+  
+  public Adapter createAdapter(Notifier target)
+  {
+    XSDSwitch xsdSwitch = new XSDSwitch()
+    {
+      public Object caseXSDSchemaDirective(XSDSchemaDirective object)
+      {
+        return new XSDSchemaDirectiveAdapter();
+      }
+      
+      public Object caseXSDWildcard(XSDWildcard object)
+      {
+        return new XSDWildcardAdapter();
+      }
+      
+      public Object caseXSDAttributeGroupDefinition(XSDAttributeGroupDefinition object)
+      {
+        return new XSDAttributeGroupDefinitionAdapter();
+      }
+
+      public Object caseXSDModelGroupDefinition(XSDModelGroupDefinition object)
+      {
+        return new XSDModelGroupDefinitionAdapter();
+      }
+      
+      public Object caseXSDAttributeDeclaration(XSDAttributeDeclaration object)
+      {
+        return new XSDAttributeDeclarationAdapter();
+      }
+
+      public Object caseXSDAttributeUse(XSDAttributeUse object)
+      {
+        return new XSDAttributeUseAdapter();
+      }
+      
+      public Object caseXSDParticle(XSDParticle object)
+      {
+        return new XSDParticleAdapter();
+      }
+
+      public Object caseXSDElementDeclaration(XSDElementDeclaration object)
+      {
+        return new XSDElementDeclarationAdapter();
+      }
+      
+      public Object caseXSDSimpleTypeDefinition(XSDSimpleTypeDefinition object)
+      {
+        // TODO Auto-generated method stub
+        return new XSDSimpleTypeDefinitionAdapter();
+      }
+      
+      public Object caseXSDComplexTypeDefinition(XSDComplexTypeDefinition object)
+      {
+        // we don't like exposing the 'anyType' type as a visible complex type
+        // so we adapt it in a specialized way so that it's treated as simple type
+        // that way it doesn't show up as a reference from a field
+        //
+        if ("anyType".equals(object.getName()))
+        {
+          return new XSDAnyTypeDefinitionAdapter(); 
+        }  
+        else
+        {             
+          return new XSDComplexTypeDefinitionAdapter();
+        }  
+      }
+      
+      public Object caseXSDModelGroup(XSDModelGroup object)
+      {
+        return new XSDModelGroupAdapter();
+      }
+
+      public Object caseXSDSchema(XSDSchema object)
+      {
+        return new XSDSchemaAdapter();
+      }
+    };
+    Object o = xsdSwitch.doSwitch((EObject) target);
+    Adapter result = null;
+    if (o instanceof Adapter)
+    {
+      result = (Adapter) o;
+    }
+    else
+    {
+      System.out.println(target);
+      Thread.dumpStack();
+    }
+    return result;
+  }
+
+  public Adapter adapt(Notifier target)
+  {
+    return adapt(target, this);
+  }
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDAnyTypeDefinitionAdapter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDAnyTypeDefinitionAdapter.java
new file mode 100644
index 0000000..1a07e04
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDAnyTypeDefinitionAdapter.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.adapters;
+
+public class XSDAnyTypeDefinitionAdapter extends XSDTypeDefinitionAdapter
+{
+  public boolean isComplexType()
+  {
+    return false;
+  }
+
+  public boolean isFocusAllowed()
+  {
+    return false;
+  } 
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDAttributeDeclarationAdapter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDAttributeDeclarationAdapter.java
new file mode 100644
index 0000000..5c1333b
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDAttributeDeclarationAdapter.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.adapters;
+
+import org.eclipse.xsd.XSDAttributeDeclaration;
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.wst.xsd.adt.design.editparts.model.IActionProvider;
+import org.eclipse.wst.xsd.adt.facade.IModel;
+import org.eclipse.xsd.XSDSchema;
+
+public class XSDAttributeDeclarationAdapter extends XSDBaseAttributeAdapter implements IActionProvider
+{
+  protected XSDAttributeDeclaration getXSDAttributeDeclaration()
+  {
+    return (XSDAttributeDeclaration)target;
+  }
+ 
+  protected XSDAttributeDeclaration getResolvedXSDAttributeDeclaration()
+  {
+    return getXSDAttributeDeclaration().getResolvedAttributeDeclaration();
+  }
+  
+  public boolean isGlobal()
+  {
+    return getXSDAttributeDeclaration().eContainer() instanceof XSDSchema;
+  }
+
+  public IModel getModel()
+  {
+    Adapter adapter = XSDAdapterFactory.getInstance().adapt(getXSDAttributeDeclaration().getSchema());
+    return (IModel)adapter;
+  }  
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDAttributeGroupDefinitionAdapter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDAttributeGroupDefinitionAdapter.java
new file mode 100644
index 0000000..105af1b
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDAttributeGroupDefinitionAdapter.java
@@ -0,0 +1,118 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.adapters;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.xsd.adt.actions.BaseSelectionAction;
+import org.eclipse.wst.xsd.adt.design.editparts.model.IActionProvider;
+import org.eclipse.wst.xsd.adt.facade.IModel;
+import org.eclipse.wst.xsd.adt.facade.IStructure;
+import org.eclipse.wst.xsd.adt.outline.ITreeElement;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+import org.eclipse.wst.xsd.ui.common.actions.AddXSDAttributeDeclarationAction;
+import org.eclipse.wst.xsd.ui.common.actions.DeleteXSDConcreteComponentAction;
+import org.eclipse.xsd.XSDAttributeGroupDefinition;
+import org.eclipse.xsd.XSDWildcard;
+
+public class XSDAttributeGroupDefinitionAdapter extends XSDBaseAdapter implements IStructure, IActionProvider
+{
+
+  public XSDAttributeGroupDefinitionAdapter()
+  {
+    super();
+  }
+
+  public XSDAttributeGroupDefinition getXSDAttributeGroupDefinition()
+  {
+    return (XSDAttributeGroupDefinition) target;
+  }
+
+  public Image getImage()
+  {
+    XSDAttributeGroupDefinition xsdAttributeGroupDefinition = (XSDAttributeGroupDefinition) target;
+    if (xsdAttributeGroupDefinition.isAttributeGroupDefinitionReference())
+    {
+      return XSDEditorPlugin.getXSDImage("icons/XSDAttributeGroupRef.gif");
+    }
+    else
+    {
+      return XSDEditorPlugin.getXSDImage("icons/XSDAttributeGroup.gif");
+    }
+  }
+
+  public String getText()
+  {
+    XSDAttributeGroupDefinition xsdAttributeGroupDefinition = (XSDAttributeGroupDefinition) target;
+    String result = xsdAttributeGroupDefinition.isAttributeGroupDefinitionReference() ? xsdAttributeGroupDefinition.getQName() : xsdAttributeGroupDefinition.getName();
+    return result == null ? "'absent'" : result;
+  }
+
+  public ITreeElement[] getChildren()
+  {
+    XSDAttributeGroupDefinition xsdAttributeGroup = (XSDAttributeGroupDefinition) target;
+    List list = new ArrayList();
+    list.addAll(xsdAttributeGroup.getContents());
+    XSDWildcard wildcard = xsdAttributeGroup.getAttributeWildcardContent();
+    if (wildcard != null)
+    {
+      list.add(wildcard);
+    }
+    List adapterList = new ArrayList();
+    populateAdapterList(list, adapterList);
+    return (ITreeElement[]) adapterList.toArray(new ITreeElement[0]);
+  }
+  
+  public String[] getActions(Object object)
+  {
+    List list = new ArrayList();
+    list.add(AddXSDAttributeDeclarationAction.ID);
+    list.add(BaseSelectionAction.SEPARATOR_ID);
+    list.add(DeleteXSDConcreteComponentAction.DELETE_XSD_COMPONENT_ID);
+    return (String [])list.toArray(new String[0]);
+  }
+
+  public Command getAddNewFieldCommand(String fieldKind)
+  {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  public Command getDeleteCommand()
+  {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  public List getFields()
+  {
+    // TODO (cs) ... review this    
+    ITreeElement[] chidlren = getChildren();
+    return Arrays.asList(chidlren);
+  }
+
+  public IModel getModel()
+  {
+    Adapter adapter = XSDAdapterFactory.getInstance().adapt(getXSDAttributeGroupDefinition().getSchema());
+    return (IModel)adapter;
+  }
+
+  public String getName()
+  {
+    // TODO (cs) ... review this
+    return getText();
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDAttributeUseAdapter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDAttributeUseAdapter.java
new file mode 100644
index 0000000..d0b6af5
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDAttributeUseAdapter.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.adapters;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.wst.xsd.adt.design.editparts.model.IActionProvider;
+import org.eclipse.wst.xsd.adt.facade.IModel;
+import org.eclipse.xsd.XSDAttributeDeclaration;
+import org.eclipse.xsd.XSDAttributeUse;
+
+public class XSDAttributeUseAdapter extends XSDBaseAttributeAdapter implements IActionProvider
+{
+  protected XSDAttributeDeclaration getXSDAttributeDeclaration()
+  {
+    return getXSDAttributeUse().getAttributeDeclaration();
+  }
+
+  protected XSDAttributeDeclaration getResolvedXSDAttributeDeclaration()
+  {
+    return getXSDAttributeDeclaration().getResolvedAttributeDeclaration();
+  }
+  
+  protected XSDAttributeUse getXSDAttributeUse()
+  {
+    return (XSDAttributeUse)target;
+  }
+
+  public XSDAttributeUseAdapter()
+  {
+    super();
+  }
+
+  public String getText()
+  {
+    return getTextForAttributeUse(getXSDAttributeUse(), true);
+  }
+
+  public String getTextForAttributeUse(XSDAttributeUse attributeUse, boolean showType)
+  {
+    XSDAttributeDeclaration ad = attributeUse.getAttributeDeclaration();
+      
+    StringBuffer result  = new StringBuffer();
+    result.append(getTextForAttribute(ad, showType));
+    /*
+    if (xsdAttributeUse.isSetConstraint())
+    {
+      if (result.length() != 0)
+      {
+        result.append("  ");
+      }
+      result.append('<');
+      result.append(xsdAttributeUse.getConstraint());
+      result.append("=\"");
+      result.append(xsdAttributeUse.getLexicalValue());
+      result.append("\">");
+    }
+    */
+    return result.toString();
+  }
+  
+  public boolean isGlobal()
+  {
+    return false;
+  }
+
+  public IModel getModel()
+  {
+    Adapter adapter = XSDAdapterFactory.getInstance().adapt(getXSDAttributeDeclaration().getSchema());
+    return (IModel)adapter;
+  }
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDBaseAdapter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDBaseAdapter.java
new file mode 100644
index 0000000..cbe5ee6
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDBaseAdapter.java
@@ -0,0 +1,199 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.adapters;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.wst.xml.core.internal.document.ElementImpl;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
+import org.eclipse.wst.xsd.adt.facade.IADTObject;
+import org.eclipse.wst.xsd.adt.facade.IADTObjectListener;
+import org.eclipse.wst.xsd.adt.facade.IComplexType;
+import org.eclipse.wst.xsd.adt.outline.ITreeElement;
+import org.eclipse.xsd.XSDComplexTypeDefinition;
+import org.eclipse.xsd.XSDConcreteComponent;
+import org.eclipse.xsd.XSDSchema;
+import org.w3c.dom.Element;
+
+public class XSDBaseAdapter extends AdapterImpl implements IADTObject, ITreeElement
+{  
+  protected List listenerList = new ArrayList();
+  
+  public boolean isAdapterForType(Object type)
+  {
+    return type == XSDAdapterFactory.getInstance();
+  }
+  
+  public void populateAdapterList(List notifierList, List adapterList)
+  {
+    for (Iterator i = notifierList.iterator(); i.hasNext(); )
+    {
+      Object obj = i.next();
+      if (obj instanceof XSDConcreteComponent)
+      {
+        XSDConcreteComponent component = (XSDConcreteComponent)obj;
+        adapterList.add(XSDAdapterFactory.getInstance().adapt(component));
+      }
+      else
+      {
+        adapterList.add(obj);
+      }
+    }
+  }  
+  
+  public void registerListener(IADTObjectListener listener)
+  {
+    if (!listenerList.contains(listener))
+    {
+      listenerList.add(listener);
+    }
+  }
+  
+  public void unregisterListener(IADTObjectListener listener)
+  {
+    listenerList.remove(listener);
+  }
+  
+  public void notifyChanged(Notification msg)
+  {
+    super.notifyChanged(msg);
+    notifyListeners(this, null);
+  }
+  
+  protected void notifyListeners(Object changedObject, String property)
+  {
+    List clonedListenerList = new ArrayList();
+    clonedListenerList.addAll(listenerList);
+    for (Iterator i = clonedListenerList.iterator(); i.hasNext(); )
+    {
+      IADTObjectListener listener = (IADTObjectListener)i.next();
+      listener.propertyChanged(this, property);
+    }      
+  }
+    
+  public ITreeElement[] getChildren()
+  {
+    return null;
+  }
+  
+  public Image getImage()
+  {
+    return null;
+  }
+  
+  public String getText()
+  {
+    return "";
+  }
+  
+  public ITreeElement getParent()
+  {
+    return null;
+  }
+  
+  public boolean hasChildren()
+  {
+    if (getChildren() != null)
+    {
+      return getChildren().length > 0;
+    }
+    return false;
+  }
+  
+
+  /**
+   * Implements IField getContainerType.  Get parent Complex Type containing the field
+   * @return IComplexType
+   */
+  public IComplexType getContainerType()
+  {
+    XSDConcreteComponent xsdConcreteComponent = (XSDConcreteComponent) target;
+    XSDConcreteComponent parent = null;
+    XSDComplexTypeDefinition ct = null;
+    for (parent = xsdConcreteComponent.getContainer(); parent != null; )
+    {
+      if (parent instanceof XSDComplexTypeDefinition)
+      {
+        ct = (XSDComplexTypeDefinition)parent;
+        break;
+      }
+      parent = parent.getContainer();
+    }
+    if (ct != null)
+    {
+      return (IComplexType)XSDAdapterFactory.getInstance().adapt(ct);
+    }
+    return null;
+  }
+  
+  public boolean isReadOnly()
+  {
+    XSDSchema xsdSchema = null;
+    try
+    {
+      IEditorPart editorPart = null;
+      IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+      if (window != null)
+      {
+        IWorkbenchPage page = window.getActivePage();
+        if (page != null)
+        {
+          editorPart = page.getActiveEditor();
+        }
+      }
+      if (target instanceof XSDConcreteComponent)
+      {
+        xsdSchema = ((XSDConcreteComponent)target).getSchema();
+      }
+      if (editorPart == null)
+      {
+        return fallBackCheckIsReadOnly();
+      }
+      
+      XSDSchema editorSchema = (XSDSchema)editorPart.getAdapter(XSDSchema.class);
+      if (xsdSchema != null && xsdSchema == editorSchema)
+      {
+        return false;
+      }
+      else
+      {
+        return fallBackCheckIsReadOnly();
+      }
+    }
+    catch(Exception e)
+    {
+
+    }
+    return true;
+  }
+  
+  private boolean fallBackCheckIsReadOnly()
+  {
+    Element element = ((XSDConcreteComponent)target).getElement();
+    if (element instanceof IDOMNode
+        || element instanceof ElementImpl)
+    {
+       return false;
+    }
+    return true;
+  }
+
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDBaseAttributeAdapter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDBaseAttributeAdapter.java
new file mode 100644
index 0000000..aa3e00f
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDBaseAttributeAdapter.java
@@ -0,0 +1,188 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.adapters;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.xsd.adt.actions.BaseSelectionAction;
+import org.eclipse.wst.xsd.adt.actions.ShowPropertiesViewAction;
+import org.eclipse.wst.xsd.adt.facade.IField;
+import org.eclipse.wst.xsd.adt.facade.IModel;
+import org.eclipse.wst.xsd.adt.facade.IType;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+import org.eclipse.wst.xsd.ui.common.actions.AddXSDAttributeDeclarationAction;
+import org.eclipse.wst.xsd.ui.common.actions.DeleteXSDConcreteComponentAction;
+import org.eclipse.wst.xsd.ui.common.commands.DeleteCommand;
+import org.eclipse.wst.xsd.ui.common.commands.UpdateNameCommand;
+import org.eclipse.xsd.XSDAttributeDeclaration;
+import org.eclipse.xsd.XSDTypeDefinition;
+
+// a base adapter for reuse by an AttributeUse and AttributeDeclaration
+//
+public abstract class XSDBaseAttributeAdapter extends XSDBaseAdapter implements IField
+{
+  protected abstract XSDAttributeDeclaration getXSDAttributeDeclaration();
+  protected abstract XSDAttributeDeclaration getResolvedXSDAttributeDeclaration();
+
+  public XSDBaseAttributeAdapter()
+  {
+    super();
+  }
+
+  public String[] getActions(Object object)
+  {
+    List list = new ArrayList();
+    list.add(AddXSDAttributeDeclarationAction.ID);
+    list.add(BaseSelectionAction.SEPARATOR_ID);
+    list.add(DeleteXSDConcreteComponentAction.DELETE_XSD_COMPONENT_ID);
+
+    list.add(BaseSelectionAction.SEPARATOR_ID);
+    list.add(ShowPropertiesViewAction.ID);
+    return (String[]) list.toArray(new String[0]);
+  }
+
+  public Command getDeleteCommand()
+  {
+    return new DeleteCommand("", getXSDAttributeDeclaration());
+  }
+
+  public String getKind()
+  {
+    return "attribute";
+  }
+
+  public int getMaxOccurs()
+  {
+    // TODO Auto-generated method stub
+    return -3;
+  }
+
+  public int getMinOccurs()
+  {
+    // TODO Auto-generated method stub
+    return -3;
+  }
+
+  public String getName()
+  {
+    XSDAttributeDeclaration resolvedAttributeDeclaration = getResolvedXSDAttributeDeclaration();
+    String name = resolvedAttributeDeclaration.getName();
+    return (name == null) ? "" : name;
+  }
+
+  public IType getType()
+  {
+    XSDTypeDefinition td = getResolvedXSDAttributeDeclaration().getTypeDefinition();
+    return (td != null) ? (IType) XSDAdapterFactory.getInstance().adapt(td) : null;
+  }
+
+  public String getTypeName()
+  {
+    XSDTypeDefinition td = getResolvedXSDAttributeDeclaration().getTypeDefinition();
+    return (td != null) ? td.getName() : "(no type defined)";
+  }
+
+  public String getTypeNameQualifier()
+  {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  public Command getUpdateMaxOccursCommand(int maxOccurs)
+  {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  public Command getUpdateMinOccursCommand(int minOccurs)
+  {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  public Command getUpdateNameCommand(String name)
+  {
+    return new UpdateNameCommand("Update Name", getResolvedXSDAttributeDeclaration(), name);
+  }
+
+  public Command getUpdateTypeNameCommand(String typeName, String quailifier)
+  {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.wst.xsd.adt.outline.ITreeElement#getImage()
+   */
+  public Image getImage()
+  {
+    XSDAttributeDeclaration xsdAttributeDeclaration = getXSDAttributeDeclaration();  // don't want the resolved attribute
+    if (xsdAttributeDeclaration.isAttributeDeclarationReference())
+    {
+      return XSDEditorPlugin.getXSDImage("icons/XSDAttributeRef.gif");
+    }
+    else
+    {
+      return XSDEditorPlugin.getXSDImage("icons/XSDAttribute.gif");
+    }
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.wst.xsd.adt.outline.ITreeElement#getText()
+   */
+  public String getText()
+  {
+    return getTextForAttribute(getResolvedXSDAttributeDeclaration(), true);
+  }
+
+  public String getTextForAttribute(XSDAttributeDeclaration ad, boolean showType)
+  {
+    ad = ad.getResolvedAttributeDeclaration();
+    String name = ad.getName();
+    StringBuffer result = new StringBuffer();
+    if (name == null)
+    {
+      result.append("'absent'");
+    }
+    else
+    {
+      result.append(name);
+    }
+    if (ad.getAnonymousTypeDefinition() == null && ad.getTypeDefinition() != null)
+    {
+      result.append(" : ");
+      // result.append(resolvedAttributeDeclaration.getTypeDefinition().getQName(xsdAttributeDeclaration));
+      result.append(ad.getTypeDefinition().getName());
+    }
+    return result.toString();
+  }
+
+  public boolean isGlobal()
+  {
+    return false;
+  }
+  
+  public IModel getModel()
+  {
+    Adapter adapter = XSDAdapterFactory.getInstance().adapt(getXSDAttributeDeclaration().getSchema());
+    return (IModel)adapter;
+  }  
+
+}
+
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDChildUtility.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDChildUtility.java
new file mode 100644
index 0000000..53a3d31
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDChildUtility.java
@@ -0,0 +1,286 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.adapters;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.xsd.XSDAttributeUse;
+import org.eclipse.xsd.XSDComplexTypeDefinition;
+import org.eclipse.xsd.XSDElementDeclaration;
+import org.eclipse.xsd.XSDModelGroup;
+import org.eclipse.xsd.XSDModelGroupDefinition;
+import org.eclipse.xsd.XSDParticle;
+import org.eclipse.xsd.XSDSchema;
+import org.eclipse.xsd.XSDTypeDefinition;
+import org.eclipse.xsd.XSDWildcard;
+import org.eclipse.xsd.util.XSDSwitch;
+              
+
+public class XSDChildUtility
+{              
+  static public List getModelChildren(Object model)
+  {
+    XSDChildVisitor visitor = new XSDChildVisitor(model);
+    visitor.visitXSDObject(model);
+    return visitor.list;
+  }
+
+  static public List getImmediateDerivedTypes(XSDComplexTypeDefinition complexType)
+  {
+    ArrayList typesDerivedFrom = new ArrayList();
+
+    // A handy convenience method quickly gets all 
+    // typeDefinitions within our schema; note that 
+    // whether or not this returns types in included, 
+    // imported, or redefined schemas is subject to change
+    List typedefs = complexType.getSchema().getTypeDefinitions();
+
+    for (Iterator iter = typedefs.iterator(); iter.hasNext(); )
+    {
+      XSDTypeDefinition typedef = (XSDTypeDefinition)iter.next();
+      // Walk the baseTypes from this typedef seeing if any 
+      // of them match the requested one
+      if (complexType.equals(typedef.getBaseType()))
+      {
+        // We found it, return the original one and continue
+        typesDerivedFrom.add(typedef);
+      }
+    }
+    return typesDerivedFrom;
+  }
+  // TODO... use the XSDVisitor defined in xsdeditor.util instead
+  //          
+  public static class XSDChildVisitor extends XSDVisitor
+  {
+    Object root;
+    List list = new ArrayList();
+
+    public XSDChildVisitor(Object root)
+    {
+      this.root = root;
+    }                  
+
+    public void visitXSDModelGroup(XSDModelGroup xsdModelGroup)
+    {
+      if (xsdModelGroup != root)
+      {
+        list.add(xsdModelGroup); 
+      }                         
+      else
+      {
+        super.visitXSDModelGroup(xsdModelGroup);
+      }
+    }
+
+    public void visitXSDModelGroupDefinition(XSDModelGroupDefinition xsdModelGroupDefinition)
+    {
+      if (xsdModelGroupDefinition != root)
+      {
+        list.add(xsdModelGroupDefinition);
+      }                         
+      else
+      {
+        super.visitXSDModelGroupDefinition(xsdModelGroupDefinition);
+      }
+    }
+
+    public void visitXSDElementDeclaration(XSDElementDeclaration xsdElementDeclaration)
+    {
+      if (xsdElementDeclaration != root)
+      {
+        list.add(xsdElementDeclaration);
+        
+      }                         
+      else
+      {
+        super.visitXSDElementDeclaration(xsdElementDeclaration);
+      }
+    }
+
+    public void visitXSDComplexTypeDefinition(XSDComplexTypeDefinition xsdComplexTypeDefinition)
+    {
+      if (xsdComplexTypeDefinition != root)
+      {                                    
+        if (xsdComplexTypeDefinition.getName() != null || getModelChildren(xsdComplexTypeDefinition).size() > 0)
+        {
+          list.add(xsdComplexTypeDefinition);
+        }
+      }                         
+      else
+      {
+        super.visitXSDComplexTypeDefinition(xsdComplexTypeDefinition);
+      }
+    }    
+
+    public void visitXSDWildcard(XSDWildcard xsdWildCard)
+    {
+      if (xsdWildCard != root)
+      {                                    
+        list.add(xsdWildCard);        
+      }                         
+      else
+      {
+        super.visitXSDWildcard(xsdWildCard);
+      }
+    }
+  }
+               
+
+  public static class XSDVisitor
+  { 
+    int indent = 0;
+                 
+    public void visitXSDObject(Object object)
+    {           
+      if (object == null)
+        return;
+
+      XSDSwitch theSwitch = new XSDSwitch()
+      {   
+        public Object caseXSDComplexTypeDefinition(XSDComplexTypeDefinition object)
+        {
+          visitXSDComplexTypeDefinition(object);
+          return null;
+        } 
+
+        public Object caseXSDAttributeUse(XSDAttributeUse object)
+        {
+          visitXSDAttributeUse(object);
+          return null;
+        }
+
+        public Object caseXSDElementDeclaration(XSDElementDeclaration object)
+        {
+          visitXSDElementDeclaration(object);
+          return null;
+        }
+
+        public Object caseXSDModelGroupDefinition(XSDModelGroupDefinition object)
+        {
+          visitXSDModelGroupDefinition(object);
+          return super.caseXSDModelGroupDefinition(object);
+        }
+
+        public Object caseXSDModelGroup(XSDModelGroup object)
+        {
+          visitXSDModelGroup(object);
+          return super.caseXSDModelGroup(object);
+        }
+
+        public Object caseXSDParticle(XSDParticle object)
+        { 
+          visitXSDParticle(object);
+          return null;
+        } 
+
+        public Object caseXSDSchema(XSDSchema object)
+        { 
+          visitXSDSchema(object);
+          return null;
+        } 
+
+        public Object caseXSDWildcard(XSDWildcard object)
+        { 
+          visitXSDWildcard(object);
+          return null;
+        } 
+      };
+      theSwitch.doSwitch((EObject)object);
+    }
+         
+    public void visitXSDAttributeUse(XSDAttributeUse xsdAttributeUse)
+    {  
+//      printIndented("@" + xsdAttributeUse.getAttributeDeclaration().getName());
+    }
+
+    public void visitXSDSchema(XSDSchema xsdSchema)
+    {         
+//      printIndented("XSDSchema");
+      indent += 2;
+      for (Iterator iterator = xsdSchema.getElementDeclarations().iterator(); iterator.hasNext(); )
+      {
+        visitXSDObject(iterator.next());
+      }
+      indent -= 2;
+    }
+
+    public void visitXSDElementDeclaration(XSDElementDeclaration xsdElementDeclaration)
+    {      
+//      printIndented(xsdElementDeclaration.getName());
+      indent += 2;         
+      XSDTypeDefinition td = xsdElementDeclaration.getTypeDefinition();
+      if (td == null)
+      {
+        td = xsdElementDeclaration.getAnonymousTypeDefinition();
+      }                       
+      visitXSDObject(td);
+      indent -= 2;
+    }
+   
+    public void visitXSDComplexTypeDefinition(XSDComplexTypeDefinition xsdComplexTypeDefinition)
+    {
+//      printIndented("XSDComplexTypeDefinition : " + xsdComplexTypeDefinition.getContent());
+      indent += 2;
+      for (Iterator i = xsdComplexTypeDefinition.getAttributeUses().iterator(); i.hasNext(); )
+      {        
+        visitXSDObject((XSDAttributeUse)i.next());
+      }
+      visitXSDObject(xsdComplexTypeDefinition.getContent());
+      indent -= 2;
+    }
+
+    public void visitXSDModelGroup(XSDModelGroup xsdModelGroup)
+    {
+//      printIndented("XSDModelGroup");
+      indent += 2;
+      for (Iterator iterator = xsdModelGroup.getContents().iterator(); iterator.hasNext(); )
+      {
+        visitXSDObject(iterator.next());
+      } 
+      indent -= 2;
+    }     
+
+    public void visitXSDModelGroupDefinition(XSDModelGroupDefinition xsdModelGroupDefinition)
+    {
+//      printIndented("XSDModelGroupDefinition");
+      indent += 2;
+      visitXSDObject(xsdModelGroupDefinition.getResolvedModelGroupDefinition().getModelGroup());
+      indent -= 2;
+    }
+
+    public void visitXSDParticle(XSDParticle xsdParticle)
+    {
+//      printIndented("XSDParticle");
+      indent += 2;                 
+      if (xsdParticle.getContent() != null)
+        visitXSDObject(xsdParticle.getContent());
+      indent -= 2;
+    } 
+
+    public void visitXSDWildcard(XSDWildcard object)
+    { 
+//      printIndented("XSDWildcard");
+    }
+
+    public void printIndented(String string)
+    { 
+      //String spaces = "";
+      //for (int i = 0; i < indent; i++)
+      //{
+      //  spaces += " ";
+      //}               
+      //System.out.println(spaces + string);      
+    }
+  } 
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDComplexTypeDefinitionAdapter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDComplexTypeDefinitionAdapter.java
new file mode 100644
index 0000000..bf8ce65
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDComplexTypeDefinitionAdapter.java
@@ -0,0 +1,412 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.adapters;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.jface.action.Action;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.wst.xsd.adt.actions.BaseSelectionAction;
+import org.eclipse.wst.xsd.adt.actions.DeleteAction;
+import org.eclipse.wst.xsd.adt.actions.SetInputToGraphView;
+import org.eclipse.wst.xsd.adt.actions.ShowPropertiesViewAction;
+import org.eclipse.wst.xsd.adt.design.editparts.model.IActionProvider;
+import org.eclipse.wst.xsd.adt.facade.IADTObject;
+import org.eclipse.wst.xsd.adt.facade.IADTObjectListener;
+import org.eclipse.wst.xsd.adt.facade.IComplexType;
+import org.eclipse.wst.xsd.adt.facade.IModel;
+import org.eclipse.wst.xsd.adt.facade.IType;
+import org.eclipse.wst.xsd.adt.outline.ITreeElement;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+import org.eclipse.wst.xsd.editor.internal.design.editparts.model.SpaceFiller;
+import org.eclipse.wst.xsd.editor.internal.design.editparts.model.TargetConnectionSpaceFiller;
+import org.eclipse.wst.xsd.ui.common.actions.AddXSDAttributeDeclarationAction;
+import org.eclipse.wst.xsd.ui.common.actions.AddXSDAttributeGroupDefinitionAction;
+import org.eclipse.wst.xsd.ui.common.actions.AddXSDElementAction;
+import org.eclipse.wst.xsd.ui.common.actions.AddXSDModelGroupAction;
+import org.eclipse.wst.xsd.ui.common.actions.OpenInNewEditor;
+import org.eclipse.wst.xsd.ui.common.commands.AddXSDElementCommand;
+import org.eclipse.wst.xsd.ui.common.commands.DeleteCommand;
+import org.eclipse.wst.xsd.ui.common.commands.UpdateNameCommand;
+import org.eclipse.xsd.XSDAttributeGroupContent;
+import org.eclipse.xsd.XSDAttributeGroupDefinition;
+import org.eclipse.xsd.XSDAttributeUse;
+import org.eclipse.xsd.XSDComplexTypeContent;
+import org.eclipse.xsd.XSDComplexTypeDefinition;
+import org.eclipse.xsd.XSDModelGroup;
+import org.eclipse.xsd.XSDParticle;
+import org.eclipse.xsd.XSDParticleContent;
+import org.eclipse.xsd.XSDSchema;
+import org.eclipse.xsd.XSDTypeDefinition;
+import org.eclipse.xsd.util.XSDConstants;
+
+public class XSDComplexTypeDefinitionAdapter extends XSDTypeDefinitionAdapter implements IComplexType, IActionProvider, IADTObjectListener
+{
+  protected List fields = null;
+  protected List otherThingsToListenTo = null;
+
+  public XSDComplexTypeDefinition getXSDComplexTypeDefinition()
+  {
+    return (XSDComplexTypeDefinition) target;
+  }
+
+  public IType getSuperType()
+  {
+    XSDTypeDefinition td = getXSDTypeDefinition().getBaseType();
+
+    // test to filter out the 'anyType' type ... don't want to see that
+    //
+    if (td != null && !td.getName().equals("anyType"))
+    {
+      return (IType) XSDAdapterFactory.getInstance().adapt(td);
+    }
+    return null;
+  }
+
+  protected void clearFields()
+  {
+    if (otherThingsToListenTo != null)
+    {
+      for (Iterator i = otherThingsToListenTo.iterator(); i.hasNext();)
+      {
+        Adapter adapter = (Adapter) i.next();
+        if (adapter instanceof IADTObject)
+        {
+          IADTObject adtObject = (IADTObject) adapter;
+          adtObject.unregisterListener(this);
+        }
+      }
+    }
+    fields = null;
+    otherThingsToListenTo = null;
+  }
+
+  public List getFields()
+  {
+    if (fields == null)
+    {
+      fields = new ArrayList();
+      otherThingsToListenTo = new ArrayList();
+
+      XSDVisitorForFields visitor = new XSDVisitorForFieldsWithSpaceFillers();
+      visitor.visitComplexTypeDefinition(getXSDComplexTypeDefinition());
+      populateAdapterList(visitor.concreteComponentList, fields);
+      populateAdapterList(visitor.thingsWeNeedToListenTo, otherThingsToListenTo);
+      for (Iterator i = otherThingsToListenTo.iterator(); i.hasNext();)
+      {
+        Adapter adapter = (Adapter) i.next();
+        if (adapter instanceof IADTObject)
+        {
+          IADTObject adtObject = (IADTObject) adapter;
+          adtObject.registerListener(this);
+        }
+      }
+    }
+    // System.out.println("fields[" + this + "].size() = " + fields.size());
+    return fields;
+  }
+
+  class XSDVisitorForFieldsWithSpaceFillers extends XSDVisitorForFields
+  {
+    public XSDVisitorForFieldsWithSpaceFillers()
+    {
+      super();
+    }
+
+    public void visitAttributeGroupDefinition(XSDAttributeGroupDefinition attributeGroup)
+    {
+      for (Iterator it = attributeGroup.getContents().iterator(); it.hasNext();)
+      {
+        Object o = it.next();
+        if (o instanceof XSDAttributeUse)
+        {
+          XSDAttributeUse attributeUse = (XSDAttributeUse) o;
+          concreteComponentList.add(attributeUse.getAttributeDeclaration());
+          thingsWeNeedToListenTo.add(attributeUse.getAttributeDeclaration());
+        }
+        else if (o instanceof XSDAttributeGroupDefinition)
+        {
+          XSDAttributeGroupDefinition attrGroup = (XSDAttributeGroupDefinition) o;
+          thingsWeNeedToListenTo.add(attrGroup);
+          if (attrGroup.isAttributeGroupDefinitionReference())
+          {
+            attrGroup = attrGroup.getResolvedAttributeGroupDefinition();
+            if (attrGroup.getContents().size() == 0)
+            {
+              concreteComponentList.add(new SpaceFiller("attribute"));
+            }
+            visitAttributeGroupDefinition(attrGroup);
+          }
+        }
+      }
+    }
+
+    public void visitModelGroup(XSDModelGroup modelGroup)
+    {
+      int numOfChildren = modelGroup.getContents().size();
+      if (numOfChildren == 0)
+      {
+        concreteComponentList.add(new SpaceFiller("element"));
+      }
+      super.visitModelGroup(modelGroup);
+    }
+  }
+
+  public List getModelGroups()
+  {
+    List groups = new ArrayList();
+    groups.addAll(XSDChildUtility.getModelChildren(getXSDComplexTypeDefinition()));
+    return groups;
+  }
+
+  public List getAttributeGroupContent()
+  {
+    EList attrContent = getXSDComplexTypeDefinition().getAttributeContents();
+    List attrUses = new ArrayList();
+    List list = new ArrayList();
+
+    for (Iterator it = attrContent.iterator(); it.hasNext();)
+    {
+      XSDAttributeGroupContent attrGroupContent = (XSDAttributeGroupContent) it.next();
+
+      if (attrGroupContent instanceof XSDAttributeGroupDefinition)
+      {
+        XSDAttributeGroupDefinition attributeGroupDefinition = (XSDAttributeGroupDefinition) attrGroupContent;
+        list.add(XSDAdapterFactory.getInstance().adapt(attributeGroupDefinition));
+        getAttributeUses(attributeGroupDefinition, attrUses);
+      }
+      else
+      {
+        attrUses.add(attrGroupContent);
+        list.add(new TargetConnectionSpaceFiller(this));
+      }
+    }
+    return list;
+  }
+
+  public boolean isComplexType()
+  {
+    return true;
+  }
+
+  public void notifyChanged(Notification msg)
+  {
+    clearFields();
+    super.notifyChanged(msg);
+  }
+
+  public Command getUpdateNameCommand(String newName)
+  {
+    return new UpdateNameCommand("Update Name", getXSDComplexTypeDefinition(), newName);
+  }
+
+  public Command getAddNewFieldCommand(String fieldKind)
+  {
+    return new AddXSDElementCommand("whyDoWeUseThisLabel?", getXSDComplexTypeDefinition());
+  }
+
+  public Command getDeleteCommand()
+  {
+    return new DeleteCommand("", getXSDComplexTypeDefinition());
+  }
+
+  protected class AddNewFieldCommand extends Command
+  {
+    protected String defaultName;
+    protected String fieldKind;
+
+    AddNewFieldCommand(String defaultName, String fieldKind)
+    {
+      this.defaultName = defaultName;
+      this.fieldKind = fieldKind;
+    }
+  }
+
+  public String[] getActions(Object object)
+  {
+    List list = new ArrayList();
+    IWorkbench workbench = PlatformUI.getWorkbench();
+    IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
+    IEditorPart editorPart = workbenchWindow.getActivePage().getActiveEditor();
+    Object schema = editorPart.getAdapter(XSDSchema.class);
+    
+    list.add(AddXSDElementAction.ID);
+    list.add(AddXSDElementAction.REF_ID);
+    list.add(AddXSDAttributeDeclarationAction.ID);
+    list.add(AddXSDAttributeGroupDefinitionAction.ID);
+    list.add(BaseSelectionAction.SEPARATOR_ID);
+    list.add(AddXSDModelGroupAction.SEQUENCE_ID);
+    list.add(AddXSDModelGroupAction.CHOICE_ID);
+
+    list.add(BaseSelectionAction.SEPARATOR_ID);
+    list.add(DeleteAction.ID);
+    list.add(BaseSelectionAction.SEPARATOR_ID);
+    if (getXSDComplexTypeDefinition().getSchema() == schema)
+    {
+      if (getXSDComplexTypeDefinition().getContainer() == schema)
+      {
+        list.add(SetInputToGraphView.ID);
+      }
+    }
+    else
+    {
+      list.add(OpenInNewEditor.ID);
+    }
+    list.add(BaseSelectionAction.SEPARATOR_ID);
+    list.add(ShowPropertiesViewAction.ID);
+    String[] result = new String[list.size()];
+    list.toArray(result);
+    return result;
+  }
+
+  public void propertyChanged(Object object, String property)
+  {
+    clearFields();
+    notifyListeners(this, null);
+  }
+
+  class BogusAction extends Action
+  {
+    BogusAction(String name)
+    {
+      super(name);
+    }
+
+    public void run()
+    {
+      // TODO Auto-generated method stub
+      super.run();
+    }
+  }
+
+  public ITreeElement[] getChildren()
+  {
+    XSDComplexTypeDefinition xsdComplexTypeDefinition = getXSDComplexTypeDefinition();
+    List list = new ArrayList();
+    // Add attributes
+    for (Iterator i = xsdComplexTypeDefinition.getAttributeContents().iterator(); i.hasNext();)
+    {
+      Object obj = i.next();
+      if (obj instanceof XSDAttributeUse)
+      {
+        list.add(obj);
+      }
+      else if (obj instanceof XSDAttributeGroupDefinition)
+      {
+        getAttributeUses((XSDAttributeGroupDefinition) obj, list);
+      }
+    }
+    // get immediate XSD Model Group of this complex type
+    if (xsdComplexTypeDefinition.getContent() != null)
+    {
+      XSDComplexTypeContent xsdComplexTypeContent = xsdComplexTypeDefinition.getContent();
+      if (xsdComplexTypeContent instanceof XSDParticle)
+      {
+        XSDParticleContent particleContent = ((XSDParticle) xsdComplexTypeContent).getContent();
+        if (particleContent instanceof XSDModelGroup)
+        {
+          list.add((XSDModelGroup) particleContent);
+        }
+      }
+    }
+    // get inherited XSD Model Group of this complex type
+    boolean showInheritedContent = XSDEditorPlugin.getPlugin().getShowInheritedContent();
+    if (showInheritedContent)
+    {
+      XSDTypeDefinition typeDef = xsdComplexTypeDefinition.getBaseTypeDefinition();
+      if (typeDef instanceof XSDComplexTypeDefinition)
+      {
+        XSDComplexTypeDefinition baseCT = (XSDComplexTypeDefinition) typeDef;
+        if (baseCT.getTargetNamespace() != null && !baseCT.getTargetNamespace().equals(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001))
+        {
+          if (baseCT.getContent() != null)
+          {
+            XSDComplexTypeContent xsdComplexTypeContent = baseCT.getContent();
+            if (xsdComplexTypeContent instanceof XSDParticle)
+            {
+              XSDParticleContent particleContent = ((XSDParticle) xsdComplexTypeContent).getContent();
+              if (particleContent instanceof XSDModelGroup)
+              {
+                list.add((XSDModelGroup) particleContent);
+              }
+            }
+          }
+        }
+      }
+    }
+    List adapterList = new ArrayList();
+    populateAdapterList(list, adapterList);
+    return (ITreeElement[]) adapterList.toArray(new ITreeElement[0]);
+  }
+
+  public Image getImage()
+  {
+    return XSDEditorPlugin.getXSDImage("icons/XSDComplexType.gif");
+  }
+
+  public String getText()
+  {
+    XSDComplexTypeDefinition xsdComplexTypeDefinition = (XSDComplexTypeDefinition) target;
+
+    StringBuffer result = new StringBuffer();
+
+    result.append(xsdComplexTypeDefinition.getName() == null ? "local type" : xsdComplexTypeDefinition.getName());
+
+    XSDTypeDefinition baseTypeDefinition = xsdComplexTypeDefinition.getBaseTypeDefinition();
+    if (baseTypeDefinition != null && baseTypeDefinition != xsdComplexTypeDefinition.getContent() && baseTypeDefinition.getName() != null && !XSDConstants.isURType(baseTypeDefinition))
+    {
+      result.append(" : ");
+      result.append(baseTypeDefinition.getQName(xsdComplexTypeDefinition));
+    }
+
+    return result.toString();
+  }
+
+  public void getAttributeUses(XSDAttributeGroupDefinition attributeGroupDefinition, List list)
+  {
+    Iterator i = attributeGroupDefinition.getResolvedAttributeGroupDefinition().getContents().iterator();
+
+    while (i.hasNext())
+    {
+      XSDAttributeGroupContent attrGroupContent = (XSDAttributeGroupContent) i.next();
+
+      if (attrGroupContent instanceof XSDAttributeGroupDefinition)
+      {
+        getAttributeUses((XSDAttributeGroupDefinition) attrGroupContent, list);
+      }
+      else
+      {
+        list.add(XSDAdapterFactory.getInstance().adapt(attrGroupContent));
+      }
+    }
+  }
+
+  public IModel getModel()
+  {
+    Adapter adapter = XSDAdapterFactory.getInstance().adapt(getXSDComplexTypeDefinition().getSchema());
+    return (IModel)adapter;
+  }
+
+  public boolean isFocusAllowed()
+  {
+    return true;
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDElementDeclarationAdapter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDElementDeclarationAdapter.java
new file mode 100644
index 0000000..d57dda4
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDElementDeclarationAdapter.java
@@ -0,0 +1,280 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.adapters;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.xsd.adt.actions.BaseSelectionAction;
+import org.eclipse.wst.xsd.adt.actions.DeleteAction;
+import org.eclipse.wst.xsd.adt.actions.ShowPropertiesViewAction;
+import org.eclipse.wst.xsd.adt.design.IAnnotationProvider;
+import org.eclipse.wst.xsd.adt.design.editparts.model.IActionProvider;
+import org.eclipse.wst.xsd.adt.facade.IField;
+import org.eclipse.wst.xsd.adt.facade.IModel;
+import org.eclipse.wst.xsd.adt.facade.IType;
+import org.eclipse.wst.xsd.adt.outline.ITreeElement;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+import org.eclipse.wst.xsd.ui.common.actions.AddXSDElementAction;
+import org.eclipse.wst.xsd.ui.common.actions.SetMultiplicityAction;
+import org.eclipse.wst.xsd.ui.common.actions.SetTypeAction;
+import org.eclipse.wst.xsd.ui.common.commands.DeleteCommand;
+import org.eclipse.wst.xsd.ui.common.commands.UpdateNameCommand;
+import org.eclipse.xsd.XSDComplexTypeDefinition;
+import org.eclipse.xsd.XSDElementDeclaration;
+import org.eclipse.xsd.XSDParticle;
+import org.eclipse.xsd.XSDSchema;
+import org.eclipse.xsd.XSDTypeDefinition;
+import org.eclipse.xsd.util.XSDConstants;
+import org.w3c.dom.Element;
+
+public class XSDElementDeclarationAdapter extends XSDParticleAdapter implements IField, IActionProvider, IAnnotationProvider
+{
+  protected XSDElementDeclaration getXSDElementDeclaration()
+  {
+    return (XSDElementDeclaration) target;
+  }
+
+  public String getName()
+  {
+    String name = getXSDElementDeclaration().getResolvedElementDeclaration().getName();
+    return (name == null) ? "" : name;
+  }
+
+  public String getTypeName()
+  {
+    IType type = getType();
+    if (type != null)
+    {  
+      return type.getName();
+    }
+    return null;
+  }
+
+  public String getTypeNameQualifier()
+  {
+    return getXSDElementDeclaration().getTypeDefinition().getTargetNamespace();
+  }
+
+  public IType getType()
+  {
+    XSDTypeDefinition td = getXSDElementDeclaration().getResolvedElementDeclaration().getTypeDefinition();
+    //if (td != null &&
+    //    td.getTargetNamespace() != null && td.getTargetNamespace().equals(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001)) return null;
+    return (td != null) ? (IType) XSDAdapterFactory.getInstance().adapt(td) : null;
+  }
+ 
+  public Image getImage()
+  {
+    XSDElementDeclaration xsdElementDeclaration = (XSDElementDeclaration) target;
+
+    if (!xsdElementDeclaration.isElementDeclarationReference())
+    {
+      return XSDEditorPlugin.getXSDImage("icons/XSDElement.gif");
+    }
+    else
+    {
+      return XSDEditorPlugin.getXSDImage("icons/XSDElementRef.gif");
+    }
+  }
+
+  public String getText()
+  {
+    XSDElementDeclaration xsdElementDeclaration = (XSDElementDeclaration) target;
+    XSDElementDeclaration resolvedElementDeclaration = xsdElementDeclaration.getResolvedElementDeclaration();
+    //String name = xsdElementDeclaration != resolvedElementDeclaration ? xsdElementDeclaration.getQName() : xsdElementDeclaration.getName();
+    String name = resolvedElementDeclaration.getName();
+
+    StringBuffer result = new StringBuffer();
+    if (name == null)
+    {
+      result.append("'absent'");
+    }
+    else
+    {
+      result.append(name);
+    }
+
+    if (!xsdElementDeclaration.isGlobal())
+    {
+      Element element = xsdElementDeclaration.getElement();
+      boolean hasMinOccurs = element.hasAttribute(XSDConstants.MINOCCURS_ATTRIBUTE);
+      boolean hasMaxOccurs = element.hasAttribute(XSDConstants.MAXOCCURS_ATTRIBUTE);
+
+      if (hasMinOccurs || hasMaxOccurs)
+      {
+        result.append(" [");
+        if (hasMinOccurs)
+        {
+          int min = ((XSDParticle) xsdElementDeclaration.getContainer()).getMinOccurs();
+          if (min == XSDParticle.UNBOUNDED)
+          {
+            result.append("*");
+          }
+          else
+          {
+            result.append(String.valueOf(min));
+          }
+        }
+        else
+        // print default
+        {
+          int min = ((XSDParticle) xsdElementDeclaration.getContainer()).getMinOccurs();
+          result.append(String.valueOf(min));
+        }
+        if (hasMaxOccurs)
+        {
+          int max = ((XSDParticle) xsdElementDeclaration.getContainer()).getMaxOccurs();
+          result.append("..");
+          if (max == XSDParticle.UNBOUNDED)
+          {
+            result.append("*");
+          }
+          else
+          {
+            result.append(String.valueOf(max));
+          }
+        }
+        else
+        // print default
+        {
+          result.append("..");
+          int max = ((XSDParticle) xsdElementDeclaration.getContainer()).getMaxOccurs();
+          result.append(String.valueOf(max));
+
+        }
+        result.append("]");
+      }
+    }
+
+    if (resolvedElementDeclaration.getAnonymousTypeDefinition() == null && resolvedElementDeclaration.getTypeDefinition() != null)
+    {
+      result.append(" : ");
+      // result.append(resolvedElementDeclaration.getTypeDefinition().getQName(xsdElementDeclaration));
+      result.append(resolvedElementDeclaration.getTypeDefinition().getName());
+    }
+
+    return result.toString();
+
+  }
+
+  public ITreeElement[] getChildren()
+  {
+    XSDElementDeclaration xsdElementDeclaration = (XSDElementDeclaration) target;
+    List list = new ArrayList();
+    XSDTypeDefinition type = null;
+    if (xsdElementDeclaration.isElementDeclarationReference())
+    {
+      type = xsdElementDeclaration.getResolvedElementDeclaration().getTypeDefinition();
+    }
+    else
+    {
+      type = xsdElementDeclaration.getAnonymousTypeDefinition();
+      if (type == null)
+      {
+        type = xsdElementDeclaration.getTypeDefinition();
+      }
+    }
+
+    if (type instanceof XSDComplexTypeDefinition && type.getTargetNamespace() != null && !type.getTargetNamespace().equals(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001))
+    {
+      XSDComplexTypeDefinition ctType = (XSDComplexTypeDefinition) type;
+      if (ctType != null)
+      {
+        if (xsdElementDeclaration.isGlobal())
+          list.add(ctType);
+      }
+    }
+
+    List adapterList = new ArrayList();
+    populateAdapterList(list, adapterList);
+    return (ITreeElement[]) adapterList.toArray(new ITreeElement[0]);
+
+  }
+  
+  public String getKind()
+  {
+    return "element";
+  }
+  
+  public boolean isGlobal()
+  {
+    return getXSDElementDeclaration().eContainer() instanceof XSDSchema;
+  }
+  
+  public boolean isElementDeclarationReference()
+  {
+	  return ((XSDElementDeclaration) target).isElementDeclarationReference();
+  }
+
+  public Command getUpdateMaxOccursCommand(int maxOccurs)
+  {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  public Command getUpdateMinOccursCommand(int minOccurs)
+  {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  public Command getUpdateNameCommand(String name)
+  {
+    return new UpdateNameCommand("Update Name", getXSDElementDeclaration().getResolvedElementDeclaration(), name);
+  }
+
+  public Command getUpdateTypeNameCommand(String typeName, String quailifier)
+  {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  public Command getDeleteCommand()
+  {
+    // TODO Auto-generated method stub
+    return new DeleteCommand("", getXSDElementDeclaration());
+  }
+  
+  public String[] getActions(Object object)
+  {
+    List list = new ArrayList();
+    if (!isGlobal())
+      list.add(AddXSDElementAction.ID);
+
+    list.add(BaseSelectionAction.SUBMENU_START_ID + "Set Type");
+    list.add(SetTypeAction.SET_NEW_TYPE_ID);
+    list.add(SetTypeAction.SELECT_EXISTING_TYPE_ID);
+    list.add(BaseSelectionAction.SUBMENU_END_ID);
+
+    list.add(BaseSelectionAction.SUBMENU_START_ID + "Set Multiplicity");
+    list.add(SetMultiplicityAction.REQUIRED_ID);
+    list.add(SetMultiplicityAction.ZERO_OR_ONE_ID);
+    list.add(SetMultiplicityAction.ZERO_OR_MORE_ID);
+    list.add(SetMultiplicityAction.ONE_OR_MORE_ID);    
+    list.add(BaseSelectionAction.SUBMENU_END_ID);
+
+    list.add(BaseSelectionAction.SEPARATOR_ID);
+    list.add(DeleteAction.ID);
+    list.add(BaseSelectionAction.SEPARATOR_ID);
+    list.add(ShowPropertiesViewAction.ID);
+    return (String [])list.toArray(new String[0]);
+  }
+  
+  public IModel getModel()
+  {
+    Adapter adapter = XSDAdapterFactory.getInstance().adapt(getXSDElementDeclaration().getSchema());
+    return (IModel)adapter;
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDEmptyFieldAdapter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDEmptyFieldAdapter.java
new file mode 100644
index 0000000..8f6b858
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDEmptyFieldAdapter.java
@@ -0,0 +1,114 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.adapters;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.wst.xsd.adt.facade.IField;
+import org.eclipse.wst.xsd.adt.facade.IModel;
+import org.eclipse.wst.xsd.adt.facade.IType;
+
+/**
+ * @deprecated not used
+ */
+public class XSDEmptyFieldAdapter extends XSDBaseAdapter implements IField
+{
+  String kind;
+  public XSDEmptyFieldAdapter()
+  {
+    super();
+  }
+
+  public String getKind()
+  {
+    return kind;
+  }
+  
+  public void setKind(String kind)
+  {
+    this.kind = kind;
+  }
+
+  public String getName()
+  {
+    return null;
+  }
+
+  public String getTypeName()
+  {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  public String getTypeNameQualifier()
+  {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  public IType getType()
+  {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  public int getMinOccurs()
+  {
+    // TODO Auto-generated method stub
+    return 0;
+  }
+
+  public int getMaxOccurs()
+  {
+    // TODO Auto-generated method stub
+    return 0;
+  }
+  
+  public boolean isGlobal()
+  {
+    return false;
+  }
+
+  public Command getUpdateMinOccursCommand(int minOccurs)
+  {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  public Command getUpdateMaxOccursCommand(int maxOccurs)
+  {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  public Command getUpdateTypeNameCommand(String typeName, String quailifier)
+  {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  public Command getUpdateNameCommand(String name)
+  {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  public Command getDeleteCommand()
+  {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  public IModel getModel()
+  {
+    // TODO Auto-generated method stub
+    return null;
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDModelGroupAdapter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDModelGroupAdapter.java
new file mode 100644
index 0000000..0ad1b31
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDModelGroupAdapter.java
@@ -0,0 +1,227 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.adapters;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.xsd.adt.actions.BaseSelectionAction;
+import org.eclipse.wst.xsd.adt.actions.ShowPropertiesViewAction;
+import org.eclipse.wst.xsd.adt.design.editparts.model.IActionProvider;
+import org.eclipse.wst.xsd.adt.outline.ITreeElement;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+import org.eclipse.wst.xsd.ui.common.actions.AddXSDElementAction;
+import org.eclipse.wst.xsd.ui.common.actions.AddXSDModelGroupAction;
+import org.eclipse.wst.xsd.ui.common.actions.AddXSDModelGroupDefinitionAction;
+import org.eclipse.wst.xsd.ui.common.actions.DeleteXSDConcreteComponentAction;
+import org.eclipse.wst.xsd.ui.common.actions.SetMultiplicityAction;
+import org.eclipse.xsd.XSDCompositor;
+import org.eclipse.xsd.XSDElementDeclaration;
+import org.eclipse.xsd.XSDModelGroup;
+import org.eclipse.xsd.XSDModelGroupDefinition;
+import org.eclipse.xsd.XSDParticle;
+import org.eclipse.xsd.XSDParticleContent;
+import org.eclipse.xsd.XSDWildcard;
+import org.eclipse.xsd.util.XSDConstants;
+import org.w3c.dom.Element;
+
+public class XSDModelGroupAdapter extends XSDParticleAdapter implements IActionProvider
+{
+  public static final Image SEQUENCE_ICON_IMAGE = XSDEditorPlugin.getImageDescriptor("newSequence2.gif", true).createImage();
+  public static final Image CHOICE_ICON_IMAGE = XSDEditorPlugin.getImageDescriptor("newChoice.gif", true).createImage();
+  public static final Image ALL_ICON_IMAGE = XSDEditorPlugin.getImageDescriptor("obj16/all.gif", true).createImage();
+
+  XSDModelGroup getXSDModelGroup()
+  {
+    return (XSDModelGroup) target;
+  }
+
+  public XSDModelGroupAdapter()
+  {
+
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.wst.xsd.adt.outline.ITreeElement#getImage()
+   */
+  public Image getImage()
+  {
+    XSDModelGroup xsdModelGroup = getXSDModelGroup();
+    if (XSDCompositor.CHOICE_LITERAL == xsdModelGroup.getCompositor())
+    {
+      return CHOICE_ICON_IMAGE;
+    }
+    else if (XSDCompositor.ALL_LITERAL == xsdModelGroup.getCompositor())
+    {
+      return ALL_ICON_IMAGE;
+    }
+    else
+    {
+      return SEQUENCE_ICON_IMAGE;
+    }
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.wst.xsd.adt.outline.ITreeElement#getText()
+   */
+  public String getText()
+  {
+    XSDModelGroup xsdModelGroup = getXSDModelGroup();
+
+    StringBuffer result = new StringBuffer();
+    String name = xsdModelGroup.getCompositor().getName();
+    if (name != null)
+    {
+      result.append(name);
+    }
+
+    Element element = xsdModelGroup.getElement();
+
+    if (element != null)
+    {
+      boolean hasMinOccurs = element.hasAttribute(XSDConstants.MINOCCURS_ATTRIBUTE);
+      boolean hasMaxOccurs = element.hasAttribute(XSDConstants.MAXOCCURS_ATTRIBUTE);
+
+      if (hasMinOccurs || hasMaxOccurs)
+      {
+        result.append(" [");
+        if (hasMinOccurs)
+        {
+          int min = ((XSDParticle) xsdModelGroup.getContainer()).getMinOccurs();
+          if (min == XSDParticle.UNBOUNDED)
+          {
+            result.append("*");
+          }
+          else
+          {
+            result.append(String.valueOf(min));
+          }
+        }
+        else
+        // print default
+        {
+          int min = ((XSDParticle) xsdModelGroup.getContainer()).getMinOccurs();
+          result.append(String.valueOf(min));
+        }
+        if (hasMaxOccurs)
+        {
+          int max = ((XSDParticle) xsdModelGroup.getContainer()).getMaxOccurs();
+          result.append("..");
+          if (max == XSDParticle.UNBOUNDED)
+          {
+            result.append("*");
+          }
+          else
+          {
+            result.append(String.valueOf(max));
+          }
+        }
+        else
+        // print default
+        {
+          result.append("..");
+          int max = ((XSDParticle) xsdModelGroup.getContainer()).getMaxOccurs();
+          result.append(String.valueOf(max));
+        }
+        result.append("]");
+      }
+    }
+    return result.toString();
+  }
+
+  public ITreeElement[] getChildren()
+  {
+    XSDModelGroup xsdModelGroup = getXSDModelGroup();
+    List list = new ArrayList();
+    for (Iterator i = xsdModelGroup.getContents().iterator(); i.hasNext(); )
+    {
+       Object object = i.next();
+       XSDParticleContent particle = ((XSDParticle)object).getContent();
+       if (particle instanceof XSDElementDeclaration)
+       {
+         list.add((XSDElementDeclaration)particle);
+       }
+       else if (particle instanceof XSDWildcard)
+       {
+         list.add((XSDWildcard)particle);
+       }
+       else if (particle instanceof XSDModelGroup)
+       {
+         list.add((XSDModelGroup)particle);
+       }
+    }
+
+    List adapterList = new ArrayList();
+    populateAdapterList(list, adapterList);
+    return (ITreeElement []) adapterList.toArray(new ITreeElement[0]);
+  }
+
+  public Object getParent(Object object)
+  {
+    XSDModelGroup element = (XSDModelGroup) object;
+    return element.getContainer();
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.wst.xsd.adt.design.editparts.model.IActionProvider#getActions(java.lang.Object)
+   */
+  public String[] getActions(Object object)
+  {
+     Collection actionIDs = new ArrayList();
+     actionIDs.add(AddXSDElementAction.ID);
+     actionIDs.add(AddXSDElementAction.REF_ID);
+     // Add Element Ref
+     actionIDs.add(BaseSelectionAction.SEPARATOR_ID);
+     actionIDs.add(AddXSDModelGroupAction.SEQUENCE_ID);
+     actionIDs.add(AddXSDModelGroupAction.CHOICE_ID);
+     actionIDs.add(AddXSDModelGroupDefinitionAction.MODELGROUPDEFINITIONREF_ID);
+//     actionIDs.add(AddFieldAction.ID);
+     actionIDs.add(BaseSelectionAction.SEPARATOR_ID);
+     // Add Any
+
+     actionIDs.add(BaseSelectionAction.SUBMENU_START_ID + "Set Multiplicity");
+     actionIDs.add(SetMultiplicityAction.REQUIRED_ID);
+     actionIDs.add(SetMultiplicityAction.ZERO_OR_ONE_ID);
+     actionIDs.add(SetMultiplicityAction.ZERO_OR_MORE_ID);
+     actionIDs.add(SetMultiplicityAction.ONE_OR_MORE_ID);    
+     actionIDs.add(BaseSelectionAction.SUBMENU_END_ID);
+    
+     if (!(getParent(target) instanceof XSDModelGroupDefinition))
+     {
+       actionIDs.add(BaseSelectionAction.SEPARATOR_ID);
+       actionIDs.add(DeleteXSDConcreteComponentAction.DELETE_XSD_COMPONENT_ID);
+     }    
+     actionIDs.add(BaseSelectionAction.SEPARATOR_ID);
+     actionIDs.add(ShowPropertiesViewAction.ID);
+        
+     return (String [])actionIDs.toArray(new String[0]);
+  }
+
+  public int getMaxOccurs()
+  {
+    return getMaxOccurs(getXSDModelGroup());
+  }
+
+  public int getMinOccurs()
+  {
+    return getMinOccurs(getXSDModelGroup());
+  }
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDModelGroupDefinitionAdapter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDModelGroupDefinitionAdapter.java
new file mode 100644
index 0000000..ac6d93e
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDModelGroupDefinitionAdapter.java
@@ -0,0 +1,146 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.adapters;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.xsd.adt.actions.BaseSelectionAction;
+import org.eclipse.wst.xsd.adt.design.editparts.model.IActionProvider;
+import org.eclipse.wst.xsd.adt.facade.IModel;
+import org.eclipse.wst.xsd.adt.facade.IStructure;
+import org.eclipse.wst.xsd.adt.outline.ITreeElement;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+import org.eclipse.wst.xsd.ui.common.actions.AddXSDElementAction;
+import org.eclipse.wst.xsd.ui.common.actions.AddXSDModelGroupAction;
+import org.eclipse.wst.xsd.ui.common.actions.DeleteXSDConcreteComponentAction;
+import org.eclipse.xsd.XSDModelGroup;
+import org.eclipse.xsd.XSDModelGroupDefinition;
+
+public class XSDModelGroupDefinitionAdapter extends XSDBaseAdapter implements IStructure, IActionProvider
+{
+  public XSDModelGroupDefinitionAdapter()
+  {
+    super();
+  }
+
+  public XSDModelGroupDefinition getXSDModelGroupDefinition()
+  {
+    return (XSDModelGroupDefinition) target;
+  }
+
+  public Image getImage()
+  {
+    XSDModelGroupDefinition xsdModelGroupDefinition = (XSDModelGroupDefinition) target;
+
+    if (xsdModelGroupDefinition.isModelGroupDefinitionReference())
+    {
+      return XSDEditorPlugin.getXSDImage("icons/XSDGroupRef.gif");
+    }
+    else
+    {
+      return XSDEditorPlugin.getXSDImage("icons/XSDGroup.gif");
+    }
+  }
+
+  public String getText()
+  {
+    XSDModelGroupDefinition xsdModelGroupDefinition = (XSDModelGroupDefinition) target;
+    String result = xsdModelGroupDefinition.isModelGroupDefinitionReference() ? xsdModelGroupDefinition.getQName() : xsdModelGroupDefinition.getName();
+    return result == null ? "'absent'" : result;
+  }
+
+  public ITreeElement[] getChildren()
+  {
+    List list = new ArrayList();
+    XSDModelGroup xsdModelGroup = ((XSDModelGroupDefinition) target).getResolvedModelGroupDefinition().getModelGroup();
+    if (xsdModelGroup != null)
+      list.add(xsdModelGroup);
+
+    List adapterList = new ArrayList();
+    populateAdapterList(list, adapterList);
+    return (ITreeElement[]) adapterList.toArray(new ITreeElement[0]);
+
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.wst.xsd.adt.design.editparts.model.IActionProvider#getActions(java.lang.Object)
+   */
+  public String[] getActions(Object object)
+  {
+    Collection list = new ArrayList();
+
+    if (!getXSDModelGroupDefinition().isModelGroupDefinitionReference())
+    {
+      list.add(AddXSDElementAction.ID);
+      list.add(AddXSDElementAction.REF_ID);
+      list.add(BaseSelectionAction.SEPARATOR_ID);
+      list.add(AddXSDModelGroupAction.SEQUENCE_ID);
+      list.add(AddXSDModelGroupAction.CHOICE_ID);
+    }
+    
+    list.add(DeleteXSDConcreteComponentAction.DELETE_XSD_COMPONENT_ID);
+    return (String [])list.toArray(new String[0]);
+  }
+
+  public Command getAddNewFieldCommand(String fieldKind)
+  {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  public Command getDeleteCommand()
+  {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  public List getFields()
+  {
+    List fields = new ArrayList();
+    boolean showGroups = false;
+    XSDVisitorForFields visitor = new XSDVisitorForFields();
+    visitor.visitModelGroupDefinition(getXSDModelGroupDefinition());
+    populateAdapterList(visitor.concreteComponentList, fields);
+    
+    // TODO (cs) common a base class for a structure thingee
+    //
+    /*
+    populateAdapterList(visitor.thingsWeNeedToListenTo, otherThingsToListenTo);
+    for (Iterator i = otherThingsToListenTo.iterator(); i.hasNext();)
+    {
+      Adapter adapter = (Adapter) i.next();
+      if (adapter instanceof IADTObject)
+      {
+        IADTObject adtObject = (IADTObject) adapter;
+        adtObject.registerListener(this);
+      }
+    }*/
+    // System.out.println("fields[" + this + "].size() = " + fields.size());
+    return fields;
+  }
+
+  public IModel getModel()
+  {
+    Adapter adapter = XSDAdapterFactory.getInstance().adapt(getXSDModelGroupDefinition().getSchema());
+    return (IModel)adapter;
+  }
+  public String getName()
+  {
+    return getText();
+  }    
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDParticleAdapter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDParticleAdapter.java
new file mode 100644
index 0000000..d0425e3
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDParticleAdapter.java
@@ -0,0 +1,160 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.adapters;
+
+import org.eclipse.wst.xsd.adt.design.IAnnotationProvider;
+import org.eclipse.xsd.XSDConcreteComponent;
+import org.eclipse.xsd.XSDParticle;
+
+public class XSDParticleAdapter extends XSDBaseAdapter implements IAnnotationProvider
+{
+  public XSDParticleAdapter()
+  {
+    super();
+  }
+
+  public int getMaxOccurs()
+  {
+    return getMaxOccurs((XSDConcreteComponent) target);
+  }
+
+  public int getMinOccurs()
+  {
+    return getMinOccurs((XSDConcreteComponent) target);
+  }
+
+  public static int getMinOccurs(XSDConcreteComponent component)
+  {
+    int minOccur = -2;
+    if (component != null)
+    {
+      Object o = component.getContainer();
+      if (o instanceof XSDParticle)
+      {
+        if (((XSDParticle) o).isSetMinOccurs())
+        {
+          try
+          {
+            minOccur = ((XSDParticle) o).getMinOccurs();
+          }
+          catch (Exception e)
+          {
+          }
+        }
+      }
+    }
+    return minOccur;
+  }
+
+  public static int getMaxOccurs(XSDConcreteComponent component)
+  {
+    int maxOccur = -2;
+    if (component != null)
+    {
+      Object o = component.getContainer();
+      if (o instanceof XSDParticle)
+      {
+        if (((XSDParticle) o).isSetMaxOccurs())
+        {
+          try
+          {
+            maxOccur = ((XSDParticle) o).getMaxOccurs();
+          }
+          catch (Exception e)
+          {
+          }
+        }
+      }
+    }
+    return maxOccur;
+  }
+
+  public String getNameAnnotationString()
+  {
+    return buildAnnotationString(true);
+  }
+
+  public String getNameAnnotationToolTipString()
+  {
+    return buildAnnotationString(false);
+  }
+
+  public String getTypeAnnotationString()
+  {
+    return null;
+  }
+
+  public String getTypeAnnotationToolTipString()
+  {
+    return null;
+  }
+
+  protected String buildAnnotationString(boolean isForLabel)
+  {
+    String occurenceDescription = "";
+    String toolTipDescription = "";
+    // TODO: set int values as defined constants
+    // -2 means the user didn't specify (so the default is 1)
+    int minOccurs = getMinOccurs();
+    int maxOccurs = getMaxOccurs();
+
+    // This is for the attribute field case, which has no
+    // occurrence attributes
+    if (minOccurs == -3 && maxOccurs == -3)
+    {
+      occurenceDescription = "";
+    }
+    else if (minOccurs == 0 && (maxOccurs == -2 || maxOccurs == 1))
+    {
+      occurenceDescription = "[0..1]";
+      toolTipDescription = "optional";
+    }
+    else if (minOccurs == 0 && maxOccurs == -1)
+    {
+      occurenceDescription = "[0..*]";
+      toolTipDescription = "Zero or more";
+    }
+    else if ((minOccurs == 1 && maxOccurs == -1) || (minOccurs == -2 && maxOccurs == -1))
+    {
+      occurenceDescription = "[1..*]";
+      toolTipDescription = "One or more";
+    }
+    else if ((minOccurs == 1 && maxOccurs == 1) || (minOccurs == -2 && maxOccurs == 1) || (minOccurs == 1 && maxOccurs == -2))
+    {
+      occurenceDescription = "[1..1]";
+      toolTipDescription = "required";
+    }
+    else if (minOccurs == -2 && maxOccurs == -2)
+    {
+      occurenceDescription = "";
+      // none specified, so don't have any toolTip description
+    }
+    else
+    {
+      if (maxOccurs == -2)
+        maxOccurs = 1;
+      String maxSymbol = maxOccurs == -1 ? "*" : "" + maxOccurs;
+      String minSymbol = minOccurs == -2 ? "1" : "" + minOccurs;
+      occurenceDescription = "[" + minSymbol + ".." + maxSymbol + "]";
+      toolTipDescription = "array";
+    }
+
+    if (isForLabel)
+    {
+      return occurenceDescription;
+    }
+    else
+    {
+      return toolTipDescription;
+    }
+  }
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDSchemaAdapter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDSchemaAdapter.java
new file mode 100644
index 0000000..6d418d8
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDSchemaAdapter.java
@@ -0,0 +1,427 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.adapters;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.impl.NotificationImpl;
+import org.eclipse.wst.xsd.adt.design.editparts.model.IActionProvider;
+import org.eclipse.wst.xsd.adt.facade.IADTObjectListener;
+import org.eclipse.wst.xsd.adt.facade.IModel;
+import org.eclipse.wst.xsd.adt.outline.ITreeElement;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+import org.eclipse.wst.xsd.ui.common.actions.AddXSDComplexTypeDefinitionAction;
+import org.eclipse.wst.xsd.ui.common.actions.AddXSDElementAction;
+import org.eclipse.xsd.XSDAttributeDeclaration;
+import org.eclipse.xsd.XSDAttributeGroupDefinition;
+import org.eclipse.xsd.XSDComplexTypeDefinition;
+import org.eclipse.xsd.XSDConcreteComponent;
+import org.eclipse.xsd.XSDElementDeclaration;
+import org.eclipse.xsd.XSDModelGroupDefinition;
+import org.eclipse.xsd.XSDPackage;
+import org.eclipse.xsd.XSDSchema;
+import org.eclipse.xsd.XSDSchemaDirective;
+import org.eclipse.xsd.XSDSimpleTypeDefinition;
+import org.eclipse.xsd.XSDTypeDefinition;
+
+public class XSDSchemaAdapter extends XSDBaseAdapter implements IActionProvider, IModel, IADTObjectListener
+{
+  protected List types = null;
+  protected List children;
+
+  protected CategoryAdapter fDirectivesCategory;
+  protected CategoryAdapter fElementsCategory;
+  protected CategoryAdapter fAttributesCategory;
+  protected CategoryAdapter fAttributeGroupsCategory;
+  protected CategoryAdapter fTypesCategory;
+  protected CategoryAdapter fGroupsCategory;
+
+  /**
+   * Create all the category adapters
+   * 
+   * @param xsdSchema
+   */
+  protected void createCategoryAdapters(XSDSchema xsdSchema)
+  {
+    List directivesList = getDirectives(xsdSchema);
+    List elementsList = getGlobalElements(xsdSchema);
+    List attributeGroupList = getAttributeGroupList(xsdSchema);
+    List attributesList = getAttributeList(xsdSchema);
+    List groups = getGroups(xsdSchema);
+    List types = getComplexTypes(xsdSchema);
+    types.addAll(getSimpleTypes(xsdSchema));
+
+    fDirectivesCategory = new CategoryAdapter(XSDEditorPlugin.getResourceString("_UI_GRAPH_DIRECTIVES"), XSDEditorPlugin.getDefault().getIconImage("obj16/directivesheader"), directivesList, xsdSchema, CategoryAdapter.DIRECTIVES);
+    registerListener(fDirectivesCategory);
+
+    fElementsCategory = new CategoryAdapter(XSDEditorPlugin.getResourceString("_UI_GRAPH_ELEMENTS"), XSDEditorPlugin.getDefault().getIconImage("obj16/elementsheader"), elementsList, xsdSchema, CategoryAdapter.ELEMENTS);
+    registerListener(fElementsCategory);
+
+    fAttributesCategory = new CategoryAdapter(XSDEditorPlugin.getResourceString("_UI_GRAPH_ATTRIBUTES"), XSDEditorPlugin.getDefault().getIconImage("obj16/attributesheader"), attributesList, xsdSchema, CategoryAdapter.ATTRIBUTES);
+    registerListener(fAttributesCategory);
+    fAttributeGroupsCategory = new CategoryAdapter(XSDEditorPlugin.getResourceString("_UI_GRAPH_ATTRIBUTE_GROUPS"), XSDEditorPlugin.getDefault().getIconImage("obj16/attributegroupsheader"), attributeGroupList, xsdSchema, CategoryAdapter.ATTRIBUTE_GROUPS);
+    registerListener(fAttributeGroupsCategory);
+
+    fTypesCategory = new CategoryAdapter(XSDEditorPlugin.getResourceString("_UI_GRAPH_TYPES"), XSDEditorPlugin.getDefault().getIconImage("obj16/typesheader"), types, xsdSchema, CategoryAdapter.TYPES);
+    registerListener(fTypesCategory);
+
+    fGroupsCategory = new CategoryAdapter(XSDEditorPlugin.getResourceString("_UI_GRAPH_GROUPS"), XSDEditorPlugin.getDefault().getIconImage("obj16/groupsheader"), groups, xsdSchema, CategoryAdapter.GROUPS);
+    registerListener(fGroupsCategory);
+  }
+
+  public List getTypes()
+  {
+    if (types == null)
+    {
+      types = new ArrayList();
+      XSDSchema schema = (XSDSchema) target;
+      List concreteComponentList = new ArrayList();
+      for (Iterator i = schema.getContents().iterator(); i.hasNext();)
+      {
+        XSDConcreteComponent component = (XSDConcreteComponent) i.next();
+        if (component instanceof XSDTypeDefinition)
+        {
+          concreteComponentList.add(component);
+        }
+      }
+      populateAdapterList(concreteComponentList, types);
+    }
+    return types;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.wst.xsd.adt.outline.ITreeElement#getChildren()
+   */
+  public ITreeElement[] getChildren()
+  {
+    XSDSchema xsdSchema = (XSDSchema) getTarget();
+
+    children = new ArrayList();
+
+    // just set categoryadapters' children if category adapters are
+    // already created
+    if (fDirectivesCategory != null)
+    {
+      List directivesList = getDirectives(xsdSchema);
+      List elementsList = getGlobalElements(xsdSchema);
+      List attributeGroupList = getAttributeGroupList(xsdSchema);
+      List attributesList = getAttributeList(xsdSchema);
+      List groups = getGroups(xsdSchema);
+      List types = getComplexTypes(xsdSchema);
+      types.addAll(getSimpleTypes(xsdSchema));
+
+      fDirectivesCategory.setChildren(directivesList);
+      fElementsCategory.setChildren(elementsList);
+      fAttributesCategory.setChildren(attributesList);
+      fAttributeGroupsCategory.setChildren(attributeGroupList);
+      fTypesCategory.setChildren(types);
+      fGroupsCategory.setChildren(groups);
+    }
+    else
+    {
+      createCategoryAdapters(xsdSchema);
+    }
+
+    children.add(fDirectivesCategory);
+    children.add(fElementsCategory);
+    children.add(fAttributesCategory);
+    children.add(fAttributeGroupsCategory);
+    children.add(fTypesCategory);
+    children.add(fGroupsCategory);
+
+    return (ITreeElement[]) children.toArray(new ITreeElement[0]);
+  }
+
+  public void notifyChanged(final Notification msg)
+  {
+    class CategoryNotification extends NotificationImpl
+    {
+      protected Object category;
+
+      public CategoryNotification(Object category)
+      {
+        super(msg.getEventType(), msg.getOldValue(), msg.getNewValue(), msg.getPosition());
+        this.category = category;
+      }
+
+      public Object getNotifier()
+      {
+        return category;
+      }
+
+      public Object getFeature()
+      {
+        return msg.getFeature();
+      }
+    }
+
+    if (children == null)
+    {
+      getChildren();
+    }
+
+    if (msg.getFeature() == XSDPackage.eINSTANCE.getXSDSchema_ReferencingDirectives())
+    {
+      CategoryAdapter adapter = getCategory(CategoryAdapter.DIRECTIVES);
+      Assert.isTrue(adapter != null);
+      XSDSchema xsdSchema = adapter.getXSDSchema();
+      adapter.setChildren(getDirectives(xsdSchema));
+      notifyListeners(new CategoryNotification(adapter), adapter.getText());
+      return;
+    }
+    else if (msg.getFeature() == XSDPackage.eINSTANCE.getXSDSchema_ElementDeclarations())
+    {
+      CategoryAdapter adapter = getCategory(CategoryAdapter.ELEMENTS);
+      Assert.isTrue(adapter != null);
+      XSDSchema xsdSchema = adapter.getXSDSchema();
+      adapter.setChildren(getGlobalElements(xsdSchema));
+      notifyListeners(new CategoryNotification(adapter), adapter.getText());
+      return;
+    }
+    else if (msg.getFeature() == XSDPackage.eINSTANCE.getXSDSchema_AttributeDeclarations())
+    {
+      CategoryAdapter adapter = getCategory(CategoryAdapter.ATTRIBUTES);
+      Assert.isTrue(adapter != null);
+      XSDSchema xsdSchema = adapter.getXSDSchema();
+      adapter.setChildren(getAttributeList(xsdSchema));
+      notifyListeners(new CategoryNotification(adapter), adapter.getText());
+      return;
+    }
+    else if (msg.getFeature() == XSDPackage.eINSTANCE.getXSDSchema_AttributeGroupDefinitions())
+    {
+      CategoryAdapter adapter = getCategory(CategoryAdapter.ATTRIBUTE_GROUPS);
+      Assert.isTrue(adapter != null);
+      XSDSchema xsdSchema = adapter.getXSDSchema();
+      adapter.setChildren(getAttributeGroupList(xsdSchema));
+      notifyListeners(new CategoryNotification(adapter), adapter.getText());
+      return;
+    }
+    else if (msg.getFeature() == XSDPackage.eINSTANCE.getXSDSchema_TypeDefinitions())
+    {
+      CategoryAdapter adapter = getCategory(CategoryAdapter.TYPES);
+      Assert.isTrue(adapter != null);
+      XSDSchema xsdSchema = adapter.getXSDSchema();
+      List types = getComplexTypes(xsdSchema);
+      types.addAll(getSimpleTypes(xsdSchema));
+
+      adapter.setChildren(types);
+      notifyListeners(new CategoryNotification(adapter), adapter.getText());
+      return;
+    }
+    else if (msg.getFeature() == XSDPackage.eINSTANCE.getXSDSchema_ModelGroupDefinitions())
+    {
+      CategoryAdapter adapter = getCategory(CategoryAdapter.GROUPS);
+      Assert.isTrue(adapter != null);
+      XSDSchema xsdSchema = adapter.getXSDSchema();
+      adapter.setChildren(getGroups(xsdSchema));
+      notifyListeners(new CategoryNotification(adapter), adapter.getText());
+      return;
+    }
+    else if (msg.getFeature() == XSDPackage.eINSTANCE.getXSDSchema_Annotations())
+    {
+      return;
+    }
+    else if (msg.getFeature() == XSDPackage.eINSTANCE.getXSDSchema_SchemaLocation())
+    {
+      notifyListeners(msg, null);
+      return;
+    }
+    
+    types = null;
+    getTypes();
+
+    super.notifyChanged(msg);
+  }
+  
+  protected CategoryAdapter getCategory(int category)
+  {
+    int length = children.size();
+    CategoryAdapter adapter = null;
+    for (int i = 0; i < length; i++)
+    {
+      adapter = (CategoryAdapter) children.get(i);
+      if (adapter.getGroupType() ==  category)
+      {
+        break;
+      }
+    }
+    return adapter;
+  }
+
+  protected List getDirectives(XSDSchema schema)
+  {
+    List list = new ArrayList();
+    for (Iterator i = schema.getContents().iterator(); i.hasNext();)
+    {
+      Object o = i.next();
+      if (o instanceof XSDSchemaDirective)
+      {
+        list.add(o);
+      }
+    }
+    List adapterList = new ArrayList();
+    populateAdapterList(list, adapterList);
+    return adapterList;
+  }
+
+  protected List getGlobalElements(XSDSchema schema)
+  {
+    List elements = schema.getElementDeclarations();
+    List list = new ArrayList();
+    for (Iterator i = elements.iterator(); i.hasNext();)
+    {
+      XSDElementDeclaration elem = (XSDElementDeclaration) i.next();
+      if (elem.getRootContainer() == schema)
+      {
+        list.add(elem);
+      }
+    }
+    List adapterList = new ArrayList();
+    populateAdapterList(list, adapterList);
+    return adapterList;
+  }
+
+  /**
+   * @param schema
+   * @return
+   */
+  protected List getComplexTypes(XSDSchema schema)
+  {
+    List allTypes = schema.getTypeDefinitions();
+    List list = new ArrayList();
+    for (Iterator i = allTypes.iterator(); i.hasNext();)
+    {
+      XSDTypeDefinition td = (XSDTypeDefinition) i.next();
+      if (td instanceof XSDComplexTypeDefinition)
+      {
+        XSDComplexTypeDefinition ct = (XSDComplexTypeDefinition) td;
+        if (ct.getRootContainer() == schema)
+        {
+          list.add(ct);
+        }
+      }
+    }
+    List adapterList = new ArrayList();
+    populateAdapterList(list, adapterList);
+    return adapterList;
+  }
+
+  protected List getAttributeGroupList(XSDSchema xsdSchema)
+  {
+    List attributeGroupList = new ArrayList();
+    for (Iterator i = xsdSchema.getAttributeGroupDefinitions().iterator(); i.hasNext();)
+    {
+      XSDAttributeGroupDefinition attrGroup = (XSDAttributeGroupDefinition) i.next();
+      if (attrGroup.getRootContainer() == xsdSchema)
+      {
+        attributeGroupList.add(attrGroup);
+      }
+    }
+    List adapterList = new ArrayList();
+    populateAdapterList(attributeGroupList, adapterList);
+    return adapterList;
+  }
+
+  protected List getAttributeList(XSDSchema xsdSchema)
+  {
+    List attributesList = new ArrayList();
+    for (Iterator iter = xsdSchema.getAttributeDeclarations().iterator(); iter.hasNext();)
+    {
+      Object o = iter.next();
+      if (o instanceof XSDAttributeDeclaration)
+      {
+        XSDAttributeDeclaration attr = (XSDAttributeDeclaration) o;
+        if (attr != null)
+        {
+          if (attr.getTargetNamespace() != null)
+          {
+            if (!(attr.getTargetNamespace().equals("http://www.w3.org/2001/XMLSchema-instance")))
+            {
+              if (attr.getRootContainer() == xsdSchema)
+              {
+                attributesList.add(attr);
+              }
+            }
+          }
+          else
+          {
+            if (attr.getRootContainer() == xsdSchema)
+            {
+              attributesList.add(attr);
+            }
+          }
+        }
+      }
+    }
+    List adapterList = new ArrayList();
+    populateAdapterList(attributesList, adapterList);
+    return adapterList;
+  }
+
+  protected List getSimpleTypes(XSDSchema schema)
+  {
+    List allTypes = schema.getTypeDefinitions();
+    List list = new ArrayList();
+    for (Iterator i = allTypes.iterator(); i.hasNext();)
+    {
+      XSDTypeDefinition td = (XSDTypeDefinition) i.next();
+      if (td instanceof XSDSimpleTypeDefinition)
+      {
+        XSDSimpleTypeDefinition st = (XSDSimpleTypeDefinition) td;
+        if (st.getRootContainer() == schema)
+        {
+          list.add(st);
+        }
+      }
+    }
+    List adapterList = new ArrayList();
+    populateAdapterList(list, adapterList);
+    return adapterList;
+  }
+
+  protected List getGroups(XSDSchema schema)
+  {
+    List groups = schema.getModelGroupDefinitions();
+    List list = new ArrayList();
+    for (Iterator i = groups.iterator(); i.hasNext();)
+    {
+      XSDModelGroupDefinition group = (XSDModelGroupDefinition) i.next();
+      if (group.getRootContainer() == schema)
+      {
+        list.add(group);
+      }
+    }
+    List adapterList = new ArrayList();
+    populateAdapterList(list, adapterList);
+    return adapterList;
+  }
+  
+  public String[] getActions(Object object)
+  {
+     Collection actionIDs = new ArrayList();
+     actionIDs.add(AddXSDElementAction.ID);
+     actionIDs.add(AddXSDComplexTypeDefinitionAction.ID);
+        
+     return (String [])actionIDs.toArray(new String[0]);
+  }
+
+  public void propertyChanged(Object object, String property)
+  {
+    notifyListeners(object, property);
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDSchemaDirectiveAdapter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDSchemaDirectiveAdapter.java
new file mode 100644
index 0000000..a2a77bf
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDSchemaDirectiveAdapter.java
@@ -0,0 +1,115 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.adapters;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.xsd.adt.outline.ITreeElement;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+import org.eclipse.xsd.XSDAttributeGroupDefinition;
+import org.eclipse.xsd.XSDComplexTypeDefinition;
+import org.eclipse.xsd.XSDImport;
+import org.eclipse.xsd.XSDInclude;
+import org.eclipse.xsd.XSDModelGroupDefinition;
+import org.eclipse.xsd.XSDRedefinableComponent;
+import org.eclipse.xsd.XSDRedefine;
+import org.eclipse.xsd.XSDRedefineContent;
+import org.eclipse.xsd.XSDSchemaDirective;
+import org.eclipse.xsd.XSDSimpleTypeDefinition;
+
+public class XSDSchemaDirectiveAdapter extends XSDBaseAdapter
+{
+  public Image getImage()
+  {
+    XSDSchemaDirective object = (XSDSchemaDirective) target;
+    if (object instanceof XSDImport)
+    {
+      return XSDEditorPlugin.getXSDImage("icons/XSDImport.gif");
+    }
+    else if (object instanceof XSDInclude)
+    {
+      return XSDEditorPlugin.getXSDImage("icons/XSDInclude.gif");
+    }
+    else if (object instanceof XSDRedefine)
+    {
+      return XSDEditorPlugin.getXSDImage("icons/XSDRedefine.gif");
+    }
+    return null;
+  }
+
+  public String getText()
+  {
+    XSDSchemaDirective directive = (XSDSchemaDirective) target;
+    String result = directive.getSchemaLocation();
+    if (result == null)
+      result = "(" + XSDEditorPlugin.getXSDString("_UI_LABEL_NO_LOCATION_SPECIFIED") + ")";
+    if (result.equals(""))
+      result = "(" + XSDEditorPlugin.getXSDString("_UI_LABEL_NO_LOCATION_SPECIFIED") + ")";
+    return result;
+
+  }
+
+  public ITreeElement[] getChildren()
+  {
+    List list = new ArrayList();
+    if (target instanceof XSDRedefine)
+    {
+      XSDRedefine redefine = (XSDRedefine) target;
+      for (Iterator i = redefine.getContents().iterator(); i.hasNext();)
+      {
+        XSDRedefineContent redefineContent = (XSDRedefineContent) i.next();
+        if (redefineContent instanceof XSDAttributeGroupDefinition)
+        {
+          list.add((XSDAttributeGroupDefinition) redefine);
+        }
+        else if (redefineContent instanceof XSDModelGroupDefinition)
+        {
+          list.add((XSDModelGroupDefinition) redefineContent);
+        }
+        else if (redefineContent instanceof XSDRedefinableComponent)
+        {
+          XSDRedefinableComponent comp = (XSDRedefinableComponent) redefineContent;
+          if (comp instanceof XSDAttributeGroupDefinition)
+          {
+            list.add((XSDAttributeGroupDefinition) comp);
+          }
+          else if (comp instanceof XSDModelGroupDefinition)
+          {
+            list.add((XSDModelGroupDefinition) comp);
+          }
+          else if (comp instanceof XSDComplexTypeDefinition)
+          {
+            list.add((XSDComplexTypeDefinition) comp);
+          }
+          else if (comp instanceof XSDSimpleTypeDefinition)
+          {
+            list.add((XSDSimpleTypeDefinition) comp);
+          }
+        }
+        else if (redefineContent instanceof XSDComplexTypeDefinition)
+        {
+          list.add((XSDComplexTypeDefinition) redefineContent);
+        }
+        else if (redefineContent instanceof XSDSimpleTypeDefinition)
+        {
+          list.add((XSDSimpleTypeDefinition) redefineContent);
+        }
+      }
+
+    }
+    List adapterList = new ArrayList();
+    populateAdapterList(list, adapterList);
+    return (ITreeElement[]) adapterList.toArray(new ITreeElement[0]);
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDSimpleTypeDefinitionAdapter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDSimpleTypeDefinitionAdapter.java
new file mode 100644
index 0000000..ddc67ee
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDSimpleTypeDefinitionAdapter.java
@@ -0,0 +1,163 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.adapters;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.xsd.adt.facade.IType;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+import org.eclipse.xsd.XSDSimpleTypeDefinition;
+import org.eclipse.xsd.XSDVariety;
+import org.eclipse.xsd.util.XSDConstants;
+
+public class XSDSimpleTypeDefinitionAdapter extends XSDTypeDefinitionAdapter implements IType
+{
+  public Image getImage()
+  {
+    XSDSimpleTypeDefinition xsdSimpleTypeDefinition = (XSDSimpleTypeDefinition) target;
+
+    if (xsdSimpleTypeDefinition.getContainer() == null)
+    {
+      return XSDEditorPlugin.getXSDImage("icons/XSDSimpleType.gif");
+    }
+
+    if (XSDVariety.LIST_LITERAL == xsdSimpleTypeDefinition.getVariety())
+    {
+      return XSDEditorPlugin.getPlugin().getIconImage("obj16/smpl_list_obj");
+    }
+    else if (XSDVariety.UNION_LITERAL == xsdSimpleTypeDefinition.getVariety())
+    {
+      return XSDEditorPlugin.getPlugin().getIconImage("obj16/smpl_union_obj");
+    }
+    else if (XSDVariety.ATOMIC_LITERAL == xsdSimpleTypeDefinition.getVariety())
+    {
+      if (xsdSimpleTypeDefinition.getPrimitiveTypeDefinition() != null)
+      {
+        return XSDEditorPlugin.getPlugin().getIconImage("obj16/smpl_restrict_obj");
+      }
+      return XSDEditorPlugin.getXSDImage("icons/XSDSimpleType.gif");
+    }
+    else if (xsdSimpleTypeDefinition.isSetVariety())
+    {
+      return XSDEditorPlugin.getXSDImage("icons/XSDSimpleType.gif");
+    }
+    else
+    {
+      return XSDEditorPlugin.getXSDImage("icons/XSDSimpleType.gif");
+    }
+  }
+  
+  public String getDisplayName()
+  {
+    XSDSimpleTypeDefinition xsdSimpleTypeDefinition = (XSDSimpleTypeDefinition) target;
+    return (xsdSimpleTypeDefinition.getName() == null ? "local type" : xsdSimpleTypeDefinition.getName());
+  }
+
+  public String getText()
+  {
+    return getText(true);
+  }
+
+  public String getText(boolean showType)
+  {
+    XSDSimpleTypeDefinition xsdSimpleTypeDefinition = (XSDSimpleTypeDefinition) target;
+
+    StringBuffer result = new StringBuffer();
+
+    result.append(xsdSimpleTypeDefinition.getName() == null ? "local type" : xsdSimpleTypeDefinition.getName());
+
+    if (showType)
+    {
+      XSDSimpleTypeDefinition baseTypeDefinition = xsdSimpleTypeDefinition.getBaseTypeDefinition();
+      if (baseTypeDefinition != null && XSDVariety.ATOMIC_LITERAL == xsdSimpleTypeDefinition.getVariety())
+      {
+        if (baseTypeDefinition.getName() != null && !xsdSimpleTypeDefinition.getContents().contains(baseTypeDefinition) && !XSDConstants.isAnySimpleType(baseTypeDefinition))
+        {
+          result.append(" : ");
+          result.append(baseTypeDefinition.getQName(xsdSimpleTypeDefinition));
+        }
+      }
+      else
+      {
+        XSDSimpleTypeDefinition itemTypeDefinition = xsdSimpleTypeDefinition.getItemTypeDefinition();
+        if (itemTypeDefinition != null)
+        {
+          if (itemTypeDefinition.getName() != null)
+          {
+            result.append(" : ");
+            result.append(itemTypeDefinition.getQName(xsdSimpleTypeDefinition));
+          }
+        }
+        else
+        {
+          List memberTypeDefinitions = xsdSimpleTypeDefinition.getMemberTypeDefinitions();
+          if (!memberTypeDefinitions.isEmpty())
+          {
+            boolean first = true;
+            for (Iterator members = memberTypeDefinitions.iterator(); members.hasNext();)
+            {
+              XSDSimpleTypeDefinition memberTypeDefinition = (XSDSimpleTypeDefinition) members.next();
+              if (memberTypeDefinition.getName() != null)
+              {
+                if (first)
+                {
+                  result.append(" : ");
+                  first = false;
+                }
+                else
+                {
+                  result.append(" | ");
+                }
+                result.append(memberTypeDefinition.getQName(xsdSimpleTypeDefinition));
+              }
+              else
+              {
+                break;
+              }
+            }
+          }
+          else if (result.length() == 0)
+          {
+            result.append("'absent'");
+          }
+        }
+      }
+    }
+
+    return result.toString();
+  }
+
+  public boolean hasChildren()
+  {
+    return false;
+  }
+  
+  public boolean isComplexType()
+  {
+    return false;
+  }
+
+  public boolean isFocusAllowed()
+  {
+    XSDSimpleTypeDefinition xsdSimpleTypeDefinition = (XSDSimpleTypeDefinition) target;
+    if (XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001.equals(xsdSimpleTypeDefinition.getTargetNamespace()))
+    {
+      return false;
+    }
+    if (xsdSimpleTypeDefinition.getName() == null)
+    {
+      return false;
+    }
+    return true;
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDTypeDefinitionAdapter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDTypeDefinitionAdapter.java
new file mode 100644
index 0000000..74ece93
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDTypeDefinitionAdapter.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.adapters;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.wst.xsd.adt.facade.IType;
+import org.eclipse.xsd.XSDNamedComponent;
+import org.eclipse.xsd.XSDSchema;
+import org.eclipse.xsd.XSDTypeDefinition;
+
+public abstract class XSDTypeDefinitionAdapter extends XSDBaseAdapter implements IType
+{
+  public XSDTypeDefinition getXSDTypeDefinition()
+  {
+    return (XSDTypeDefinition)target;
+  }
+
+  public String getName()
+  {
+    if (getXSDTypeDefinition().eContainer() instanceof XSDSchema)
+    {  
+      return getXSDTypeDefinition().getName();
+    }
+    else 
+    {
+      EObject o = getXSDTypeDefinition().eContainer();
+      if (o instanceof XSDNamedComponent)
+      {
+         XSDNamedComponent ed = (XSDNamedComponent)o;
+         return "(" + ed.getName() + "Type)";               
+      }
+    }
+    return null;
+  }
+
+  public String getQualifier()
+  {
+    return getXSDTypeDefinition().getTargetNamespace();
+  }
+
+  public IType getSuperType()
+  {
+    XSDTypeDefinition td = getXSDTypeDefinition().getBaseType();
+    return td != null ? (IType)XSDAdapterFactory.getInstance().adapt(td) : null;
+  }
+
+  public Command getUpdateNameCommand(String newName)
+  {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  public boolean isComplexType()
+  {
+    return false;
+  }    
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDVisitor.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDVisitor.java
new file mode 100644
index 0000000..208d8b7
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDVisitor.java
@@ -0,0 +1,219 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.adapters;
+
+import java.util.Iterator;
+
+import org.eclipse.xsd.XSDAttributeDeclaration;
+import org.eclipse.xsd.XSDAttributeGroupDefinition;
+import org.eclipse.xsd.XSDAttributeUse;
+import org.eclipse.xsd.XSDComplexTypeContent;
+import org.eclipse.xsd.XSDComplexTypeDefinition;
+import org.eclipse.xsd.XSDElementDeclaration;
+import org.eclipse.xsd.XSDIdentityConstraintDefinition;
+import org.eclipse.xsd.XSDModelGroup;
+import org.eclipse.xsd.XSDModelGroupDefinition;
+import org.eclipse.xsd.XSDNotationDeclaration;
+import org.eclipse.xsd.XSDParticle;
+import org.eclipse.xsd.XSDParticleContent;
+import org.eclipse.xsd.XSDSchema;
+import org.eclipse.xsd.XSDSimpleTypeDefinition;
+import org.eclipse.xsd.XSDTypeDefinition;
+import org.eclipse.xsd.XSDWildcard;
+
+public class XSDVisitor
+{
+  public XSDVisitor()
+  {
+  }
+  
+  protected XSDSchema schema;
+  
+  public void visitSchema(XSDSchema schema)
+  {
+    this.schema = schema;
+    for (Iterator iterator = schema.getAttributeDeclarations().iterator(); iterator.hasNext();)
+    {
+      XSDAttributeDeclaration attr = (XSDAttributeDeclaration) iterator.next();
+      visitAttributeDeclaration(attr);
+    }
+    for (Iterator iterator = schema.getTypeDefinitions().iterator(); iterator.hasNext();)
+    {
+      XSDTypeDefinition type = (XSDTypeDefinition) iterator.next();
+      visitTypeDefinition(type);
+    }
+    for (Iterator iterator = schema.getElementDeclarations().iterator(); iterator.hasNext();)
+    {
+      XSDElementDeclaration element = (XSDElementDeclaration) iterator.next();
+      visitElementDeclaration(element);
+    }
+    for (Iterator iterator = schema.getIdentityConstraintDefinitions().iterator(); iterator.hasNext();)
+    {
+      XSDIdentityConstraintDefinition identityConstraint = (XSDIdentityConstraintDefinition) iterator.next();
+      visitIdentityConstraintDefinition(identityConstraint);
+    }
+    for (Iterator iterator = schema.getModelGroupDefinitions().iterator(); iterator.hasNext();)
+    {
+      XSDModelGroupDefinition modelGroup = (XSDModelGroupDefinition) iterator.next();
+      visitModelGroupDefinition(modelGroup);
+    }
+    for (Iterator iterator = schema.getAttributeGroupDefinitions().iterator(); iterator.hasNext();)
+    {
+      XSDAttributeGroupDefinition attributeGroup = (XSDAttributeGroupDefinition) iterator.next();
+      visitAttributeGroupDefinition(attributeGroup);
+    }
+    for (Iterator iterator = schema.getNotationDeclarations().iterator(); iterator.hasNext();)
+    {
+      XSDNotationDeclaration element = (XSDNotationDeclaration) iterator.next();
+      visitNotationDeclaration(element);
+    }
+    
+  }
+  
+  public void visitAttributeDeclaration(XSDAttributeDeclaration attr)
+  {
+  }
+  
+  public void visitTypeDefinition(XSDTypeDefinition type)
+  {
+    if (type instanceof XSDSimpleTypeDefinition)
+    {
+      visitSimpleTypeDefinition((XSDSimpleTypeDefinition)type);
+    }
+    else if (type instanceof XSDComplexTypeDefinition)
+    {
+      visitComplexTypeDefinition((XSDComplexTypeDefinition)type);
+    }
+  }
+  
+  public void visitElementDeclaration(XSDElementDeclaration element)
+  {
+    if (element.isElementDeclarationReference())
+    {
+      visitElementDeclaration(element.getResolvedElementDeclaration());
+    }
+    else if (element.getAnonymousTypeDefinition() != null)
+    {
+      visitTypeDefinition(element.getAnonymousTypeDefinition());
+    }
+  }
+  
+  public void visitIdentityConstraintDefinition(XSDIdentityConstraintDefinition identityConstraint)
+  {
+  }
+  
+  public void visitModelGroupDefinition(XSDModelGroupDefinition modelGroupDef)
+  {
+    if (!modelGroupDef.isModelGroupDefinitionReference())
+    {
+      if (modelGroupDef.getModelGroup() != null)
+      {
+        visitModelGroup(modelGroupDef.getModelGroup());
+      }
+    }
+    else
+    {
+      XSDModelGroup modelGroup = modelGroupDef.getResolvedModelGroupDefinition().getModelGroup();
+      if (modelGroup != null)
+      {
+        visitModelGroup(modelGroup);
+      }
+    }
+  }
+
+  public void visitAttributeGroupDefinition(XSDAttributeGroupDefinition attributeGroup)
+  {
+    for (Iterator it = attributeGroup.getContents().iterator(); it.hasNext(); )
+    {
+      Object o = it.next();
+      if (o instanceof XSDAttributeUse)
+      {
+        XSDAttributeUse attrUse = (XSDAttributeUse)o;
+        visitAttributeDeclaration(attrUse.getContent());
+      }
+      else if (o instanceof XSDAttributeGroupDefinition)
+      {
+        XSDAttributeGroupDefinition attrGroup = (XSDAttributeGroupDefinition)o;
+        visitAttributeGroupDefinition(attrGroup.getResolvedAttributeGroupDefinition());
+      }
+    }
+  }
+  
+  public void visitNotationDeclaration(XSDNotationDeclaration notation)
+  {
+  }
+  
+  public void visitSimpleTypeDefinition(XSDSimpleTypeDefinition type)
+  {
+  }
+  
+  public void visitComplexTypeContent(XSDSimpleTypeDefinition content)
+  {
+    
+  }
+  
+  public void visitComplexTypeDefinition(XSDComplexTypeDefinition type)
+  {
+    if (type.getContent() != null)
+    {
+      XSDComplexTypeContent complexContent = type.getContent();
+      if (complexContent instanceof XSDSimpleTypeDefinition)
+      {
+        visitComplexTypeContent((XSDSimpleTypeDefinition)complexContent);
+      }
+      else if (complexContent instanceof XSDParticle)
+      {
+        visitParticle((XSDParticle) complexContent);
+      }
+    }
+  }
+  
+  public void visitParticle(XSDParticle particle)
+  {
+    visitParticleContent(particle.getContent());
+  }
+  
+  public void visitParticleContent(XSDParticleContent particleContent)
+  {
+    if (particleContent instanceof XSDModelGroupDefinition)
+    {
+      visitModelGroupDefinition((XSDModelGroupDefinition) particleContent);
+    }
+    else if (particleContent instanceof XSDModelGroup)
+    {
+      visitModelGroup((XSDModelGroup)particleContent);
+    }
+    else if (particleContent instanceof XSDElementDeclaration)
+    {
+      visitElementDeclaration((XSDElementDeclaration)particleContent);
+    }
+    else if (particleContent instanceof XSDWildcard)
+    {
+      visitWildcard((XSDWildcard)particleContent);
+    }
+  }
+  
+  public void visitModelGroup(XSDModelGroup modelGroup)
+  {
+    if (modelGroup.getContents() != null)
+    {
+      for (Iterator iterator = modelGroup.getContents().iterator(); iterator.hasNext();)
+      {
+        XSDParticle particle = (XSDParticle) iterator.next();
+        visitParticle(particle);
+      }
+    }
+  }
+  
+  public void visitWildcard(XSDWildcard wildcard)
+  {
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDVisitorForFields.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDVisitorForFields.java
new file mode 100644
index 0000000..59b236d
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDVisitorForFields.java
@@ -0,0 +1,166 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.adapters;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.xsd.XSDAttributeDeclaration;
+import org.eclipse.xsd.XSDAttributeGroupContent;
+import org.eclipse.xsd.XSDAttributeGroupDefinition;
+import org.eclipse.xsd.XSDAttributeUse;
+import org.eclipse.xsd.XSDComplexTypeDefinition;
+import org.eclipse.xsd.XSDElementDeclaration;
+import org.eclipse.xsd.XSDModelGroup;
+import org.eclipse.xsd.XSDModelGroupDefinition;
+import org.eclipse.xsd.XSDParticle;
+import org.eclipse.xsd.XSDSimpleTypeDefinition;
+
+public class XSDVisitorForFields extends XSDVisitor
+{
+  public XSDVisitorForFields()
+  {
+  }
+
+  public List concreteComponentList = new ArrayList();
+  public List thingsWeNeedToListenTo = new ArrayList();
+  
+  public void visitComplexTypeDefinition(XSDComplexTypeDefinition type)
+  {
+    if (type.getAttributeContents() != null)
+    {
+      for (Iterator iter = type.getAttributeContents().iterator(); iter.hasNext(); )
+      {
+        XSDAttributeGroupContent attrGroupContent = (XSDAttributeGroupContent)iter.next();
+        if (attrGroupContent instanceof XSDAttributeUse)
+        {
+          XSDAttributeUse attrUse = (XSDAttributeUse)attrGroupContent;
+          
+          visitAttributeDeclaration(attrUse.getContent());
+
+//          if (attrUse.getAttributeDeclaration() != attrUse.getContent())
+//          {
+//            visitAttributeDeclaration(attrUse.getContent());
+//          }
+//          else
+//          {
+//            thingsWeNeedToListenTo.add(attrUse.getAttributeDeclaration());
+//            concreteComponentList.add(attrUse.getAttributeDeclaration());
+//          }
+        }
+        else if (attrGroupContent instanceof XSDAttributeGroupDefinition)
+        {
+          XSDAttributeGroupDefinition attrGroup = (XSDAttributeGroupDefinition)attrGroupContent;
+          thingsWeNeedToListenTo.add(attrGroup);
+          if (attrGroup.isAttributeGroupDefinitionReference())
+          {
+            attrGroup = attrGroup.getResolvedAttributeGroupDefinition();
+            visitAttributeGroupDefinition(attrGroup);
+          }
+        }
+      }
+    }   
+    super.visitComplexTypeDefinition(type);
+  }
+  
+  public void visitComplexTypeContent(XSDSimpleTypeDefinition content)
+  {
+    thingsWeNeedToListenTo.add(content);
+    
+    super.visitComplexTypeContent(content);   
+  }
+
+  
+  public void visitModelGroupDefinition(XSDModelGroupDefinition modelGroupDef)
+  {
+    if (modelGroupDef.isModelGroupDefinitionReference())
+    {
+      // if it's a reference we need to listen to the reference incase it changes
+      thingsWeNeedToListenTo.add(modelGroupDef);      
+    }    
+    // listen to definition incase it changes
+    XSDModelGroupDefinition resolvedModelGroupDef = modelGroupDef.getResolvedModelGroupDefinition();
+    thingsWeNeedToListenTo.add(resolvedModelGroupDef);
+    super.visitModelGroupDefinition(modelGroupDef);      
+  }
+  
+  public void visitModelGroup(XSDModelGroup modelGroup)
+  {
+    super.visitModelGroup(modelGroup);
+    thingsWeNeedToListenTo.add(modelGroup); 
+  }
+  
+  public void visitAttributeGroupDefinition(XSDAttributeGroupDefinition attributeGroup)
+  {
+    for (Iterator it = attributeGroup.getContents().iterator(); it.hasNext(); )
+    {
+      Object o = it.next();
+      if (o instanceof XSDAttributeUse)
+      {
+        XSDAttributeUse attributeUse = (XSDAttributeUse)o;
+        concreteComponentList.add(attributeUse.getAttributeDeclaration());
+        thingsWeNeedToListenTo.add(attributeUse.getAttributeDeclaration());
+      }
+      else if (o instanceof XSDAttributeGroupDefinition)
+      {
+        XSDAttributeGroupDefinition attrGroup = (XSDAttributeGroupDefinition)o;
+        thingsWeNeedToListenTo.add(attrGroup);
+        if (attrGroup.isAttributeGroupDefinitionReference())
+        {
+          attrGroup = attrGroup.getResolvedAttributeGroupDefinition();
+          visitAttributeGroupDefinition(attrGroup);
+        }
+      }
+    }
+  }
+  
+  public void visitParticle(XSDParticle particle)
+  {
+    thingsWeNeedToListenTo.add(particle);
+    super.visitParticle(particle);
+  }
+
+  public void visitElementDeclaration(XSDElementDeclaration element)
+  {
+    if (element.isElementDeclarationReference())
+    {
+      thingsWeNeedToListenTo.add(element);
+      thingsWeNeedToListenTo.add(element.getResolvedElementDeclaration());
+      // now, add the reference as a field
+      concreteComponentList.add(element);
+    }
+    else
+    {
+      concreteComponentList.add(element.getResolvedElementDeclaration());
+      // note... we intentionally ommit the call to super.visitElementDeclaration()
+      // since we don't want to delve down deeper than the element      
+    }
+  }
+  
+  public void visitAttributeDeclaration(XSDAttributeDeclaration attr)
+  {
+    if (attr.isAttributeDeclarationReference())
+    {
+      thingsWeNeedToListenTo.add(attr);
+      thingsWeNeedToListenTo.add(attr.getResolvedAttributeDeclaration());
+      concreteComponentList.add(attr);
+    }
+    else
+    {
+      concreteComponentList.add(attr.getResolvedAttributeDeclaration());
+      thingsWeNeedToListenTo.add(attr.getResolvedAttributeDeclaration());
+    }
+  }
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDWildcardAdapter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDWildcardAdapter.java
new file mode 100644
index 0000000..1ab8da8
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/adapters/XSDWildcardAdapter.java
@@ -0,0 +1,106 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.adapters;
+
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+import org.eclipse.xsd.XSDParticle;
+import org.eclipse.xsd.XSDWildcard;
+import org.eclipse.xsd.util.XSDConstants;
+import org.w3c.dom.Element;
+
+public class XSDWildcardAdapter extends XSDBaseAdapter
+{
+
+  public XSDWildcardAdapter()
+  {
+
+  }
+
+  public Image getImage()
+  {
+    XSDWildcard xsdWildcard = (XSDWildcard) target;
+    return XSDEditorPlugin.getXSDImage(xsdWildcard.eContainer() instanceof XSDParticle ? "icons/XSDAny.gif" : "icons/XSDAnyAttribute.gif");
+  }
+
+  public String getText()
+  {
+    XSDWildcard xsdWildcard = (XSDWildcard) target;
+
+    StringBuffer result = new StringBuffer();
+    Element element = xsdWildcard.getElement();
+
+    if (element != null)
+    {
+      result.append(element.getNodeName());
+      boolean hasMinOccurs = element.hasAttribute(XSDConstants.MINOCCURS_ATTRIBUTE);
+      boolean hasMaxOccurs = element.hasAttribute(XSDConstants.MAXOCCURS_ATTRIBUTE);
+
+      if (hasMinOccurs || hasMaxOccurs)
+      {
+        result.append(" ["); //$NON-NLS-1$
+        if (hasMinOccurs)
+        {
+
+          int min = ((XSDParticle) xsdWildcard.getContainer()).getMinOccurs();
+          if (min == XSDParticle.UNBOUNDED)
+          {
+            result.append("*");
+          }
+          else
+          {
+            result.append(String.valueOf(min));
+          }
+        }
+        else
+        // print default
+        {
+          int min = ((XSDParticle) xsdWildcard.getContainer()).getMinOccurs();
+          result.append(String.valueOf(min));
+        }
+        if (hasMaxOccurs)
+        {
+          int max = ((XSDParticle) xsdWildcard.getContainer()).getMaxOccurs();
+          result.append("..");
+          if (max == XSDParticle.UNBOUNDED)
+          {
+            result.append("*");
+          }
+          else
+          {
+            result.append(String.valueOf(max));
+          }
+        }
+        else
+        // print default
+        {
+          result.append("..");
+          int max = ((XSDParticle) xsdWildcard.getContainer()).getMaxOccurs();
+          result.append(String.valueOf(max));
+        }
+        result.append("]");
+      }
+    }
+    return result.toString();
+
+  }
+
+  public boolean hasChildren()
+  {
+    return false;
+  }
+
+  public Object getParent(Object object)
+  {
+    XSDWildcard xsdWildcard = (XSDWildcard) target;
+    return xsdWildcard.getContainer();
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/editparts/AttributeGroupDefinitionEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/editparts/AttributeGroupDefinitionEditPart.java
new file mode 100644
index 0000000..3c48693
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/editparts/AttributeGroupDefinitionEditPart.java
@@ -0,0 +1,112 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.design.editparts;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.xsd.adt.design.editparts.BaseEditPart;
+import org.eclipse.wst.xsd.adt.design.editparts.CenteredConnectionAnchor;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+import org.eclipse.wst.xsd.editor.internal.adapters.XSDAdapterFactory;
+import org.eclipse.wst.xsd.editor.internal.adapters.XSDAttributeGroupDefinitionAdapter;
+import org.eclipse.wst.xsd.editor.internal.adapters.XSDBaseAdapter;
+import org.eclipse.wst.xsd.editor.internal.design.editparts.model.TargetConnectionSpaceFiller;
+import org.eclipse.wst.xsd.editor.internal.design.figures.GenericGroupFigure;
+import org.eclipse.xsd.XSDAttributeGroupContent;
+import org.eclipse.xsd.XSDAttributeGroupDefinition;
+
+public class AttributeGroupDefinitionEditPart extends ConnectableEditPart
+{
+  public static final Image ATTRIBUTE_GROUP_REF_ICON_IMAGE = XSDEditorPlugin.getImageDescriptor("obj16/attributeGroupRef.gif", true).createImage();
+
+  public AttributeGroupDefinitionEditPart()
+  {
+    super();
+  }
+
+  public XSDAttributeGroupDefinition getXSDAttributeGroupDefinition()
+  {
+    if (getModel() instanceof XSDAttributeGroupDefinitionAdapter)
+    {
+      XSDAttributeGroupDefinitionAdapter adapter = (XSDAttributeGroupDefinitionAdapter) getModel();
+      return (XSDAttributeGroupDefinition) adapter.getTarget();
+    }
+//    else if (getModel() instanceof XSDAttributeGroupDefinition)
+//    {
+//      return (XSDAttributeGroupDefinition) getModel();
+//    }
+    return null;
+
+  }
+
+  protected IFigure createFigure()
+  {
+    GenericGroupFigure figure = new GenericGroupFigure();
+    figure.getIconFigure().image = ATTRIBUTE_GROUP_REF_ICON_IMAGE;
+    return figure;
+  }
+
+  protected List getModelChildren()
+  {
+    List list = new ArrayList();
+    
+    XSDAttributeGroupDefinitionAdapter adapter = (XSDAttributeGroupDefinitionAdapter)getModel();
+    XSDAttributeGroupDefinition attributeGroupDefinition = adapter.getXSDAttributeGroupDefinition();
+    Iterator i = attributeGroupDefinition.getResolvedAttributeGroupDefinition().getContents().iterator();
+
+    while (i.hasNext())
+    {
+      XSDAttributeGroupContent attrGroupContent = (XSDAttributeGroupContent) i.next();
+
+      if (attrGroupContent instanceof XSDAttributeGroupDefinition)
+      {
+        list.add(XSDAdapterFactory.getInstance().adapt(attrGroupContent));
+      }
+      else
+      {
+        list.add(new TargetConnectionSpaceFiller((XSDBaseAdapter)getModel()));
+      }
+    }
+    
+    if (list.isEmpty())
+    {
+      list.add(new TargetConnectionSpaceFiller((XSDBaseAdapter)getModel()));
+    }
+
+    return list;
+  }
+
+
+  public ReferenceConnection createConnectionFigure(BaseEditPart child)
+  {
+    ReferenceConnection connectionFigure = new ReferenceConnection();
+
+    connectionFigure.setSourceAnchor(new CenteredConnectionAnchor(((GenericGroupFigure)getFigure()).getIconFigure(), CenteredConnectionAnchor.RIGHT, 0, 0));
+
+    if (child instanceof AttributeGroupDefinitionEditPart)
+    {
+      connectionFigure.setTargetAnchor(new CenteredConnectionAnchor(((AttributeGroupDefinitionEditPart) child).getTargetFigure(), CenteredConnectionAnchor.LEFT, 0, 0));
+    }
+    else if (child instanceof TargetConnectionSpacingFigureEditPart)
+    {
+      TargetConnectionSpacingFigureEditPart elem = (TargetConnectionSpacingFigureEditPart) child;
+      connectionFigure.setTargetAnchor(new CenteredConnectionAnchor(((TargetConnectionSpacingFigureEditPart) child).getFigure(), CenteredConnectionAnchor.LEFT, 0, 0));
+    }
+
+    connectionFigure.setHighlight(false);
+    return connectionFigure;
+  }
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/editparts/ConnectableEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/editparts/ConnectableEditPart.java
new file mode 100644
index 0000000..9d9acf1
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/editparts/ConnectableEditPart.java
@@ -0,0 +1,225 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.design.editparts;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPartFactory;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.LayerConstants;
+import org.eclipse.wst.xsd.adt.design.editparts.BaseEditPart;
+import org.eclipse.wst.xsd.adt.design.editpolicies.ADTSelectionFeedbackEditPolicy;
+import org.eclipse.wst.xsd.editor.internal.adapters.XSDBaseAdapter;
+import org.eclipse.wst.xsd.editor.internal.design.figures.GenericGroupFigure;
+import org.eclipse.wst.xsd.editor.internal.design.figures.IExtendedFigureFactory;
+import org.eclipse.xsd.XSDConcreteComponent;
+
+public abstract class ConnectableEditPart extends BaseEditPart
+{
+  protected ArrayList connectionFigures = new ArrayList();
+  
+  public IExtendedFigureFactory getExtendedFigureFactory()
+  {
+    EditPartFactory factory = getViewer().getEditPartFactory();
+    Assert.isTrue(factory instanceof IExtendedFigureFactory, "EditPartFactory must be an instanceof of IExtendedFigureFactory");    
+    return (IExtendedFigureFactory)factory; 
+  }
+  
+  public ConnectableEditPart()
+  {
+    super();
+  }
+  
+  protected IFigure createFigure()
+  {
+    GenericGroupFigure figure = new GenericGroupFigure();
+    return figure;
+  }
+
+  public XSDConcreteComponent getXSDConcreteComponent()
+  {
+    return (XSDConcreteComponent)((XSDBaseAdapter)getModel()).getTarget();
+  }
+  
+  public List getConnectionFigures()
+  {
+    return connectionFigures;
+  }
+  
+  public abstract ReferenceConnection createConnectionFigure(BaseEditPart child);
+  
+  public void activate()
+  {
+    super.activate();
+    activateConnection();
+  }
+
+  protected void activateConnection()
+  {
+    if (connectionFigures == null)
+    {
+      connectionFigures = new ArrayList();
+    }
+    for (Iterator i = getChildren().iterator(); i.hasNext();)
+    {
+      Object o = i.next();
+      if (o instanceof BaseEditPart)
+      {
+        BaseEditPart g = (BaseEditPart) o;
+        ReferenceConnection figure = createConnectionFigure(g);
+        connectionFigures.add(figure);
+        figure.setPoints(figure.getPoints());
+
+        getLayer(LayerConstants.CONNECTION_LAYER).add(figure);
+      }
+    }
+  }
+  
+  public void deactivate()
+  {
+    super.deactivate();
+    deactivateConnection();
+  }
+
+  protected void deactivateConnection()
+  {
+    // if we have a connection, remove it
+    ReferenceConnection connectionFigure;
+    if (connectionFigures != null && !connectionFigures.isEmpty())
+    {
+      for (Iterator i = connectionFigures.iterator(); i.hasNext();)
+      {
+        connectionFigure = (ReferenceConnection) i.next();
+
+        if (getLayer(LayerConstants.CONNECTION_LAYER).getChildren().contains(connectionFigure))
+        {
+          getLayer(LayerConstants.CONNECTION_LAYER).remove(connectionFigure);
+        }
+      }
+      connectionFigures = null;
+    }
+  }
+
+  public void refresh()
+  {
+    super.refresh();
+    refreshConnection();
+  }
+
+  protected void refreshConnection()
+  {
+    if (!isActive())
+      return;
+
+    if (connectionFigures == null || connectionFigures.isEmpty())
+    {
+      activateConnection();
+    }
+    else
+    {
+      deactivateConnection();
+      activateConnection();
+    }
+  }
+  
+  RectangleFigure selectionFeedbackFigure;
+  public void addFeedback()
+  {
+    ReferenceConnection connectionFigure;
+    if (connectionFigures != null && !connectionFigures.isEmpty())
+    {
+      for (Iterator i = connectionFigures.iterator(); i.hasNext();)
+      {
+        connectionFigure = (ReferenceConnection) i.next();
+        connectionFigure.setHighlight(true);
+      }
+    }
+    GenericGroupFigure figure = (GenericGroupFigure)getFigure();
+    Rectangle r = figure.getIconFigure().getBounds();
+    Rectangle zoomedRect = getZoomedBounds(r);
+    selectionFeedbackFigure = new RectangleFigure();
+    selectionFeedbackFigure.setForegroundColor(ColorConstants.blue);
+    selectionFeedbackFigure.setBounds(zoomedRect);
+    selectionFeedbackFigure.setFill(false);
+    selectionFeedbackFigure.setOpaque(true);
+    selectionFeedbackFigure.setLineWidth(1);
+    getLayer(LayerConstants.FEEDBACK_LAYER).add(selectionFeedbackFigure);
+  }
+  
+  public void removeFeedback()
+  {
+    ReferenceConnection connectionFigure;
+    if (connectionFigures != null && !connectionFigures.isEmpty())
+    {
+      for (Iterator i = connectionFigures.iterator(); i.hasNext();)
+      {
+        connectionFigure = (ReferenceConnection) i.next();
+        connectionFigure.setHighlight(false);
+      }
+    }
+    if (selectionFeedbackFigure != null)
+    {
+      getLayer(LayerConstants.FEEDBACK_LAYER).remove(selectionFeedbackFigure);
+    }
+    selectionFeedbackFigure = null;
+  }
+  
+  protected void refreshVisuals()
+  {
+    super.refreshVisuals();
+    if (selectionFeedbackFigure != null)
+    {
+      GenericGroupFigure figure = (GenericGroupFigure)getFigure();
+      Rectangle r = figure.getIconFigure().getBounds();
+      Rectangle zoomedRect = getZoomedBounds(r);
+      selectionFeedbackFigure.setBounds(zoomedRect);
+      selectionFeedbackFigure.repaint();
+      selectionFeedbackFigure.revalidate();
+    }
+  }
+
+  protected void createEditPolicies()
+  {
+    installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new ADTSelectionFeedbackEditPolicy());
+  }
+
+  protected void addChildVisual(EditPart childEditPart, int index)
+  {
+    IFigure child = ((GraphicalEditPart) childEditPart).getFigure();
+    getContentPane().add(child, index);
+  }
+
+  protected void removeChildVisual(EditPart childEditPart)
+  {
+    IFigure child = ((GraphicalEditPart) childEditPart).getFigure();
+    getContentPane().remove(child);
+  }
+  
+  public IFigure getContentPane()
+  {
+    return ((GenericGroupFigure)getFigure()).getContentFigure();
+  }
+
+  public Figure getTargetFigure()
+  {
+    return ((GenericGroupFigure)getFigure()).getTargetFigure();
+  }
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/editparts/ModelGroupDefinitionReferenceEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/editparts/ModelGroupDefinitionReferenceEditPart.java
new file mode 100644
index 0000000..33c4989
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/editparts/ModelGroupDefinitionReferenceEditPart.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.design.editparts;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.xsd.adt.design.editparts.BaseEditPart;
+import org.eclipse.wst.xsd.adt.design.editparts.CenteredConnectionAnchor;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+import org.eclipse.wst.xsd.editor.internal.adapters.XSDAdapterFactory;
+import org.eclipse.wst.xsd.editor.internal.adapters.XSDModelGroupDefinitionAdapter;
+import org.eclipse.wst.xsd.editor.internal.design.figures.GenericGroupFigure;
+import org.eclipse.xsd.XSDModelGroup;
+import org.eclipse.xsd.XSDModelGroupDefinition;
+
+public class ModelGroupDefinitionReferenceEditPart extends ConnectableEditPart
+{
+  public static final Image image = XSDEditorPlugin.getImageDescriptor("XSDGroupRef.gif", true).createImage();
+
+  public ModelGroupDefinitionReferenceEditPart()
+  {
+    super();
+  }
+
+  protected IFigure createFigure()
+  {
+    GenericGroupFigure figure = new GenericGroupFigure();
+    figure.getIconFigure().image = image;
+    return figure;
+  }
+
+  protected List getModelChildren()
+  {
+    List list = new ArrayList();
+
+    XSDModelGroupDefinitionAdapter adapter = (XSDModelGroupDefinitionAdapter)getModel();
+    XSDModelGroup xsdModelGroup = ((XSDModelGroupDefinition) adapter.getTarget()).getResolvedModelGroupDefinition().getModelGroup();
+    if (xsdModelGroup != null)
+      list.add(XSDAdapterFactory.getInstance().adapt(xsdModelGroup));
+    return list;
+  }
+
+  public ReferenceConnection createConnectionFigure(BaseEditPart child)
+  {
+    ReferenceConnection connectionFigure = new ReferenceConnection();
+
+    connectionFigure.setSourceAnchor(new CenteredConnectionAnchor(((GenericGroupFigure)getFigure()).getIconFigure(), CenteredConnectionAnchor.RIGHT, 0, 0));
+
+    if (child instanceof ModelGroupEditPart)
+    {
+      connectionFigure.setTargetAnchor(new CenteredConnectionAnchor(((ModelGroupEditPart) child).getTargetFigure(), CenteredConnectionAnchor.LEFT, 0, 0));
+    }
+    connectionFigure.setHighlight(false);
+    return connectionFigure;
+  }
+
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/editparts/ModelGroupEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/editparts/ModelGroupEditPart.java
new file mode 100644
index 0000000..d0d299e
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/editparts/ModelGroupEditPart.java
@@ -0,0 +1,186 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.design.editparts;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.wst.xsd.adt.design.editparts.BaseEditPart;
+import org.eclipse.wst.xsd.adt.design.editparts.CenteredConnectionAnchor;
+import org.eclipse.wst.xsd.editor.internal.adapters.XSDAdapterFactory;
+import org.eclipse.wst.xsd.editor.internal.adapters.XSDBaseAdapter;
+import org.eclipse.wst.xsd.editor.internal.adapters.XSDModelGroupAdapter;
+import org.eclipse.wst.xsd.editor.internal.design.editparts.model.TargetConnectionSpaceFiller;
+import org.eclipse.wst.xsd.editor.internal.design.figures.GenericGroupFigure;
+import org.eclipse.wst.xsd.editor.internal.design.figures.ModelGroupFigure;
+import org.eclipse.xsd.XSDCompositor;
+import org.eclipse.xsd.XSDElementDeclaration;
+import org.eclipse.xsd.XSDModelGroup;
+import org.eclipse.xsd.XSDModelGroupDefinition;
+import org.eclipse.xsd.XSDParticle;
+
+public class ModelGroupEditPart extends ConnectableEditPart
+{
+  protected IFigure createFigure()
+  {
+    return getExtendedFigureFactory().createModelGroupFigure(getModel());
+  }
+  
+  public XSDParticle getXSDParticle()
+  {
+    Object o = getXSDModelGroup().getContainer();
+    return (o instanceof XSDParticle) ? (XSDParticle) o : null;
+  }
+
+  public XSDModelGroup getXSDModelGroup()
+  {
+    if (getModel() instanceof XSDModelGroupAdapter)
+    {
+      XSDModelGroupAdapter adapter = (XSDModelGroupAdapter) getModel();
+      return (XSDModelGroup) adapter.getTarget();
+    }
+//    else if (getModel() instanceof XSDModelGroup)
+//    {
+//      return (XSDModelGroup) getModel();
+//    }
+    return null;
+
+  }
+
+  
+  
+  protected void refreshVisuals()
+  {
+    String iconName = "icons/newSequence.gif";
+    GenericGroupFigure modelGroupFigure = (GenericGroupFigure)getFigure();
+    switch (getXSDModelGroup().getCompositor().getValue())
+    {
+      case XSDCompositor.ALL:
+      {
+        modelGroupFigure.getIconFigure().image = ModelGroupFigure.ALL_ICON_IMAGE;
+        break;
+      }
+      case XSDCompositor.CHOICE:
+      {
+        modelGroupFigure.getIconFigure().image = ModelGroupFigure.CHOICE_ICON_IMAGE;
+        break;
+      }
+      case XSDCompositor.SEQUENCE:
+      {
+        modelGroupFigure.getIconFigure().image = ModelGroupFigure.SEQUENCE_ICON_IMAGE;
+        break;
+      }
+    }
+
+    XSDModelGroupAdapter adapter = (XSDModelGroupAdapter) getModel();
+//    String occurenceDescription = adapter.getNameAnnotationToolTipString();
+//    modelGroupFigure.getIconFigure().setToolTip(occurenceDescription);
+
+    // TODO: commmon this up with XSDParticleAdapter's code
+    
+    // -2 means the user didn't specify (so the default is 1)
+    int minOccurs = adapter.getMinOccurs();
+    int maxOccurs = adapter.getMaxOccurs();
+    String occurenceDescription = "";
+    
+    if (minOccurs == -3 && maxOccurs == -3)
+    {
+      occurenceDescription = "";
+    }
+    else if (minOccurs == 0 && (maxOccurs == -2 || maxOccurs == 1))
+    {
+      occurenceDescription = "[0..1]";
+    }
+    else if ((minOccurs == 1 && maxOccurs == 1) ||
+             (minOccurs == -2 && maxOccurs == 1) ||
+             (minOccurs == 1 && maxOccurs == -2))
+    {
+      occurenceDescription = "[1..1]";
+    }
+    else if (minOccurs == -2 && maxOccurs == -2)
+    {
+      occurenceDescription = "";
+    }
+    else
+    {
+      if (maxOccurs == -2) maxOccurs = 1;
+      String maxSymbol = maxOccurs == -1 ? "*" : "" + maxOccurs;
+      
+      String minSymbol = minOccurs == -2 ? "1" : "" + minOccurs;
+      occurenceDescription = "[" + minSymbol + ".." + maxSymbol + "]";
+    }
+
+    modelGroupFigure.getIconFigure().setToolTipText(occurenceDescription);
+    modelGroupFigure.getIconFigure().repaint();
+
+    refreshConnection();
+  }
+
+  protected List getModelChildren()
+  {
+    List list = new ArrayList();
+    XSDModelGroup xsdModelGroup = getXSDModelGroup();
+    for (Iterator i = xsdModelGroup.getContents().iterator(); i.hasNext();)
+    {
+      XSDParticle next = (XSDParticle) i.next();
+      if (next.getContent() instanceof XSDElementDeclaration)
+      {
+        XSDElementDeclaration elementDeclaration = (XSDElementDeclaration) next.getContent();
+        Adapter adapter = XSDAdapterFactory.getInstance().adapt(elementDeclaration);
+        list.add(new TargetConnectionSpaceFiller((XSDBaseAdapter)adapter));
+      }
+      if (next.getContent() instanceof XSDModelGroupDefinition)
+      {
+        XSDModelGroupDefinition def = (XSDModelGroupDefinition) next.getContent();
+        Adapter adapter = XSDAdapterFactory.getInstance().adapt(def);
+        list.add(adapter);
+      }
+      else if (next.getTerm() instanceof XSDModelGroup)
+      {
+        XSDModelGroup modelGroup = (XSDModelGroup) next.getTerm();
+        Adapter adapter = XSDAdapterFactory.getInstance().adapt(modelGroup);
+        list.add(adapter);
+      }
+    }
+
+    if (list.size() == 0)
+      list.add(new TargetConnectionSpaceFiller(null));
+
+    return list;
+  }
+
+  public ReferenceConnection createConnectionFigure(BaseEditPart child)
+  {
+    ReferenceConnection connectionFigure = new ReferenceConnection();
+    GenericGroupFigure modelGroupFigure = (GenericGroupFigure)getFigure();
+    connectionFigure.setSourceAnchor(new CenteredConnectionAnchor(modelGroupFigure.getIconFigure(), CenteredConnectionAnchor.RIGHT, 0, 0));
+
+    if (child instanceof ModelGroupEditPart)
+    {
+      connectionFigure.setTargetAnchor(new CenteredConnectionAnchor(((ModelGroupEditPart) child).getTargetFigure(), CenteredConnectionAnchor.LEFT, 0, 0));
+    }
+    else if (child instanceof TargetConnectionSpacingFigureEditPart)
+    {
+      TargetConnectionSpacingFigureEditPart elem = (TargetConnectionSpacingFigureEditPart) child;
+      connectionFigure.setTargetAnchor(new CenteredConnectionAnchor(elem.getFigure(), CenteredConnectionAnchor.LEFT, 0, 0));
+    }
+    else if (child instanceof ModelGroupDefinitionReferenceEditPart)
+    {
+      ModelGroupDefinitionReferenceEditPart elem = (ModelGroupDefinitionReferenceEditPart) child;
+      connectionFigure.setTargetAnchor(new CenteredConnectionAnchor(elem.getFigure(), CenteredConnectionAnchor.LEFT, 0, 0));
+    }
+    connectionFigure.setHighlight(false);
+    return connectionFigure;
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/editparts/ReferenceConnection.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/editparts/ReferenceConnection.java
new file mode 100644
index 0000000..009bff2
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/editparts/ReferenceConnection.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.design.editparts;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.ConnectionRouter;
+import org.eclipse.draw2d.PolylineConnection;
+import org.eclipse.swt.graphics.Color;
+
+public class ReferenceConnection extends PolylineConnection
+{
+  protected boolean highlight = false;
+
+  protected static final Color activeConnection = ColorConstants.black;
+  protected static final Color inactiveConnection = new Color(null, 198, 195, 198);
+
+  public ReferenceConnection()
+  {
+    super();
+    setConnectionRouter(new XSDModelGroupRouter());
+  }
+
+  public void setConnectionRouter(ConnectionRouter cr)
+  {
+    if (cr != null && getConnectionRouter() != null && !(getConnectionRouter() instanceof XSDModelGroupRouter))
+      super.setConnectionRouter(cr);
+  }
+
+  public boolean isHighlighted()
+  {
+    return highlight;
+  }
+
+  public void setHighlight(boolean highlight)
+  {
+    this.highlight = highlight;
+    setForegroundColor(highlight ? activeConnection : inactiveConnection);
+    setOpaque(highlight);
+  }
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/editparts/SpaceFillerForFieldEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/editparts/SpaceFillerForFieldEditPart.java
new file mode 100644
index 0000000..41cfa23
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/editparts/SpaceFillerForFieldEditPart.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.design.editparts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.MarginBorder;
+import org.eclipse.wst.xsd.adt.design.editparts.BaseEditPart;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+
+public class SpaceFillerForFieldEditPart extends BaseEditPart
+{
+  Label space;
+  public SpaceFillerForFieldEditPart()
+  {
+    super();
+  }
+
+  protected IFigure createFigure()
+  {
+    space = new Label("");
+    space.setIcon(XSDEditorPlugin.getXSDImage("icons/Dot.gif"));
+    space.setBorder(new MarginBorder(3, 0, 3, 0));
+    return space;
+  }
+
+  protected void refreshVisuals()
+  {
+  }
+
+  protected void createEditPolicies()
+  {
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/editparts/TargetConnectionSpacingFigureEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/editparts/TargetConnectionSpacingFigureEditPart.java
new file mode 100644
index 0000000..c26537d
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/editparts/TargetConnectionSpacingFigureEditPart.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.design.editparts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.wst.xsd.adt.design.editparts.BaseEditPart;
+import org.eclipse.wst.xsd.editor.internal.design.figures.SpacingFigure;
+
+public class TargetConnectionSpacingFigureEditPart extends BaseEditPart
+{
+  public TargetConnectionSpacingFigureEditPart()
+  {
+    super();
+  }
+
+  SpacingFigure figure;
+
+  protected IFigure createFigure()
+  {
+    figure = new SpacingFigure();
+    return figure;
+  }
+
+  public IFigure getConnectionFigure()
+  {
+    return figure;
+  }
+
+  protected void createEditPolicies()
+  {
+
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/editparts/XSDAttributesForAnnotationEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/editparts/XSDAttributesForAnnotationEditPart.java
new file mode 100644
index 0000000..f7f17f5
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/editparts/XSDAttributesForAnnotationEditPart.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.design.editparts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.ToolbarLayout;
+import org.eclipse.wst.xsd.adt.design.editparts.BaseEditPart;
+import org.eclipse.wst.xsd.adt.design.editparts.model.Annotation;
+import org.eclipse.wst.xsd.adt.facade.IComplexType;
+import org.eclipse.wst.xsd.adt.facade.IStructure;
+import org.eclipse.wst.xsd.editor.internal.adapters.XSDComplexTypeDefinitionAdapter;
+
+public class XSDAttributesForAnnotationEditPart extends BaseEditPart
+{
+  IComplexType complexType;
+  public XSDAttributesForAnnotationEditPart()
+  {
+    super();
+  }
+
+  protected IFigure createFigure()
+  {
+    Figure fig = new Figure();
+    fig.setLayoutManager(new ToolbarLayout());
+    return fig;
+  }
+
+  protected void createEditPolicies()
+  {
+
+  }
+
+  protected List getModelChildren()
+  {
+    IStructure structure =  ((Annotation)getModel()).getOwner();
+    if (structure instanceof IComplexType)
+    {  
+      complexType = (IComplexType)structure;
+      if (complexType instanceof XSDComplexTypeDefinitionAdapter)
+      {
+        XSDComplexTypeDefinitionAdapter adapter = (XSDComplexTypeDefinitionAdapter) complexType;
+        return adapter.getAttributeGroupContent();
+      }
+    }
+    return Collections.EMPTY_LIST;
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/editparts/XSDBaseFieldEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/editparts/XSDBaseFieldEditPart.java
new file mode 100644
index 0000000..58c7f21
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/editparts/XSDBaseFieldEditPart.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.design.editparts;
+
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.wst.xsd.adt.design.IAnnotationProvider;
+import org.eclipse.wst.xsd.adt.design.editparts.BaseFieldEditPart;
+import org.eclipse.wst.xsd.adt.design.figures.IFieldFigure;
+import org.eclipse.wst.xsd.adt.facade.IField;
+import org.eclipse.wst.xsd.adt.outline.ITreeElement;
+
+public class XSDBaseFieldEditPart extends BaseFieldEditPart
+{
+
+  public XSDBaseFieldEditPart()
+  {
+    super();
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.gef.editparts.AbstractEditPart#refreshVisuals()
+   */
+  protected void refreshVisuals()
+  {
+    IFieldFigure figure = getFieldFigure();
+    IField field = (IField) getModel();
+    
+    figure.getNameLabel().setText(field.getName());
+    figure.getTypeLabel().setText(field.getTypeName());
+    figure.refreshVisuals(getModel());
+
+    String occurrenceDescription = "";
+    if (field instanceof IAnnotationProvider)
+    {
+      occurrenceDescription = ((IAnnotationProvider)field).getNameAnnotationString();
+    }
+    
+    figure.getNameAnnotationLabel().setText(occurrenceDescription);
+    
+    figure.recomputeLayout();
+
+    // our model implements ITreeElement
+    if (getModel() instanceof ITreeElement)
+    {
+      figure.getNameLabel().setIcon(((ITreeElement)getModel()).getImage());
+    }
+
+    if (getRoot() != null)
+      ((GraphicalEditPart)getRoot()).getFigure().invalidateTree();
+  }
+
+  public void addNotify()
+  {
+    super.addNotify();
+    getFieldFigure().editPartAttached(this);
+  }
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/editparts/XSDEditPartFactory.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/editparts/XSDEditPartFactory.java
new file mode 100644
index 0000000..561bb40
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/editparts/XSDEditPartFactory.java
@@ -0,0 +1,141 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.design.editparts;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.wst.xsd.adt.design.editparts.ADTEditPartFactory;
+import org.eclipse.wst.xsd.adt.design.editparts.ColumnEditPart;
+import org.eclipse.wst.xsd.adt.design.editparts.CompartmentEditPart;
+import org.eclipse.wst.xsd.adt.design.editparts.model.Annotation;
+import org.eclipse.wst.xsd.adt.design.figures.ICompartmentFigure;
+import org.eclipse.wst.xsd.adt.design.figures.IFieldFigure;
+import org.eclipse.wst.xsd.adt.design.figures.IStructureFigure;
+import org.eclipse.wst.xsd.adt.facade.IField;
+import org.eclipse.wst.xsd.adt.typeviz.design.figures.TypeVizFigureFactory;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+import org.eclipse.wst.xsd.editor.internal.adapters.XSDAttributeGroupDefinitionAdapter;
+import org.eclipse.wst.xsd.editor.internal.adapters.XSDModelGroupAdapter;
+import org.eclipse.wst.xsd.editor.internal.adapters.XSDModelGroupDefinitionAdapter;
+import org.eclipse.wst.xsd.editor.internal.adapters.XSDSimpleTypeDefinitionAdapter;
+import org.eclipse.wst.xsd.editor.internal.design.editparts.model.SpaceFiller;
+import org.eclipse.wst.xsd.editor.internal.design.editparts.model.TargetConnectionSpaceFiller;
+import org.eclipse.wst.xsd.editor.internal.design.figures.IExtendedFigureFactory;
+import org.eclipse.wst.xsd.editor.internal.design.figures.IModelGroupFigure;
+
+public class XSDEditPartFactory extends ADTEditPartFactory implements IExtendedFigureFactory
+{
+  protected IExtendedFigureFactory delegate;
+  
+  public XSDEditPartFactory()
+  {
+    delegate = XSDEditorPlugin.getPlugin().getXSDEditorConfiguration().getFigureFactory();
+    if (delegate == null)
+      delegate = new TypeVizFigureFactory();
+  }
+
+  public EditPart createEditPart(EditPart context, Object model)
+  {
+    EditPart child = null;
+    // Override edit part where desired
+    
+    if (model instanceof IField)
+    {
+      if (model instanceof SpaceFiller)
+      {
+        child = new SpaceFillerForFieldEditPart();
+      }
+      else if (context instanceof CompartmentEditPart)
+      {  
+        child = new XSDBaseFieldEditPart();
+      }
+    }
+    else if (model instanceof XSDSimpleTypeDefinitionAdapter)
+    {
+      child = new XSDSimpleTypeEditPart();
+    }
+    else if (model instanceof XSDModelGroupAdapter)
+    {
+      child = new ModelGroupEditPart();
+    }
+    else if (model instanceof Annotation)
+    {
+      Annotation annotation = (Annotation) model;
+      String kind = annotation.getCompartment().getKind();
+      if (kind.equals("element"))
+      {
+        child = new XSDGroupsForAnnotationEditPart();
+      }
+      else if (kind.equals("attribute"))
+      {
+        child = new XSDAttributesForAnnotationEditPart();
+      }
+    }
+    else if (!(context instanceof ColumnEditPart))
+    {   
+      if (model instanceof TargetConnectionSpaceFiller)
+      {
+        child = new TargetConnectionSpacingFigureEditPart();
+      }
+      else if (model instanceof XSDModelGroupDefinitionAdapter)
+      {
+        child = new ModelGroupDefinitionReferenceEditPart();
+      }
+      else if (model instanceof XSDAttributeGroupDefinitionAdapter)
+      {
+        child = new AttributeGroupDefinitionEditPart();
+      }
+    }
+    // if we don't have a specialzied XSD edit part to create
+    // then we simply call the super class to create a generic ADT edit part
+    //
+    if (child == null)
+    {
+      child = super.createEditPart(context, model);
+    }
+
+    // if at this this point we have not created an edit part we simply
+    // create a placeholder edit part to provide the most robust behaviour possible
+    //    
+    if (child == null)
+    {
+      // TODO (cs) log an error message here, since we shouldn't really get here 
+      child = new SpaceFillerForFieldEditPart();
+    }  
+
+    child.setModel(model);
+    return child;
+  }
+
+  protected void checkChild(EditPart child, Object model)
+  {
+    // do nothing since we have contribute our own editparts to the facade
+  }
+
+  public ICompartmentFigure createCompartmentFigure(Object model)
+  {
+    return delegate.createCompartmentFigure(model);
+  }
+  
+  public IStructureFigure createStructureFigure(Object model)
+  {
+    return delegate.createStructureFigure(model);
+  }  
+
+  public IFieldFigure createFieldFigure(Object model)
+  {
+    return delegate.createFieldFigure(model);
+  }
+  
+  public IModelGroupFigure createModelGroupFigure(Object model)
+  {
+    return delegate.createModelGroupFigure(model);
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/editparts/XSDGroupsForAnnotationEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/editparts/XSDGroupsForAnnotationEditPart.java
new file mode 100644
index 0000000..e981285
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/editparts/XSDGroupsForAnnotationEditPart.java
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.design.editparts;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.ToolbarLayout;
+import org.eclipse.wst.xsd.adt.design.editparts.BaseEditPart;
+import org.eclipse.wst.xsd.adt.design.editparts.model.Annotation;
+import org.eclipse.wst.xsd.adt.facade.IComplexType;
+import org.eclipse.wst.xsd.adt.facade.IStructure;
+import org.eclipse.wst.xsd.editor.internal.adapters.XSDComplexTypeDefinitionAdapter;
+import org.eclipse.wst.xsd.editor.internal.adapters.XSDAdapterFactory;
+import org.eclipse.wst.xsd.editor.internal.adapters.XSDModelGroupDefinitionAdapter;
+import org.eclipse.xsd.XSDModelGroup;
+import org.eclipse.xsd.XSDModelGroupDefinition;
+
+public class XSDGroupsForAnnotationEditPart extends BaseEditPart
+{
+  IComplexType complexType;
+  public XSDGroupsForAnnotationEditPart()
+  {
+    super();
+  }
+
+  protected IFigure createFigure()
+  {
+    Figure fig = new Figure();
+    fig.setLayoutManager(new ToolbarLayout());
+    return fig;
+  }
+
+  protected void createEditPolicies()
+  {
+
+  }
+
+  protected List getModelChildren()
+  {
+    List xsdModelGroupList = new ArrayList();
+    List adapterList = new ArrayList();
+    
+    IStructure structure =  ((Annotation)getModel()).getOwner();
+    if (structure instanceof IComplexType)
+    {  
+      complexType = (IComplexType)structure;
+      if (complexType instanceof XSDComplexTypeDefinitionAdapter)
+      {
+        XSDComplexTypeDefinitionAdapter adapter = (XSDComplexTypeDefinitionAdapter) complexType;
+        xsdModelGroupList = adapter.getModelGroups();
+      }
+      
+      for (Iterator i = xsdModelGroupList.iterator(); i.hasNext(); )
+      {
+        Object obj = i.next();
+        if (obj instanceof XSDModelGroup)
+        {
+          adapterList.add(XSDAdapterFactory.getInstance().adapt((XSDModelGroup)obj));
+        }
+        else if (obj instanceof XSDModelGroupDefinition)
+        {
+          adapterList.add(XSDAdapterFactory.getInstance().adapt((XSDModelGroupDefinition)obj));
+        }
+      }
+    }
+    else if (structure instanceof XSDModelGroupDefinitionAdapter)
+    {
+      XSDModelGroupDefinitionAdapter adapter = (XSDModelGroupDefinitionAdapter) structure;
+      XSDModelGroup group = adapter.getXSDModelGroupDefinition().getModelGroup();
+      if (group != null)
+      {
+        adapterList.add(XSDAdapterFactory.getInstance().adapt(group));
+      }
+    }
+    
+    return adapterList;
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/editparts/XSDModelGroupRouter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/editparts/XSDModelGroupRouter.java
new file mode 100644
index 0000000..29e8098
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/editparts/XSDModelGroupRouter.java
@@ -0,0 +1,379 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.design.editparts;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.draw2d.AbstractRouter;
+import org.eclipse.draw2d.Connection;
+import org.eclipse.draw2d.ConnectionAnchor;
+import org.eclipse.draw2d.ConnectionRouter;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.PointList;
+import org.eclipse.draw2d.geometry.Ray;
+import org.eclipse.draw2d.geometry.Rectangle;
+
+// TODO Manhattan connection router is final
+public class XSDModelGroupRouter extends AbstractRouter
+{
+  public XSDModelGroupRouter()
+  {
+    super();
+  }
+  private Map rowsUsed = new HashMap();
+  private Map colsUsed = new HashMap();
+
+  private Map reservedInfo = new HashMap();
+
+  private class ReservedInfo {
+    public List reservedRows = new ArrayList(2);
+    public List reservedCols = new ArrayList(2);
+  }
+
+  private static Ray  UP    = new Ray(0, -1),
+              DOWN  = new Ray(0, 1),
+              LEFT  = new Ray(-1, 0),
+              RIGHT = new Ray(1, 0);
+
+
+  /**
+   * @see ConnectionRouter#invalidate(Connection)
+   */
+  public void invalidate(Connection connection) {
+    removeReservedLines(connection);
+  }
+
+  private int getColumnNear(Connection connection, int r, int n, int x) {
+    int min = Math.min(n, x),
+      max = Math.max(n, x);
+    if (min > r) {
+      max = min;
+      min = r - (min - r);
+    }
+    if (max < r) {
+      min = max;
+      max = r + (r - max);
+    }
+    int proximity = 0;
+    int direction = -1;
+    if (r % 2 == 1)
+      r--;
+    Integer i;
+    while (proximity < r) {
+      i = new Integer(r + proximity * direction);
+      if (!colsUsed.containsKey(i)) {
+        colsUsed.put(i, i);
+        reserveColumn(connection, i);
+        return i.intValue();
+      }
+      int j = i.intValue();
+      if (j <= min)
+        return j + 2;
+      if (j >= max)
+        return j - 2;
+      if (direction == 1)
+        direction = -1;
+      else {
+        direction = 1;
+        proximity += 2;
+      }
+    }
+    return r;
+  }
+
+  /**
+   * Returns the direction the point <i>p</i> is in relation to the given rectangle.
+   * Possible values are LEFT (-1,0), RIGHT (1,0), UP (0,-1) and DOWN (0,1).
+   * 
+   * @param r the rectangle
+   * @param p the point
+   * @return the direction from <i>r</i> to <i>p</i>
+   */
+  protected Ray getDirection(Rectangle r, Point p) {
+    int i, distance = Math.abs(r.x - p.x);
+    Ray direction;
+    
+    direction = LEFT;
+
+    i = Math.abs(r.y - p.y);
+    if (i <= distance) {
+      distance = i;
+      direction = UP;
+    }
+
+    i = Math.abs(r.bottom() - p.y);
+    if (i <= distance) {
+      distance = i;
+      direction = DOWN;
+    }
+
+    i = Math.abs(r.right() - p.x);
+    if (i < distance) {
+      distance = i;
+      direction = RIGHT;
+    }
+
+    return direction;
+  }
+
+  protected Ray getEndDirection(Connection conn) {
+    ConnectionAnchor anchor = conn.getTargetAnchor();
+    Point p = getEndPoint(conn);
+    Rectangle rect;
+    if (anchor.getOwner() == null)
+      rect = new Rectangle(p.x - 1, p.y - 1, 2, 2);
+    else {
+      rect = conn.getTargetAnchor().getOwner().getBounds().getCopy();
+      conn.getTargetAnchor().getOwner().translateToAbsolute(rect);
+    }
+    return getDirection(rect, p);
+  }
+
+  protected int getRowNear(Connection connection, int r, int n, int x) {
+    int min = Math.min(n, x),
+      max = Math.max(n, x);
+    if (min > r) {
+      max = min;
+      min = r - (min - r);
+    }
+    if (max < r) {
+      min = max;
+      max = r + (r - max);
+    }
+
+    int proximity = 0;
+    int direction = -1;
+    if (r % 2 == 1)
+      r--;
+    Integer i;
+    while (proximity < r) {
+      i = new Integer(r + proximity * direction);
+      if (!rowsUsed.containsKey(i)) {
+        rowsUsed.put(i, i);
+        reserveRow(connection, i);
+        return i.intValue();
+      }
+      int j = i.intValue();
+      if (j <= min)
+        return j + 2;
+      if (j >= max)
+        return j - 2;
+      if (direction == 1)
+        direction = -1;
+      else {
+        direction = 1;
+        proximity += 2;
+      }
+    }
+    return r;
+  }
+
+  protected Ray getStartDirection(Connection conn) {
+    ConnectionAnchor anchor = conn.getSourceAnchor();
+    Point p = getStartPoint(conn);
+    Rectangle rect;
+    if (anchor.getOwner() == null)
+      rect = new Rectangle(p.x - 1, p.y - 1, 2, 2);
+    else {
+      rect = conn.getSourceAnchor().getOwner().getBounds().getCopy();
+      conn.getSourceAnchor().getOwner().translateToAbsolute(rect);
+    }
+    return getDirection(rect, p);
+  }
+
+  protected void processPositions(Ray start, Ray end, List positions, 
+                    boolean horizontal, Connection conn) {
+    removeReservedLines(conn);
+
+    int pos[] = new int[positions.size() + 2];
+    if (horizontal)
+      pos[0] = start.x;
+    else
+      pos[0] = start.y;
+    int i;
+    for (i = 0; i < positions.size(); i++) {
+      pos[i + 1] = ((Integer)positions.get(i)).intValue();
+    }
+    if (horizontal == (positions.size() % 2 == 1))
+      pos[++i] = end.x;
+    else
+      pos[++i] = end.y;
+
+    PointList points = new PointList();
+    points.addPoint(new Point(start.x, start.y));
+    Point p;
+    int current, prev, min, max;
+    boolean adjust;
+    for (i = 2; i < pos.length - 1; i++) {
+      horizontal = !horizontal;
+      prev = pos[i - 1];
+      current = pos[i];
+
+      adjust = (i != pos.length - 2);
+      if (horizontal) {
+        if (adjust) {
+          min = pos[i - 2];
+          max = pos[i + 2];
+          pos[i] = current = getRowNear(conn, current, min, max);
+        }
+        p = new Point(prev, current);
+      } else {
+        if (adjust) {
+          min = pos[i - 2];
+          max = pos[i + 2];
+          pos[i] = current = getColumnNear(conn, current, min, max);
+        }
+        p = new Point(current, prev);
+      }
+      points.addPoint(p);
+    }
+    points.addPoint(new Point(end.x, end.y));
+    conn.setPoints(points);
+  }
+
+  /**
+   * @see ConnectionRouter#remove(Connection)
+   */
+  public void remove(Connection connection) {
+    removeReservedLines(connection);
+  }
+
+  protected void removeReservedLines(Connection connection) {
+    ReservedInfo rInfo = (ReservedInfo) reservedInfo.get(connection);
+    if (rInfo == null) 
+      return;
+    
+    for (int i = 0; i < rInfo.reservedRows.size(); i++) {
+      rowsUsed.remove(rInfo.reservedRows.get(i));
+    }
+    for (int i = 0; i < rInfo.reservedCols.size(); i++) {
+      colsUsed.remove(rInfo.reservedCols.get(i));
+    }
+    reservedInfo.remove(connection);
+  }
+
+  protected void reserveColumn(Connection connection, Integer column) {
+    ReservedInfo info = (ReservedInfo) reservedInfo.get(connection);
+    if (info == null) {
+      info = new ReservedInfo();
+      reservedInfo.put(connection, info);
+    }
+    info.reservedCols.add(column);
+  }
+
+  protected void reserveRow(Connection connection, Integer row) {
+    ReservedInfo info = (ReservedInfo) reservedInfo.get(connection);
+    if (info == null) {
+      info = new ReservedInfo();
+      reservedInfo.put(connection, info);
+    }
+    info.reservedRows.add(row);
+  }
+
+  /**
+   * @see ConnectionRouter#route(Connection)
+   */
+  public void route(Connection conn) {
+    if ((conn.getSourceAnchor() == null) || (conn.getTargetAnchor() == null)) 
+      return;
+    int i;
+    Point startPoint = getStartPoint(conn);
+    conn.translateToRelative(startPoint);
+    Point endPoint = getEndPoint(conn);
+    conn.translateToRelative(endPoint);
+
+    Ray start = new Ray(startPoint);
+    Ray end = new Ray(endPoint);
+    Ray average = new Ray(startPoint.x + 2, startPoint.y); // start.getAveraged(end);
+
+    Ray direction = new Ray(start, end);
+    Ray startNormal = getStartDirection(conn);
+    Ray endNormal   = getEndDirection(conn);
+
+    List positions = new ArrayList(5);
+    boolean horizontal = startNormal.isHorizontal();
+    if (horizontal) 
+      positions.add(new Integer(start.y));
+    else
+      positions.add(new Integer(start.x));
+    horizontal = !horizontal;
+
+    if (startNormal.dotProduct(endNormal) == 0) {
+      if ((startNormal.dotProduct(direction) >= 0) 
+        && (endNormal.dotProduct(direction) <= 0)) {
+        // 0
+      } else {
+        // 2
+        if (startNormal.dotProduct(direction) < 0)
+          i = startNormal.similarity(start.getAdded(startNormal.getScaled(10)));
+        else {
+          if (horizontal) 
+            i = average.y;
+          else 
+            i = average.x;
+        }
+        positions.add(new Integer(i));
+        horizontal = !horizontal;
+
+        if (endNormal.dotProduct(direction) > 0)
+          i = endNormal.similarity(end.getAdded(endNormal.getScaled(10)));
+        else {
+          if (horizontal) 
+            i = average.y;
+          else 
+            i = average.x;
+        }
+        positions.add(new Integer(i));
+        horizontal = !horizontal;
+      }
+    } else {
+      if (startNormal.dotProduct(endNormal) > 0) {
+        //1
+        if (startNormal.dotProduct(direction) >= 0)
+          i = startNormal.similarity(start.getAdded(startNormal.getScaled(10)));
+        else
+          i = endNormal.similarity(end.getAdded(endNormal.getScaled(10)));
+        positions.add(new Integer(i));
+        horizontal = !horizontal;
+      } else {
+        //3 or 1
+        if (startNormal.dotProduct(direction) < 0) {
+          i = startNormal.similarity(start.getAdded(startNormal.getScaled(10)));
+          positions.add(new Integer(i));
+          horizontal = !horizontal;
+        }
+
+        if (horizontal) 
+          i = average.y;
+        else 
+          i = average.x;
+        positions.add(new Integer(i));
+        horizontal = !horizontal;
+
+        if (startNormal.dotProduct(direction) < 0) {
+          i = endNormal.similarity(end.getAdded(endNormal.getScaled(10)));
+          positions.add(new Integer(i));
+          horizontal = !horizontal;
+        }
+      }
+    }
+    if (horizontal) 
+      positions.add(new Integer(end.y));
+    else 
+      positions.add(new Integer(end.x));
+    
+    processPositions(start, end, positions, startNormal.isHorizontal(), conn);
+  }
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/editparts/XSDSimpleTypeEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/editparts/XSDSimpleTypeEditPart.java
new file mode 100644
index 0000000..a8a4e34
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/editparts/XSDSimpleTypeEditPart.java
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.design.editparts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.ToolbarLayout;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.wst.xsd.adt.design.editparts.BaseEditPart;
+import org.eclipse.wst.xsd.adt.design.editparts.BaseTypeConnectingEditPart;
+import org.eclipse.wst.xsd.adt.design.editparts.TypeReferenceConnection;
+import org.eclipse.wst.xsd.adt.design.editpolicies.ADTDirectEditPolicy;
+import org.eclipse.wst.xsd.adt.design.editpolicies.ADTSelectionFeedbackEditPolicy;
+import org.eclipse.wst.xsd.adt.design.figures.IStructureFigure;
+import org.eclipse.wst.xsd.adt.typeviz.design.figures.RoundedLineBorder;
+import org.eclipse.wst.xsd.adt.typeviz.design.figures.StructureFigure;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+import org.eclipse.wst.xsd.editor.internal.adapters.XSDSimpleTypeDefinitionAdapter;
+import org.eclipse.xsd.XSDSimpleTypeDefinition;
+
+public class XSDSimpleTypeEditPart extends BaseTypeConnectingEditPart
+{
+  StructureFigure figure;
+  protected ADTDirectEditPolicy adtDirectEditPolicy = new ADTDirectEditPolicy();
+  
+  public XSDSimpleTypeEditPart()
+  {
+    super();
+  }
+  
+  public XSDSimpleTypeDefinition getXSDSimpleTypeDefinition()
+  {
+    return (XSDSimpleTypeDefinition)((XSDSimpleTypeDefinitionAdapter)getModel()).getTarget();
+  }
+
+  protected IFigure createFigure()
+  {
+    figure = new StructureFigure();
+    figure.setBorder(new RoundedLineBorder(1, 10));    
+    ToolbarLayout toolbarLayout = new ToolbarLayout();
+    toolbarLayout.setStretchMinorAxis(true);
+    figure.setLayoutManager(toolbarLayout);
+    figure.getHeadingFigure().getLabel().setIcon(XSDEditorPlugin.getXSDImage("icons/XSDSimpleType.gif"));
+    return figure;
+  }
+  
+  protected void refreshVisuals()
+  {
+    String name = ((XSDSimpleTypeDefinitionAdapter)getModel()).getDisplayName();
+    figure.headingFigure.getLabel().setText(name);
+  }
+  
+  public IStructureFigure getStructureFigure()
+  {
+    return (IStructureFigure)getFigure();
+  }
+
+  public IFigure getContentPane()
+  {
+    return getStructureFigure().getContentPane();
+  }
+  
+  
+  protected void createEditPolicies()
+  {
+    installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new ADTSelectionFeedbackEditPolicy());
+    installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, adtDirectEditPolicy);
+  }
+
+  public void addFeedback()
+  {
+    getStructureFigure().addSelectionFeedback();
+    super.addFeedback();
+  }
+  
+  public void removeFeedback()
+  {
+    getStructureFigure().removeSelectionFeedback();
+    super.removeFeedback();    
+  }
+
+  public ReferenceConnection createConnectionFigure(BaseEditPart child)
+  {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  public TypeReferenceConnection createConnectionFigure()
+  {
+    // TODO Auto-generated method stub
+    return null;
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/editparts/model/SpaceFiller.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/editparts/model/SpaceFiller.java
new file mode 100644
index 0000000..682a64e
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/editparts/model/SpaceFiller.java
@@ -0,0 +1,157 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.design.editparts.model;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.xsd.adt.facade.IADTObjectListener;
+import org.eclipse.wst.xsd.adt.facade.IComplexType;
+import org.eclipse.wst.xsd.adt.facade.IField;
+import org.eclipse.wst.xsd.adt.facade.IModel;
+import org.eclipse.wst.xsd.adt.facade.IType;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+
+/**
+ * Dummy class to add space to field list
+ *
+ */
+public class SpaceFiller implements IField
+{
+  String kind;
+  public SpaceFiller(String kind)
+  {
+    super();
+    this.kind = kind;
+  }
+
+  public Image getImage()
+  {
+    if (kind.equals("attribute"))
+    {
+      return XSDEditorPlugin.getXSDImage("icons/XSDAttribute.gif");
+    }
+    else
+    {
+      return XSDEditorPlugin.getXSDImage("icons/XSDElement.gif");
+    }
+  }
+  
+  public String getKind()
+  {
+    return kind;
+  }
+  
+  public void setKind(String kind)
+  {
+    this.kind = kind;
+  }
+  
+  public boolean isGlobal()
+  {
+    return false;
+  }
+
+  public IComplexType getContainerType()
+  {
+    return null;
+  }
+
+  public String getName()
+  {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  public String getTypeName()
+  {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  public String getTypeNameQualifier()
+  {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  public IType getType()
+  {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  public int getMinOccurs()
+  {
+    // TODO Auto-generated method stub
+    return 0;
+  }
+
+  public int getMaxOccurs()
+  {
+    // TODO Auto-generated method stub
+    return 0;
+  }
+
+  public Command getUpdateMinOccursCommand(int minOccurs)
+  {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  public Command getUpdateMaxOccursCommand(int maxOccurs)
+  {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  public Command getUpdateTypeNameCommand(String typeName, String quailifier)
+  {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  public Command getUpdateNameCommand(String name)
+  {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  public Command getDeleteCommand()
+  {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  public void registerListener(IADTObjectListener listener)
+  {
+    // TODO Auto-generated method stub
+    
+  }
+
+  public void unregisterListener(IADTObjectListener listener)
+  {
+    // TODO Auto-generated method stub
+    
+  }
+  
+  public boolean isReadOnly()
+  {
+    return true;
+  }
+
+  public IModel getModel()
+  {
+    // TODO Auto-generated method stub
+    return null;
+  }
+}
+
+
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/editparts/model/TargetConnectionSpaceFiller.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/editparts/model/TargetConnectionSpaceFiller.java
new file mode 100644
index 0000000..ff59262
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/editparts/model/TargetConnectionSpaceFiller.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.design.editparts.model;
+
+import org.eclipse.wst.xsd.adt.facade.IADTObject;
+import org.eclipse.wst.xsd.adt.facade.IADTObjectListener;
+import org.eclipse.wst.xsd.editor.internal.adapters.XSDBaseAdapter;
+
+public class TargetConnectionSpaceFiller implements IADTObject
+{
+  private XSDBaseAdapter adapter;
+  
+  public TargetConnectionSpaceFiller(XSDBaseAdapter adapter)
+  {
+    this.adapter = adapter;
+  }
+
+  /**
+   * @deprecated remove this
+   * @return
+   */
+  public XSDBaseAdapter getAdapter()
+  {
+    return adapter;
+  }
+
+  public void registerListener(IADTObjectListener listener)
+  {
+    
+  }
+
+  public void unregisterListener(IADTObjectListener listener)
+  {
+   
+  }
+  
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/figures/CenteredIconFigure.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/figures/CenteredIconFigure.java
new file mode 100644
index 0000000..2f62395
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/figures/CenteredIconFigure.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.design.figures;
+            
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.swt.graphics.Image;
+
+public class CenteredIconFigure extends RectangleFigure
+{                                                
+  public Image image;
+  protected Label toolTipLabel;
+                               
+  public CenteredIconFigure()
+  {
+    super();
+    setFill(true);   
+    toolTipLabel = new Label();
+  }
+  
+  
+  protected void outlineShape(Graphics graphics)
+  {
+  }
+
+  protected void fillShape(Graphics g)
+  {    
+    super.fillShape(g);    
+    if (image != null)
+    {                         
+      Rectangle r = getBounds();
+      Dimension imageSize = new Dimension(15, 15);
+      g.drawImage(image, r.x + (r.width - imageSize.width)/2, r.y + (r.height - imageSize.height)/2);
+    }
+  }
+  
+  public Label getToolTipLabel()
+  {
+    return toolTipLabel;
+  }
+  
+  public void setToolTipText(String text)
+  {
+    if (text.length() > 0)
+    {
+      setToolTip(toolTipLabel);
+      toolTipLabel.setText(text);
+    }
+    else
+    {
+      setToolTip(null);
+    }
+  }  
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/figures/GenericGroupFigure.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/figures/GenericGroupFigure.java
new file mode 100644
index 0000000..a80b113
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/figures/GenericGroupFigure.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.design.figures;
+
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.xsd.editor.internal.design.layouts.ModelGroupLayout;
+
+public class GenericGroupFigure extends Figure
+{
+  protected CenteredIconFigure centeredIconFigure;
+  protected Figure contentFigure;
+  
+  public GenericGroupFigure()
+  {
+    super();
+    setLayoutManager(new ModelGroupLayout(true));
+   
+    centeredIconFigure = new CenteredIconFigure();
+    centeredIconFigure.setPreferredSize(new Dimension(15, 15));
+
+    add(centeredIconFigure);
+    contentFigure = new Figure();
+    contentFigure.setLayoutManager(new ModelGroupLayout(false, 0));
+    add(contentFigure);
+  }
+  
+  public void setIconFigure(Image image)
+  {
+    centeredIconFigure.image = image;
+  }
+
+  public CenteredIconFigure getTargetFigure()
+  {
+    return centeredIconFigure;
+  }
+  
+  public CenteredIconFigure getIconFigure()
+  {
+    return centeredIconFigure;
+  }
+  
+  public Figure getContentFigure()
+  {
+    return contentFigure;
+  }
+  
+  public void setToolTipText(String text)
+  {
+    centeredIconFigure.setToolTipText(text);
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/figures/IExtendedFigureFactory.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/figures/IExtendedFigureFactory.java
new file mode 100644
index 0000000..6dbcacb
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/figures/IExtendedFigureFactory.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.design.figures;
+
+import org.eclipse.wst.xsd.adt.design.figures.IFigureFactory;
+
+public interface IExtendedFigureFactory extends IFigureFactory
+{
+  IModelGroupFigure createModelGroupFigure(Object model);
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/figures/IModelGroupFigure.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/figures/IModelGroupFigure.java
new file mode 100644
index 0000000..8465ae2
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/figures/IModelGroupFigure.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.design.figures;
+
+import org.eclipse.wst.xsd.adt.design.figures.IADTFigure;
+
+public interface IModelGroupFigure extends IADTFigure
+{
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/figures/ModelGroupFigure.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/figures/ModelGroupFigure.java
new file mode 100644
index 0000000..83a3c63
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/figures/ModelGroupFigure.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.design.figures;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+
+public class ModelGroupFigure extends GenericGroupFigure implements IModelGroupFigure
+{
+  public static final Image SEQUENCE_ICON_IMAGE = XSDEditorPlugin.getImageDescriptor("newSequence2.gif", true).createImage();
+  public static final Image CHOICE_ICON_IMAGE = XSDEditorPlugin.getImageDescriptor("newChoice.gif", true).createImage();
+  public static final Image ALL_ICON_IMAGE = XSDEditorPlugin.getImageDescriptor("obj16/all.gif", true).createImage();
+  
+  public ModelGroupFigure()
+  {
+    super();
+  }
+
+  public void setIconFigure(Image image)
+  {
+    centeredIconFigure.image = image;
+  }
+
+  public void addSelectionFeedback()
+  {
+    // TODO Auto-generated method stub
+    
+  }
+
+  public void editPartAttached(EditPart owner)
+  {
+    // TODO Auto-generated method stub
+    
+  }
+
+  public void refreshVisuals(Object model)
+  {
+    // TODO Auto-generated method stub
+    
+  }
+
+  public void removeSelectionFeedback()
+  {
+    // TODO Auto-generated method stub   
+  }
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/figures/SpacingFigure.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/figures/SpacingFigure.java
new file mode 100644
index 0000000..5c1f657
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/figures/SpacingFigure.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.design.figures;
+
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.MarginBorder;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+
+public class SpacingFigure extends Label
+{
+  public SpacingFigure()
+  {
+    super("");
+    setIcon(XSDEditorPlugin.getXSDImage("icons/Dot.gif"));
+    setBorder(new MarginBorder(3, 0, 3, 0));
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/layouts/ContainerLayout.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/layouts/ContainerLayout.java
new file mode 100644
index 0000000..1cfdd71
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/layouts/ContainerLayout.java
@@ -0,0 +1,219 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.design.layouts;
+                   
+import java.util.List;
+
+import org.eclipse.draw2d.AbstractLayout;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.wst.xsd.editor.internal.design.figures.SpacingFigure;
+              
+
+public class ContainerLayout extends AbstractLayout
+{                                         
+  protected boolean isHorizontal;
+  protected int spacing = 0;
+  protected int border = 0; 
+
+  public ContainerLayout()
+  { 
+    this(true, 0); 
+  }             
+
+  public ContainerLayout(boolean isHorizontal, int spacing)
+  {
+    this.isHorizontal = isHorizontal;   
+    this.spacing = spacing;
+  }  
+
+  public void setHorizontal(boolean isHorizontal)
+  {
+    this.isHorizontal = isHorizontal;
+  }  
+
+  public void setSpacing(int spacing)
+  {
+    this.spacing = spacing;
+  }  
+
+  public void setBorder(int border)
+  {
+    this.border = border;
+  }  
+
+  protected int alignFigure(IFigure parent, IFigure child)
+  { 
+    return -1;
+  }
+
+  /**
+   * Calculates and returns the preferred size of the container 
+   * given as input.
+   * 
+   * @param figure  Figure whose preferred size is required.
+   * @return  The preferred size of the passed Figure.
+   * @since 2.0
+   */
+  protected Dimension calculatePreferredSizeHelper(IFigure parent)
+  { 
+    Dimension	preferred = new Dimension();
+  	List children = parent.getChildren();
+		                                        
+	  for (int i=0; i < children.size(); i++)
+    {
+		  IFigure child = (IFigure)children.get(i);      
+    
+      Dimension	childSize = child.getPreferredSize();
+	  
+      if (isHorizontal)
+      {
+		    preferred.width += childSize.width;
+		    preferred.height = Math.max(preferred.height, childSize.height);
+      }
+      else
+      {  
+        preferred.height += childSize.height;
+        preferred.width = Math.max(preferred.width, childSize.width);
+      }
+	  }   
+
+    int childrenSize = children.size();
+    if (childrenSize > 1)
+    {                      
+      if (isHorizontal)    
+      {
+        preferred.width += spacing * (childrenSize - 1);
+      }
+      else
+      {
+		    preferred.height += spacing * (childrenSize - 1);
+      } 
+    }
+                          
+    preferred.width += border * 2;
+    preferred.height += border * 2;
+	  preferred.width += parent.getInsets().getWidth();
+	  preferred.height += parent.getInsets().getHeight();       
+  
+  	return preferred;
+  }
+
+  protected Dimension calculatePreferredSize(IFigure parent, int width, int height)
+  {    
+    Dimension	preferred = null;                                              
+                                  
+    // Here we ensure that an unexpanded container is given a size of (0,0)
+    //
+//    if (parent instanceof IExpandable)
+//    {
+//      IExpandable expandableFigure = (IExpandable)parent;
+//      if (!expandableFigure.isExpanded())
+//      {
+//        preferred = new Dimension(); 
+//      }
+//    }   
+    
+    if (preferred == null)
+    {
+	    preferred = calculatePreferredSizeHelper(parent);    
+    }
+    
+    return preferred;
+  }
+     
+
+  protected void adjustLayoutLocation(IFigure parent, Dimension dimension)
+  {     
+  }   
+
+  public void layout(IFigure parent)
+  {       
+  	List children = parent.getChildren();
+ 
+    int rx = 0;
+    Dimension	dimension = new Dimension();                                          
+
+
+	  for (int i=0; i < children.size(); i++)
+    {
+		  IFigure child = (IFigure)children.get(i);
+		  Dimension	childSize = child.getPreferredSize();
+      if (isHorizontal)
+      {   
+        dimension.height = Math.max(dimension.height, childSize.height);
+        rx += childSize.width;
+      }
+      else
+      {
+        dimension.width = Math.max(dimension.width, childSize.width);
+      }
+    }
+
+	  //dimension.width += parent.getInsets().left;
+    //dimension.height += parent.getInsets().top;
+
+    if (isHorizontal)
+    {
+      dimension.height += border*2;
+    	dimension.width += border;
+    }
+    else
+    {
+      dimension.width += border*2;
+    	dimension.height += border;
+    }
+    adjustLayoutLocation(parent, dimension);    
+
+    for (int i=0; i < children.size(); i++)
+    {
+      IFigure child = (IFigure)children.get(i);
+	    Dimension	childSize = child.getPreferredSize();
+        
+      if (isHorizontal)
+      {   
+        int y = -1; 
+    
+        y = alignFigure(parent, child);
+    
+        if (y == -1)
+        {
+           y = (dimension.height - childSize.height) / 2;                                      
+        }                      
+                                                   
+        Rectangle rectangle = new Rectangle(dimension.width, y, childSize.width, childSize.height);
+        rectangle.translate(parent.getClientArea().getLocation());                           
+
+
+        child.setBounds(rectangle);                           
+	      dimension.width += childSize.width; 
+        dimension.width += spacing;       
+
+        if (child instanceof SpacingFigure)
+        {          
+          int availableHorizontalSpace = parent.getClientArea().width - rx;
+          dimension.width += availableHorizontalSpace;
+        }           
+      }
+      else
+      {
+        Rectangle rectangle = new Rectangle(0, dimension.height, childSize.width, childSize.height);
+	      rectangle.translate(parent.getClientArea().getLocation());                                  
+        
+
+        child.setBounds(rectangle);  
+        dimension.height += childSize.height;
+        dimension.height += spacing;
+      }
+	  }	      
+  }                                      
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/layouts/ModelGroupLayout.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/layouts/ModelGroupLayout.java
new file mode 100644
index 0000000..94eecb0
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/design/layouts/ModelGroupLayout.java
@@ -0,0 +1,197 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.design.layouts;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.draw2d.AbstractLayout;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.wst.xsd.editor.internal.design.figures.SpacingFigure;
+import org.eclipse.wst.xsd.editor.internal.design.figures.ModelGroupFigure;
+
+public class ModelGroupLayout extends AbstractLayout
+{
+  protected boolean isHorizontal;
+  protected int spacing = 7;
+  protected int border = 0;
+
+  public ModelGroupLayout()
+  {
+    this(0);
+  }
+
+  public ModelGroupLayout(boolean isHorizontal)
+  {
+    this.isHorizontal = isHorizontal;
+  }
+
+  public ModelGroupLayout(boolean isHorizontal, int spacing)
+  {
+    this.isHorizontal = isHorizontal;
+    this.spacing = spacing;
+  }
+
+  public ModelGroupLayout(int spacing)
+  {
+    super();
+    this.spacing = spacing;
+  }
+
+  protected Dimension calculatePreferredSize(IFigure container, int wHint, int hHint)
+  {
+    Dimension preferred = new Dimension();
+    List children = container.getChildren();
+
+    for (int i = 0; i < children.size(); i++)
+    {
+      IFigure child = (IFigure) children.get(i);
+
+      Dimension childSize = child.getPreferredSize();
+
+      if (isHorizontal)
+      {
+        preferred.width += childSize.width;
+        preferred.height = Math.max(preferred.height, childSize.height);
+      }
+      else
+      {
+        preferred.height += childSize.height;
+        preferred.width = Math.max(preferred.width, childSize.width);
+      }
+    }
+
+    int childrenSize = children.size();
+    if (childrenSize > 1)
+    {
+      if (isHorizontal)
+      {
+        preferred.width += spacing * (childrenSize - 1);
+      }
+      else
+      {
+        preferred.height += spacing * (childrenSize - 1);
+      }
+    }
+
+    preferred.width += border * 2;
+    preferred.height += border * 2;
+    preferred.width += container.getInsets().getWidth();
+    preferred.height += container.getInsets().getHeight();
+
+    return preferred;
+  }
+
+  public void layout(IFigure container)
+  {
+    List children = container.getChildren();
+
+    int rx = 0;
+    Dimension dimension = new Dimension();
+
+    for (int i = 0; i < children.size(); i++)
+    {
+      IFigure child = (IFigure) children.get(i);
+      Dimension childSize = child.getPreferredSize();
+      if (isHorizontal)
+      {
+        dimension.height = Math.max(dimension.height, childSize.height);
+        rx += childSize.width;
+      }
+      else
+      {
+        dimension.width = Math.max(dimension.width, childSize.width);
+      }
+    }
+
+    if (isHorizontal)
+    {
+      dimension.height += border * 2;
+      dimension.width += border;
+    }
+    else
+    {
+      dimension.width += border * 2;
+      dimension.height += border;
+    }
+
+    Rectangle r = container.getClientArea();
+    dimension = new Dimension(r.width, r.height);
+    Point p = new Point(0, 0);
+
+    for (Iterator i = children.iterator(); i.hasNext();)
+    {
+      IFigure child = (IFigure) i.next();
+      Dimension childSize = child.getPreferredSize();
+
+      if (isHorizontal)
+      {
+        Rectangle rectangle = new Rectangle(p.x, 0, childSize.width, childSize.height);
+
+        // last child
+        if (!i.hasNext())
+        {
+          rectangle.width = dimension.width - rectangle.x;
+        }
+
+        if (p.x == 0)
+        {
+          rectangle.y = r.height / 2 - childSize.height / 2;
+        }
+        else
+        {
+          rectangle.y = r.height / 2 - childSize.height / 2;
+        }
+
+        rectangle.translate(container.getClientArea().getLocation());
+        child.setBounds(rectangle);
+        p.x += childSize.width;
+        p.x += spacing;
+
+      }
+      else
+      {
+        Rectangle rectangle = new Rectangle(0, p.y, childSize.width, childSize.height);
+
+        if (child instanceof SpacingFigure)
+        {
+          rectangle.x = dimension.width + 6;
+        }
+        else if (child instanceof ModelGroupFigure)
+        {
+          rectangle.width = dimension.width - rectangle.x;
+        }
+        else
+        {
+          rectangle.width = dimension.width - rectangle.x;
+        }
+
+        rectangle.translate(container.getClientArea().getLocation());
+        child.setBounds(rectangle);
+        p.y += childSize.height;
+        p.y += spacing;
+      }
+    }
+  }
+
+  public void setSpacing(int spacing)
+  {
+    this.spacing = spacing;
+  }
+
+  protected int alignFigure(IFigure parent, IFigure child)
+  {
+    return -1;
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/dialogs/BuiltInTypesTreeViewerProvider.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/dialogs/BuiltInTypesTreeViewerProvider.java
new file mode 100644
index 0000000..f140c21
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/dialogs/BuiltInTypesTreeViewerProvider.java
@@ -0,0 +1,221 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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 
+ *     Trung de Irene <trungha@ca.ibm.com>
+ *******************************************************************************/
+package org.eclipse.wst.xsd.editor.internal.dialogs;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+import org.eclipse.xsd.util.XSDConstants;
+
+
+/**
+ * This class provides the content for SelectBuiltInTypesForFilterDialog
+ * readability Warning: Some simple tricks to tweak efficiency are used
+ */
+public class BuiltInTypesTreeViewerProvider {
+	
+	ILabelProvider labelProvider;
+	
+	ITreeContentProvider contentProvider;
+	
+	private static final String CONST_PARENT = "parent";
+	
+	/**
+	 * Currently there are 3 subgroups: Numbers, Data and Time, Other
+	 * Folks can choose to expand to more subgroups
+	 */
+	private static int BUILT_IN_TYPES_SUB_GROUP = 3;
+	
+    static String[] numberTypes = 
+    	{ "base64Binary", "byte", "decimal", "double", "float", "hexBinary",
+    	  "int", "integer", "long", "negativeInteger", "nonNegativeInteger",
+    	  "nonPositiveInteger", "positiveInteger", "short", "unsignedByte",
+    	  "unsignedInt", "unsignedLong", "unsignedShort"};
+    
+    static String[] dateAndTimeTypes =
+    	{ "date", "dateTime", "duration", "gDay",
+    	  "gMonth", "gMonthDay", "gYear", "gYearMonth", "time"};
+	
+	
+    public static List getAllBuiltInTypes() {
+        List items = new ArrayList();
+        //for (int i = 0; i < XSDDOMHelper.dataType.length; i++) {
+        //  items.add(XSDDOMHelper.dataType[i][0]);
+        //}
+        Iterator it = items.iterator();
+        
+        List mainContainer = new ArrayList(BUILT_IN_TYPES_SUB_GROUP);
+        ComponentSpecification header = new ComponentSpecification("", "Root", null);
+        mainContainer.add(header);
+        
+        List numbersGroup = new ArrayList();
+        header = new ComponentSpecification("", "Numbers", null);
+        numbersGroup.add(header);
+        mainContainer.add(numbersGroup);
+        
+        List dateAndTimeGroup = new ArrayList();
+        header = new ComponentSpecification("", "Date and Time", null);
+        dateAndTimeGroup.add(header);
+        mainContainer.add(dateAndTimeGroup);
+        
+        List otherGroup = new ArrayList();
+        header = new ComponentSpecification("", "Other", null);
+        otherGroup.add(header);
+        mainContainer.add(otherGroup);
+
+        while (it.hasNext()) {
+        	Object item = it.next();
+            String name = item.toString();
+
+            ComponentSpecification builtInTypeItem = new ComponentSpecification(name, XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, null);
+          
+            // if this built-In Type is in Number group 
+            if ( partOf(name, numberTypes) ){
+            	// Set parent
+            	//builtInTypeItem.addAttributeInfo(CONST_PARENT, numbersGroup);
+            	
+            	numbersGroup.add(builtInTypeItem);
+            }
+            // if this built-In Type is in Date-and-Time group 
+            else if ( partOf(name, dateAndTimeTypes)){
+            	//builtInTypeItem.addAttributeInfo(CONST_PARENT, dateAndTimeGroup);
+            	dateAndTimeGroup.add(builtInTypeItem);
+            }
+            // otherwise, put in Other group
+            else {
+            	//builtInTypeItem.addAttributeInfo(CONST_PARENT, otherGroup);
+            	otherGroup.add(builtInTypeItem);
+            }
+        }
+
+        return mainContainer;
+    }
+    
+    public ILabelProvider getLabelProvider(){
+		if (labelProvider != null)
+			return labelProvider;
+		
+		labelProvider = new BuiltInTypeLabelProvider();
+		return labelProvider;
+	}
+	
+	public ITreeContentProvider getContentProvider() {
+		if (contentProvider != null)
+			return contentProvider;
+		
+		contentProvider = new BuiltInTypesTreeContentProvider();
+		return contentProvider;
+	}
+	
+	/**
+	 * Determines whether an equivalent of 'item' appears in 'array'
+	 * @param item
+	 * @param array
+	 * @return
+	 */
+	private static boolean partOf(String item, String[] array){
+	    for(int i = 0; i < array.length; i++ ){
+	    	if ( item.equals(array[i]) ){
+	    		return true;
+	    	}            		
+	    }
+	    return false;
+	}
+	
+	class BuiltInTypeLabelProvider implements ILabelProvider{
+		public Image getImage(Object element) {			
+			if ( getText(element).equals("Numbers") )
+				return XSDEditorPlugin.getXSDImage("icons/XSDNumberTypes.gif");
+			if ( getText(element).equals("Date and Time") )
+				return XSDEditorPlugin.getXSDImage("icons/XSDDateAndTimeTypes.gif");
+			if ( getText(element).equals("Other") )
+				return XSDEditorPlugin.getXSDImage("icons/browsebutton.gif");
+			if ( element instanceof ComponentSpecification ){
+				return XSDEditorPlugin.getXSDImage("icons/XSDSimpleType.gif");
+			}
+			return null;
+		}
+
+		public String getText(Object element) {
+			ComponentSpecification spec = null;
+			
+			/* if not non-leaf node, the first element has the name for 
+			 * the whole list */
+			if (element instanceof List){
+				spec = (ComponentSpecification) ((List) element).get(0);
+			}
+			else if (element instanceof ComponentSpecification ){
+				spec = (ComponentSpecification) element;
+			}
+			return (String) spec.getName();
+		}
+
+		public void addListener(ILabelProviderListener listener) {
+			
+		}
+
+		public void dispose() {
+		}
+
+		public boolean isLabelProperty(Object element, String property) {
+			return false;
+		}
+
+		public void removeListener(ILabelProviderListener listener) {
+			
+		}  
+		
+	}
+
+
+	class BuiltInTypesTreeContentProvider implements ITreeContentProvider {
+
+		public Object[] getChildren(Object parentElement) {
+			if (parentElement instanceof List) {
+				List parentContent = (List) parentElement;
+				
+				/** Ignore the first element (which contains the name of this list
+				 * ie. 'Numbers', 'Date and time', 'Other') */
+				return parentContent.subList(1, parentContent.size()).toArray();
+			}
+			return new Object[0];
+		}
+
+		public Object[] getElements(Object inputElement) {
+			return getChildren(inputElement);
+		}
+
+		public Object getParent(Object element) {
+		    return null;
+		}
+
+		public boolean hasChildren(Object element) {
+			if (getChildren(element).length > 1) {
+				return true;
+			}
+			return false;
+		}
+
+		public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+		}
+
+		public void dispose() {
+		}
+	}
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/dialogs/NewComponentDialog.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/dialogs/NewComponentDialog.java
new file mode 100644
index 0000000..d148a72
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/dialogs/NewComponentDialog.java
@@ -0,0 +1,184 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.dialogs;
+
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+public class NewComponentDialog extends Dialog implements ModifyListener
+{
+  protected Text nameField; 
+  protected Button okButton;
+  protected String name;                             
+  protected String title;
+  protected Label errorMessageLabel;
+  protected List usedNames;
+
+  public NewComponentDialog(Shell parentShell, String title, String defaultName) 
+  {
+    super(parentShell);
+    setShellStyle(getShellStyle() | SWT.RESIZE);
+    name = defaultName;      
+    this.title = title;
+  }
+  
+  public NewComponentDialog(Shell parentShell, String title, String defaultName, List usedNames) 
+  {
+    super(parentShell);
+    setShellStyle(getShellStyle() | SWT.RESIZE);
+    name = defaultName;      
+    this.title = title;
+    this.usedNames = usedNames;
+  }
+
+  public int createAndOpen()
+  {
+    create();
+    getShell().setText(title);
+    setBlockOnOpen(true);
+    return open();
+  }
+
+  protected Control createContents(Composite parent)  
+  {
+    Control control = super.createContents(parent);
+    nameField.forceFocus();
+    nameField.selectAll();  
+    updateErrorMessage();
+    return control;
+  }
+
+
+  protected void createButtonsForButtonBar(Composite parent) 
+  {
+    okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
+    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
+  }
+
+  protected void createHeaderContent(Composite parent)
+  {
+  }
+  
+  protected void createExtendedContent(Composite parent)
+  {
+  }
+
+  protected Control createDialogArea(Composite parent) 
+  {
+    Composite dialogArea = (Composite)super.createDialogArea(parent);
+    
+    createHeaderContent(dialogArea);
+
+    Composite composite = new Composite(dialogArea, SWT.NONE);
+    GridLayout layout = new GridLayout();
+    layout.numColumns = 2;
+    layout.marginWidth = 0;
+    composite.setLayout(layout);
+
+    GridData gdFill= new GridData();
+    gdFill.horizontalAlignment= GridData.FILL;
+    gdFill.grabExcessHorizontalSpace= true;
+    gdFill.verticalAlignment= GridData.FILL;
+    gdFill.grabExcessVerticalSpace= true;
+    composite.setLayoutData(gdFill);
+
+    Label nameLabel = new Label(composite, SWT.NONE);
+    nameLabel.setText("name");//XSDEditorPlugin.getXSDString("_UI_LABEL_NAME")); //$NON-NLS-1$
+
+    nameField = new Text(composite, SWT.SINGLE | SWT.BORDER);
+    GridData gd= new GridData();
+    gd.horizontalAlignment= GridData.FILL;
+    gd.grabExcessHorizontalSpace= true;
+    gd.widthHint = 200;
+    nameField.setLayoutData(gd);
+    nameField.setText(name);
+    nameField.addModifyListener(this);
+
+    createExtendedContent(dialogArea);
+
+    // error message
+    errorMessageLabel = new Label(dialogArea, SWT.NONE);
+    errorMessageLabel.setText("error message goes here");         
+    GridData gd2 = new GridData();
+    gd2.horizontalAlignment= GridData.FILL;
+    gd2.grabExcessHorizontalSpace= true;
+    gd2.widthHint = 200;
+    errorMessageLabel.setLayoutData(gd2);          
+//    Color color = new Color(errorMessageLabel.getDisplay(), 200, 0, 0);
+//    errorMessageLabel.setForeground(color);
+
+    return dialogArea;
+  }
+  
+  public void modifyText(ModifyEvent e) 
+  {                        
+    updateErrorMessage();
+  }        
+
+  protected String computeErrorMessage(String name)
+  {
+  	if (usedNames == null)
+  		return null;
+  	
+  	Iterator iterator = usedNames.iterator();
+  	while (iterator.hasNext()) {
+  		if (name.equalsIgnoreCase((String) iterator.next())) {
+  			return "_UI_LABEL_WARNING_DUPLICATE_NAME_EXISTS";
+  		}
+  	}
+  	
+  	return null;
+  }
+
+  protected void updateErrorMessage()
+  {                 
+    String errorMessage = null;
+    String name = nameField.getText().trim();
+    if (name.length() > 0)
+    {                                
+      errorMessage = computeErrorMessage(name);
+    }   
+    else
+    {
+      errorMessage = "";
+    }  
+    errorMessageLabel.setText(errorMessage != null ? errorMessage : "");
+//    okButton.setEnabled(errorMessage == null);
+  }
+ 
+  protected void buttonPressed(int buttonId) 
+  {
+    if (buttonId == IDialogConstants.OK_ID)
+    {
+      name = nameField.getText();
+    }
+    super.buttonPressed(buttonId);
+  }
+
+  public String getName()
+  {
+    return name;
+  }
+}
+
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/dialogs/NewTypeButtonHandler.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/dialogs/NewTypeButtonHandler.java
new file mode 100644
index 0000000..14ae1d7
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/dialogs/NewTypeButtonHandler.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.dialogs;
+
+import org.eclipse.wst.common.ui.internal.search.dialogs.INewComponentHandler;
+
+public class NewTypeButtonHandler implements INewComponentHandler
+{
+  public NewTypeButtonHandler()
+  {
+  }
+
+  public void openNewComponentDialog()
+  {
+    NewTypeDialog newTypeDialog = new NewTypeDialog();
+    newTypeDialog.open();
+  }
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/dialogs/NewTypeDialog.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/dialogs/NewTypeDialog.java
new file mode 100644
index 0000000..cf15bfb
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/dialogs/NewTypeDialog.java
@@ -0,0 +1,112 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.dialogs;
+
+import java.net.URL;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification;
+import org.eclipse.wst.xsd.adt.edit.IComponentDialog;
+import org.eclipse.wst.xsd.ui.internal.search.IXSDSearchConstants;
+
+public class NewTypeDialog extends NewComponentDialog implements IComponentDialog
+{
+  protected static int SIMPLE_TYPE = 0;
+  protected static int COMPLEX_TYPE = 1;
+  protected Object setObject;
+  protected int typeKind;
+  protected Object selection;
+
+  public NewTypeDialog()
+  {
+    super(Display.getCurrent().getActiveShell(), "New Type", "NewType");    
+  }
+  
+  public int createAndOpen()
+  {
+    int returnCode = super.createAndOpen();
+    if (returnCode == 0)
+    {
+      if (setObject instanceof Adapter)
+      {  
+        //Command command = new AddComplexTypeDefinitionCommand(getName(), schema);
+      }        
+    }  
+    return returnCode;
+  }
+
+  public ComponentSpecification getSelectedComponent()
+  {
+    ComponentSpecification componentSpecification =  new ComponentSpecification(null, getName(), null);    
+    componentSpecification.setMetaName(typeKind == COMPLEX_TYPE ? IXSDSearchConstants.COMPLEX_TYPE_META_NAME : IXSDSearchConstants.SIMPLE_TYPE_META_NAME);
+    componentSpecification.setNew(true);
+    return componentSpecification;
+  }
+
+  public void setInitialSelection(ComponentSpecification componentSpecification)
+  {
+    // TODO Auto-generated method stub
+  }
+
+  protected void createHeaderContent(Composite parent)
+  {
+    final Button complexTypeButton = new Button(parent, SWT.RADIO);
+    complexTypeButton.setText("Complex Type");
+    
+    final Button simpleTypeButton = new Button(parent, SWT.RADIO);
+    simpleTypeButton.setText("Simple Type");
+
+    SelectionAdapter listener = new SelectionAdapter()
+    {
+      public void widgetSelected(SelectionEvent e)
+      {
+        if (e.widget == simpleTypeButton)
+        {
+          typeKind = SIMPLE_TYPE;
+        }
+        else if (e.widget == complexTypeButton)
+        {
+          typeKind = COMPLEX_TYPE;
+        }
+      }
+    };
+    complexTypeButton.setSelection(true);
+    typeKind = COMPLEX_TYPE;
+    simpleTypeButton.addSelectionListener(listener);
+    complexTypeButton.addSelectionListener(listener);
+    Label separator = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
+    GridData gd = new GridData(GridData.FILL_BOTH);
+    separator.setLayoutData(gd);
+  }
+
+  protected String getNormalizedLocation(String location)
+  {
+    try
+    {
+      URL url = new URL(location);
+      URL resolvedURL = Platform.resolve(url);
+      location = resolvedURL.getPath();
+    }
+    catch (Exception e)
+    {
+      e.printStackTrace();
+    }
+    return location;
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/dialogs/SelectBuiltInTypesForFilteringDialog.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/dialogs/SelectBuiltInTypesForFilteringDialog.java
new file mode 100644
index 0000000..9b3d58f
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/dialogs/SelectBuiltInTypesForFilteringDialog.java
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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 
+ *     Trung de Irene <trungha@ca.ibm.com>
+ *******************************************************************************/
+package org.eclipse.wst.xsd.editor.internal.dialogs;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.jface.viewers.CheckboxTreeViewer;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.dialogs.CheckedTreeSelectionDialog;
+import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+
+/**
+ * The BuiltInTypesFilteringDialog is a SelectionDialog that allows the user to
+ *  select a ...
+ */
+public class SelectBuiltInTypesForFilteringDialog extends CheckedTreeSelectionDialog {
+
+	public final static String CUSTOM_LIST_SEPARATOR = XSDEditorPlugin.CUSTOM_LIST_SEPARATOR;
+
+	public SelectBuiltInTypesForFilteringDialog(Shell parent, 
+			ILabelProvider labelProvider, ITreeContentProvider contentProvider) {
+		super(parent, labelProvider, contentProvider);
+
+		init();
+	}
+	
+	public CheckboxTreeViewer getTreeViewer(){
+		return super.getTreeViewer();
+	}
+	
+	private void init(){
+		// grey state enable
+		setContainerMode(true);
+		
+		// TODO externalize String
+		setTitle("Set common Built-In types");
+		setMessage("Select the types that you do not want to filter out: ");
+		
+		//super.create();
+		//super.getTreeViewer().setSorter(new ViewerSorter());
+		
+	}
+	
+	/**
+	 *   Returns a String acting as list of built-in types selected by the user
+	 * in the filter dialog (white space acts as the item separator).
+	 *   Suggest using getSelectedBuiltInTypesFromString
+	 * to get a concrete array of selected types.
+	 *   We can only store String in the plugin preference's storage so we have 
+	 * use this method for conversion
+	 */
+	public static String getTypesListInString(Object[] chosenTypes) {
+		String returningList = "";
+		for (int i = 0; i < chosenTypes.length; i++){
+			if ( chosenTypes[i] instanceof ComponentSpecification){
+				ComponentSpecification aType = 
+					(ComponentSpecification) chosenTypes[i];
+
+				returningList += aType.getName() + CUSTOM_LIST_SEPARATOR;
+			}
+			/* else selectedBuiltInTypes[i] instanceof List, ie. a parentNode
+			 * we ignore it. */
+		}
+		return returningList;
+	}
+	
+	/**
+	 * Filters out all built-In type not recorded in the 'listString' and 
+	 * returns the result in a List
+	 * Warning: recursive method
+	 * @param listString 
+	 * @param aContainer 
+	 * 			Containing all types
+	 * @return a subset of what 'aContainer' has as specified by 'listString'
+	 */
+	public static List getSelectedBuiltInTypesFromString(String listString, 
+			List aContainer) {
+		List selectedTypes = new ArrayList();
+
+		// ignore the 'header' item in the container, starting from i = 1
+		for (int i = 1; i < aContainer.size(); i++){
+			Object o = aContainer.get(i);
+			if ( o instanceof ComponentSpecification){
+				ComponentSpecification aType = (ComponentSpecification) o;
+				String typeName = (String) aType.getName();
+				// if typeName's name appears in 'listString'
+				if ( listString.indexOf(typeName + CUSTOM_LIST_SEPARATOR) != -1)
+					selectedTypes.add(o);
+			}
+			else if ( o instanceof List){
+				selectedTypes.addAll( getSelectedBuiltInTypesFromString(listString, (List) o) ); 
+			}
+		}
+		return selectedTypes;
+	}
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/Dot.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/Dot.gif
new file mode 100644
index 0000000..210bb24
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/Dot.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/GenerateDtd.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/GenerateDtd.gif
new file mode 100644
index 0000000..ac58c1e
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/GenerateDtd.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/GenerateJava.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/GenerateJava.gif
new file mode 100644
index 0000000..2375c65
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/GenerateJava.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/GraphViewElementRef.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/GraphViewElementRef.gif
new file mode 100644
index 0000000..d535dac
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/GraphViewElementRef.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/NewXSD.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/NewXSD.gif
new file mode 100644
index 0000000..47f6730
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/NewXSD.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/RegexWizardArrow.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/RegexWizardArrow.gif
new file mode 100644
index 0000000..3d550a3
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/RegexWizardArrow.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/TriangleToolBar.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/TriangleToolBar.gif
new file mode 100644
index 0000000..bd37eb5
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/TriangleToolBar.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/ValidateXSD.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/ValidateXSD.gif
new file mode 100644
index 0000000..2b347ac
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/ValidateXSD.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDAll.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDAll.gif
new file mode 100644
index 0000000..6d74e80
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDAll.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDAnnotate.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDAnnotate.gif
new file mode 100644
index 0000000..d2108c0
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDAnnotate.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDAny.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDAny.gif
new file mode 100644
index 0000000..a39f93c
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDAny.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDAnyAttribute.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDAnyAttribute.gif
new file mode 100644
index 0000000..5280cc2
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDAnyAttribute.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDAppInfo.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDAppInfo.gif
new file mode 100644
index 0000000..2da001e
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDAppInfo.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDAttribute.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDAttribute.gif
new file mode 100644
index 0000000..79d49d0
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDAttribute.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDAttributeGroup.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDAttributeGroup.gif
new file mode 100644
index 0000000..648462f
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDAttributeGroup.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDAttributeGroupRef.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDAttributeGroupRef.gif
new file mode 100644
index 0000000..a89fa8f
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDAttributeGroupRef.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDAttributeRef.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDAttributeRef.gif
new file mode 100644
index 0000000..8365af2
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDAttributeRef.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDChoice.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDChoice.gif
new file mode 100644
index 0000000..89ba825
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDChoice.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDComplexContent.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDComplexContent.gif
new file mode 100644
index 0000000..41c68dd
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDComplexContent.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDComplexType.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDComplexType.gif
new file mode 100644
index 0000000..007f852
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDComplexType.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDDateAndTimeTypes.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDDateAndTimeTypes.gif
new file mode 100644
index 0000000..4fc84e4
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDDateAndTimeTypes.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDDoc.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDDoc.gif
new file mode 100644
index 0000000..d349a05
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDDoc.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDElement.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDElement.gif
new file mode 100644
index 0000000..dd45f08
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDElement.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDElementRef.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDElementRef.gif
new file mode 100644
index 0000000..749acfc
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDElementRef.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDExtension.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDExtension.gif
new file mode 100644
index 0000000..0cfb807
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDExtension.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDField.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDField.gif
new file mode 100644
index 0000000..378e43e
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDField.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDFile.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDFile.gif
new file mode 100644
index 0000000..3900f1b
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDFile.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDGlobalAttribute.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDGlobalAttribute.gif
new file mode 100644
index 0000000..79d49d0
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDGlobalAttribute.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDGlobalElement.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDGlobalElement.gif
new file mode 100644
index 0000000..dd45f08
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDGlobalElement.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDGroup.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDGroup.gif
new file mode 100644
index 0000000..555ef53
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDGroup.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDGroupRef.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDGroupRef.gif
new file mode 100644
index 0000000..34a7fb3
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDGroupRef.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDImport.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDImport.gif
new file mode 100644
index 0000000..9e44ce5
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDImport.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDInclude.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDInclude.gif
new file mode 100644
index 0000000..b26c527
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDInclude.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDKey.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDKey.gif
new file mode 100644
index 0000000..04032a9
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDKey.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDKeyRef.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDKeyRef.gif
new file mode 100644
index 0000000..ee5829d
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDKeyRef.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDNotation.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDNotation.gif
new file mode 100644
index 0000000..ce9df98
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDNotation.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDNumberTypes.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDNumberTypes.gif
new file mode 100644
index 0000000..7134210
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDNumberTypes.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDRedefine.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDRedefine.gif
new file mode 100644
index 0000000..56964c1
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDRedefine.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDSelector.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDSelector.gif
new file mode 100644
index 0000000..2399a58
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDSelector.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDSequence.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDSequence.gif
new file mode 100644
index 0000000..8bf3f97
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDSequence.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDSimpleContent.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDSimpleContent.gif
new file mode 100644
index 0000000..7ef38df
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDSimpleContent.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDSimpleEnum.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDSimpleEnum.gif
new file mode 100644
index 0000000..11d7958
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDSimpleEnum.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDSimpleList.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDSimpleList.gif
new file mode 100644
index 0000000..d08e78f
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDSimpleList.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDSimplePattern.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDSimplePattern.gif
new file mode 100644
index 0000000..a113cf4
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDSimplePattern.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDSimpleRestrict.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDSimpleRestrict.gif
new file mode 100644
index 0000000..38bc12e
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDSimpleRestrict.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDSimpleType.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDSimpleType.gif
new file mode 100644
index 0000000..75f33c2
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDSimpleType.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDSimpleTypeForEditPart.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDSimpleTypeForEditPart.gif
new file mode 100644
index 0000000..9aefeb2
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDSimpleTypeForEditPart.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDSimpleUnion.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDSimpleUnion.gif
new file mode 100644
index 0000000..292adaf
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDSimpleUnion.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDUnique.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDUnique.gif
new file mode 100644
index 0000000..5a8a650
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/XSDUnique.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/appinfo_browse.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/appinfo_browse.gif
new file mode 100644
index 0000000..85f9baa
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/appinfo_browse.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/appinfo_category.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/appinfo_category.gif
new file mode 100644
index 0000000..9e665d5
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/appinfo_category.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/back.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/back.gif
new file mode 100644
index 0000000..24d1a27
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/back.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/browsebutton.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/browsebutton.gif
new file mode 100644
index 0000000..13dae59
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/browsebutton.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/error_st_obj.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/error_st_obj.gif
new file mode 100644
index 0000000..0bc6068
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/error_st_obj.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/forward.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/forward.gif
new file mode 100644
index 0000000..eab699e
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/forward.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/generate_xml.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/generate_xml.gif
new file mode 100644
index 0000000..f2e3635
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/generate_xml.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/newChoice.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/newChoice.gif
new file mode 100644
index 0000000..eca1446
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/newChoice.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/newSequence.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/newSequence.gif
new file mode 100644
index 0000000..a56782f
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/newSequence.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/newSequence2.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/newSequence2.gif
new file mode 100644
index 0000000..9e3968c
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/newSequence2.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/regx_wiz.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/regx_wiz.gif
new file mode 100644
index 0000000..789d137
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/regx_wiz.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/reloadgrammar.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/reloadgrammar.gif
new file mode 100644
index 0000000..c705db0
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/reloadgrammar.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/sort.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/sort.gif
new file mode 100644
index 0000000..3c65dc4
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/sort.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/xmlcatalog_obj.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/xmlcatalog_obj.gif
new file mode 100644
index 0000000..a61441f
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/icons/xmlcatalog_obj.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/navigation/DesignViewNavigationLocation.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/navigation/DesignViewNavigationLocation.java
new file mode 100644
index 0000000..c6a773e
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/navigation/DesignViewNavigationLocation.java
@@ -0,0 +1,339 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.navigation;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.StringTokenizer;
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.GraphicalViewer;
+import org.eclipse.gef.RootEditPart;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.INavigationLocation;
+import org.eclipse.ui.NavigationLocation;
+import org.eclipse.wst.xsd.adt.design.DesignViewGraphicalViewer;
+import org.eclipse.wst.xsd.adt.design.editparts.RootContentEditPart;
+import org.eclipse.wst.xsd.editor.internal.adapters.XSDAdapterFactory;
+import org.eclipse.wst.xsd.editor.internal.adapters.XSDVisitor;
+import org.eclipse.xsd.XSDConcreteComponent;
+import org.eclipse.xsd.XSDElementDeclaration;
+import org.eclipse.xsd.XSDSchema;
+import org.eclipse.xsd.XSDTypeDefinition;
+
+/**
+ * This class exists to support navigation in a context where there is no text 
+ * editor page.  In these cases we can't rely on the TextSelectionNavigationLocations
+ * so we this class which is designed to work with just the design view.
+ */
+public class DesignViewNavigationLocation extends NavigationLocation
+{
+  protected Path path;
+
+  public DesignViewNavigationLocation(IEditorPart part)
+  {
+    super(part);
+    this.path = new Path();
+  }
+  
+  public DesignViewNavigationLocation(IEditorPart part, XSDConcreteComponent component)
+  {
+    super(part);   
+    this.path = Path.computePath(component);  
+  }
+
+  public boolean mergeInto(INavigationLocation currentLocation)
+  {
+    boolean result = false;
+    if (currentLocation instanceof DesignViewNavigationLocation)
+    {
+      DesignViewNavigationLocation loc = (DesignViewNavigationLocation) currentLocation;
+      result = loc.path.toString().equals(path.toString());
+      //System.out.println("path1=" + loc.path.toString());
+      //System.out.println("path2=" + path.toString());
+    }
+    else
+    {
+//      System.out.println("this.editorPart = " + getEditorPart());
+//      System.out.println("that.editorPart = " + currentLocation.getInput());
+//      System.out.println(currentLocation.getClass().getName());
+    }
+    return result;
+  }
+
+  public void restoreLocation()
+  {
+    //System.out.println("resourceLocation " + path.toString());
+    XSDSchema schema = (XSDSchema) getEditorPart().getAdapter(XSDSchema.class);
+    Object viewer = getEditorPart().getAdapter(GraphicalViewer.class);
+    if (viewer instanceof DesignViewGraphicalViewer)
+    {
+      DesignViewGraphicalViewer graphicalViewer = (DesignViewGraphicalViewer) viewer;
+      RootEditPart rootEditPart = graphicalViewer.getRootEditPart();
+      EditPart editPart = rootEditPart.getContents();
+      if (editPart instanceof RootContentEditPart)
+      {
+        XSDConcreteComponent component = Path.computeComponent(schema, path);
+        if (component != null)
+        {
+          Adapter adapter = XSDAdapterFactory.getInstance().adapt(component);
+          if (adapter != null)
+          {
+            ((RootContentEditPart) editPart).setInput(adapter);
+          }
+        }
+      }
+    }
+  }
+
+  public void restoreState(IMemento memento)
+  {
+    String string = memento.getString("path");
+    path = Path.createPath(string);
+  }
+
+  public void saveState(IMemento memento)
+  {
+    memento.putString("path", path.toString());
+  }
+
+  public void update()
+  {
+    // TODO (cs) not sure what needs to be done here
+  }
+  static class PathSegment
+  {
+    final static int ELEMENT = 1;
+    final static int TYPE = 2;
+    int kind;
+    String name;
+
+    PathSegment()
+    {
+    }
+
+    PathSegment(int kind, String name)
+    {
+      this.kind = kind;
+      this.name = name;
+    }
+  }
+  static class Path
+  {
+    List segments = new ArrayList();
+
+    static XSDConcreteComponent computeComponent(XSDSchema schema, Path path)
+    {
+      PathResolvingXSDVisitor visitor = new PathResolvingXSDVisitor(path);
+      visitor.visitSchema(schema);
+      if (visitor.isDone())
+      {
+        return visitor.result;
+      }
+      return null;
+    }
+
+    static Path createPath(String string)
+    {
+      Path path = new Path();
+      PathSegment segment = null;
+      for (StringTokenizer st = new StringTokenizer(string, "/"); st.hasMoreTokens();)
+      {
+        String token = st.nextToken();
+        int kind = -1;
+        if (token.equals("element"))
+        {
+          kind = PathSegment.ELEMENT;
+        }
+        else if (token.equals("type"))
+        {
+          kind = PathSegment.TYPE;
+        }
+        if (kind != -1)
+        {
+          segment = new PathSegment();
+          segment.kind = kind;
+          path.segments.add(segment);
+          String namePattern = "[@name='";
+          int startIndex = token.indexOf(namePattern);
+          if (startIndex != -1)
+          {
+            startIndex += namePattern.length();
+            int endIndex = token.indexOf("']");
+            if (endIndex != -1)
+            {
+              segment.name = token.substring(startIndex, endIndex);
+            }
+          }
+        }
+      }
+      return path;
+    }
+
+    static Path computePath(XSDConcreteComponent component)
+    {
+      Path path = new Path();
+      for (EObject c = component; c != null; c = c.eContainer())
+      {
+        if (c instanceof XSDConcreteComponent)
+        {
+          PathSegment segment = computePathSegment((XSDConcreteComponent) c);
+          if (segment != null)
+          {
+            path.segments.add(0, segment);
+          }
+        }
+      }
+      return path;
+    }
+
+    static PathSegment computePathSegment(XSDConcreteComponent c)
+    {
+      if (c instanceof XSDElementDeclaration)
+      {
+        XSDElementDeclaration ed = (XSDElementDeclaration) c;
+        return new PathSegment(PathSegment.ELEMENT, ed.getResolvedElementDeclaration().getName());
+      }
+      else if (c instanceof XSDTypeDefinition)
+      {
+        XSDTypeDefinition td = (XSDTypeDefinition) c;
+        return new PathSegment(PathSegment.TYPE, td.getName());
+      }
+      return null;
+    }
+
+    public String toString()
+    {
+      StringBuffer b = new StringBuffer();
+      for (Iterator i = segments.iterator(); i.hasNext();)
+      {
+        PathSegment segment = (PathSegment) i.next();
+        String kind = "";
+        if (segment.kind == PathSegment.ELEMENT)
+        {
+          kind = "element";
+        }
+        else if (segment.kind == PathSegment.TYPE)
+        {
+          kind = "type";
+        }
+        b.append(kind);
+        if (segment.name != null)
+        {
+          b.append("[@name='" + segment.name + "']");
+        }
+        if (i.hasNext())
+        {
+          b.append("/");
+        }
+      }
+      return b.toString();
+    }
+  }
+  
+  
+  static class PathResolvingXSDVisitor extends XSDVisitor
+  {
+    Path path;
+    int index = -1;
+    PathSegment segment;
+    XSDConcreteComponent result = null;
+
+    PathResolvingXSDVisitor(Path path)
+    {
+      this.path = path;
+      incrementSegment();
+    }
+
+    boolean isDone()
+    {
+      return index >= path.segments.size();
+    }
+
+    void incrementSegment()
+    {
+      index++;
+      if (index < path.segments.size())
+      {
+        segment = (PathSegment) path.segments.get(index);
+      }
+      else
+      {
+        segment = null;
+      }
+    }
+
+    public void visitSchema(XSDSchema schema)
+    {
+      if (segment != null)
+      {
+        if (segment.kind == PathSegment.ELEMENT)
+        {
+          XSDElementDeclaration ed = schema.resolveElementDeclaration(segment.name);
+          if (ed != null)
+          {
+            visitElementDeclaration(ed);
+          }
+        }
+        else if (segment.kind == PathSegment.TYPE)
+        {
+          XSDTypeDefinition td = schema.resolveTypeDefinition(segment.name);
+          if (td != null)
+          {
+            visitTypeDefinition(td);
+          }
+        }
+      }
+    }
+
+    public void visitElementDeclaration(XSDElementDeclaration element)
+    {
+      if (segment != null)
+      {
+        String name = element.getResolvedElementDeclaration().getName();
+        if (segment.kind == PathSegment.ELEMENT && isMatch(segment.name, name))
+        {
+          result = element;
+          incrementSegment();
+          if (!isDone())
+          {
+            super.visitElementDeclaration(element);
+          }
+        }
+      }
+    }
+
+    public void visitTypeDefinition(XSDTypeDefinition type)
+    {
+      if (segment != null)
+      {
+        String name = type.getName();
+        if (segment.kind == PathSegment.TYPE && isMatch(segment.name, name))
+        {
+          result = type;
+          incrementSegment();
+          if (!isDone())
+          {
+            super.visitTypeDefinition(type);
+          }
+        }
+      }
+    }
+
+    protected boolean isMatch(String name1, String name2)
+    {
+      return name1 != null ? name1.equals(name2) : name1 == name2;
+    }
+  }
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/navigation/MultiPageEditorTextSelectionNavigationLocation.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/navigation/MultiPageEditorTextSelectionNavigationLocation.java
new file mode 100644
index 0000000..8cb66ff
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/navigation/MultiPageEditorTextSelectionNavigationLocation.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.navigation;
+
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.eclipse.ui.texteditor.TextSelectionNavigationLocation;
+
+/**
+ * The platform's navigation history plumbing doesn't like multipage text
+ * editors very much and tends to ignore text locations.  To fix this
+ * problem we need to override the getEditPart() method of the super class
+ * in order to return the actual TextEditor of our multi-page editor
+ */
+public class MultiPageEditorTextSelectionNavigationLocation extends TextSelectionNavigationLocation
+{
+  public MultiPageEditorTextSelectionNavigationLocation(ITextEditor part, boolean initialize)
+  {
+    super(part, initialize);
+  }
+
+  protected IEditorPart getEditorPart()
+  {
+    IEditorPart part = super.getEditorPart();
+    return (ITextEditor) part.getAdapter(ITextEditor.class);
+  }
+
+  public String getText()
+  {
+    // ISSUE: how to get title?
+    // IEditorPart part = getEditorPart();
+    // if (part instanceof WSDLTextEditor) {
+    // return ((WSDLTextEditor) part).getWSDLEditor().getTitle();
+    // }
+    // else {
+    // return super.getText();
+    // }
+    return super.getText();
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/preferences/XSDPreferencePage.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/preferences/XSDPreferencePage.java
new file mode 100644
index 0000000..7e4ecd2
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/preferences/XSDPreferencePage.java
@@ -0,0 +1,254 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.eclipse.ui.help.WorkbenchHelp;
+import org.eclipse.wst.xsd.editor.XSDEditorContextIds;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+import org.eclipse.wst.xsd.ui.internal.util.ViewUtility;
+
+public class XSDPreferencePage extends PreferencePage implements IWorkbenchPreferencePage, Listener 
+{
+  Text indentTextField;
+  String indentString;
+  Text schemaNsPrefixField;
+  Text defaultTargetNamespaceText;
+  Button qualifyXSDLanguage;
+
+  /**
+   * Creates preference page controls on demand.
+   *   @param parent  the parent for the preference page
+   */
+  protected Control createContents(Composite parent)
+  {
+    WorkbenchHelp.setHelp(parent, XSDEditorContextIds.XSDP_PREFERENCE_PAGE);
+
+    Group group = createGroup(parent, 2);   
+    group.setText(XSDEditorPlugin.getXSDString("_UI_TEXT_XSD_NAMESPACE_PREFIX"));
+
+    qualifyXSDLanguage = ViewUtility.createCheckBox(group, XSDEditorPlugin.getXSDString("_UI_QUALIFY_XSD"));
+    ViewUtility.createLabel(group, " ");
+
+    createLabel(group, XSDEditorPlugin.getXSDString("_UI_TEXT_XSD_DEFAULT_PREFIX"));
+    schemaNsPrefixField = createTextField(group);
+    schemaNsPrefixField.addKeyListener(new KeyAdapter()
+    {
+      public void keyPressed(KeyEvent e)
+      {
+        setValid(true);
+      }      
+    });
+    
+    createLabel(group, XSDEditorPlugin.getXSDString("_UI_TEXT_XSD_DEFAULT_TARGET_NAMESPACE"));
+    defaultTargetNamespaceText = createTextField(group);
+
+    initializeValues();
+
+    return new Composite(parent, SWT.NULL);
+  }
+
+  private Group createGroup(Composite parent, int numColumns) 
+  {
+    Group group = new Group(parent, SWT.NULL);
+
+    GridLayout layout = new GridLayout();
+    layout.numColumns = numColumns;
+    group.setLayout(layout);
+
+    GridData data = new GridData();
+    data.verticalAlignment = GridData.FILL;
+    data.horizontalAlignment = GridData.FILL;
+    data.grabExcessHorizontalSpace = true;
+    group.setLayoutData(data);
+    
+    return group;
+  }
+
+  private Text createTextField(Composite parent) 
+  {
+     Text text = new Text(parent, SWT.SINGLE | SWT.BORDER);
+     GridData data = new GridData();
+     data.verticalAlignment = GridData.FILL;
+     data.horizontalAlignment = GridData.FILL;
+     data.grabExcessHorizontalSpace = true;
+     text.setLayoutData(data);
+
+     return text;
+  }
+
+  private Label createLabel(Composite parent, String text) 
+  {
+    Label label = new Label(parent, SWT.LEFT);
+    label.setText(text);
+    
+    GridData data = new GridData();
+    data.verticalAlignment = GridData.CENTER;
+    data.horizontalAlignment = GridData.FILL;
+    label.setLayoutData(data);
+    
+    return label;
+  }
+  
+  /**
+   * Does anything necessary because the default button has been pressed.
+   */
+  protected void performDefaults() 
+  {
+    super.performDefaults();
+    initializeDefaults();
+    checkValues();
+  }
+
+  /**
+   * Do anything necessary because the OK button has been pressed.
+   *  @return whether it is okay to close the preference page
+   */
+  public boolean performOk() 
+  {
+    if (checkValues())
+    {
+      storeValues();    
+      return true;
+    }
+    return false;
+  }
+
+  protected void performApply()
+  {
+    if (checkValues())
+    {
+      storeValues();    
+    }
+  }
+
+  /**
+   * Handles events generated by controls on this page.
+   *   @param e  the event to handle
+   */
+  public void handleEvent(Event e) 
+  {
+  }
+
+  /**
+   * @see IWorkbenchPreferencePage
+   */
+  public void init(IWorkbench workbench)
+  { 
+  }
+
+  /** 
+   * The indent is stored in the preference store associated with the XML Schema Model
+   */
+  public IPreferenceStore getPreferenceStore()
+  {
+    return XSDEditorPlugin.getPlugin().getPreferenceStore();
+  }
+
+  /**
+   * Initializes states of the controls using default values
+   * in the preference store.
+   */
+  private void initializeDefaults() 
+  {
+    schemaNsPrefixField.setText(getPreferenceStore().getDefaultString(XSDEditorPlugin.CONST_XSD_DEFAULT_PREFIX_TEXT));
+    qualifyXSDLanguage.setSelection(getPreferenceStore().getDefaultBoolean(XSDEditorPlugin.CONST_XSD_LANGUAGE_QUALIFY));
+    defaultTargetNamespaceText.setText(getPreferenceStore().getString(XSDEditorPlugin.CONST_DEFAULT_TARGET_NAMESPACE));
+  }
+
+  /**
+   * Initializes states of the controls from the preference store.
+   */
+  private void initializeValues() 
+  {
+    IPreferenceStore store = getPreferenceStore();
+    schemaNsPrefixField.setText(store.getString(XSDEditorPlugin.CONST_XSD_DEFAULT_PREFIX_TEXT));
+    qualifyXSDLanguage.setSelection(store.getBoolean(XSDEditorPlugin.CONST_XSD_LANGUAGE_QUALIFY));
+    defaultTargetNamespaceText.setText(store.getString(XSDEditorPlugin.CONST_DEFAULT_TARGET_NAMESPACE));
+  }
+
+  /**
+   * Stores the values of the controls back to the preference store.
+   */
+  private void storeValues() 
+  {
+    IPreferenceStore store = getPreferenceStore();
+
+    store.setValue(XSDEditorPlugin.CONST_XSD_DEFAULT_PREFIX_TEXT, getXMLSchemaPrefix());
+    store.setValue(XSDEditorPlugin.CONST_XSD_LANGUAGE_QUALIFY, getQualify());
+    store.setValue(XSDEditorPlugin.CONST_DEFAULT_TARGET_NAMESPACE, getXMLSchemaTargetNamespace());
+
+    XSDEditorPlugin.getPlugin().savePluginPreferences();
+  }
+
+  public String getXMLSchemaPrefix()
+  {
+    String prefix = schemaNsPrefixField.getText();
+    if (prefix == null || prefix.equals("")) 
+    {
+      return "xsd";
+    }
+    return prefix;
+  }
+
+  public boolean getQualify()
+  {
+    return qualifyXSDLanguage.getSelection();
+  }
+  
+  /**
+   * Get the xml schema default target namespace
+   */
+  public String getXMLSchemaTargetNamespace()
+  {
+  	String targetNamespace = defaultTargetNamespaceText.getText();
+    if (targetNamespace == null || targetNamespace.equals("")) 
+    {
+      return XSDEditorPlugin.DEFAULT_TARGET_NAMESPACE;
+    }
+    return targetNamespace;
+  }
+  
+  public boolean checkValues()
+  {
+// KCPort TODO    String errorMessage = ValidateHelper.checkXMLName(schemaNsPrefixField.getText());
+	 String errorMessage = null;
+
+    if (errorMessage == null || errorMessage.length() == 0)
+    {
+      setErrorMessage(null);
+      setValid(true);
+      return true;
+    }
+    else
+    {
+      setErrorMessage(XSDEditorPlugin.getXSDString("_ERROR_LABEL_INVALID_PREFIX"));
+      setValid(false);
+      return false;
+    }
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/search/IXSDTypesFilter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/search/IXSDTypesFilter.java
new file mode 100644
index 0000000..204066c
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/search/IXSDTypesFilter.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.search;
+
+public interface IXSDTypesFilter {	
+	/**
+	 * Give me an Object o, if I know it and it should be filtered out, I will 
+	 * return true. Otherwise I'll return false, even if I don't know the object 
+	 * @param o
+	 * @return
+	 */
+	public boolean shouldFilterOut(Object o);
+	
+	public void turnOn();
+	public void turnOff();
+	public boolean isOn();
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/search/XSDComponentDescriptionProvider.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/search/XSDComponentDescriptionProvider.java
new file mode 100644
index 0000000..d62bce1
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/search/XSDComponentDescriptionProvider.java
@@ -0,0 +1,185 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.search;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.common.core.search.SearchMatch;
+import org.eclipse.wst.common.core.search.pattern.QualifiedName;
+import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification;
+import org.eclipse.wst.common.ui.internal.search.dialogs.IComponentDescriptionProvider;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+import org.eclipse.wst.xsd.ui.internal.search.IXSDSearchConstants;
+import org.eclipse.xsd.XSDComplexTypeDefinition;
+import org.eclipse.xsd.XSDConcreteComponent;
+import org.eclipse.xsd.XSDElementDeclaration;
+import org.eclipse.xsd.XSDNamedComponent;
+import org.eclipse.xsd.XSDSchema;
+import org.eclipse.xsd.XSDSimpleTypeDefinition;
+
+public class XSDComponentDescriptionProvider extends LabelProvider implements IComponentDescriptionProvider
+{
+  public boolean isApplicable(Object component)
+  {
+    // TODO (cs) if this provider is used in a multi language context
+    // we'll need to provide some logic here
+    return true;
+  }
+
+  private static final Image SIMPLE_TYPE_IMAGE =  XSDEditorPlugin.getXSDImage("icons/XSDSimpleType.gif");
+  private static final Image COMPLEX_TYPE_IMAGE = XSDEditorPlugin.getXSDImage("icons/XSDComplexType.gif");
+  private static final Image ELEMENT_IMAGE = XSDEditorPlugin.getXSDImage("icons/XSDElement.gif");
+  //private final static Image BUILT_IN_TYPE)IMAGE = 
+    
+  public String getQualifier(Object component)
+  {
+    String result = null;
+    if (component instanceof ComponentSpecification)
+    {
+      result = ((ComponentSpecification)component).getQualifier();
+    }  
+    else if (component instanceof XSDNamedComponent)
+    {
+      result = ((XSDNamedComponent)component).getTargetNamespace(); 
+    }  
+    else if (component instanceof SearchMatch)
+    {
+      QualifiedName qualifiedName = getQualifiedNameForSearchMatch((SearchMatch)component);
+      if (qualifiedName != null)
+      {  
+        result = qualifiedName.getNamespace();
+      }    
+    }  
+    return result;
+  }
+  
+  // TODO... this will be much easier with Hiroshi's proposed SearchMatch changes
+  //
+  private QualifiedName getQualifiedNameForSearchMatch(SearchMatch match)
+  {
+    QualifiedName qualifiedName = null;
+    Object o = match.map.get("name");
+    if (o != null && o instanceof QualifiedName)
+    {  
+      qualifiedName = (QualifiedName)o;
+    }      
+    return qualifiedName;
+  }
+
+  public String getName(Object component)
+  {
+    String result = null;
+    if (component instanceof ComponentSpecification)
+    {
+      result = ((ComponentSpecification)component).getName();
+    }  
+    else if (component instanceof XSDNamedComponent)
+    {
+      result = ((XSDNamedComponent)component).getName(); 
+    }  
+    else if (component instanceof SearchMatch)
+    {
+      QualifiedName qualifiedName = getQualifiedNameForSearchMatch((SearchMatch)component);
+      if (qualifiedName != null)
+      {  
+        result = qualifiedName.getLocalName();
+      }    
+    }      
+    return result;
+  }
+
+  public IFile getFile(Object component)
+  {
+    IFile result = null;
+    if (component instanceof ComponentSpecification)
+    {
+      result = ((ComponentSpecification)component).getFile();
+    }  
+    else if (component instanceof SearchMatch)
+    {
+      result = ((SearchMatch)component).getFile();
+    }  
+    else if (component instanceof XSDConcreteComponent)
+    {
+      XSDConcreteComponent concreteComponent = (XSDConcreteComponent)component;
+      XSDSchema schema = concreteComponent.getSchema();
+      if (schema != null)
+      {
+        // TODO (cs) revisit and test more
+        //
+        String location = schema.getSchemaLocation();
+        String platformResource = "platform:/resource";
+        if (location != null && location.startsWith(platformResource))
+        {
+          Path path = new Path(location.substring(platformResource.length()));
+          result = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
+        }  
+      }  
+    }
+    return result;
+  }
+
+  public ILabelProvider getLabelProvider()
+  {
+    return this;
+  }
+  
+  public String getText(Object element)
+  {
+    String result = "";
+    String name = getName(element);
+    if (name != null)
+    {
+      result += name;
+      /*
+      String qualifier = getQualifier(element);
+      if (qualifier != null)
+      {
+        result += " - " + qualifier;
+      }  
+      IFile file = getFile(element);
+      if (file != null)
+      {
+        result += "  (" + file.getProject().getName() + ")";
+      }*/ 
+    }
+    return result;
+  } 
+  
+  public Image getImage(Object component)
+  {
+    Image result = null; 
+    if (component instanceof SearchMatch)
+    {
+      SearchMatch searchMatch = (SearchMatch)component;
+      QualifiedName qualifiedName = (QualifiedName)searchMatch.map.get("metaName");
+      if ( qualifiedName != null ){
+    	  if ( qualifiedName.equals(IXSDSearchConstants.SIMPLE_TYPE_META_NAME))
+    		  result = SIMPLE_TYPE_IMAGE;
+    	  else if ( qualifiedName.equals(IXSDSearchConstants.COMPLEX_TYPE_META_NAME))
+    		  result = COMPLEX_TYPE_IMAGE;
+    	  else if ( qualifiedName.equals(IXSDSearchConstants.ELEMENT_META_NAME))
+    		  result = ELEMENT_IMAGE;
+      }
+    }      
+    else if (component instanceof XSDComplexTypeDefinition)
+      result = COMPLEX_TYPE_IMAGE;      
+    else if (component instanceof XSDSimpleTypeDefinition)
+      result = SIMPLE_TYPE_IMAGE;
+    else if (component instanceof XSDElementDeclaration)
+      result = ELEMENT_IMAGE;
+    return result;
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/search/XSDElementsSearchListProvider.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/search/XSDElementsSearchListProvider.java
new file mode 100644
index 0000000..288609b
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/search/XSDElementsSearchListProvider.java
@@ -0,0 +1,170 @@
+package org.eclipse.wst.xsd.editor.internal.search;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.wst.common.core.search.SearchEngine;
+import org.eclipse.wst.common.core.search.SearchMatch;
+import org.eclipse.wst.common.core.search.SearchParticipant;
+import org.eclipse.wst.common.core.search.SearchPlugin;
+import org.eclipse.wst.common.core.search.SearchRequestor;
+import org.eclipse.wst.common.core.search.pattern.QualifiedName;
+import org.eclipse.wst.common.core.search.pattern.SearchPattern;
+import org.eclipse.wst.common.core.search.scope.SearchScope;
+import org.eclipse.wst.common.ui.internal.search.dialogs.IComponentList;
+import org.eclipse.wst.common.ui.internal.search.dialogs.IComponentSearchListProvider;
+import org.eclipse.wst.xml.core.internal.search.XMLComponentDeclarationPattern;
+import org.eclipse.wst.xsd.ui.internal.search.IXSDSearchConstants;
+import org.eclipse.xsd.XSDElementDeclaration;
+import org.eclipse.xsd.XSDImport;
+import org.eclipse.xsd.XSDInclude;
+import org.eclipse.xsd.XSDSchema;
+import org.eclipse.xsd.XSDSchemaContent;
+import org.eclipse.xsd.XSDSchemaDirective;
+
+public class XSDElementsSearchListProvider implements
+		IComponentSearchListProvider {
+	protected XSDSchema[] schemas;
+
+	protected IFile currentFile;
+
+	// TODO (cs) remove these and use proper search scopes!
+	//
+	public static final int ENCLOSING_PROJECT_SCOPE = 0;
+
+	public static final int ENTIRE_WORKSPACE_SCOPE = 1;
+
+	public XSDElementsSearchListProvider(IFile currentFile,
+			XSDSchema[] schemas) {
+		this.schemas = schemas;
+		this.currentFile = currentFile;
+	}
+
+	public void populateComponentList(IComponentList list, SearchScope scope,
+			IProgressMonitor pm) {
+		// we traverse the elements already defined within the visible
+		// schemas
+		// we do this in addition to the component search since this should
+		// execute
+		// very quickly and there's a good chance the user wants to select an
+		// element that's
+		// already imported/included
+		// TODO (cs) ensure we don't add duplicates when we proceed to use the
+		// search list
+		//
+		for (int i = 0; i < schemas.length; i++) {
+			XSDSchema schema = schemas[i];
+			ComponentCollectingXSDVisitor visitor = 
+				new ComponentCollectingXSDVisitor(list);
+			visitor.visitSchema(schema, true);
+		}
+
+		// finally we call the search API's to do a potentially slow search
+		if (scope != null) {
+			populateComponentListUsingSearch(list, scope, pm);
+		}
+	}
+
+	class ComponentCollectingXSDVisitor {
+		protected List visitedSchemas = new ArrayList();
+
+		IComponentList list;
+
+		ComponentCollectingXSDVisitor(IComponentList list) {
+			this.list = list;
+		}
+
+		public void visitSchema(XSDSchema schema, boolean visitImportedSchema) {
+			
+			visitedSchemas.add(schema);
+			for (Iterator contents = schema.getContents().iterator(); contents.hasNext();) {
+				XSDSchemaContent content = (XSDSchemaContent) contents.next();
+				if (content instanceof XSDSchemaDirective) {
+					XSDSchemaDirective schemaDirective = (XSDSchemaDirective) content;
+					XSDSchema extSchema = schemaDirective.getResolvedSchema();
+					if (extSchema != null && !visitedSchemas.contains(extSchema)){
+						if ( schemaDirective instanceof XSDImport && visitImportedSchema){
+							visitSchema(extSchema, false);
+						}
+						else if ( extSchema instanceof XSDInclude || extSchema instanceof XSDImport){
+							visitSchema(extSchema, false);
+						}
+					}
+				} else if (content instanceof XSDElementDeclaration) {
+					list.add(content);
+				}
+			}
+		}
+	}
+
+	private void populateComponentListUsingSearch(IComponentList list,
+			SearchScope scope, IProgressMonitor pm) {
+		SearchEngine searchEngine = new SearchEngine();
+		InternalSearchRequestor requestor = new InternalSearchRequestor(list);
+		findTypes(searchEngine, requestor, scope,
+				IXSDSearchConstants.ELEMENT_META_NAME);
+	}
+
+	class InternalSearchRequestor extends SearchRequestor {
+		IComponentList componentList;
+
+		InternalSearchRequestor(IComponentList componentList) {
+			this.componentList = componentList;
+		}
+
+		public void acceptSearchMatch(SearchMatch match) throws CoreException {
+			// we filter out the matches from the current file since we assume
+			// the
+			// info derived from our schema models is more update to date
+			// (in the event that we haven't saved our latest modifications)
+			//
+			if (match.getFile() != currentFile) {
+				// TODO... this ugly qualified name stashing will go away soon
+				//
+				QualifiedName qualifiedName = null;
+				Object o = match.map.get("name");
+				if (o != null && o instanceof QualifiedName) {
+					qualifiedName = (QualifiedName) o;
+				}
+				if (qualifiedName != null
+						&& qualifiedName.getLocalName() != null) {
+					componentList.add(match);
+				}
+			}
+		}
+	}
+
+	protected void findTypes(SearchEngine searchEngine,
+			SearchRequestor requestor, SearchScope scope, QualifiedName metaName) {
+		try {
+			XMLComponentDeclarationPattern pattern = new XMLComponentDeclarationPattern(
+					new QualifiedName("*", "*"), metaName,
+					SearchPattern.R_PATTERN_MATCH);
+
+			// TODO (cs) revist this... we shouldn't be needing to hard-code
+			// partipant id's
+			// All we're really doing here is trying to avoid finding matches in
+			// wsdl's since we don't
+			// ever want to import/include a wsdl from a schema! Maybe we should
+			// just scope out any file
+			// types that aren't xsd's using a custom SearchScope?
+			//
+			SearchParticipant particpant = SearchPlugin.getDefault()
+					.getSearchParticipant(
+							"org.eclipse.wst.xsd.search.XSDSearchParticipant");
+
+			Assert.isNotNull(particpant);
+			SearchParticipant[] participants = { particpant };
+			searchEngine.search(pattern, requestor, participants, scope, null,
+					new NullProgressMonitor());
+		} catch (CoreException e) {
+			e.printStackTrace();
+		}
+	}
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/search/XSDSearchListDialogDelegate.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/search/XSDSearchListDialogDelegate.java
new file mode 100644
index 0000000..31b50b0
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/search/XSDSearchListDialogDelegate.java
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.search;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.wst.common.core.search.pattern.QualifiedName;
+import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSearchListDialog;
+import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSearchListDialogConfiguration;
+import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification;
+import org.eclipse.wst.common.ui.internal.search.dialogs.ScopedComponentSearchListDialog;
+import org.eclipse.wst.xsd.adt.edit.IComponentDialog;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+import org.eclipse.wst.xsd.editor.internal.dialogs.NewTypeButtonHandler;
+import org.eclipse.xsd.XSDSchema;
+import org.eclipse.xsd.util.XSDConstants;
+
+public class XSDSearchListDialogDelegate implements IComponentDialog
+{
+  public final static QualifiedName TYPE_META_NAME = new QualifiedName(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, "type");
+  public final static QualifiedName ELEMENT_META_NAME = new QualifiedName(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, "element");
+  // protected Object setObject;
+  protected ComponentSpecification selection;
+  protected IFile currentFile;
+  protected XSDSchema[] schemas;
+  protected QualifiedName metaName;
+
+  public XSDSearchListDialogDelegate(QualifiedName metaName, IFile currentFile, XSDSchema[] schemas)
+  {
+    super();
+    this.metaName = metaName;
+    this.currentFile = currentFile;
+    this.schemas = schemas;
+  }
+
+  public ComponentSpecification getSelectedComponent()
+  {
+    return selection;
+  }
+
+  public void setInitialSelection(ComponentSpecification componentSpecification)
+  {
+    // TODO Auto-generated method stub   
+  }
+  
+  public int createAndOpen()
+  {
+    Shell shell = XSDEditorPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell();
+    int returnValue = Window.CANCEL;
+    ComponentSearchListDialog dialog = null;
+    if ( metaName == ELEMENT_META_NAME)
+    {
+    	XSDComponentDescriptionProvider descriptionProvider = new XSDComponentDescriptionProvider();
+    	final XSDElementsSearchListProvider searchListProvider = new XSDElementsSearchListProvider(currentFile, schemas);
+    	ComponentSearchListDialogConfiguration configuration = new ComponentSearchListDialogConfiguration();
+    	
+        configuration.setDescriptionProvider(descriptionProvider);
+        configuration.setSearchListProvider(searchListProvider);
+        configuration.setFilterLabelText("Name:");
+        //TODO externalize string
+        dialog = new ScopedComponentSearchListDialog(shell, "Set element reference", configuration);
+    }
+    else if (metaName == TYPE_META_NAME)
+    {
+      XSDComponentDescriptionProvider descriptionProvider = new XSDComponentDescriptionProvider();
+      final XSDTypesSearchListProvider searchListProvider = new XSDTypesSearchListProvider(currentFile, schemas);
+     
+      ComponentSearchListDialogConfiguration configuration = new ComponentSearchListDialogConfiguration();
+      configuration.setDescriptionProvider(descriptionProvider);
+      configuration.setSearchListProvider(searchListProvider);
+      configuration.setNewComponentHandler(new NewTypeButtonHandler());
+      dialog = new ScopedComponentSearchListDialog(shell, XSDEditorPlugin.getXSDString("_UI_LABEL_SET_TYPE"), configuration);
+    }
+    
+    if (dialog != null)
+    {
+      dialog.setBlockOnOpen(true);
+      dialog.create();
+      returnValue = dialog.open();
+      if (returnValue == Window.OK)
+      {
+        selection = dialog.getSelectedComponent();
+      }
+    }
+    return returnValue;
+  }
+
+  private IEditorPart getActiveEditor()
+  {
+    IWorkbench workbench = PlatformUI.getWorkbench();
+    IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
+    IEditorPart editorPart = workbenchWindow.getActivePage().getActiveEditor();
+    return editorPart;
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/search/XSDTypesSearchListProvider.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/search/XSDTypesSearchListProvider.java
new file mode 100644
index 0000000..e201cba
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/search/XSDTypesSearchListProvider.java
@@ -0,0 +1,220 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.search;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.wst.common.core.search.SearchEngine;
+import org.eclipse.wst.common.core.search.SearchMatch;
+import org.eclipse.wst.common.core.search.SearchParticipant;
+import org.eclipse.wst.common.core.search.SearchPlugin;
+import org.eclipse.wst.common.core.search.SearchRequestor;
+import org.eclipse.wst.common.core.search.pattern.QualifiedName;
+import org.eclipse.wst.common.core.search.pattern.SearchPattern;
+import org.eclipse.wst.common.core.search.scope.SearchScope;
+import org.eclipse.wst.common.ui.internal.search.dialogs.IComponentList;
+import org.eclipse.wst.common.ui.internal.search.dialogs.IComponentSearchListProvider;
+import org.eclipse.wst.xml.core.internal.search.XMLComponentDeclarationPattern;
+import org.eclipse.wst.xsd.ui.internal.search.IXSDSearchConstants;
+import org.eclipse.xsd.XSDComplexTypeDefinition;
+import org.eclipse.xsd.XSDImport;
+import org.eclipse.xsd.XSDInclude;
+import org.eclipse.xsd.XSDRedefine;
+import org.eclipse.xsd.XSDSchema;
+import org.eclipse.xsd.XSDSchemaContent;
+import org.eclipse.xsd.XSDSchemaDirective;
+import org.eclipse.xsd.XSDTypeDefinition;
+import org.eclipse.xsd.impl.XSDSchemaImpl;
+import org.eclipse.xsd.util.XSDConstants;
+
+public class XSDTypesSearchListProvider implements IComponentSearchListProvider
+{
+  protected XSDSchema[] schemas;
+  protected IFile currentFile;
+  // TODO (cs) remove these and use proper search scopes!
+  //
+  public static final int ENCLOSING_PROJECT_SCOPE = 0;
+  public static final int ENTIRE_WORKSPACE_SCOPE = 1;
+  
+  protected IXSDTypesFilter builtInFilter;
+  
+  /**
+   * Determines if we should use the filter
+   * This us used to turn the filter on and off 
+   */
+  protected boolean supportFilter = true;
+  private boolean showComplexTypes = true;
+
+  public XSDTypesSearchListProvider(IFile currentFile, XSDSchema[] schemas)
+  {
+    this.schemas = schemas;
+    this.currentFile = currentFile;
+  }
+
+  public void populateComponentList(IComponentList list, SearchScope scope, IProgressMonitor pm)
+  {	  
+    // first we add the 'built in' types
+    //
+    XSDSchema schemaForSchema = XSDSchemaImpl.getSchemaForSchema(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001);
+    for (Iterator i = schemaForSchema.getSimpleTypeIdMap().values().iterator(); i.hasNext();)
+    {
+    	XSDTypeDefinition td = (XSDTypeDefinition) i.next();
+    	if ( builtInFilter == null || !builtInFilter.shouldFilterOut(td) ) {
+    		list.add(td);
+    	}
+    }    
+  
+    // now we traverse the types already defined within the visible schemas
+    // we do this in addition to the component search since this should execute
+    // very quickly and there's a good chance the user wants to select a time that's 
+    // already imported/included
+    // TODO (cs) ensure we don't add duplicates when we proceed to use the search list
+    //
+    for (int i = 0; i < schemas.length; i++)
+    {
+      XSDSchema schema = schemas[i];
+      ComponentCollectingXSDVisitor visitor = new ComponentCollectingXSDVisitor(list);
+      visitor.visitSchema(schema, true);
+    }
+    
+    // finally we call the search API's to do a potentially slow search
+    //
+    if (scope != null)
+    {  
+      populateComponentListUsingSearch(list, scope, pm);
+    }  
+  }
+  class ComponentCollectingXSDVisitor
+  {
+    protected List visitedSchemas = new ArrayList();
+    IComponentList list;
+    
+    ComponentCollectingXSDVisitor(IComponentList list)
+    {
+      this.list = list;  
+    }
+
+    public void visitSchema(XSDSchema schema, boolean visitImportedSchema)
+    {
+      visitedSchemas.add(schema);
+      for (Iterator contents = schema.getContents().iterator(); contents.hasNext();)
+      {
+        XSDSchemaContent content = (XSDSchemaContent) contents.next();
+        if (content instanceof XSDSchemaDirective)
+        {
+          XSDSchemaDirective schemaDirective = (XSDSchemaDirective) content;
+          XSDSchema extSchema = schemaDirective.getResolvedSchema();
+          if (extSchema != null && !visitedSchemas.contains(extSchema))
+          {
+            if ( schemaDirective instanceof XSDImport && visitImportedSchema){
+            	visitSchema(extSchema, false);
+            }
+            else if ( schemaDirective instanceof XSDInclude ||
+            		schemaDirective instanceof XSDRedefine){
+            	visitSchema(extSchema, false);
+            }
+          }
+        }
+        else if (content instanceof XSDTypeDefinition)
+        {
+          if ( showComplexTypes || ! (content instanceof XSDComplexTypeDefinition) )
+        	  list.add(content);
+        }
+      }
+    }
+  }
+
+  private void populateComponentListUsingSearch(IComponentList list, SearchScope scope, IProgressMonitor pm)
+  {
+    SearchEngine searchEngine = new SearchEngine();
+    InternalSearchRequestor requestor = new InternalSearchRequestor(list);
+    if (showComplexTypes)
+    	findTypes(searchEngine, requestor, scope, IXSDSearchConstants.COMPLEX_TYPE_META_NAME);
+    findTypes(searchEngine, requestor, scope, IXSDSearchConstants.SIMPLE_TYPE_META_NAME);
+  }
+  
+  class InternalSearchRequestor extends SearchRequestor
+  {
+    IComponentList componentList;
+
+    InternalSearchRequestor(IComponentList componentList)
+    {
+      this.componentList = componentList;
+    }
+
+    public void acceptSearchMatch(SearchMatch match) throws CoreException
+    {
+      // we filter out the matches from the current file since we assume the
+      // info derived from our schema models is more update to date
+      // (in the event that we haven't saved our latest modifications)
+      //
+      if (match.getFile() != currentFile)
+      {  
+        // TODO... this ugly qualified name stashing will go away soon
+        //
+        QualifiedName qualifiedName = null;
+        Object o = match.map.get("name");
+        if (o != null && o instanceof QualifiedName)
+        {  
+          qualifiedName = (QualifiedName)o;
+        } 
+        if (qualifiedName != null && qualifiedName.getLocalName() != null)
+        {  
+          componentList.add(match);
+        }
+      }  
+    }
+  }
+
+  protected void findTypes(SearchEngine searchEngine, SearchRequestor requestor, SearchScope scope, QualifiedName metaName)
+  {
+    try
+    {
+      XMLComponentDeclarationPattern pattern = new XMLComponentDeclarationPattern(new QualifiedName("*", "*"), metaName, SearchPattern.R_PATTERN_MATCH);
+      
+      // TODO (cs) revist this... we shouldn't be needing to hard-code partipant id's
+      // All we're really doing here is trying to avoid finding matches in wsdl's since we don't
+      // ever want to import/include a wsdl from a schema! Maybe we should just scope out any file 
+      // types that aren't xsd's using a custom SearchScope?
+      //
+      SearchParticipant particpant = SearchPlugin.getDefault().getSearchParticipant("org.eclipse.wst.xsd.search.XSDSearchParticipant");
+      Assert.isNotNull(particpant);
+      SearchParticipant[] participants = {particpant};
+      searchEngine.search(pattern, requestor, participants, scope, null, new NullProgressMonitor());
+    }
+    catch (CoreException e)
+    {
+      e.printStackTrace();
+    }
+  }
+
+  public void _populateComponentListQuick(IComponentList list, IProgressMonitor pm)
+  {    
+  }
+
+  public void turnBuiltInFilterOn(boolean option){
+	  supportFilter = option;
+  }
+  
+  public void setBuiltInFilter(IXSDTypesFilter filter) {
+ 	this.builtInFilter = filter;
+  }
+  
+  public void showComplexTypes(boolean show){
+	  showComplexTypes = show;
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/utils/OpenOnSelectionHelper.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/utils/OpenOnSelectionHelper.java
new file mode 100644
index 0000000..5789cc6
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/editor/internal/utils/OpenOnSelectionHelper.java
@@ -0,0 +1,330 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.editor.internal.utils;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.wst.common.uriresolver.internal.util.URIHelper;
+import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
+import org.eclipse.wst.sse.ui.StructuredTextEditor;
+import org.eclipse.wst.xsd.editor.InternalXSDMultiPageEditor;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+import org.eclipse.xsd.XSDAttributeDeclaration;
+import org.eclipse.xsd.XSDAttributeGroupDefinition;
+import org.eclipse.xsd.XSDConcreteComponent;
+import org.eclipse.xsd.XSDElementDeclaration;
+import org.eclipse.xsd.XSDIdentityConstraintDefinition;
+import org.eclipse.xsd.XSDModelGroupDefinition;
+import org.eclipse.xsd.XSDNamedComponent;
+import org.eclipse.xsd.XSDSchema;
+import org.eclipse.xsd.XSDSchemaDirective;
+import org.eclipse.xsd.XSDSimpleTypeDefinition;
+import org.eclipse.xsd.XSDTypeDefinition;
+import org.eclipse.xsd.util.XSDConstants;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Node;
+
+
+// issue (cs) can we remove this?
+//
+public class OpenOnSelectionHelper
+{
+  
+  protected StructuredTextEditor textEditor;
+  protected XSDSchema xsdSchema;
+
+ 
+  public OpenOnSelectionHelper(StructuredTextEditor textEditor, XSDSchema xsdSchema)
+  {
+  	this.textEditor = textEditor;
+  	this.xsdSchema = xsdSchema;
+  }
+  
+
+  boolean lastResult;
+  
+  public static void openXSDEditor(String schemaLocation)
+  {
+		IPath schemaPath = new Path(schemaLocation);
+		
+		final IFile schemaFile = ResourcesPlugin.getWorkspace().getRoot().getFile(schemaPath);
+	
+		Display.getDefault().syncExec(new Runnable()
+		{
+			/**
+			 * @see java.lang.Runnable#run()
+			 */
+			public void run()
+			{
+				final IWorkbenchWindow workbenchWindow = XSDEditorPlugin.getPlugin().getWorkbench().getActiveWorkbenchWindow();
+				if (workbenchWindow != null)
+				{
+					try
+					{
+					  workbenchWindow.getActivePage().openEditor(new FileEditorInput(schemaFile), XSDEditorPlugin.PLUGIN_ID);
+					}
+					catch (PartInitException initEx)
+					{
+					  initEx.printStackTrace();
+					}
+					catch(Exception e)
+					{
+					  e.printStackTrace();
+					}
+				}          
+			}
+		});
+  }
+  
+  protected boolean revealObject(final XSDConcreteComponent component)
+  {
+    if (component.getRootContainer().equals(xsdSchema))
+    {
+      Node element = component.getElement();
+      if (element instanceof IndexedRegion)
+      {
+        IndexedRegion indexNode = (IndexedRegion) element;
+        textEditor.getTextViewer().setRangeIndication(indexNode.getStartOffset(), indexNode.getEndOffset() - indexNode.getStartOffset(), true);
+        return true;
+      }
+      return false;
+    }
+    else
+    {
+      lastResult = false;
+      if (component.getSchema() != null)
+      {
+				String schemaLocation = URIHelper.removePlatformResourceProtocol(component.getSchema().getSchemaLocation());
+        IPath schemaPath = new Path(schemaLocation);
+				final IFile schemaFile = ResourcesPlugin.getWorkspace().getRoot().getFile(schemaPath);
+        Display.getDefault().syncExec(new Runnable()
+        {
+	        /**
+	         * @see java.lang.Runnable#run()
+	         */
+	        public void run()
+	        {
+		        final IWorkbenchWindow workbenchWindow = XSDEditorPlugin.getPlugin().getWorkbench().getActiveWorkbenchWindow();
+		        if (workbenchWindow != null)
+		        {
+							try
+							{
+								IEditorPart editorPart = workbenchWindow.getActivePage().openEditor(new FileEditorInput(schemaFile), XSDEditorPlugin.getPlugin().PLUGIN_ID);
+								if (editorPart instanceof InternalXSDMultiPageEditor)
+								{
+									((InternalXSDMultiPageEditor)editorPart).openOnGlobalReference(component);
+									lastResult = true;
+								}
+							}
+							catch (PartInitException initEx)
+							{
+							}
+						}          
+					}
+				});
+      }
+      return lastResult;
+    }
+  }
+  
+  public XSDNamedComponent openOnGlobalReference(XSDConcreteComponent comp)
+  {
+    XSDSchema schema = xsdSchema;
+    String name = null;
+    if (comp instanceof XSDNamedComponent)
+    {
+      name = ((XSDNamedComponent) comp).getName();
+    }
+    
+    if (schema == null || name == null)
+    {
+      return null;
+    }
+
+    List objects = null;    
+    if (comp instanceof XSDElementDeclaration)
+    {
+      objects = schema.getElementDeclarations();
+    }
+    else if (comp instanceof XSDTypeDefinition)
+    {
+      objects = schema.getTypeDefinitions();
+    }
+
+    if (objects != null)
+    {
+      for (Iterator iter = objects.iterator(); iter.hasNext();)
+      {
+        XSDNamedComponent namedComp = (XSDNamedComponent) iter.next();
+        
+        if (namedComp.getName().equals(name))
+        {
+          revealObject(namedComp);
+          return namedComp;
+        }
+      }
+    }
+    return null;
+  }
+  
+  public boolean openOnSelection()
+  {
+    List selectedNodes = null;
+    ISelection selection = textEditor.getSelectionProvider().getSelection();
+    if (selection instanceof IStructuredSelection) {
+      selectedNodes = ((IStructuredSelection) selection).toList();
+    }
+
+    if (selectedNodes != null && !selectedNodes.isEmpty())
+    {
+      for (Iterator i = selectedNodes.iterator(); i.hasNext();)
+      {
+        Object obj = i.next();
+        if (xsdSchema != null)
+        {
+          XSDConcreteComponent xsdComp = xsdSchema.getCorrespondingComponent((Node)obj);
+          XSDConcreteComponent objectToReveal = null;
+
+          if (xsdComp instanceof XSDElementDeclaration)
+          {
+            XSDElementDeclaration elementDecl = (XSDElementDeclaration) xsdComp;
+            if (elementDecl.isElementDeclarationReference())
+            {
+              objectToReveal = elementDecl.getResolvedElementDeclaration();
+            }
+            else
+            {
+              XSDConcreteComponent typeDef = null;
+              if (elementDecl.getAnonymousTypeDefinition() == null)
+              {
+                typeDef = elementDecl.getTypeDefinition();
+              }
+              
+              XSDConcreteComponent subGroupAffiliation = elementDecl.getSubstitutionGroupAffiliation();
+              
+              if (typeDef != null && subGroupAffiliation != null)
+              {
+                // we have 2 things we can navigate to, if the cursor is anywhere on the substitution attribute
+                // then jump to that, otherwise just go to the typeDef.
+                if (obj instanceof Attr && ((Attr)obj).getLocalName().equals(XSDConstants.SUBSTITUTIONGROUP_ATTRIBUTE))
+                {
+                  objectToReveal = subGroupAffiliation;
+                }
+                else
+                {
+                  // try to reveal the type now.  On success, then we return true.
+                  // if we fail, set the substitution group as the object to reveal as a backup plan.
+                  if (revealObject(typeDef))
+                  {
+                    return true;
+                  }
+                  else
+                  {
+                    objectToReveal = subGroupAffiliation;
+                  }
+                }
+              }
+              else
+              {
+                // one or more of these is null.  If the typeDef is non-null, use it.  Otherwise
+                // try and use the substitution group
+                objectToReveal = typeDef != null ? typeDef : subGroupAffiliation;
+              }
+            }
+          }
+          else if (xsdComp instanceof XSDModelGroupDefinition)
+          {
+            XSDModelGroupDefinition elementDecl = (XSDModelGroupDefinition) xsdComp;
+            if (elementDecl.isModelGroupDefinitionReference())
+            {
+              objectToReveal = elementDecl.getResolvedModelGroupDefinition();
+            }
+          }
+          else if (xsdComp instanceof XSDAttributeDeclaration)
+          {
+            XSDAttributeDeclaration attrDecl = (XSDAttributeDeclaration) xsdComp;
+            if (attrDecl.isAttributeDeclarationReference())
+            {
+              objectToReveal = attrDecl.getResolvedAttributeDeclaration();
+            }
+            else if (attrDecl.getAnonymousTypeDefinition() == null)
+            {
+              objectToReveal = attrDecl.getTypeDefinition();
+            }              
+          }
+          else if (xsdComp instanceof XSDAttributeGroupDefinition)
+          {
+            XSDAttributeGroupDefinition attrGroupDef = (XSDAttributeGroupDefinition) xsdComp;
+            if (attrGroupDef.isAttributeGroupDefinitionReference())
+            {
+              objectToReveal = attrGroupDef.getResolvedAttributeGroupDefinition();
+            }
+          }
+          else if (xsdComp instanceof XSDIdentityConstraintDefinition)
+          {
+            XSDIdentityConstraintDefinition idConstraintDef = (XSDIdentityConstraintDefinition) xsdComp;
+            if (idConstraintDef.getReferencedKey() != null)
+            {
+              objectToReveal = idConstraintDef.getReferencedKey();
+            }
+          }
+          else if (xsdComp instanceof XSDSimpleTypeDefinition)
+          {
+            XSDSimpleTypeDefinition typeDef = (XSDSimpleTypeDefinition) xsdComp;
+            objectToReveal = typeDef.getItemTypeDefinition();
+            if (objectToReveal == null)
+            {
+              // if itemType attribute is not set, then check for memberType
+              List memberTypes = typeDef.getMemberTypeDefinitions();
+              if (memberTypes != null && memberTypes.size() > 0)
+              {
+                objectToReveal = (XSDConcreteComponent)memberTypes.get(0);
+              }              
+            }
+          }
+          else if (xsdComp instanceof XSDTypeDefinition)
+          {
+            XSDTypeDefinition typeDef = (XSDTypeDefinition) xsdComp;
+            objectToReveal = typeDef.getBaseType();
+          }
+          else if (xsdComp instanceof XSDSchemaDirective)
+          {
+          	XSDSchemaDirective directive = (XSDSchemaDirective) xsdComp;
+//						String schemaLocation = URIHelper.removePlatformResourceProtocol(directive.getResolvedSchema().getSchemaLocation());
+//						openXSDEditor(schemaLocation);
+//						return false;
+            objectToReveal = directive.getResolvedSchema();						          	          	
+          }
+
+          // now reveal the object if this isn't null
+          if (objectToReveal != null)
+          {
+            return revealObject(objectToReveal);
+          }
+        }
+      }
+    }
+    return false;
+  }
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/actions/CreateElementAction.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/actions/CreateElementAction.java
new file mode 100644
index 0000000..90b2baa
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/actions/CreateElementAction.java
@@ -0,0 +1,360 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 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.actions;
+import java.util.List;
+
+import org.eclipse.gef.ui.parts.AbstractEditPartViewer;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.wst.sse.core.internal.format.IStructuredFormatProcessor;
+import org.eclipse.wst.xml.core.internal.document.DocumentImpl;
+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.util.XSDDOMHelper;
+import org.eclipse.xsd.XSDAttributeDeclaration;
+import org.eclipse.xsd.XSDAttributeGroupDefinition;
+import org.eclipse.xsd.XSDAttributeUse;
+import org.eclipse.xsd.XSDComplexTypeDefinition;
+import org.eclipse.xsd.XSDConcreteComponent;
+import org.eclipse.xsd.XSDNamedComponent;
+import org.eclipse.xsd.XSDSchema;
+import org.eclipse.xsd.util.XSDConstants;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.Text;
+
+// issue (cs) can we remove this?
+//
+public class CreateElementAction extends Action
+{
+  protected String description;
+  protected Element parentNode;
+
+  protected ISelectionProvider selectionProvider;
+  protected XSDSchema xsdSchema;
+
+  protected Object sourceContext;
+
+  /**
+   * Constructor for CreateElementAction.
+   */
+  public CreateElementAction()
+  {
+    super();
+  }
+  /**
+   * Constructor for CreateElementAction.
+   * @param text
+   */
+  public CreateElementAction(String text)
+  {
+    super(text);
+  }
+  /**
+   * Constructor for CreateElementAction.
+   * @param text
+   * @param image
+   */
+  public CreateElementAction(String text, ImageDescriptor image)
+  {
+    super(text, image);
+  }
+
+  public void setXSDSchema(XSDSchema xsdSchema)
+  {
+    this.xsdSchema = xsdSchema;
+  }
+  
+  public void setSelectionProvider(ISelectionProvider selectionProvider)
+  {
+    this.selectionProvider = selectionProvider;
+  }
+
+  public void setSourceContext(Object sourceContext)
+  {
+    this.sourceContext = sourceContext;
+  }
+  
+  /**
+   * Gets the parentNode.
+   * @return Returns a Element
+   */
+  public Element getParentNode()
+  {
+    return parentNode;
+  }
+
+  /**
+   * Sets the parentNode.
+   * @param parentNode The parentNode to set
+   */
+  public void setParentNode(Element parentNode)
+  {
+    this.parentNode = parentNode;
+  }
+
+  boolean isGlobal = false;
+  
+  public void setIsGlobal(boolean isGlobal)
+  {
+    this.isGlobal = isGlobal;
+  }
+  
+  public boolean getIsGlobal()
+  {
+    return isGlobal;
+  }
+
+  protected Node relativeNode;
+  protected String elementTag;
+  public void setElementTag(String elementTag)
+  {
+    this.elementTag = elementTag;
+  }
+  
+  public DocumentImpl getDocument()
+  {
+    return (DocumentImpl) getParentNode().getOwnerDocument();
+  }
+    
+  public void beginRecording(String description)
+  {
+    getDocument().getModel().beginRecording(this, description);
+  }
+  
+  public void endRecording()
+  {
+    DocumentImpl doc = (DocumentImpl) getDocument();
+    
+    doc.getModel().endRecording(this);    
+  }
+  
+  public Element createAndAddNewChildElement()
+  {
+    String prefix = parentNode.getPrefix();
+    prefix = (prefix == null) ? "" : (prefix + ":");
+    Element childNode = getDocument().createElementNS(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, prefix + elementTag);
+    if (getAttributes() != null)
+    {
+      List attributes = getAttributes();
+      for (int i = 0; i < attributes.size(); i++)
+      {
+        DOMAttribute attr = (DOMAttribute) attributes.get(i);
+        childNode.setAttribute(attr.getName(), attr.getValue());
+      }
+    }
+    if (getRelativeNode() == null)
+    {
+      parentNode.appendChild(childNode);
+    }
+    else
+    {
+      ((Element)parentNode).insertBefore(childNode,getRelativeNode());
+    }
+    
+    if (isGlobal && getRelativeNode() == null)
+    {
+      Text textNode = getDocument().createTextNode("\n\n");
+      parentNode.appendChild(textNode);
+    }
+    else if (isGlobal && getRelativeNode() != null)
+    {
+      Text textNode = getDocument().createTextNode("\n\n");
+      parentNode.insertBefore(textNode, getRelativeNode());
+    }
+
+    formatChild(childNode);
+    
+    return childNode;
+  }    
+    
+  protected void formatChild(Element child)
+  {
+    if (child instanceof IDOMNode)
+    {
+      IDOMModel model = ((IDOMNode)child).getModel();
+      try
+      {
+        // tell the model that we are about to make a big model change
+        model.aboutToChangeModel();
+        
+	      IStructuredFormatProcessor formatProcessor = new FormatProcessorXML();
+		    formatProcessor.formatNode(child);
+      }
+      finally
+      {
+        // tell the model that we are done with the big model change
+        model.changedModel(); 
+      }
+    }
+  }
+  /*
+   * @see IAction#run()
+   */
+  public void run()
+  {
+    beginRecording(getDescription());
+    final Element child = createAndAddNewChildElement();
+    endRecording();
+
+    if (selectionProvider != null)
+    {
+      final XSDConcreteComponent comp = xsdSchema.getCorrespondingComponent(child);
+//      selectionProvider.setSelection(new StructuredSelection(comp));
+      
+    Runnable runnable = new Runnable()
+    {
+      public void run()
+      {
+        if (comp instanceof XSDAttributeDeclaration)
+        {
+          if (((XSDAttributeDeclaration)comp).getContainer() instanceof XSDAttributeUse)
+          {
+            if (comp.getContainer().getContainer() instanceof XSDAttributeGroupDefinition)
+            {
+              selectionProvider.setSelection(new StructuredSelection(comp.getContainer()));
+            }
+            else if (comp.getContainer().getContainer() instanceof XSDComplexTypeDefinition)
+            {
+              if (XSDDOMHelper.inputEquals((Element)child, XSDConstants.ATTRIBUTE_ELEMENT_TAG, true))
+              {
+                selectionProvider.setSelection(new StructuredSelection(comp.getContainer()));
+              }
+              else
+              {
+                selectionProvider.setSelection(new StructuredSelection(comp));
+              }
+            }
+            else
+            {
+              selectionProvider.setSelection(new StructuredSelection(comp));
+            }
+          }
+          else
+          {
+            selectionProvider.setSelection(new StructuredSelection(comp));
+          }
+        }
+        else
+        {
+          selectionProvider.setSelection(new StructuredSelection(comp));
+        }
+        if (comp instanceof XSDNamedComponent)
+        {
+          if (sourceContext instanceof AbstractEditPartViewer)
+          {
+            AbstractEditPartViewer viewer = (AbstractEditPartViewer)sourceContext;
+          
+            Object obj = viewer.getSelectedEditParts().get(0);
+            
+//            if (obj instanceof GraphicalEditPart)
+//            {
+//              if (obj instanceof ElementDeclarationEditPart)
+//              {
+//                XSDElementDeclaration elem = ((ElementDeclarationEditPart)obj).getXSDElementDeclaration();
+//                if (!elem.isElementDeclarationReference())
+//                {
+//                  ((ElementDeclarationEditPart)obj).doEditName();
+//                }
+//              }
+//              else if (obj instanceof ModelGroupDefinitionEditPart)
+//              {
+//                XSDModelGroupDefinition group = ((ModelGroupDefinitionEditPart)obj).getXSDModelGroupDefinition();
+//                if (!group.isModelGroupDefinitionReference())
+//                {
+//                  ((ModelGroupDefinitionEditPart)obj).doEditName();
+//                }
+//              }
+//              else if (obj instanceof ComplexTypeDefinitionEditPart)
+//              {
+//                XSDComplexTypeDefinition ct = ((ComplexTypeDefinitionEditPart)obj).getXSDComplexTypeDefinition();
+//                if (ct.getName() != null)
+//                {
+//                  ((ComplexTypeDefinitionEditPart)obj).doEditName();
+//                }
+//              }
+//              else if (obj instanceof TopLevelComponentEditPart)
+//              {
+//                ((TopLevelComponentEditPart)obj).doEditName();
+//              }
+//            }
+
+          }
+        }
+      }
+    };
+    Display.getDefault().timerExec(50,runnable);
+    }
+  }
+
+  /**
+   * Gets the relativeNode.
+   * @return Returns a Element
+   */
+  public Node getRelativeNode()
+  {
+    return relativeNode;
+  }
+
+  /**
+   * Sets the relativeNode.
+   * @param relativeNode The relativeNode to set
+   */
+  public void setRelativeNode(Node relativeNode)
+  {
+    this.relativeNode = relativeNode;
+  }
+
+  /**
+   * Gets the description.
+   * @return Returns a String
+   */
+  public String getDescription()
+  {
+    if (description == null)
+    {
+      return getText();
+    }
+    return description;
+  }
+
+  /**
+   * Sets the description.
+   * @param description The description to set
+   */
+  public void setDescription(String description)
+  {
+    this.description = description;
+  }
+
+  protected List attributes;
+  /**
+   * Gets the nameAttribute.
+   * @return Returns a String
+   */
+  public List getAttributes()
+  {
+    return attributes;
+  }
+
+  /**
+   * Sets the attributes.
+   * @param attributes The attributes to set
+   */
+  public void setAttributes(List attributes)
+  {
+    this.attributes = attributes;
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/actions/DOMAttribute.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/actions/DOMAttribute.java
new file mode 100644
index 0000000..6e6c7e5
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/actions/DOMAttribute.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 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.actions;
+
+// issue (cs) remove this
+/**
+ * @version 	1.0
+ * @author
+ */
+public class DOMAttribute
+{
+  /**
+   * Constructor for DOMAttribute.
+   */
+  public DOMAttribute()
+  {
+    super();
+  }
+  
+  /**
+   * Constructor for DOMAttribute.
+   */
+  public DOMAttribute(String name, String value)
+  {
+    super();
+    this.name = name;
+    this.value = value;
+  }
+  
+  protected String name, value;
+  /**
+   * Gets the value.
+   * @return Returns a String
+   */
+  public String getValue()
+  {
+    return value;
+  }
+
+  /**
+   * Sets the value.
+   * @param value The value to set
+   */
+  public void setValue(String value)
+  {
+    this.value = value;
+  }
+
+  /**
+   * Gets the name.
+   * @return Returns a String
+   */
+  public String getName()
+  {
+    return name;
+  }
+
+  /**
+   * Sets the name.
+   * @param name The name to set
+   */
+  public void setName(String name)
+  {
+    this.name = name;
+  }
+
+}
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
new file mode 100644
index 0000000..3e0dad4
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/actions/XSDEditNamespacesAction.java
@@ -0,0 +1,223 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 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.actions;
+
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.wst.xml.core.internal.contentmodel.util.DOMNamespaceInfoManager;
+import org.eclipse.wst.xml.core.internal.contentmodel.util.NamespaceInfo;
+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.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.XSDSchema;
+import org.eclipse.xsd.util.XSDConstants;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+
+public class XSDEditNamespacesAction extends Action {
+	private Element element;
+	private String resourceLocation;
+	private XSDSchema xsdSchema;
+    private DOMNamespaceInfoManager namespaceInfoManager = new DOMNamespaceInfoManager();
+	
+	public XSDEditNamespacesAction(String label, Element element, Node node) {
+		super();
+		setText(label);
+		
+		this.element = element;
+		///////////////////// This needs to be changed....
+		this.resourceLocation = "dummy";		
+	}
+	
+	public XSDEditNamespacesAction(String label, Element element, Node node, XSDSchema schema) {
+		this (label, element, node);
+		xsdSchema = schema;
+	}
+	
+	public void run() {
+		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); 
+
+		      List namespaceInfoList = namespaceInfoManager.getNamespaceInfoList(element);
+		      List oldNamespaceInfoList = NamespaceInfo.cloneNamespaceInfoList(namespaceInfoList);
+
+		      // here we store a copy of the old info for each NamespaceInfo
+		      // this info will be used in createPrefixMapping() to figure out how to update the document 
+		      // in response to these changes
+		      for (Iterator i = namespaceInfoList.iterator(); i.hasNext(); )
+		      {
+		        NamespaceInfo info = (NamespaceInfo)i.next();
+		        NamespaceInfo oldCopy = new NamespaceInfo(info);
+		        info.setProperty("oldCopy", oldCopy);
+		      }
+		                              
+		      dialog.setNamespaceInfoList(namespaceInfoList);   
+		      dialog.create();      
+		      //dialog.getShell().setSize(500, 300);
+		      dialog.getShell().setText(XMLCommonResources.getInstance().getString("_UI_MENU_EDIT_SCHEMA_INFORMATION_TITLE"));
+		      dialog.setBlockOnOpen(true);                                 
+		      dialog.open();
+          String xsdPrefix = "";    
+
+		      if (dialog.getReturnCode() == Window.OK)
+		      {
+            Element xsdSchemaElement = xsdSchema.getElement();
+            DocumentImpl doc = (DocumentImpl) xsdSchemaElement.getOwnerDocument();
+            
+            List newInfoList = dialog.getNamespaceInfoList();
+
+		        // see if we need to rename any prefixes
+		        Map prefixMapping = createPrefixMapping(oldNamespaceInfoList, namespaceInfoList);
+            
+            Map map2 = new Hashtable();
+            for (Iterator iter = newInfoList.iterator(); iter.hasNext(); )
+            {
+              NamespaceInfo ni = (NamespaceInfo)iter.next();
+              String pref = ni.prefix;
+              String uri = ni.uri;
+              if (pref == null) pref = "";
+              if (uri == null) uri = "";
+              if (XSDConstants.isSchemaForSchemaNamespace(uri))
+              {
+                xsdPrefix = pref;
+              }
+              map2.put(pref, uri);
+            }
+           
+		        if (map2.size() > 0)
+		        {
+		        	try {
+                
+                doc.getModel().beginRecording(this, XSDEditorPlugin.getXSDString("_UI_NAMESPACE_CHANGE"));
+
+                if (xsdPrefix != null && xsdPrefix.length() == 0)
+                {
+                  xsdSchema.setSchemaForSchemaQNamePrefix(null);
+                }
+                else
+                {
+                  xsdSchema.setSchemaForSchemaQNamePrefix(xsdPrefix);
+                }
+
+                xsdSchema.setTargetNamespace(dialog.getTargetNamespace());
+                xsdSchema.update();
+                
+                SchemaPrefixChangeHandler spch = new SchemaPrefixChangeHandler(xsdSchema, xsdPrefix);
+                spch.resolve();
+                xsdSchema.update();
+                
+                xsdSchema.setIncrementalUpdate(false);
+                namespaceInfoManager.removeNamespaceInfo(element);
+                namespaceInfoManager.addNamespaceInfo(element, newInfoList, false);
+                xsdSchema.setIncrementalUpdate(true);
+
+                // 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)
+              { 
+//                e.printStackTrace();
+              }
+              finally
+              {
+                xsdSchema.update();
+                doc.getModel().endRecording(this);
+			     		}
+		        }
+		   }      
+          
+		}
+	}
+	
+	 protected Map createPrefixMapping(List oldList, List newList)
+	  {          
+	    Map map = new Hashtable();
+
+	    Hashtable oldURIToPrefixTable = new Hashtable();
+	    for (Iterator i = oldList.iterator(); i.hasNext(); )
+	    {    
+	      NamespaceInfo oldInfo = (NamespaceInfo)i.next();                    
+	      oldURIToPrefixTable.put(oldInfo.uri, oldInfo);
+	    }
+	    
+	    for (Iterator i = newList.iterator(); i.hasNext(); )
+	    {
+	      NamespaceInfo newInfo = (NamespaceInfo)i.next();
+	      NamespaceInfo oldInfo = (NamespaceInfo)oldURIToPrefixTable.get(newInfo.uri != null ? newInfo.uri : ""); 
+
+
+	      // if oldInfo is non null ... there's a matching URI in the old set
+	      // we can use its prefix to detemine out mapping
+	      //
+	      // if oldInfo is null ...  we use the 'oldCopy' we stashed away 
+	      // assuming that the user changed the URI and the prefix
+	      if (oldInfo == null)                                            
+	      {
+	        oldInfo = (NamespaceInfo)newInfo.getProperty("oldCopy");           
+	      } 
+
+	      if (oldInfo != null)
+	      {
+	        String newPrefix = newInfo.prefix != null ? newInfo.prefix : "";
+	        String oldPrefix = oldInfo.prefix != null ? oldInfo.prefix : "";
+	        if (!oldPrefix.equals(newPrefix))
+	        {
+	          map.put(oldPrefix, newPrefix);    
+	        }
+	      }      
+	    }        
+	    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/nsedit/SchemaPrefixChangeHandler.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/nsedit/SchemaPrefixChangeHandler.java
new file mode 100644
index 0000000..2df620c
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/nsedit/SchemaPrefixChangeHandler.java
@@ -0,0 +1,209 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 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.nsedit;
+
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
+import org.eclipse.wst.xsd.ui.internal.util.XSDDOMHelper;
+import org.eclipse.xsd.XSDAttributeDeclaration;
+import org.eclipse.xsd.XSDElementDeclaration;
+import org.eclipse.xsd.XSDSchema;
+import org.eclipse.xsd.XSDSimpleTypeDefinition;
+import org.eclipse.xsd.XSDTypeDefinition;
+import org.eclipse.xsd.util.XSDConstants;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+
+public class SchemaPrefixChangeHandler
+{
+  String newPrefix;
+  XSDSchema xsdSchema;
+
+  public SchemaPrefixChangeHandler(XSDSchema xsdSchema, String newPrefix)
+  {
+    this.xsdSchema = xsdSchema;
+    this.newPrefix= newPrefix;
+  }
+  
+  public void resolve()
+  {
+    XSDSchemaPrefixRenamer xsdSchemaPrefixRenamer = new XSDSchemaPrefixRenamer();
+    xsdSchemaPrefixRenamer.visitSchema(xsdSchema);
+  }
+
+  public String getNewQName(XSDTypeDefinition comp, String value, String newXSDPrefix)
+  {
+    String qName = null;
+    if (value != null)
+    {
+      qName = newXSDPrefix;
+      if (qName != null && qName.length() > 0)
+      {
+        qName += ":" + value;
+      }
+      else
+      {
+        qName = value; 
+      }
+    }
+    else
+    {
+      qName = value;
+    }
+    
+    return qName;
+  }
+
+  
+  class XSDSchemaPrefixRenamer extends XSDVisitor
+  {
+    public XSDSchemaPrefixRenamer()
+    {
+      super();
+    }
+    
+    public void visitElementDeclaration(XSDElementDeclaration element)
+    {
+      super.visitElementDeclaration(element);
+      XSDTypeDefinition type = element.getType();
+      if (type != null)
+      {
+        String ns = type.getTargetNamespace();
+        if (ns == null) ns = "";
+//        if (ns.equals(xsdSchema.getSchemaForSchemaNamespace()))
+        if (ns.equals(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001))        
+        {
+          Element domElement = element.getElement();
+          if (domElement != null && domElement instanceof IDOMNode)
+          {
+            Attr typeAttr = domElement.getAttributeNode(XSDConstants.TYPE_ATTRIBUTE);
+            if (typeAttr != null)
+            {
+              element.getElement().setAttribute(XSDConstants.TYPE_ATTRIBUTE, getNewQName(type, type.getName(), newPrefix));            
+            }
+          }
+        }
+      }
+    }
+    
+    public void visitSimpleTypeDefinition(XSDSimpleTypeDefinition simpleType)
+    {
+      super.visitSimpleTypeDefinition(simpleType);
+      XSDTypeDefinition baseType = simpleType.getBaseTypeDefinition();
+      
+      if (baseType != null)
+      {
+        String ns = baseType.getTargetNamespace();
+        if (ns == null) ns = "";
+//        if (ns.equals(xsdSchema.getSchemaForSchemaNamespace()))
+//        System.out.println(xsdSchema.getSchemaForSchemaNamespace());
+        if (ns.equals(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001))
+        {
+          XSDDOMHelper domHelper = new XSDDOMHelper();
+          Element derivedBy = domHelper.getDerivedByElement(simpleType.getElement());
+          if (derivedBy != null && derivedBy instanceof IDOMNode)
+          {
+            Attr typeAttr = derivedBy.getAttributeNode(XSDConstants.BASE_ATTRIBUTE);
+            if (typeAttr != null)
+            {
+              derivedBy.setAttribute(XSDConstants.BASE_ATTRIBUTE, getNewQName(baseType, baseType.getName(), newPrefix));
+            }
+          }
+        }
+      }
+      
+      XSDSimpleTypeDefinition itemType = simpleType.getItemTypeDefinition();
+      if (itemType != null)
+      {
+        String ns = itemType.getTargetNamespace();
+        if (ns == null) ns = "";
+        if (ns.equals(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001))
+        {
+          XSDDOMHelper domHelper = new XSDDOMHelper();
+          Node listNode = domHelper.getChildNode(simpleType.getElement(), XSDConstants.LIST_ELEMENT_TAG);
+          if (listNode != null && listNode instanceof Element)
+          {
+            Element listElement = (Element)listNode;          
+            if (listElement instanceof IDOMNode)
+            {
+              Attr typeAttr = listElement.getAttributeNode(XSDConstants.ITEMTYPE_ATTRIBUTE);
+              if (typeAttr != null)
+              {
+                listElement.setAttribute(XSDConstants.ITEMTYPE_ATTRIBUTE, getNewQName(itemType, itemType.getName(), newPrefix));
+              }
+            }
+          }
+        }
+      }
+      
+      List memberTypes = simpleType.getMemberTypeDefinitions();
+      if (memberTypes.size() > 0)
+      {
+        XSDDOMHelper domHelper = new XSDDOMHelper();
+        Node unionNode = domHelper.getChildNode(simpleType.getElement(), XSDConstants.UNION_ELEMENT_TAG);
+        if (unionNode != null && unionNode instanceof Element)
+        {
+          Element unionElement = (Element)unionNode;          
+          if (unionElement instanceof IDOMNode)
+          {
+            StringBuffer sb = new StringBuffer("");
+            for (Iterator i = memberTypes.iterator(); i.hasNext(); )
+            {
+              XSDSimpleTypeDefinition st = (XSDSimpleTypeDefinition)i.next();
+              String ns = st.getTargetNamespace();
+              if (ns == null) ns = "";
+              if (ns.equals(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001))
+              {
+                sb.append(getNewQName(st, st.getName(), newPrefix));                
+              }
+              else
+              {
+                sb.append(st.getQName(xsdSchema));
+              }
+              if (i.hasNext())
+              {
+                sb.append(" ");
+              }
+            }
+            unionElement.setAttribute(XSDConstants.MEMBERTYPES_ATTRIBUTE, sb.toString());
+          }
+        }
+      }
+    }
+
+    public void visitAttributeDeclaration(XSDAttributeDeclaration attr)
+    {
+      super.visitAttributeDeclaration(attr);
+      XSDTypeDefinition type = attr.getType();
+      if (type != null)
+      {
+        String ns = type.getTargetNamespace();
+        if (ns == null) ns = "";
+//        if (ns.equals(xsdSchema.getSchemaForSchemaNamespace()))
+        if (ns.equals(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001))
+        {
+          Element domElement = attr.getElement();
+          if (domElement != null && domElement instanceof IDOMNode)
+          {
+            Attr typeAttr = domElement.getAttributeNode(XSDConstants.TYPE_ATTRIBUTE);
+            if (typeAttr != null)
+            {
+              attr.getElement().setAttribute(XSDConstants.TYPE_ATTRIBUTE, getNewQName(type, type.getName(), newPrefix));            
+            }
+          }
+        }
+      }
+    }
+  }    
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/nsedit/TargetNamespaceChangeHandler.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/nsedit/TargetNamespaceChangeHandler.java
new file mode 100644
index 0000000..9e745dd
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/nsedit/TargetNamespaceChangeHandler.java
@@ -0,0 +1,152 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 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.nsedit;
+
+import java.util.Iterator;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.xsd.XSDAttributeDeclaration;
+import org.eclipse.xsd.XSDAttributeGroupContent;
+import org.eclipse.xsd.XSDAttributeGroupDefinition;
+import org.eclipse.xsd.XSDAttributeUse;
+import org.eclipse.xsd.XSDComplexTypeDefinition;
+import org.eclipse.xsd.XSDElementDeclaration;
+import org.eclipse.xsd.XSDSchema;
+
+
+public class TargetNamespaceChangeHandler
+{
+  String newNS;
+  String oldNS;
+  XSDSchema xsdSchema;
+
+  public TargetNamespaceChangeHandler(XSDSchema xsdSchema, String oldNS, String newNS)
+  {
+    this.xsdSchema = xsdSchema;
+    this.oldNS= oldNS;
+    this.newNS= newNS;
+  }
+  
+  public void resolve()
+  {
+    ElementReferenceRenamer elementReferenceRenamer = new ElementReferenceRenamer();
+    elementReferenceRenamer.visitSchema(xsdSchema);
+    AttributeReferenceRenamer attributeReferenceRenamer = new AttributeReferenceRenamer();
+    attributeReferenceRenamer.visitSchema(xsdSchema);
+  }
+
+  class ElementReferenceRenamer extends XSDVisitor
+  {
+    public ElementReferenceRenamer()
+    {
+      super();
+    }
+    
+    public void visitElementDeclaration(XSDElementDeclaration element)
+    {
+      super.visitElementDeclaration(element);
+      if (element.isElementDeclarationReference())
+      {
+      	if (element.getResolvedElementDeclaration().getTargetNamespace() != null)
+      	{
+      	  if (element.getResolvedElementDeclaration().getTargetNamespace().equals(oldNS))
+          {
+            // set the resolved element's declaration to new ns
+            // this is defect 237518 - target namespace rename creates a new namespace
+            element.getResolvedElementDeclaration().setTargetNamespace(newNS);
+          }
+        }
+        else
+        {
+        	if (oldNS == null || (oldNS != null && oldNS.equals("")))
+        	{
+						element.getResolvedElementDeclaration().setTargetNamespace(newNS);
+        	}
+        }
+      }
+    }
+  }
+  
+  // Similar to defect 237518 but for attributes
+  class AttributeReferenceRenamer extends XSDVisitor
+  {
+    public AttributeReferenceRenamer()
+    {
+      super();
+    }
+    
+    public void visitComplexTypeDefinition(XSDComplexTypeDefinition type)
+    {
+      super.visitComplexTypeDefinition(type);
+      if (type.getAttributeContents() != null)
+      {
+        for (Iterator iter = type.getAttributeContents().iterator(); iter.hasNext(); )
+        {
+          XSDAttributeGroupContent attrGroupContent = (XSDAttributeGroupContent) iter.next();
+          if (attrGroupContent instanceof XSDAttributeUse)
+          {
+            XSDAttributeUse attrUse = (XSDAttributeUse) attrGroupContent;
+            XSDAttributeDeclaration attrDecl = attrUse.getContent();
+            
+            if (attrDecl != null && attrDecl.isAttributeDeclarationReference())
+            {
+							if (attrDecl.getResolvedAttributeDeclaration().getTargetNamespace() != null)
+							{
+                if (attrDecl.getResolvedAttributeDeclaration().getTargetNamespace().equals(oldNS))
+                {
+                  attrDecl.getResolvedAttributeDeclaration().setTargetNamespace(newNS);
+                }
+              }
+              else
+              {
+								if (oldNS == null || (oldNS != null && oldNS.equals("")))
+								{
+									attrDecl.getResolvedAttributeDeclaration().setTargetNamespace(newNS);
+								}
+              }
+            }
+          }
+        }
+      }
+    }
+  
+    public void visitAttributeGroupDefinition(XSDAttributeGroupDefinition attributeGroup)
+    {
+      super.visitAttributeGroupDefinition(attributeGroup);
+      EList list = attributeGroup.getAttributeUses();
+      if (list != null)
+      {
+        for (Iterator iter = list.iterator(); iter.hasNext(); )
+        {
+          XSDAttributeUse attrUse = (XSDAttributeUse)iter.next();
+          XSDAttributeDeclaration attrDecl = attrUse.getContent();
+
+          if (attrDecl != null && attrDecl.isAttributeDeclarationReference())
+          {
+						if (attrDecl.getResolvedAttributeDeclaration().getTargetNamespace() != null)
+						{
+              if (attrDecl.getResolvedAttributeDeclaration().getTargetNamespace().equals(oldNS))
+              {
+                attrDecl.getResolvedAttributeDeclaration().setTargetNamespace(newNS);
+              }
+            }
+            else
+            {
+							if (oldNS == null || (oldNS != null && oldNS.equals("")))
+							{
+								attrDecl.getResolvedAttributeDeclaration().setTargetNamespace(newNS);
+							}
+            }
+          }
+        }
+      }
+    }
+  }
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/nsedit/XSDVisitor.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/nsedit/XSDVisitor.java
new file mode 100644
index 0000000..c9bfbaf
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/nsedit/XSDVisitor.java
@@ -0,0 +1,216 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 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.nsedit;
+
+import java.util.Iterator;
+import org.eclipse.xsd.XSDAttributeDeclaration;
+import org.eclipse.xsd.XSDAttributeGroupContent;
+import org.eclipse.xsd.XSDAttributeGroupDefinition;
+import org.eclipse.xsd.XSDAttributeUse;
+import org.eclipse.xsd.XSDComplexTypeContent;
+import org.eclipse.xsd.XSDComplexTypeDefinition;
+import org.eclipse.xsd.XSDElementDeclaration;
+import org.eclipse.xsd.XSDIdentityConstraintDefinition;
+import org.eclipse.xsd.XSDModelGroup;
+import org.eclipse.xsd.XSDModelGroupDefinition;
+import org.eclipse.xsd.XSDNotationDeclaration;
+import org.eclipse.xsd.XSDParticle;
+import org.eclipse.xsd.XSDParticleContent;
+import org.eclipse.xsd.XSDSchema;
+import org.eclipse.xsd.XSDSimpleTypeDefinition;
+import org.eclipse.xsd.XSDTypeDefinition;
+import org.eclipse.xsd.XSDWildcard;
+
+public class XSDVisitor
+{
+  public XSDVisitor()
+  {
+  }
+  
+  protected XSDSchema schema;
+  
+  public void visitSchema(XSDSchema schema)
+  {
+    this.schema = schema;
+    for (Iterator iterator = schema.getAttributeDeclarations().iterator(); iterator.hasNext();)
+    {
+      XSDAttributeDeclaration attr = (XSDAttributeDeclaration) iterator.next();
+      visitAttributeDeclaration(attr);
+    }
+    for (Iterator iterator = schema.getTypeDefinitions().iterator(); iterator.hasNext();)
+    {
+      XSDTypeDefinition type = (XSDTypeDefinition) iterator.next();
+      visitTypeDefinition(type);
+    }
+    for (Iterator iterator = schema.getElementDeclarations().iterator(); iterator.hasNext();)
+    {
+      XSDElementDeclaration element = (XSDElementDeclaration) iterator.next();
+      visitElementDeclaration(element);
+    }
+    for (Iterator iterator = schema.getIdentityConstraintDefinitions().iterator(); iterator.hasNext();)
+    {
+      XSDIdentityConstraintDefinition identityConstraint = (XSDIdentityConstraintDefinition) iterator.next();
+      visitIdentityConstraintDefinition(identityConstraint);
+    }
+    for (Iterator iterator = schema.getModelGroupDefinitions().iterator(); iterator.hasNext();)
+    {
+      XSDModelGroupDefinition modelGroup = (XSDModelGroupDefinition) iterator.next();
+      visitModelGroupDefinition(modelGroup);
+    }
+    for (Iterator iterator = schema.getAttributeGroupDefinitions().iterator(); iterator.hasNext();)
+    {
+      XSDAttributeGroupDefinition attributeGroup = (XSDAttributeGroupDefinition) iterator.next();
+      visitAttributeGroupDefinition(attributeGroup);
+    }
+    for (Iterator iterator = schema.getNotationDeclarations().iterator(); iterator.hasNext();)
+    {
+      XSDNotationDeclaration element = (XSDNotationDeclaration) iterator.next();
+      visitNotationDeclaration(element);
+    }
+    
+  }
+  
+  public void visitAttributeDeclaration(XSDAttributeDeclaration attr)
+  {
+  }
+  
+  public void visitTypeDefinition(XSDTypeDefinition type)
+  {
+    if (type instanceof XSDSimpleTypeDefinition)
+    {
+      visitSimpleTypeDefinition((XSDSimpleTypeDefinition)type);
+    }
+    else if (type instanceof XSDComplexTypeDefinition)
+    {
+      visitComplexTypeDefinition((XSDComplexTypeDefinition)type);
+    }
+  }
+  
+  public void visitElementDeclaration(XSDElementDeclaration element)
+  {
+    if (element.isElementDeclarationReference())
+    {
+    }
+    else if (element.getAnonymousTypeDefinition() != null)
+    {
+      visitTypeDefinition(element.getAnonymousTypeDefinition());
+    }
+  }
+  
+  public void visitIdentityConstraintDefinition(XSDIdentityConstraintDefinition identityConstraint)
+  {
+  }
+  
+  public void visitModelGroupDefinition(XSDModelGroupDefinition modelGroupDef)
+  {
+    if (!modelGroupDef.isModelGroupDefinitionReference())
+    {
+      if (modelGroupDef.getModelGroup() != null)
+      {
+        visitModelGroup(modelGroupDef.getModelGroup());
+      }
+    }
+  }
+  
+  public void visitAttributeGroupDefinition(XSDAttributeGroupDefinition attributeGroup)
+  {
+    if (attributeGroup.getAttributeUses() != null)
+    {
+      for (Iterator iter = attributeGroup.getAttributeUses().iterator(); iter.hasNext(); )
+      {
+        XSDAttributeUse attrUse = (XSDAttributeUse)iter.next();
+        visitAttributeDeclaration(attrUse.getContent());
+      }
+    }
+  }
+  
+  public void visitNotationDeclaration(XSDNotationDeclaration notation)
+  {
+  }
+  
+  public void visitSimpleTypeDefinition(XSDSimpleTypeDefinition type)
+  {
+  }
+  
+  public void visitComplexTypeDefinition(XSDComplexTypeDefinition type)
+  {
+    if (type.getContentType() != null)
+    {
+      XSDComplexTypeContent complexContent = (XSDComplexTypeContent) type.getContentType();
+      if (complexContent instanceof XSDSimpleTypeDefinition)
+      {
+        visitSimpleTypeDefinition((XSDSimpleTypeDefinition)complexContent);
+      }
+      else if (complexContent instanceof XSDParticle)
+      {
+        visitParticle((XSDParticle) complexContent);
+      }
+    }
+    
+    if (type.getAttributeContents() != null)
+    {
+      for (Iterator iter = type.getAttributeContents().iterator(); iter.hasNext(); )
+      {
+        XSDAttributeGroupContent attrGroupContent = (XSDAttributeGroupContent)iter.next();
+        if (attrGroupContent instanceof XSDAttributeUse)
+        {
+          XSDAttributeUse attrUse = (XSDAttributeUse)attrGroupContent;
+          visitAttributeDeclaration(attrUse.getContent());
+        }
+        else if (attrGroupContent instanceof XSDAttributeGroupDefinition)
+        {
+          visitAttributeGroupDefinition((XSDAttributeGroupDefinition)attrGroupContent);
+        }
+      }
+    }
+  }
+  
+  public void visitParticle(XSDParticle particle)
+  {
+    visitParticleContent(particle.getContent());
+  }
+  
+  public void visitParticleContent(XSDParticleContent particleContent)
+  {
+    if (particleContent instanceof XSDModelGroupDefinition)
+    {
+      visitModelGroupDefinition((XSDModelGroupDefinition) particleContent);
+    }
+    else if (particleContent instanceof XSDModelGroup)
+    {
+      visitModelGroup((XSDModelGroup)particleContent);
+    }
+    else if (particleContent instanceof XSDElementDeclaration)
+    {
+      visitElementDeclaration((XSDElementDeclaration)particleContent);
+    }
+    else if (particleContent instanceof XSDWildcard)
+    {
+      visitWildcard((XSDWildcard)particleContent);
+    }
+  }
+  
+  public void visitModelGroup(XSDModelGroup modelGroup)
+  {
+    if (modelGroup.getContents() != null)
+    {
+      for (Iterator iterator = modelGroup.getContents().iterator(); iterator.hasNext();)
+      {
+        XSDParticle particle = (XSDParticle) iterator.next();
+        visitParticle(particle);
+      }
+    }
+  }
+  
+  public void visitWildcard(XSDWildcard wildcard)
+  {
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/text/XSDModelAdapter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/text/XSDModelAdapter.java
new file mode 100644
index 0000000..199ad94
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/text/XSDModelAdapter.java
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2005 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.text;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.wst.sse.core.internal.provisional.INodeAdapter;
+import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
+import org.eclipse.wst.xsd.ui.internal.util.XSDSchemaLocationResolverAdapterFactory;
+import org.eclipse.xsd.XSDFactory;
+import org.eclipse.xsd.XSDSchema;
+import org.eclipse.xsd.impl.XSDSchemaImpl;
+import org.eclipse.xsd.util.XSDResourceImpl;
+import org.w3c.dom.Element;
+
+public class XSDModelAdapter implements INodeAdapter
+{
+  protected ResourceSet resourceSet;
+  protected XSDSchema schema;
+
+  public XSDSchema getSchema()
+  {
+    return schema;
+  }
+
+  public void setSchema(XSDSchema schema)
+  {
+    this.schema = schema;
+  }
+  
+  public void clear()
+  {
+    schema = null;
+    resourceSet = null;
+  }
+
+  public boolean isAdapterForType(Object type)
+  {
+    return type == XSDModelAdapter.class;
+  }
+
+  public void notifyChanged(INodeNotifier notifier, int eventType, Object changedFeature, Object oldValue, Object newValue, int pos)
+  {
+  }
+
+  public XSDSchema createSchema(Element element)
+  {     
+    try
+    {
+      IDOMNode domNode = (IDOMNode)element;
+      String baseLocation = domNode.getModel().getBaseLocation();
+//      System.out.println("XSDSchemalNodeAdapter.baseLocation=" + baseLocation);
+           
+      schema = XSDFactory.eINSTANCE.createXSDSchema();
+      
+      // Force the loading of the "meta" schema for schema instance instance.
+      //
+      String schemaForSchemaNamespace = element.getNamespaceURI();
+      XSDSchemaImpl.getSchemaForSchema(schemaForSchemaNamespace);      
+      
+      resourceSet = XSDSchemaImpl.createResourceSet();
+      resourceSet.getAdapterFactories().add(new XSDSchemaLocationResolverAdapterFactory());                
+      
+      // TODO... gotta pester SSE folks to provide 'useful' baseLocations
+      // 
+      URI uri = null;
+      if (baseLocation.startsWith("/"))
+      {
+        uri = URI.createPlatformResourceURI(baseLocation);
+      }
+      else
+      {
+        uri = URI.createFileURI(baseLocation);
+      }  
+      //System.out.println("uri=" + uri.toString());
+      Resource resource = new XSDResourceImpl();
+      resource.setURI(uri);
+      schema = XSDFactory.eINSTANCE.createXSDSchema(); 
+      resource.getContents().add(schema);
+      resourceSet.getResources().add(resource);    
+      schema.setElement(element);
+      
+      // attach an adapter to keep the XSD model and DOM in sync
+      //
+      new XSDModelReconcileAdapter(element.getOwnerDocument(), schema);
+    }
+    catch (Exception ex)
+    {
+      ex.printStackTrace();
+    }
+    return schema;
+  }
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/text/XSDModelQueryExtension.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/text/XSDModelQueryExtension.java
new file mode 100644
index 0000000..bf76f7a
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/text/XSDModelQueryExtension.java
@@ -0,0 +1,204 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2005 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.text;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier;
+import org.eclipse.wst.xml.core.internal.contentmodel.modelquery.extension.ModelQueryExtension;
+import org.eclipse.wst.xsd.ui.internal.util.TypesHelper;
+import org.eclipse.xsd.XSDSchema;
+import org.eclipse.xsd.util.XSDConstants;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+public class XSDModelQueryExtension extends ModelQueryExtension
+{  
+  public XSDModelQueryExtension()
+  {
+  }
+  
+  public String[] getAttributeValues(Element e, String namespace, String name)
+  {
+    List list = new ArrayList();
+
+    String currentElementName = e.getLocalName();
+    Node parentNode = e.getParentNode();
+    String parentName = parentNode != null ? parentNode.getLocalName() : "";
+    
+    if (checkName(name, "type") && XSDConstants.isSchemaForSchemaNamespace(namespace))
+    {      
+      if (checkName(currentElementName, "attribute"))
+      {
+        list = getTypesHelper(e).getBuiltInTypeNamesList();
+        list.addAll(getTypesHelper(e).getUserSimpleTypeNamesList());
+      }
+      else if (checkName(currentElementName, "element"))
+      {
+        list = getTypesHelper(e).getBuiltInTypeNamesList2();
+        list.addAll(getTypesHelper(e).getUserSimpleTypeNamesList());
+        list.addAll(getTypesHelper(e).getUserComplexTypeNamesList());
+      }
+    }
+    else if (checkName(name, "blockDefault") ||
+             checkName(name, "finalDefault"))      
+    {    
+       list.add("#all");
+       list.add("substitution");
+       list.add("extension");
+       list.add("restriction");
+    }  
+    else if (checkName(name, "namespace"))
+    {
+      if (checkName(currentElementName, "any") || 
+          checkName(currentElementName, "anyAttribute"))
+      {
+        list.add("##any");
+        list.add("##other");
+        list.add("##targetNamespace");
+        list.add("##local");
+      }
+    }
+    else if (checkName(name, "maxOccurs"))
+    {
+      list.add("1");
+      list.add("unbounded");
+    }
+    else if (checkName(name, "minOccurs"))
+    {
+      list.add("0");
+      list.add("1");
+    }    
+    else if (checkName(name, "itemType"))
+    {
+      if (checkName(currentElementName, "list"))
+      {
+        if (checkName(parentName, "simpleType"))
+        {
+          list = getTypesHelper(e).getBuiltInTypeNamesList();
+          list.addAll(getTypesHelper(e).getUserSimpleTypeNamesList());
+        }
+      }
+    }
+    else if (checkName(name, "memberTypes"))
+    {
+      if (checkName(currentElementName, "union"))
+      {
+        if (checkName(parentName, "simpleType"))
+        {
+          list = getTypesHelper(e).getBuiltInTypeNamesList();
+          list.addAll(getTypesHelper(e).getUserSimpleTypeNamesList());
+        }
+      }
+    }
+    else if (checkName(name, "base"))
+    {
+      if (checkName(currentElementName, "restriction"))
+      {
+        if (checkName(parentName, "simpleType"))
+        {
+          list = getTypesHelper(e).getBuiltInTypeNamesList();
+          list.addAll(getTypesHelper(e).getUserSimpleTypeNamesList());
+        }
+        else if (checkName(parentName, "simpleContent"))
+        {
+          list = getTypesHelper(e).getBuiltInTypeNamesList();
+          list.addAll(getTypesHelper(e).getUserComplexTypeNamesList());
+        }
+        else if (checkName(parentName, "complexContent"))
+        {
+          list = getTypesHelper(e).getBuiltInTypeNamesList();
+          list.addAll(getTypesHelper(e).getUserComplexTypeNamesList());
+        }
+      }
+      else if (checkName(currentElementName, "extension"))
+      {
+        if (checkName(parentName, "simpleContent"))
+        {
+          list = getTypesHelper(e).getBuiltInTypeNamesList();
+          list.addAll(getTypesHelper(e).getUserComplexTypeNamesList());
+        }
+        else if (checkName(parentName, "complexContent"))
+        {
+          list = getTypesHelper(e).getBuiltInTypeNamesList();
+          list.addAll(getTypesHelper(e).getUserComplexTypeNamesList());
+        }
+      }
+    }
+    else if (checkName(name, "ref"))
+    {
+      if (checkName(currentElementName, "element"))
+      {
+        list = getTypesHelper(e).getGlobalElements();
+      }
+      else if (checkName(currentElementName, "attribute"))
+      {
+        list = getTypesHelper(e).getGlobalAttributes();
+      }
+      else if (checkName(currentElementName, "attributeGroup"))
+      {
+        list = getTypesHelper(e).getGlobalAttributeGroups();
+      }
+      else if (checkName(currentElementName, "group"))
+      {
+        list = getTypesHelper(e).getModelGroups();
+      }
+    }
+    else if (checkName(name, "substitutionGroup"))
+    {
+      if (checkName(currentElementName, "element"))
+      {
+        list = getTypesHelper(e).getGlobalElements();
+      }
+    }
+        
+    String[] result = new String[list.size()];
+    list.toArray(result);
+    return result;
+  } 
+  
+  protected XSDSchema lookupOrCreateSchemaForElement(Element element)
+  {            
+    XSDSchema result = null;
+    Document document = element.getOwnerDocument();
+    if (document instanceof INodeNotifier)
+    {
+      INodeNotifier notifier = (INodeNotifier)document;
+      XSDModelAdapter adapter = (XSDModelAdapter)notifier.getAdapterFor(XSDModelAdapter.class);
+      if (adapter == null)
+      {
+        adapter = new XSDModelAdapter();       
+        notifier.addAdapter(adapter);        
+        adapter.createSchema(document.getDocumentElement()); 
+      } 
+      result = adapter.getSchema();
+    }    
+    return result;
+  }   
+  
+  protected TypesHelper getTypesHelper(Element element)
+  {
+    XSDSchema schema = lookupOrCreateSchemaForElement(element);
+    return new TypesHelper(schema);  
+  }
+
+  
+  protected boolean checkName(String localName, String token)
+  {
+    if (localName != null && localName.trim().equals(token))
+    {
+      return true;
+    }
+    return false;
+  }
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/text/XSDModelReconcileAdapter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/text/XSDModelReconcileAdapter.java
new file mode 100644
index 0000000..76b5908
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/text/XSDModelReconcileAdapter.java
@@ -0,0 +1,303 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2005 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.text;
+
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.wst.sse.core.internal.provisional.INodeAdapter;
+import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier;
+import org.eclipse.wst.xsd.ui.internal.util.XSDDOMHelper;
+import org.eclipse.xsd.XSDConcreteComponent;
+import org.eclipse.xsd.XSDSchema;
+import org.eclipse.xsd.util.XSDConstants;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+public class XSDModelReconcileAdapter extends DocumentAdapter
+{
+    INodeNotifier currentNotifier;
+    int currentEventType;
+    XSDSchema schema;
+    
+    public XSDModelReconcileAdapter(Document document, XSDSchema schema)
+    {
+      super(document);
+      this.schema = schema;
+    }
+        
+    boolean handlingNotifyChanged = false;
+
+    public void notifyChanged(INodeNotifier notifier, int eventType, Object feature, Object oldValue, Object newValue, int index)
+    {
+      if (!handlingNotifyChanged)
+      {
+        handlingNotifyChanged = true;
+        try
+        {
+          // delay handle events only in the source view
+          //if (getCurrentPageType() == XSDEditorPlugin.SOURCE_PAGE &&
+          //    !(getActivePart() instanceof PropertySheet) && 
+          //    !(getActivePart() instanceof org.eclipse.ui.views.contentoutline.ContentOutline)) {
+          //  startDelayedEvent(notifier, eventType, feature, oldValue, newValue, index);
+          //}
+          //else // all other views, just handle the events right away
+          {
+            handleNotifyChange(notifier, eventType, feature, oldValue, newValue, index);
+          }
+        }
+        catch (Exception e)
+        {
+//          XSDEditorPlugin.getPlugin().getMsgLogger().write(e);
+        }
+        handlingNotifyChanged = false;
+      }
+    }
+
+    public void handleNotifyChange(INodeNotifier notifier, int eventType, Object feature, Object oldValue, Object newValue, int index)
+    {
+//      System.out.println(eventType + " : HandleNotifyChange " + notifier.hashCode() + " notifier " + notifier);
+      switch (eventType)
+      {
+        case INodeNotifier.ADD:
+        {
+          if (newValue instanceof Element)
+          {
+            adapt((Element)newValue);
+//  Add     updateParentForDerivation(node, listener);
+          }
+          break;
+        }
+        case INodeNotifier.REMOVE:
+        {
+          Node node = (Node)notifier;
+          XSDConcreteComponent listener = schema.getCorrespondingComponent(node);
+         
+          if (listener instanceof XSDSchema)
+          {
+            // we want to reset the schema's external elements when the directive is deleted
+            if (feature instanceof Element)
+            {
+              Element elem = (Element)feature;
+              if (XSDDOMHelper.inputEquals(elem, XSDConstants.INCLUDE_ELEMENT_TAG, false) ||
+                  XSDDOMHelper.inputEquals(elem, XSDConstants.IMPORT_ELEMENT_TAG, false) ||
+                  XSDDOMHelper.inputEquals(elem, XSDConstants.REDEFINE_ELEMENT_TAG, false))
+              {
+                schema.reset();
+                schema.update();
+              }
+            }
+          }          
+        }
+        case INodeNotifier.CHANGE:
+        {
+          Node node = (Node)notifier;
+          XSDConcreteComponent listener = schema.getCorrespondingComponent(node);
+          if (node.getNodeType() == Node.ELEMENT_NODE)
+          {
+            listener.elementAttributesChanged((Element)node);
+            listener.elementChanged((Element)node);
+          }
+          else if (node.getNodeType() == Node.DOCUMENT_NODE)
+          {
+            listener.elementAttributesChanged(((Document)node).getDocumentElement());
+            listener.elementChanged(((Document)node).getDocumentElement());
+          }
+          break;
+        }
+        case INodeNotifier.STRUCTURE_CHANGED:
+        case INodeNotifier.CONTENT_CHANGED:
+        {
+          Node node = (Node)notifier;
+          XSDConcreteComponent listener = schema.getCorrespondingComponent(node);
+          if (node.getNodeType() == Node.ELEMENT_NODE)
+          {
+            listener.elementContentsChanged((Element)node);
+            break;
+          }
+          else if (node.getNodeType() == Node.DOCUMENT_NODE)
+          {
+            Element docElement = ((Document)node).getDocumentElement();
+            // Need to add check if doc element is being edited in the source
+            if (docElement != null)
+            {
+              String prefix = docElement.getPrefix();
+              String xmlnsString = prefix == null? "xmlns" : "xmlns:" + prefix;
+              Attr attr = docElement.getAttributeNode(xmlnsString);
+              boolean doParse = false;
+              if (attr != null)
+              {
+                if (attr.getValue().equals(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001) && docElement.getLocalName().equals("schema"))
+                {
+                  // We have a viable schema so parse it
+                  doParse = true;
+                }
+              }
+              
+              if (doParse)
+              {
+                adapt(docElement);
+                schema.setElement(docElement);
+              }
+            }
+          }
+          break;
+        }
+      }
+    }
+
+    protected DelayedEvent delayedTask;
+    protected void startDelayedEvent(INodeNotifier notifier, int eventType, Object feature, Object oldValue, Object newValue, int index)
+    {
+//      System.out.println("start delayed event");
+      // check if there is already a delayed task for the same notifier and eventType
+//      if (delayedTask != null)
+//      {
+//        Notifier aNotifier = delayedTask.getNotifier();
+//        int anEventType = delayedTask.getEventType();
+//        if (notifier == aNotifier && anEventType == eventType)
+//        {
+//          // same event, just different data, delay new event
+//          delayedTask.setCancel(true);
+//        }
+//      }
+
+      delayedTask = new DelayedEvent();
+
+      delayedTask.setNotifier(notifier);
+      delayedTask.setEventType(eventType);
+      delayedTask.setFeature(feature);
+      delayedTask.setOldValue(oldValue);
+      delayedTask.setNewValue(newValue);
+      delayedTask.setIndex(index);
+
+      Display.getDefault().timerExec(400,delayedTask);
+    }
+
+    class DelayedEvent implements Runnable
+    {
+      INodeNotifier notifier;
+      int eventType;
+      Object feature;
+      Object oldValue;
+      Object newValue;
+      int index;
+      boolean cancelEvent = false;
+
+      /*
+       * @see Runnable#run()
+       */
+      public void run()
+      {
+        if (!cancelEvent)
+        {
+          handleNotifyChange(notifier, eventType, feature, oldValue, newValue, index);
+          if (delayedTask == this)
+          {
+            delayedTask = null;
+          }
+        }
+      }
+      
+      public void setCancel(boolean flag)
+      {
+        cancelEvent = flag;
+      }
+
+      public void setNotifier(INodeNotifier notifier)
+      {
+        this.notifier = notifier;
+      }
+    
+      public void setEventType(int eventType)
+      {
+        this.eventType = eventType;
+      }
+
+      public void setFeature(Object feature)
+      {
+        this.feature = feature;
+      }
+
+      public void setOldValue(Object oldValue)
+      {
+        this.oldValue = oldValue;     
+      }
+
+      public void setNewValue(Object newValue)
+      {
+        this.newValue = newValue;
+      }
+
+      public void setIndex(int index)
+      {
+        this.index = index;     
+      }
+
+      public INodeNotifier getNotifier()
+      {
+        return notifier;
+      }
+
+      public int getEventType()
+      {
+        return eventType;
+      }
+
+      public Object getNewValue()
+      {
+        return newValue;
+      }
+
+      public Object getOldValue()
+      {
+        return oldValue;
+      }
+
+    }
+}
+
+
+abstract class DocumentAdapter implements INodeAdapter
+{
+  Document document;
+  
+  public DocumentAdapter(Document document)
+  {
+    this.document = document;
+    ((INodeNotifier)document).addAdapter(this);
+    adapt(document.getDocumentElement());
+  }
+
+  public void adapt(Element element)
+  {
+    if (((INodeNotifier)element).getExistingAdapter(this) == null)
+    {
+      ((INodeNotifier)element).addAdapter(this);
+
+      for (Node child = element.getFirstChild(); child != null; child = child.getNextSibling())
+      {
+        if (child.getNodeType() == Node.ELEMENT_NODE)
+        {
+          adapt((Element)child);
+        }
+      }
+    }
+  }
+
+  public boolean isAdapterForType(Object type)
+  {
+    return type == this;
+  }
+
+  abstract public void notifyChanged
+    (INodeNotifier notifier, int eventType, Object feature, Object oldValue, Object newValue, int index);
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/util/SelectionAdapter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/util/SelectionAdapter.java
new file mode 100644
index 0000000..2cd1353
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/util/SelectionAdapter.java
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 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.util;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+
+public abstract class SelectionAdapter implements ISelectionProvider
+{
+  protected List listenerList = new ArrayList();
+  protected ISelection selection = new StructuredSelection();
+  protected ISelectionProvider eventSource;
+
+  public void setEventSource(ISelectionProvider eventSource)
+  {
+    this.eventSource = eventSource;
+  }
+
+  public void addSelectionChangedListener(ISelectionChangedListener listener) 
+  {
+    listenerList.add(listener);
+  }
+
+  public void removeSelectionChangedListener(ISelectionChangedListener listener) 
+  {
+    listenerList.remove(listener);
+  }                    
+
+  public ISelection getSelection() 
+  {
+    return selection;
+  }    
+  
+  /**
+   * This method should be specialized to return the correct object that corresponds to the 'other' model
+   */
+  abstract protected Object getObjectForOtherModel(Object object);
+
+    
+  public void setSelection(ISelection modelSelection)  
+  { 
+    List otherModelObjectList = new ArrayList();
+    if (modelSelection instanceof IStructuredSelection)
+    {
+      for (Iterator i = ((IStructuredSelection)modelSelection).iterator(); i.hasNext(); )
+      {
+        Object modelObject = i.next(); 
+        Object otherModelObject = getObjectForOtherModel(modelObject);       
+        if (otherModelObject != null)
+        { 
+          otherModelObjectList.add(otherModelObject);
+        }
+      }
+    }                
+      
+    StructuredSelection nodeSelection = new StructuredSelection(otherModelObjectList);
+    selection = nodeSelection;
+    SelectionChangedEvent event = new SelectionChangedEvent(eventSource != null ? eventSource : this, nodeSelection);
+
+    for (Iterator i = listenerList.iterator(); i.hasNext(); )
+    {
+      ISelectionChangedListener listener = (ISelectionChangedListener)i.next();
+      listener.selectionChanged(event);
+    }
+  }
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/util/TypesHelper.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/util/TypesHelper.java
new file mode 100644
index 0000000..ae933cc
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/util/TypesHelper.java
@@ -0,0 +1,415 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 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.util;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+
+import org.eclipse.xsd.XSDAttributeDeclaration;
+import org.eclipse.xsd.XSDAttributeGroupDefinition;
+import org.eclipse.xsd.XSDComplexTypeDefinition;
+import org.eclipse.xsd.XSDElementDeclaration;
+import org.eclipse.xsd.XSDImport;
+import org.eclipse.xsd.XSDModelGroupDefinition;
+import org.eclipse.xsd.XSDSchema;
+import org.eclipse.xsd.XSDSchemaContent;
+import org.eclipse.xsd.XSDSimpleTypeDefinition;
+import org.eclipse.xsd.XSDTypeDefinition;
+import org.eclipse.xsd.impl.XSDImportImpl;
+import org.eclipse.xsd.impl.XSDSchemaImpl;
+import org.eclipse.xsd.util.XSDConstants;
+import org.w3c.dom.Element;
+
+public class TypesHelper
+{
+  XSDSchema xsdSchema;
+  Vector list = new Vector();
+
+  public TypesHelper(XSDSchema xsdSchema)
+  {
+    this.xsdSchema = xsdSchema;
+  }
+
+  private void updateExternalImportGlobals()
+  {
+    if (xsdSchema != null)
+    {
+      Iterator contents = xsdSchema.getContents().iterator();
+      while (contents.hasNext())
+      {
+        XSDSchemaContent content = (XSDSchemaContent) contents.next();
+        if (content instanceof XSDImportImpl)
+        {
+          XSDImportImpl anImport = (XSDImportImpl) content;
+          try
+          {
+            if (anImport.getSchemaLocation() != null)
+            {
+              anImport.importSchema();
+            }
+          }
+          catch (Exception e)
+          {
+            
+          }
+        }
+      }
+    }
+  }
+
+
+  public java.util.List getBuiltInTypeNamesList()
+  {
+    Vector items = new Vector();
+    if (xsdSchema != null)
+    {
+      String prefix = xsdSchema.getSchemaForSchemaQNamePrefix();
+      if (prefix != null && prefix.length() > 0)
+      {
+        prefix = prefix + ":";
+      }
+      else
+      {
+        prefix = "";
+      }
+      List result = new ArrayList();
+      if (xsdSchema != null)
+      {
+        XSDSchema schemaForSchema = XSDSchemaImpl.getSchemaForSchema(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001);
+        for (Iterator i = schemaForSchema.getSimpleTypeIdMap().values().iterator(); i.hasNext();)
+        {
+          XSDTypeDefinition td = (XSDTypeDefinition) i.next();  
+          String localName = td.getName(); 
+          String prefixedName = (prefix != null && prefix.length() > 0) ? prefix + ":" + localName : localName; 
+          result.add(prefixedName);        
+        }
+      }
+    }
+    return items;
+  }
+
+  // issue (cs) do we still need this?  it can likely be remove now
+  // was used for content assist but I don't think we really need it
+  public java.util.List getBuiltInTypeNamesList2()
+  {
+    List result = new ArrayList();
+    if (xsdSchema != null)
+    {
+      List prefixes = getPrefixesForNamespace(xsdSchema.getSchemaForSchemaNamespace());
+      XSDSchema schemaForSchema = XSDSchemaImpl.getSchemaForSchema(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001);
+      for (Iterator i = schemaForSchema.getSimpleTypeIdMap().values().iterator(); i.hasNext();)
+      {
+        XSDTypeDefinition td = (XSDTypeDefinition) i.next();  
+        String localName = td.getName();
+        String prefix = prefixes.size() > 0 ? (String)prefixes.get(0) : null;
+        String prefixedName = (prefix != null && prefix.length() > 0) ? prefix + ":" + localName : localName; 
+        result.add(prefixedName);        
+      }
+    }
+    return result;
+  }
+
+  public java.util.List getUserSimpleTypeNamesList()
+  {
+    Vector items = new Vector();
+    if (xsdSchema != null)
+    {
+      updateExternalImportGlobals();
+      Iterator i = xsdSchema.getTypeDefinitions().iterator();
+      while (i.hasNext())
+      {
+        XSDTypeDefinition typeDefinition = (XSDTypeDefinition) i.next();
+        if (typeDefinition instanceof XSDSimpleTypeDefinition)
+        {
+          items.addAll(getPrefixedNames(typeDefinition.getTargetNamespace(), typeDefinition.getName()));
+          //System.out.println(typeDefinition.getQName(xsdSchema));
+          //items.add(typeDefinition.getQName(xsdSchema));
+        }
+      }
+      items.add(getPrefix(xsdSchema.getSchemaForSchemaNamespace(), true) + "anyType");
+      
+      //      items = addExternalImportedUserSimpleTypes(items);
+      items = (Vector) sortList(items);
+    }
+    return items;
+  }
+
+  public java.util.List getUserComplexTypeNamesList()
+  {
+    Vector items = new Vector();
+    if (xsdSchema != null)
+    {
+      updateExternalImportGlobals();
+      Iterator i = xsdSchema.getTypeDefinitions().iterator();
+      while (i.hasNext())
+      {
+        XSDTypeDefinition typeDefinition = (XSDTypeDefinition) i.next();
+        if (typeDefinition instanceof XSDComplexTypeDefinition)
+        {
+			    items.addAll(getPrefixedNames(typeDefinition.getTargetNamespace(), typeDefinition.getName()));         
+        }
+      }
+      items = (Vector) sortList(items);
+    }
+    return items;
+  }
+  
+  public java.util.List getUserSimpleTypes()
+  {
+    Vector items = new Vector();
+    if (xsdSchema != null)
+    {
+      updateExternalImportGlobals();
+      Iterator i = xsdSchema.getTypeDefinitions().iterator();
+      while (i.hasNext())
+      {
+        XSDTypeDefinition typeDefinition = (XSDTypeDefinition) i.next();
+        if (typeDefinition instanceof XSDSimpleTypeDefinition)
+        {
+          items.add(typeDefinition);
+          //System.out.println(typeDefinition.getQName(xsdSchema));
+          //items.add(typeDefinition.getQName(xsdSchema));
+        }
+      }
+      // We need to add the anyType
+//      items.add(getPrefix(xsdSchema.getSchemaForSchemaNamespace(), true) + "anyType");
+      
+      //      items = addExternalImportedUserSimpleTypes(items);
+      //items = (Vector) sortList(items);
+    }
+    return items;
+  }
+
+  public String getPrefix(String ns, boolean withColon)
+  {
+    String key = "";
+
+    if (xsdSchema != null)
+    {
+      Map map = xsdSchema.getQNamePrefixToNamespaceMap();
+      Iterator iter = map.keySet().iterator();
+      while (iter.hasNext())
+      {
+        Object keyObj = iter.next();
+        Object value = map.get(keyObj);
+        if (value != null && value.toString().equals(ns))
+        {
+          if (keyObj != null)
+          {
+            key = keyObj.toString();
+          }
+          else
+          {
+            key = "";
+          }
+          break;
+        }
+      }
+      if (!key.equals(""))
+      {
+        if (withColon)
+        {
+          key = key + ":";
+        }
+      }
+    }
+    return key;
+  }
+
+  public java.util.List getGlobalElements()
+  {
+    Vector items = new Vector();
+    if (xsdSchema != null)
+    {
+      updateExternalImportGlobals();
+      if (xsdSchema.getElementDeclarations() != null)
+      {
+        Iterator i = xsdSchema.getElementDeclarations().iterator();
+        while (i.hasNext())
+        {
+          XSDElementDeclaration elementDeclaration = (XSDElementDeclaration) i.next();
+          String name = elementDeclaration.getQName(xsdSchema);
+          if (name != null)
+          {
+            items.add(name);
+          }
+        }
+      }
+      //      items = addExternalImportedGlobalElements(items);
+      items = (Vector) sortList(items);
+    }
+    return items;
+  }
+
+  public java.util.List getGlobalAttributes()
+  {
+    Vector items = new Vector();
+    if (xsdSchema != null)
+    {
+      updateExternalImportGlobals();
+      if (xsdSchema.getAttributeDeclarations() != null)
+      {
+        Iterator i = xsdSchema.getAttributeDeclarations().iterator();
+        while (i.hasNext())
+        {
+          XSDAttributeDeclaration attributeDeclaration = (XSDAttributeDeclaration) i.next();
+          if (attributeDeclaration.getTargetNamespace() == null || (attributeDeclaration.getTargetNamespace() != null && !attributeDeclaration.getTargetNamespace().equals(XSDConstants.SCHEMA_INSTANCE_URI_2001)))
+          {
+            String name = attributeDeclaration.getQName(xsdSchema);
+            if (name != null)
+            {
+              items.add(name);
+            }
+          }
+        }
+      }
+      //      items = addExternalImportedAttributes(items);
+      items = (Vector) sortList(items);
+    }
+    return items;
+  }
+
+  public java.util.List getGlobalAttributeGroups()
+  {
+    Vector items = new Vector();
+    if (xsdSchema != null)
+    {
+      updateExternalImportGlobals();
+      if (xsdSchema.getAttributeGroupDefinitions() != null)
+      {
+        Iterator i = xsdSchema.getAttributeGroupDefinitions().iterator();
+        while (i.hasNext())
+        {
+          XSDAttributeGroupDefinition attributeGroupDefinition = (XSDAttributeGroupDefinition) i.next();
+          String name = attributeGroupDefinition.getQName(xsdSchema);
+          if (name != null)
+          {
+            items.add(name);
+          }
+        }
+      }
+      //      items = addExternalImportedAttributeGroups(items);
+      items = (Vector) sortList(items);
+    }
+    return items;
+  }
+
+  public java.util.List getModelGroups()
+  {
+    Vector items = new Vector();
+    if (xsdSchema != null)
+    {
+      updateExternalImportGlobals();
+      if (xsdSchema.getModelGroupDefinitions() != null)
+      {
+        Iterator i = xsdSchema.getModelGroupDefinitions().iterator();
+        while (i.hasNext())
+        {
+          XSDModelGroupDefinition modelGroupDefinition = (XSDModelGroupDefinition) i.next();
+          String name = modelGroupDefinition.getQName(xsdSchema);
+          if (name != null)
+          {
+            items.add(name);
+          }
+        }
+      }
+      //      items = addExternalImportedGroups(items);
+      items = (Vector) sortList(items);
+    }
+    return items;
+  }
+
+  // issue (cs) ssems like a rather goofy util method?
+  public static java.util.List sortList(java.util.List types)
+  {
+    try
+    {
+      java.util.Collections.sort(types); // performance?  n*log(n)
+    }
+    catch (Exception e)
+    {
+//      XSDEditorPlugin.getPlugin().getMsgLogger().write("Sort failed");
+    }
+    return types;
+  }
+
+  // issue (cs) do we still need this?
+  public void updateMapAfterDelete(XSDImport deletedNode)
+  {
+    String ns = deletedNode.getNamespace();
+    if (ns != null)
+    {
+      String prefix = getPrefix(ns, false);
+      if (prefix != null)
+      {
+        prefix = prefix.trim();
+      }
+      String xmlnsAttr = (prefix == "") ? "xmlns" : "xmlns:" + prefix;
+
+      if (prefix == "")
+      {
+        prefix = null;
+      }
+
+      if (xsdSchema != null)
+      {
+        Map map = xsdSchema.getQNamePrefixToNamespaceMap();
+        map.remove(prefix);
+        Element schemaElement = xsdSchema.getElement();
+        schemaElement.removeAttribute(xmlnsAttr);
+      }
+    }
+  }
+
+  public List getPrefixedNames(String namespace, String localName)
+  {
+    List list = new ArrayList();
+    if (namespace == null)
+    {
+      namespace = "";    			
+    }
+    if (xsdSchema != null && localName != null)
+    {
+      List prefixes = getPrefixesForNamespace(namespace);
+      for (Iterator i = prefixes.iterator(); i.hasNext(); )
+      {
+      	String prefix = (String)i.next();
+      	if (prefix == null) prefix = "";
+        String prefixedName = prefix.length() > 0 ? prefix + ":" + localName : localName;
+        list.add(prefixedName);               
+      }
+      if (prefixes.size() == 0)
+      {
+        list.add(localName);
+      }
+    }
+    return list;
+  }
+  
+  protected List getPrefixesForNamespace(String namespace)
+  {
+    List list = new ArrayList();
+    Map map = xsdSchema.getQNamePrefixToNamespaceMap();
+    for (Iterator iter = map.keySet().iterator(); iter.hasNext();)
+    {
+      String prefix = (String) iter.next();
+      Object value = map.get(prefix);
+      if (value != null && value.toString().equals(namespace))
+      {
+       list.add(prefix);
+      }
+    }
+    return list;
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/util/ViewUtility.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/util/ViewUtility.java
new file mode 100644
index 0000000..9c95ee7
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/util/ViewUtility.java
@@ -0,0 +1,246 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 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.util;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+// issue (cs) can we get rid of this class?
+// I've stripped it down a whole lot... but it'd be great to get rid of it
+//
+public class ViewUtility
+{
+  private static Font font;
+
+  private static Font getFont()
+  {
+    if (font == null)
+    {              
+      font = new Font(Display.getCurrent(), "ms sans serif", 8, SWT.NORMAL);  
+    }
+    return font;
+  }
+
+  public static void setComposite(Composite comp)
+  {
+    // deprecated.  Remove later
+  }
+  public static Composite createComposite(Composite parent, int numColumns)
+  {
+    Composite composite = new Composite(parent, SWT.NONE);
+
+    composite.setFont(getFont());
+
+    GridLayout layout = new GridLayout();
+    layout.numColumns = numColumns;
+    composite.setLayout(layout);
+
+    GridData data = new GridData();
+    data.verticalAlignment = GridData.FILL;
+    data.horizontalAlignment = GridData.FILL;
+    composite.setLayoutData(data);
+    return composite;
+  }
+
+  public static Composite createComposite(Composite parent, int numColumns, boolean horizontalFill)
+  {
+    if (!horizontalFill)
+    {
+      createComposite(parent, numColumns);
+    }
+
+    Composite composite = new Composite(parent, SWT.NONE);
+
+    composite.setFont(getFont());
+
+    GridLayout layout = new GridLayout();
+    layout.numColumns = numColumns;
+    composite.setLayout(layout);
+
+    GridData data = new GridData();
+    data.verticalAlignment = GridData.FILL;
+    data.horizontalAlignment = GridData.FILL;
+    data.grabExcessHorizontalSpace = true;
+    composite.setLayoutData(data);
+
+    return composite;
+  }
+
+  public static Label createHorizontalFiller(Composite parent, int horizontalSpan) 
+  {
+    Label label = new Label(parent, SWT.LEFT);
+    GridData data = new GridData();
+    data.horizontalAlignment = GridData.FILL;
+    data.horizontalSpan = horizontalSpan;
+    label.setLayoutData(data);
+    return label;
+  }
+
+  /**
+   * Helper method for creating labels.
+   */
+  public static Label createLabel(Composite parent, String text) 
+  {
+    Label label = new Label(parent, SWT.LEFT);
+    label.setText(text);
+
+    GridData data = new GridData();
+    data.horizontalAlignment = GridData.FILL;
+    label.setLayoutData(data);
+    return label;
+  }
+
+	public Label createLabel(Composite parent, int style, String text)
+	{
+		Label label = new Label(parent, style);
+//		setColor(label);
+		label.setText(text);
+
+		GridData data = new GridData();
+		data.horizontalAlignment = GridData.FILL;
+		label.setLayoutData(data);
+		return label;
+	}
+  
+  public static Label createLabel(Composite parent, String text, int alignment)
+  {
+    Label label = new Label(parent, SWT.LEFT);
+    label.setText(text);
+
+    GridData data = new GridData();
+    data.horizontalAlignment = GridData.FILL;
+    data.verticalAlignment = alignment;
+    label.setLayoutData(data);
+    return label;
+  }
+
+ 
+
+
+  /**
+   * Create radio button
+   */
+  public static Button createRadioButton(Composite parent, String label)
+  {
+    Button button = new Button(parent, SWT.RADIO);
+    button.setText(label);
+
+    GridData data = new GridData();
+    data.horizontalAlignment = GridData.FILL;
+    button.setLayoutData(data);
+
+    return button;
+  }
+
+  /**
+   * Helper method for creating check box
+   */
+  public static Button createCheckBox(Composite parent, String label) 
+  {
+    Button button = new Button(parent, SWT.CHECK);
+    button.setText(label);
+
+    GridData data = new GridData();
+    data.horizontalAlignment = GridData.FILL;
+    button.setLayoutData(data);
+    return button;
+  }
+
+  public static Combo createComboBox(Composite parent)
+  {
+    return createComboBox(parent, true);
+  }
+
+  public static Combo createComboBox(Composite parent, boolean isReadOnly)
+  {
+    int style = isReadOnly == true ? SWT.READ_ONLY : SWT.DROP_DOWN;
+
+    Combo combo = new Combo(parent, style);
+
+    GridData data = new GridData();
+    data.horizontalAlignment = GridData.FILL;
+    data.grabExcessHorizontalSpace = true;
+    combo.setLayoutData(data);
+    return combo;
+  }
+
+
+  public static Text createTextField(Composite parent, int width)
+  {
+    Text text = new Text(parent, SWT.SINGLE | SWT.BORDER);
+
+    GridData data = new GridData();
+    data.horizontalAlignment = GridData.FILL;
+    data.grabExcessHorizontalSpace = true;
+    data.widthHint = width;
+    text.setLayoutData(data);
+
+    return text;
+  }
+
+  /**
+   * <code>createWrappedMultiTextField</code> creates a wrapped multitext field
+   *
+   * @param parent a <code>Composite</code> value
+   * @param width an <code>int</code> value
+   * @param numLines an <code>int</code> value representing number of characters in height
+   * @param verticalFill a <code>boolean</code> value
+   * @return a <code>Text</code> value
+   */
+  public static Text createWrappedMultiTextField(Composite parent, int width, int numLines, boolean verticalFill)
+  {
+    Text text = new Text(parent, SWT.MULTI | SWT.BORDER | SWT.WRAP | SWT.V_SCROLL);
+
+    GridData data = new GridData();
+    data.horizontalAlignment = GridData.FILL;
+    data.grabExcessHorizontalSpace = true;
+    if (verticalFill)
+    {
+      data.verticalAlignment = GridData.FILL;
+      data.grabExcessVerticalSpace = true;
+    }      
+    data.widthHint = width;
+    FontData[] fontData = getFont().getFontData();
+    // hack for now where on Windows, only 1 fontdata exists
+    data.heightHint = numLines * fontData[0].getHeight();
+    text.setLayoutData(data);
+
+    return text;
+  }
+
+  public static Text createMultiTextField(Composite parent, int width, int height, boolean verticalFill)
+  {
+    Text text = new Text(parent, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
+
+    GridData data = new GridData();
+    data.horizontalAlignment = GridData.FILL;
+    data.grabExcessHorizontalSpace = true;
+    if (verticalFill)
+    {
+      data.verticalAlignment = GridData.FILL;
+      data.grabExcessVerticalSpace = true;
+    }      
+    data.widthHint = width;
+    data.heightHint = height;
+    text.setLayoutData(data);
+
+    return text;
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/util/XSDDOMHelper.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/util/XSDDOMHelper.java
new file mode 100644
index 0000000..6e705b8
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/util/XSDDOMHelper.java
@@ -0,0 +1,431 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 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.util;
+
+import java.util.ArrayList;
+
+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.xsd.util.XSDConstants;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Text;
+
+// issue (cs) remove this class!!
+public class XSDDOMHelper
+{
+
+  private static String XMLSchemaURI = "http://www.w3.org/2001/XMLSchema";
+
+  /**
+   * Constructor for XSDDOMHelper.
+   */
+  public XSDDOMHelper()
+  {
+    super();
+  }
+
+  public Node getChildNode(Element parent, String childName)
+  {
+/*    NodeList nodeList = parent.getElementsByTagNameNS(XMLSchemaURI, childName);
+    if (nodeList.getLength() > 0)
+      return nodeList.item(0);
+    return null;
+*/
+    NodeList list = null;
+    if (parent != null)
+    {
+      list = parent.getChildNodes();
+    }
+
+    if (list != null)
+    {
+      // Performance issue perhaps?
+      for (int i = 0; i < list.getLength(); i++)
+      {
+        if (list.item(i) instanceof Element)
+        {
+          if (list.item(i).getLocalName().equals(childName))
+          {
+            return list.item(i);
+          }
+        }
+      }
+    }
+    return null;
+  }
+
+
+
+
+  public void changeDerivedByType(Element element, String derivedByType, String type)
+  {
+    Document doc = element.getOwnerDocument();
+
+    String prefix = element.getPrefix();
+    prefix = prefix == null ? "" : prefix + ":";
+
+    Element derivedByElement = getDerivedByElement(element);
+    
+    if (derivedByElement != null && derivedByElement.getLocalName().equals(derivedByType))
+    {
+    	return; // it's already the derived by type
+    }
+    Element newNode;
+  	if (derivedByType.equals("restriction"))
+  	{
+    	newNode = doc.createElementNS(XSDDOMHelper.XMLSchemaURI, prefix + XSDConstants.RESTRICTION_ELEMENT_TAG);
+    }
+    else
+    {
+    	newNode = doc.createElementNS(XSDDOMHelper.XMLSchemaURI, prefix + XSDConstants.EXTENSION_ELEMENT_TAG);
+    }
+	
+    newNode.setAttribute("base", type);
+
+    if (derivedByElement != null)
+    {
+      if (derivedByElement.hasChildNodes())
+      {        
+        NodeList nodes = derivedByElement.getChildNodes();
+        // use clones so we don't have a refresh problem
+        for (int i = 0; i < nodes.getLength(); i++)
+        {
+          Node node = nodes.item(i);       
+          newNode.appendChild(node.cloneNode(true));
+        }
+      }
+	  element.replaceChild(newNode, derivedByElement);
+    }
+    else 
+	{
+		Element parent = (Element) element.getParentNode();				// get back to complexType
+        NodeList nodes = parent.getChildNodes();
+		ArrayList nodeSaveList = new ArrayList();
+		
+		// save children. (nodes turns out to be the same object as parent;
+		// deleting them from parent will delete them from nodes.)
+        for (int i = 0; i < nodes.getLength(); i++)			
+        {
+          Node node = nodes.item(i);      
+		  nodeSaveList.add(node);
+        }
+
+        // remove children so we can surround them by complexContent
+        for (int i = 0; i < nodeSaveList.size(); i++)			
+        {
+          Node node = (Node) nodeSaveList.get(i);      
+          parent.removeChild(node);
+        }
+		
+		// build a complexContent element
+		Element complexContent = doc.createElementNS(XSDDOMHelper.XMLSchemaURI, prefix + XSDConstants.COMPLEXCONTENT_ELEMENT_TAG);
+		parent.appendChild(complexContent);					// insert into complexType
+		complexContent.appendChild(newNode);				// insert derivation type
+        for (int i = 0; i < nodeSaveList.size(); i++)			// insert children previously of complexType
+        {
+          Node node = (Node) nodeSaveList.get(i);       
+          newNode.appendChild(node.cloneNode(true));
+        }
+		
+		parent.appendChild(complexContent);
+		formatChild(complexContent);
+    }
+  }
+
+  
+  /**
+   * Get the derived by node given the complexContent or simpleContent node
+   */
+  public Element getDerivedByElement(Element element)
+  {
+    Node restrictionChild = getChildNode(element, "restriction");
+    Node extensionChild = getChildNode(element, "extension");
+    if (restrictionChild != null)
+    {
+      if (restrictionChild instanceof Element)
+      {
+        return (Element)restrictionChild;
+      }
+    }
+    
+    if (extensionChild != null)
+    {
+      if (extensionChild instanceof Element)
+      {
+        return (Element)extensionChild;
+      }
+    }
+    return null;
+  }
+
+  /**
+   * Get the derived by node given the ComplexType node
+   * Returns the first one, if say, the INVALID schema has more than one
+   */
+  public Element getDerivedByElementFromComplexType(Element element)
+  {
+    NodeList nl = element.getChildNodes();
+    int j = 0;
+    for (j = 0; j < nl.getLength(); j++)
+    {
+      Node aNode = nl.item(j);
+      if (inputEquals(aNode, XSDConstants.COMPLEXCONTENT_ELEMENT_TAG, false))
+      {
+        break; 
+      }
+      else if (inputEquals(aNode, XSDConstants.SIMPLECONTENT_ELEMENT_TAG, false))
+      {
+        break;
+      }
+    }
+    Element derivedByNode = getDerivedByElement((Element)nl.item(j));
+    return derivedByNode;
+  }
+
+  /**
+   * Get the content model given the ComplexType node
+   * Returns the first one, if say, the INVALID schema has more than one
+   */
+  public Element getContentModelFromParent(Element element)
+  {
+    NodeList nl = element.getChildNodes();
+    int j = 0;
+    boolean modelExists = false;
+    int length = nl.getLength();
+    for (j = 0; j < length; j++)
+    {
+      Node aNode = nl.item(j);
+      if (inputEquals(aNode, XSDConstants.COMPLEXCONTENT_ELEMENT_TAG, false))
+      {
+        modelExists = true;
+        break; 
+      }
+      else if (inputEquals(aNode, XSDConstants.SIMPLECONTENT_ELEMENT_TAG, false))
+      {
+        modelExists = true;
+        break;
+      }
+      else if (inputEquals(aNode, XSDConstants.SEQUENCE_ELEMENT_TAG, false))
+      {
+        modelExists = true;
+        break;
+      }
+      else if (inputEquals(aNode, XSDConstants.CHOICE_ELEMENT_TAG, false))
+      {
+        modelExists = true;
+        break;
+      }
+      else if (inputEquals(aNode, XSDConstants.ALL_ELEMENT_TAG, false))
+      {
+        modelExists = true;
+        break;
+      }
+    }
+    if (!modelExists)
+    {
+      return null;
+    }
+
+    Element derivedByNode = (Element)nl.item(j);
+    return derivedByNode;
+  }
+
+  /**
+   * 
+   */
+  public void changeContentModel(Element complexTypeElement, String contentModel, Element sequenceChoiceOrAllElement)
+  {
+    Document doc = complexTypeElement.getOwnerDocument();
+
+    String prefix = complexTypeElement.getPrefix();
+    prefix = prefix == null ? "" : prefix + ":";
+    
+    Element contentModelElement = getContentModelFromParent(complexTypeElement);
+
+    if (contentModelElement.getLocalName().equals(contentModel))
+    {
+      return; // it's already the content model 
+    }
+    Element newNode;
+    newNode = doc.createElementNS(XSDDOMHelper.XMLSchemaURI, prefix + contentModel);
+
+    if (contentModelElement.hasChildNodes())
+    {        
+      NodeList nodes = contentModelElement.getChildNodes();
+      // use clones so we don't have a refresh problem
+      for (int i = 0; i < nodes.getLength(); i++)
+      {
+        Node node = nodes.item(i);
+        if (node instanceof Element)
+        {
+          if (node.getLocalName().equals(XSDConstants.ANNOTATION_ELEMENT_TAG))
+          {
+            if (!(XSDDOMHelper.inputEquals(contentModelElement, XSDConstants.SEQUENCE_ELEMENT_TAG, false) ||
+                XSDDOMHelper.inputEquals(contentModelElement, XSDConstants.CHOICE_ELEMENT_TAG, false) ||
+                XSDDOMHelper.inputEquals(contentModelElement, XSDConstants.ALL_ELEMENT_TAG, false)))
+            {
+              newNode.appendChild(node.cloneNode(true));
+            }
+          }
+          else if (node.getLocalName().equals(XSDConstants.RESTRICTION_ELEMENT_TAG) ||
+                    node.getLocalName().equals(XSDConstants.EXTENSION_ELEMENT_TAG))
+          {
+            newNode.appendChild(node.cloneNode(true));
+            if (sequenceChoiceOrAllElement != null)
+            {
+              node.appendChild(sequenceChoiceOrAllElement);
+            }
+          }
+          else
+          {
+            removeNodeAndWhitespace(node);
+          }
+        }
+        else
+        {
+          newNode.appendChild(node.cloneNode(true)); 
+        }
+      }
+    }
+    complexTypeElement.replaceChild(newNode, contentModelElement);
+  }
+
+  public Element cloneElement(Element parent, Element sourceNode)
+  {
+    Document doc = parent.getOwnerDocument();
+    String prefix = parent.getPrefix();
+    prefix = prefix == null ? "" : prefix + ":";
+    
+    Element newNode = doc.createElementNS(XSDDOMHelper.XMLSchemaURI, prefix + sourceNode.getLocalName());
+
+    if (sourceNode.hasChildNodes())
+    {        
+      NodeList nodes = sourceNode.getChildNodes();
+      // use clones so we don't have a refresh problem
+      for (int i = 0; i < nodes.getLength(); i++)
+      {
+        Node node = nodes.item(i);
+        newNode.appendChild(node.cloneNode(true));
+      }
+    }
+    return newNode;
+//    parent.replaceChild(newNode, sourceNode);
+  }
+
+ 
+
+  public static void removeNodeAndWhitespace(Node node)
+  {
+    Node parentNode = node.getParentNode();
+    
+    Node nextElement = getNextElementNode(node);
+    Node previousElement = getPreviousElementNode(node);
+
+    Node nextSibling = node.getNextSibling();
+    if (nextSibling instanceof Text)
+    {
+      parentNode.removeChild(nextSibling);
+    }
+
+    if (parentNode != null)
+    {
+		  parentNode.removeChild(node);
+    }
+
+    if (nextElement != null)
+    {
+			formatChild(nextElement);
+    }
+
+		if (previousElement != null)
+		{
+			formatChild(previousElement);
+		}
+  }
+
+	public static void formatChild(Node child)
+	{
+    if (child instanceof IDOMNode)
+    {
+      IDOMModel model = ((IDOMNode)child).getModel();
+      try
+      {
+        // tell the model that we are about to make a big model change
+        model.aboutToChangeModel();
+        
+	      IStructuredFormatProcessor formatProcessor = new FormatProcessorXML();
+		    formatProcessor.formatNode(child);
+      }
+      finally
+      {
+        // tell the model that we are done with the big model change
+        model.changedModel(); 
+      }
+    }
+  }
+  
+
+  private static Node getNextElementNode(Node node)
+  {
+    Node next = node.getNextSibling();
+    
+    while (!(next instanceof Element) && next != null)
+    {
+      next = next.getNextSibling();
+    }
+    if (next instanceof Text)
+    {
+    	return null;
+    }
+    return next;
+  }
+
+	private static Node getPreviousElementNode(Node node)
+	{
+		Node previous = node.getPreviousSibling();
+    
+		while (!(previous instanceof Element) && previous != null)
+		{
+			previous = previous.getPreviousSibling();
+		}
+    if (previous instanceof Text)
+    {
+      return null;
+    }
+    return previous;
+	}
+
+ 
+
+  // issue (cs) what's this method supposed to do?
+  // bizzare name
+  public static boolean inputEquals(Object input, String tagname, boolean isRef)
+  {
+    if (input instanceof Element)
+    {
+      Element element = (Element) input;
+      if (element.getLocalName().equals(tagname))
+      {
+        boolean refPresent = element.hasAttribute("ref");
+
+        return refPresent == isRef;
+      }
+    }
+    return false;
+  }
+
+ 
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/util/XSDSchemaLocationResolverAdapterFactory.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/util/XSDSchemaLocationResolverAdapterFactory.java
new file mode 100644
index 0000000..3c8ca3d
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/util/XSDSchemaLocationResolverAdapterFactory.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 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.util;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
+import org.eclipse.xsd.util.XSDSchemaLocationResolver;
+
+public class XSDSchemaLocationResolverAdapterFactory extends AdapterFactoryImpl
+{
+    protected XSDSchemaLocationResolverImpl schemaLocator = new XSDSchemaLocationResolverImpl();
+
+    public boolean isFactoryForType(Object type)
+    {
+      return type == XSDSchemaLocationResolver.class;
+    }
+
+    public Adapter adaptNew(Notifier target, Object type)
+    {
+      return schemaLocator;
+    }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/util/XSDSchemaLocationResolverImpl.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/util/XSDSchemaLocationResolverImpl.java
new file mode 100644
index 0000000..71e5f88
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/util/XSDSchemaLocationResolverImpl.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 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.util;
+
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.wst.common.uriresolver.internal.provisional.URIResolverPlugin;
+import org.eclipse.xsd.XSDSchema;
+import org.eclipse.xsd.util.XSDSchemaLocationResolver;
+import org.eclipse.xsd.util.XSDSchemaLocator;
+
+public class XSDSchemaLocationResolverImpl extends AdapterImpl implements XSDSchemaLocationResolver
+{
+    public String resolveSchemaLocation(XSDSchema xsdSchema, String namespaceURI, String schemaLocationURI)
+    {
+      String baseLocation = xsdSchema.getSchemaLocation();      
+      String result = URIResolverPlugin.createResolver().resolve(baseLocation, namespaceURI, schemaLocationURI);
+      if (result == null) {
+      	result = namespaceURI;
+      }
+      if (result == null) {
+      	result = "";
+      }
+
+      return result;
+    }
+
+    public boolean isAdatperForType(Object type)
+    {
+      return type == XSDSchemaLocator.class;
+    }  
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/validation/DelegatingSourceValidatorForXSD.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/validation/DelegatingSourceValidatorForXSD.java
new file mode 100644
index 0000000..240b0bd
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/validation/DelegatingSourceValidatorForXSD.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2005 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.validation;
+
+import org.eclipse.wst.validation.internal.provisional.ValidationFactory;
+import org.eclipse.wst.validation.internal.provisional.core.IValidator;
+import org.eclipse.wst.xml.ui.internal.validation.DelegatingSourceValidator;
+
+/**
+ * This performs the as-you-type validation
+ * @author Mark Hutchinson
+ *
+ */
+public class DelegatingSourceValidatorForXSD extends DelegatingSourceValidator
+{                                                
+  final private static String VALIDATOR_CLASS = "org.eclipse.wst.xsd.ui.internal.validation.Validator"; 
+
+  public DelegatingSourceValidatorForXSD()
+  { super();
+  }
+  
+  protected IValidator getDelegateValidator()
+  {
+    try
+    { return ValidationFactory.instance.getValidator(VALIDATOR_CLASS);
+    }
+    catch (Exception e)
+    { //
+    }
+    return null;
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/widgets/EnumerationsDialog.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/widgets/EnumerationsDialog.java
new file mode 100644
index 0000000..5db6c11
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/widgets/EnumerationsDialog.java
@@ -0,0 +1,106 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 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.widgets;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+import org.eclipse.wst.xsd.ui.internal.util.ViewUtility;
+
+
+/**
+ * Dialog to help define a list of enumerations
+ * for a join. This might be replaced once we know how to
+ * initiate a drag tracker
+ */
+
+public class EnumerationsDialog extends org.eclipse.jface.dialogs.Dialog
+{
+  public EnumerationsDialog(Shell shell)
+  {
+    super(shell);
+  }
+
+  protected void configureShell(Shell shell)
+  {
+    super.configureShell(shell);
+    shell.setText(XSDEditorPlugin.getXSDString("_UI_ENUMERATIONS_DIALOG_TITLE"));
+  }
+
+  protected void buttonPressed(int buttonId)
+  {
+    if (buttonId == Dialog.OK)
+    {
+      text = textField.getText();
+      delimiter = delimiterField.getText();
+      isPreserve = preserveWhitespace.getSelection();
+    }
+    super.buttonPressed(buttonId);
+  }
+
+  private String text, delimiter;
+  private boolean isPreserve;
+  public String getText() { return text; }
+  public String getDelimiter() { return delimiter; }
+  public boolean isPreserveWhitespace() { return isPreserve; }
+
+  private Text textField;
+  private Button preserveWhitespace;
+  private Combo delimiterField;
+  //
+  // Create the controls
+  //
+  public Control createDialogArea(Composite parent)
+  {
+    Control[] tabOrder = new Control[3];
+  	int tabIndex = 0;
+    Composite client = (Composite)super.createDialogArea(parent);
+    GridLayout layout = (GridLayout)client.getLayout();
+    layout.numColumns = 2;
+    client.setLayout(layout); 
+
+    textField = ViewUtility.createWrappedMultiTextField(client, 400, 20, true);
+    GridData gd = (GridData) textField.getLayoutData();
+    gd.horizontalSpan = 2;
+    tabOrder[tabIndex++] = textField;
+
+    ViewUtility.createLabel(client, XSDEditorPlugin.getXSDString("_UI_LABEL_DELIMITER_CHAR"));
+    delimiterField = ViewUtility.createComboBox(client, false);
+    gd = (GridData) delimiterField.getLayoutData();
+    gd.grabExcessHorizontalSpace = false;
+    gd.horizontalAlignment = GridData.BEGINNING;
+    gd.widthHint = 30;
+    tabOrder[tabIndex++] = delimiterField;
+
+    // add default delimiters
+    delimiterField.add(":");
+    delimiterField.add(",");
+    delimiterField.add(" ");
+    // set the current one to be ','
+    delimiterField.setText(",");
+
+    preserveWhitespace = ViewUtility.createCheckBox(client, XSDEditorPlugin.getXSDString("_UI_LABEL_PRESERVE_WHITESPACE"));
+    gd = (GridData) preserveWhitespace.getLayoutData();
+    gd.horizontalSpan = 2;
+    tabOrder[tabIndex++] = preserveWhitespace;
+    
+    client.setTabList(tabOrder);
+
+    return client;
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/widgets/TypeSection.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/widgets/TypeSection.java
new file mode 100644
index 0000000..ec97e3f
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/widgets/TypeSection.java
@@ -0,0 +1,335 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 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.widgets;
+
+import java.util.List;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.help.WorkbenchHelp;
+import org.eclipse.wst.xsd.editor.XSDEditorContextIds;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+import org.eclipse.wst.xsd.ui.internal.util.TypesHelper;
+import org.eclipse.wst.xsd.ui.internal.util.ViewUtility;
+import org.eclipse.xsd.XSDSchema;
+
+public class TypeSection
+{
+  /**
+   * Constructor for TypeSection.
+   * @param parent
+   */
+  public TypeSection(Composite parent)
+  {
+  }
+
+  protected Button  simpleType;
+  protected Button  userSimpleType;
+  protected Button  userComplexType;
+  protected Button  noneRadio;
+  protected Combo   typeList;
+  protected Combo   derivedByCombo;
+  protected boolean showUserComplexType = true;
+  protected boolean showUserSimpleType  = true;
+  protected boolean showNone            = false;
+  protected boolean showDerivedBy       = false;
+  protected String  derivedByChoices[]  = { "restriction", "extension" };
+  public final int  NONE                = 1;
+  public final int  BUILT_IN            = 2;
+  public final int  SIMPLE              = 3;
+  public final int  COMPLEX             = 4;
+
+  String            sectionTitle        = XSDEditorPlugin.getXSDString("_UI_LABEL_TYPE_INFORMATION");
+  String            currentObjectUuid   = "";
+
+  /*
+   * @see FlatPageSection#createClient(Composite, WidgetFactory)
+   */
+  public Composite createClient(Composite parent)
+  {
+    Composite client = new Composite(parent, SWT.NONE);
+    GridLayout gl = new GridLayout(1, true);
+    gl.verticalSpacing = 0;
+    client.setLayout(gl);
+
+    if (showNone)
+    {
+      noneRadio = ViewUtility.createRadioButton(client, XSDEditorPlugin.getXSDString("_UI_RADIO_NONE"));
+      WorkbenchHelp.setHelp(noneRadio, XSDEditorContextIds.XSDE_TYPE_HELPER_NONE);
+    }
+
+    simpleType = ViewUtility.createRadioButton(client, XSDEditorPlugin.getXSDString("_UI_RADIO_BUILT_IN_SIMPLE_TYPE"));
+    WorkbenchHelp.setHelp(simpleType, XSDEditorContextIds.XSDE_TYPE_HELPER_BUILT_IN);
+
+    if (showUserSimpleType)
+    {
+      userSimpleType = ViewUtility.createRadioButton(client, XSDEditorPlugin.getXSDString("_UI_RADIO_USER_DEFINED_SIMPLE_TYPE"));
+      WorkbenchHelp.setHelp(userSimpleType, XSDEditorContextIds.XSDE_TYPE_HELPER_USER_DEFINED_SIMPLE);
+    }
+
+    if (showUserComplexType)
+    {
+      userComplexType = ViewUtility.createRadioButton(client, XSDEditorPlugin.getXSDString("_UI_RADIO_USER_DEFINED_COMPLEX_TYPE"));
+      WorkbenchHelp.setHelp(userComplexType, XSDEditorContextIds.XSDE_TYPE_HELPER_USER_DEFINED_COMPLEX);
+    }
+
+    //	  typeList = utility.createComboBox(client);
+    //	  WorkbenchHelp.setHelp(typeList, XSDEditorContextIds.XSDE_TYPE_HELPER_TYPE);
+    //    utility.createHeadingLabel(client, "Type",null);
+
+    if (showDerivedBy)
+    {
+      Composite derivedByComposite = ViewUtility.createComposite(client, 2);
+      ViewUtility.createLabel(derivedByComposite, XSDEditorPlugin.getXSDString("_UI_LABEL_DERIVED_BY"));
+      derivedByCombo = ViewUtility.createComboBox(derivedByComposite);
+      populateDerivedByCombo();
+      WorkbenchHelp.setHelp(derivedByCombo, XSDEditorContextIds.XSDE_SIMPLE_CONTENT_DERIVED);
+      derivedByCombo.setToolTipText(XSDEditorPlugin.getXSDString("_UI_TOOLTIP_DERIVED_BY"));
+    }
+    // Set the default selection
+    if (showNone)
+    {
+      //		noneRadio.setSelection(true);
+      //		typeList.setEnabled(false);
+    }
+    else
+    {
+      simpleType.setSelection(true);
+    }
+    return client;
+  }
+
+  public void setIsDerivedBy(boolean derive)
+  {
+    if (derive)
+    {
+      sectionTitle = XSDEditorPlugin.getXSDString("_UI_LABEL_BASE_TYPE");
+    }
+    else
+    {
+      sectionTitle = XSDEditorPlugin.getXSDString("_UI_LABEL_TYPE_INFORMATION");
+    }
+    //	setHeaderText(sectionTitle);
+  }
+
+  /**
+   * Set to true if called by Complex Type & Simple Type
+   */
+  public void setShowDerivedBy(boolean derive)
+  {
+    showDerivedBy = derive;
+  }
+
+  /**
+   * Gets the derivedByField
+   * @return Returns a Button
+   */
+  public Combo getDerivedByCombo()
+  {
+    return derivedByCombo;
+  }
+
+  /**
+   * Gets the noneRadio.
+   * @return Returns a Button
+   */
+  public Button getNoneRadio()
+  {
+    return noneRadio;
+  }
+
+  /**
+   * Gets the simpleType.
+   * @return Returns a Button
+   */
+  public Button getSimpleType()
+  {
+    return simpleType;
+  }
+
+  /**
+   * Gets the userComplexType.
+   * @return Returns a Button
+   */
+  public Button getUserComplexType()
+  {
+    return userComplexType;
+  }
+
+  /**
+   * Gets the userSimpleType.
+   * @return Returns a Button
+   */
+  public Button getUserSimpleType()
+  {
+    return userSimpleType;
+  }
+
+  /**
+   * Gets the typeList.
+   * @return Returns a CCombo
+   */
+  public Combo getTypeList()
+  {
+    return typeList;
+  }
+
+  /**
+   * Populate combo box with built-in simple types
+   */
+  public void populateBuiltInType(XSDSchema xsdSchema)
+  {
+    getTypeList().removeAll();
+    List items = getBuiltInTypeNamesList(xsdSchema);
+    for (int i = 0; i < items.size(); i++)
+    {
+      getTypeList().add(items.get(i).toString());
+    }
+  }
+
+  public java.util.List getBuiltInTypeNamesList(XSDSchema xsdSchema)
+  {
+    TypesHelper helper = new TypesHelper(xsdSchema);
+    return helper.getBuiltInTypeNamesList();
+  }
+
+  /**
+   * Populate combo box with user defined complex types
+   */
+  public void populateUserComplexType(XSDSchema xsdSchema, boolean showAnonymous)
+  {
+    getTypeList().removeAll();
+    if (showAnonymous)
+    {
+      getTypeList().add(XSDEditorPlugin.getXSDString("_UI_ANONYMOUS"));
+    }
+
+    List items = getUserComplexTypeNamesList(xsdSchema);
+    for (int i = 0; i < items.size(); i++)
+    {
+      getTypeList().add(items.get(i).toString());
+    }
+  }
+
+  public java.util.List getUserComplexTypeNamesList(XSDSchema xsdSchema)
+  {
+    TypesHelper helper = new TypesHelper(xsdSchema);
+    return helper.getUserComplexTypeNamesList();
+  }
+
+  public void populateUserSimpleType(XSDSchema xsdSchema, boolean showAnonymous)
+  {
+    getTypeList().removeAll();
+    if (showAnonymous)
+    {
+      getTypeList().add(XSDEditorPlugin.getXSDString("_UI_ANONYMOUS"));
+    }
+    List items = getUserSimpleTypeNamesList(xsdSchema);
+    for (int i = 0; i < items.size(); i++)
+    {
+      getTypeList().add(items.get(i).toString());
+    }
+  }
+
+  /**
+   * Populate combo box with user defined simple types
+   */
+  public void populateUserSimpleType(XSDSchema xsdSchema)
+  {
+    getTypeList().removeAll();
+    List items = getUserSimpleTypeNamesList(xsdSchema);
+    for (int i = 0; i < items.size(); i++)
+    {
+      getTypeList().add(items.get(i).toString());
+    }
+  }
+
+  public java.util.List getUserSimpleTypeNamesList(XSDSchema xsdSchema)
+  {
+    TypesHelper helper = new TypesHelper(xsdSchema);
+    return helper.getUserSimpleTypeNamesList();
+  }
+
+  public String getPrefix(String ns, XSDSchema xsdSchema)
+  {
+    TypesHelper helper = new TypesHelper(xsdSchema);
+    String key = helper.getPrefix(ns, true);
+    return key;
+  }
+
+  /**
+   * Populate combo box with derived by choices
+   */
+  protected void populateDerivedByCombo()
+  {
+    for (int i = 0; i < derivedByChoices.length; i++)
+    {
+      getDerivedByCombo().add(derivedByChoices[i]);
+    }
+  }
+
+  /**
+   * Gets the showUserComplexType.
+   * @return Returns a boolean
+   */
+  public boolean getShowUserComplexType()
+  {
+    return showUserComplexType;
+  }
+
+  /**
+   * Gets the showUserSimpleType.
+   * @return Returns a boolean
+   */
+  public boolean getShowUserSimpleType()
+  {
+    return showUserSimpleType;
+  }
+
+  /**
+   * Gets the showNone.
+   * @return Returns a boolean
+   */
+  public boolean getShowNone()
+  {
+    return showNone;
+  }
+
+  /**
+   * Sets the showUserComplexType.
+   * @param showUserComplexType The showUserComplexType to set
+   */
+  public void setShowUserComplexType(boolean showUserComplexType)
+  {
+    this.showUserComplexType = showUserComplexType;
+  }
+
+  /**
+   * Sets the showUserSimpleType.
+   * @param showUserSimpleType The showUserSimpleType to set
+   */
+  public void setShowUserSimpleType(boolean showUserSimpleType)
+  {
+    this.showUserSimpleType = showUserSimpleType;
+  }
+
+  /**
+   * Sets the showNone
+   * @param showUserSimpleType The showNone to set
+   */
+  public void setShowNone(boolean showNone)
+  {
+    this.showNone = showNone;
+  }
+}
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
new file mode 100644
index 0000000..cf4d9df
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/widgets/XSDEditSchemaInfoDialog.java
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 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.widgets;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+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.dialogs.EditSchemaInfoDialog;
+import org.eclipse.wst.xml.ui.internal.nsedit.CommonEditNamespacesTargetFieldDialog;
+
+public class XSDEditSchemaInfoDialog extends EditSchemaInfoDialog {
+	String targetNamespace;
+	CommonEditNamespacesTargetFieldDialog editNamespacesControl;
+	
+	public XSDEditSchemaInfoDialog(Shell parentShell, IPath resourceLocation, String targetNamespace) {
+		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) {
+        // create a composite with standard margins and spacing
+        Composite composite = new Composite(parent, SWT.NONE);
+        GridLayout layout = new GridLayout();
+        layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
+        layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
+        layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
+        layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
+        composite.setLayout(layout);
+        composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+        applyDialogFont(composite);
+        return composite;
+    }	
+	
+	protected Control createDialogArea(Composite parent) {
+		Composite dialogArea = (Composite) __internalCreateDialogArea(parent);
+		editNamespacesControl = new CommonEditNamespacesTargetFieldDialog(dialogArea, resourceLocation); //$NON-NLS-1$
+		if (targetNamespace != null)
+		{	
+			editNamespacesControl.setTargetNamespace(targetNamespace);
+		}
+		editNamespacesControl.setNamespaceInfoList(namespaceInfoList);
+		editNamespacesControl.updateErrorMessage(namespaceInfoList);
+		return dialogArea;
+	}	
+	
+	public String getTargetNamespace() {
+		return editNamespacesControl.getTargetNamespace();
+	}
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/wizards/NewXSDWizard.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/wizards/NewXSDWizard.java
new file mode 100644
index 0000000..8382030
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/wizards/NewXSDWizard.java
@@ -0,0 +1,172 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 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.wizards;
+
+import java.io.ByteArrayInputStream;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Preferences;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IEditorDescriptor;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.ui.part.ISetSelectionTarget;
+import org.eclipse.wst.sse.core.internal.encoding.CommonEncodingPreferenceNames;
+import org.eclipse.wst.xml.core.internal.XMLCorePlugin;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+
+
+public class NewXSDWizard extends Wizard implements INewWizard {
+	private XSDNewFilePage newFilePage;
+	private IStructuredSelection selection;
+	private IWorkbench workbench;
+
+	public NewXSDWizard() {
+	}
+
+	public void init(IWorkbench aWorkbench, IStructuredSelection aSelection) {
+		this.selection = aSelection;
+		this.workbench = aWorkbench;
+
+		this.setDefaultPageImageDescriptor(ImageDescriptor.createFromFile(XSDEditorPlugin.class, "icons/NewXSD.gif"));
+		this.setWindowTitle(XSDEditorPlugin.getXSDString("_UI_WIZARD_CREATE_XSD_MODEL_TITLE"));
+	}
+
+	public void addPages() {
+		newFilePage = new XSDNewFilePage(selection);
+		addPage(newFilePage);
+	}
+
+	public boolean performFinish() {
+		IFile file = newFilePage.createNewFile();
+
+		//
+		// Get the xsd schema name from the full path name
+		// e.g. f:/b2b/po.xsd => schema name = po
+		//
+		IPath iPath = file.getFullPath().removeFileExtension();
+		// String schemaName = iPath.lastSegment();
+		String schemaName = iPath.lastSegment();
+		String schemaPrefix = "tns";
+		String prefixForSchemaNamespace = "";
+		String schemaNamespaceAttribute = "xmlns";
+		if (XSDEditorPlugin.getPlugin().isQualifyXMLSchemaLanguage()) {
+			// Added this if check before disallowing blank prefixes in the
+			// preferences...
+			// Can take this out. See also XSDEditor
+			if (XSDEditorPlugin.getPlugin().getXMLSchemaPrefix().trim().length() > 0) {
+				prefixForSchemaNamespace = XSDEditorPlugin.getPlugin().getXMLSchemaPrefix() + ":";
+				schemaNamespaceAttribute += ":" + XSDEditorPlugin.getPlugin().getXMLSchemaPrefix();
+			}
+		}
+
+		Preferences preference = XMLCorePlugin.getDefault().getPluginPreferences();
+		String charSet = preference.getString(CommonEncodingPreferenceNames.OUTPUT_CODESET);
+		if (charSet == null || charSet.trim().equals("")) {
+			charSet = "UTF-8";
+		}
+
+		String newContents = "<?xml version=\"1.0\" encoding=\"" + charSet + "\"?>\n";
+
+		String defaultTargetURI = XSDEditorPlugin.getPlugin().getXMLSchemaTargetNamespace();
+		newContents += "<" + prefixForSchemaNamespace + "schema " + schemaNamespaceAttribute + "=\"http://www.w3.org/2001/XMLSchema\" targetNamespace=\"" + defaultTargetURI + schemaName + "\" xmlns:" + schemaPrefix + "=\"" + defaultTargetURI + schemaName + "\">\n</" + prefixForSchemaNamespace + "schema>";
+
+		try {
+			byte[] bytes = newContents.getBytes(charSet);
+			ByteArrayInputStream inputStream = new ByteArrayInputStream(bytes);
+
+			file.setContents(inputStream, true, false, null);
+			inputStream.close();
+		}
+		catch (Exception e) {
+			// XSDEditorPlugin.getPlugin().getMsgLogger().write("Error writing
+			// default content:\n" + newContents);
+			// XSDEditorPlugin.getPlugin().getMsgLogger().write(e);
+		}
+
+		if (file != null) {
+			revealSelection(new StructuredSelection(file));
+		}
+
+		openEditor(file);
+
+		return true;
+	}
+
+	private void revealSelection(final ISelection selection) {
+		if (selection != null) {
+			IWorkbench workbench2;
+			if (workbench == null)
+			{
+			  workbench2 = XSDEditorPlugin.getPlugin().getWorkbench();
+			}
+			else
+			{
+			  workbench2 = workbench;
+			}
+			final IWorkbenchWindow workbenchWindow = workbench2.getActiveWorkbenchWindow();
+			final IWorkbenchPart focusPart = workbenchWindow.getActivePage().getActivePart();
+			if (focusPart instanceof ISetSelectionTarget) {
+				Display.getCurrent().asyncExec(new Runnable() {
+					public void run() {
+						((ISetSelectionTarget) focusPart).selectReveal(selection);
+					}
+				});
+			}
+		}
+	}
+
+	public void openEditor(final IFile iFile) {
+		if (iFile != null) {
+			IWorkbench workbench2;
+			if (workbench == null)
+			{
+			  workbench2 = XSDEditorPlugin.getPlugin().getWorkbench();
+			}
+			else
+			{
+			  workbench2 = workbench;
+			}
+			final IWorkbenchWindow workbenchWindow = workbench2.getActiveWorkbenchWindow();
+
+			Display.getDefault().asyncExec(new Runnable() {
+				public void run() {
+					try {
+						String editorId = null;
+						IEditorDescriptor editor = PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor(iFile.getLocation().toOSString(), iFile.getContentDescription().getContentType());
+						if (editor != null) {
+							editorId = editor.getId();
+						}
+						workbenchWindow.getActivePage().openEditor(new FileEditorInput(iFile), editorId);
+						
+					}
+					catch (PartInitException ex) {
+					}
+					catch (CoreException ex) {
+					}
+				}
+			});
+		}
+	}
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/wizards/RegexCompositionPage.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/wizards/RegexCompositionPage.java
new file mode 100644
index 0000000..2e2859b
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/wizards/RegexCompositionPage.java
@@ -0,0 +1,958 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 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
+ *******************************************************************************/
+// Based on version 1.12 of original xsdeditor
+package org.eclipse.wst.xsd.ui.internal.wizards;
+
+import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
+
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyleRange;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.FocusListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.layout.RowLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.help.WorkbenchHelp;
+import org.eclipse.wst.xsd.editor.XSDEditorContextIds;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+import org.eclipse.wst.xsd.ui.internal.util.ViewUtility;
+import org.eclipse.xsd.XSDPatternFacet;
+
+
+
+/*
+-other regex features (eg case sensitivity, ^ or $, |, etc etc)
+-smarter model
+-better keyboard navigation
+-update list of tokens 
+*/
+
+public class RegexCompositionPage extends WizardPage
+{
+  private static final boolean debug = false;
+
+  /* The text representation of our pattern. */
+  private StyledText value; 
+
+  /* The StyleRange used to color code the current parse error. */
+  private StyleRange currentError;
+
+  /* The regex terms we can form tokens from. */
+  private Combo terms;
+
+  /* The checkbox for activating auto-escape mode. */  
+  private Button escapeCheckbox;
+  
+  /* On/off status of auto-escape mode. */ 
+  private boolean autoEscapeStatus;
+
+  /* The Add Token button. */
+  private Button add;
+
+
+  // The following controls are used in the occurrence selection group
+
+  private Text repeatValue;
+
+  private Text rangeMinValue;
+  private Text rangeMaxValue;
+  private Label rangeToLabel;  
+
+  private Button singleRadio;
+  private Button starRadio;
+  private Button plusRadio;
+  private Button optionalRadio; 
+  private Button repeatRadio;
+  private Button rangeRadio;
+
+  
+  // The following variables used as part of the model. 
+
+  /* Our pattern. */
+  private XSDPatternFacet pattern;
+
+  /* Model used to store the current token. */
+  private RegexNode node;    
+
+  /* The flags passed to the new RegularExpression object.  Default value includes:
+      X = XMLSchema mode    */
+  private String regexFlags = "X";
+      
+
+  /* Is the current regex token valid? */
+  private boolean isValidToken;
+
+  /* The label used to indicate the value's caret position when it looses focus. */
+  private Label caretLabel;
+
+  /* The pixel offsets needed to align the label icon with the caret location.
+     These are dependent on the icon used. */
+  private static final int CARET_LABEL_X_OFFSET = -3;
+  private static final int CARET_LABEL_Y_OFFSET = 19;
+
+  
+  /* Enumerated constants for specifying the type of an error message. */
+  private static final int TOKEN = 0;
+  private static final int SELECTION = 1;
+  private static final int PARSE = 2;
+  
+  private static final int NUM_ERROR_MESSAGE_TYPES = 3;
+  
+  /* The current error message for each type of error.  A value of null indicates no message. 
+     The array is indexed according to the above constants.
+  */
+  private String[] currentErrorMessages;
+
+
+  public RegexCompositionPage(XSDPatternFacet pattern)
+  {
+    super(XSDEditorPlugin.getXSDString("_UI_REGEX_WIZARD_COMPOSITION_PAGE_TITLE"));
+    this.pattern = pattern;
+
+    setTitle(XSDEditorPlugin.getXSDString("_UI_REGEX_WIZARD_COMPOSITION_PAGE_TITLE"));
+    setDescription(XSDEditorPlugin.getXSDString("_UI_REGEX_WIZARD_COMPOSITION_PAGE_DESCRIPTION"));
+  }
+
+  public void createControl(Composite parent)
+  {
+    // Set up our model and validator
+    node = new RegexNode();
+        
+    isValidToken = true;
+
+    currentErrorMessages = new String[NUM_ERROR_MESSAGE_TYPES];
+
+    // The main composite
+    Composite composite= new Composite(parent, SWT.NONE);
+    WorkbenchHelp.setHelp(composite, XSDEditorContextIds.XSDR_COMPOSITION_PAGE);
+    composite.setLayout(new GridLayout());
+
+
+    // The composite for the token combo box, label, and auto-escape checkbox
+    Composite tokenComposite = new Composite (composite, SWT.NONE);
+    GridLayout tokenCompositeLayout = new GridLayout();
+    tokenCompositeLayout.numColumns = 3;
+    tokenCompositeLayout.marginWidth = 0;
+    tokenComposite.setLayout(tokenCompositeLayout);
+
+
+    new Label(tokenComposite, SWT.LEFT).setText(XSDEditorPlugin.getXSDString("_UI_REGEX_WIZARD_TOKEN_LABEL"));
+    
+    terms = new Combo(tokenComposite, SWT.DROP_DOWN);
+    WorkbenchHelp.setHelp(terms, XSDEditorContextIds.XSDR_COMPOSITION_TOKEN);
+    for (int i = 0; i < RegexNode.getNumRegexTerms(); i++)
+    {
+      terms.add(RegexNode.getRegexTermText(i));
+    }
+    terms.addListener(SWT.Modify, new ComboListener());
+    terms.setToolTipText(XSDEditorPlugin.getXSDString("_UI_TOOLTIP_REGEX_WIZARD_TERMS"));
+
+    escapeCheckbox = new Button(tokenComposite, SWT.CHECK);
+    escapeCheckbox.setText(XSDEditorPlugin.getXSDString("_UI_REGEX_WIZARD_AUTO_ESCAPE_CHECKBOX_LABEL"));
+    escapeCheckbox.setToolTipText(XSDEditorPlugin.getXSDString("_UI_TOOLTIP_REGEX_WIZARD_AUTO_ESCAPE_CHECKBOX")); 
+    escapeCheckbox.addSelectionListener(new CheckboxListener());
+    autoEscapeStatus = false;
+    
+    tokenComposite.pack();
+
+
+    // Set up the composites pertaining to the selection of occurrence quantifiers
+
+    Group occurrenceSelectionArea = new Group(composite, SWT.NONE);
+    occurrenceSelectionArea.setText(XSDEditorPlugin.getXSDString("_UI_REGEX_WIZARD_OCCURENCE_LABEL"));
+    WorkbenchHelp.setHelp(occurrenceSelectionArea, XSDEditorContextIds.XSDR_COMPOSITION_OCCURRENCE_GROUP);
+    GridLayout selectionAreaLayout = new GridLayout();
+    selectionAreaLayout.numColumns = 2;
+    occurrenceSelectionArea.setLayout(selectionAreaLayout);
+
+    // Listener used for all of the text fields
+    TextListener textListener = new TextListener();
+    
+
+    // Add the radio buttons
+    RadioSelectListener radioSelectListener = new RadioSelectListener();
+
+    singleRadio = addOccurenceRadioButton(RegexNode.SINGLE, occurrenceSelectionArea, radioSelectListener);
+    WorkbenchHelp.setHelp(singleRadio, XSDEditorContextIds.XSDR_COMPOSITION_JUST_ONCE);
+    ViewUtility.createHorizontalFiller(occurrenceSelectionArea, 1);
+
+    starRadio = addOccurenceRadioButton(RegexNode.STAR, occurrenceSelectionArea, radioSelectListener);
+    WorkbenchHelp.setHelp(starRadio, XSDEditorContextIds.XSDR_COMPOSITION_ZERO_OR_MORE);
+    ViewUtility.createHorizontalFiller(occurrenceSelectionArea, 1);
+
+    plusRadio = addOccurenceRadioButton(RegexNode.PLUS, occurrenceSelectionArea, radioSelectListener);
+    WorkbenchHelp.setHelp(plusRadio, XSDEditorContextIds.XSDR_COMPOSITION_ONE_OR_MORE);
+    ViewUtility.createHorizontalFiller(occurrenceSelectionArea, 1);
+
+    optionalRadio = addOccurenceRadioButton(RegexNode.OPTIONAL, occurrenceSelectionArea, radioSelectListener);
+    WorkbenchHelp.setHelp(optionalRadio, XSDEditorContextIds.XSDR_COMPOSITION_OPTIONAL);
+    ViewUtility.createHorizontalFiller(occurrenceSelectionArea, 1);
+
+    repeatRadio = addOccurenceRadioButton(RegexNode.REPEAT, occurrenceSelectionArea, radioSelectListener);
+    WorkbenchHelp.setHelp(repeatRadio, XSDEditorContextIds.XSDR_COMPOSITION_REPEAT);
+
+    // Add text field for specifying number of repeats
+    Composite repeatWidgets = new Composite(occurrenceSelectionArea, SWT.NONE);
+    RowLayout repeatWidgetsLayout = new RowLayout();
+    repeatWidgetsLayout.marginTop = 0;
+    repeatWidgetsLayout.marginBottom = 0;
+    repeatWidgetsLayout.marginLeft = 0;
+    repeatWidgetsLayout.marginRight = 0;
+    repeatWidgets.setLayout(repeatWidgetsLayout);        
+    
+    repeatValue = new Text(repeatWidgets, SWT.SINGLE | SWT.BORDER);
+    repeatValue.addListener(SWT.Modify, textListener);
+    WorkbenchHelp.setHelp(repeatValue, XSDEditorContextIds.XSDR_COMPOSITION_REPEAT_TEXT);
+    repeatValue.setToolTipText(XSDEditorPlugin.getXSDString("_UI_TOOLTIP_REGEX_WIZARD_REPEAT"));
+    setEnabledStatus(RegexNode.REPEAT, false);
+    
+    repeatWidgets.pack();
+    
+    rangeRadio = addOccurenceRadioButton(RegexNode.RANGE, occurrenceSelectionArea, radioSelectListener);
+    WorkbenchHelp.setHelp(rangeRadio, XSDEditorContextIds.XSDR_COMPOSITION_RANGE);
+
+    // Add text fields and labels for specifying the range    
+    Composite rangeWidgets = new Composite(occurrenceSelectionArea, SWT.NONE);
+    RowLayout rangeWidgetsLayout = new RowLayout();
+    rangeWidgetsLayout.marginTop = 0;
+    rangeWidgetsLayout.marginBottom = 0;
+    rangeWidgetsLayout.marginLeft = 0;
+    rangeWidgetsLayout.marginRight = 0;
+    rangeWidgets.setLayout(rangeWidgetsLayout);
+    
+    rangeMinValue = new Text(rangeWidgets, SWT.SINGLE | SWT.BORDER);
+    rangeMinValue.addListener(SWT.Modify, textListener);
+    WorkbenchHelp.setHelp(rangeMinValue, XSDEditorContextIds.XSDR_COMPOSITION_RANGE_MIN);
+    rangeMinValue.setToolTipText(XSDEditorPlugin.getXSDString("_UI_TOOLTIP_REGEX_WIZARD_MIN"));
+    
+    rangeToLabel = new Label(rangeWidgets, SWT.NONE);
+    rangeToLabel.setText(XSDEditorPlugin.getXSDString("_UI_REGEX_WIZARD_TO_LABEL"));
+    
+    rangeMaxValue = new Text(rangeWidgets, SWT.SINGLE | SWT.BORDER);
+    rangeMaxValue.addListener(SWT.Modify, textListener);
+    rangeMaxValue.setToolTipText(XSDEditorPlugin.getXSDString("_UI_TOOLTIP_REGEX_WIZARD_MAX"));
+    WorkbenchHelp.setHelp(rangeMaxValue, XSDEditorContextIds.XSDR_COMPOSITION_RANGE_MAX);
+
+    setEnabledStatus(RegexNode.RANGE, false);
+    rangeWidgets.pack();
+    
+    singleRadio.setSelection(true);
+    
+    occurrenceSelectionArea.pack();
+
+    // The add button
+    add = new Button(composite, SWT.PUSH);
+    add.addSelectionListener(new ButtonSelectListener());
+    add.setText(XSDEditorPlugin.getXSDString("_UI_REGEX_WIZARD_ADD_BUTTON_LABEL"));
+    WorkbenchHelp.setHelp(add, XSDEditorContextIds.XSDR_COMPOSITION_ADD);
+    add.setToolTipText(XSDEditorPlugin.getXSDString("_UI_TOOLTIP_REGEX_WIZARD_ADD_BUTTON"));
+
+    
+    Label separator = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
+    separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+    
+    // Our main text box
+
+    Label valueLabel= new Label(composite, SWT.LEFT);
+    valueLabel.setText(XSDEditorPlugin.getXSDString("_UI_REGEX_WIZARD_CURRENT_REGEX_LABEL"));
+    
+    value = new StyledText(composite, SWT.SINGLE | SWT.BORDER);
+    value.addListener(SWT.Modify, textListener);
+    value.addListener(SWT.Selection, textListener);
+    WorkbenchHelp.setHelp(value, XSDEditorContextIds.XSDR_COMPOSITION_CURRENT);
+    value.setToolTipText(XSDEditorPlugin.getXSDString("_UI_TOOLTIP_REGEX_WIZARD_CURRENT_REGEX"));
+    value.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+    value.setFocus();
+
+    // StyleRange used for highlighting parse errors
+    currentError = new StyleRange();
+    currentError.length = 1;
+    currentError.foreground = parent.getDisplay().getSystemColor(SWT.COLOR_RED);
+
+    // The caret label
+    caretLabel = new Label(composite, SWT.LEFT);
+    caretLabel.setImage(XSDEditorPlugin.getXSDImage("icons/RegexWizardArrow.gif"));
+    caretLabel.setToolTipText(XSDEditorPlugin.getXSDString("_UI_TOOLTIP_REGEX_WIZARD_CARET_LABEL"));
+    setShowCaretLabel(true);
+
+    value.addFocusListener(new TextFocusListener());
+
+    terms.select(0);
+
+
+    setControl(composite);
+  }
+
+
+  public void setVisible(boolean visible)
+  {
+    super.setVisible(visible);
+
+    value.setText(pattern.getLexicalValue());
+    value.setCaretOffset(value.getCharCount());
+  }
+
+  public void dispose()
+  {
+    super.dispose();
+  }
+
+
+  /**
+   * Sets the visible status of caretLabel to status.  If status is true, then we also update the position
+   * of caretLabel in one of two ways.  If there is no active selection in value, we set caretLabel's
+   * position to correspond with the position of the actual caret.  Alternatively, if there is an active selection
+   * in value, we set caretLabel's position to the beginning of the selection.
+   *
+   * @param The new visibility status of caretLabel.
+   */
+  private void setShowCaretLabel(boolean status)
+  {
+    if (status)
+    {
+  
+      int offset;
+      
+      if (value.getSelectionText().equals(""))
+      {
+        offset = value.getCaretOffset();
+      }
+      else
+      {
+        offset = value.getSelection().x;
+      }
+  
+      Point p = value.getLocationAtOffset(offset);
+      
+      p.x += value.getLocation().x;
+      p.y = value.getLocation().y;
+      
+      // Place the label under value, and make sure it is aligned with the caret.
+      // The offsets are dependent on the icon used.
+      p.x += CARET_LABEL_X_OFFSET;
+      p.y += CARET_LABEL_Y_OFFSET;
+  
+      if (debug)
+      {
+        System.out.println("POINT: " + p);
+      }
+      
+      caretLabel.setLocation(p);
+      caretLabel.setVisible(true);
+    }
+    else
+    {
+      caretLabel.setVisible(false);
+    }
+  }
+
+
+  /**
+   * Adds a new radio button to Composite c with SelectionListener l.  The text of the button is the String associated with
+   * quantifier.
+   *
+   * @param quantifier The desired quantifier, as enumerated in RegexNode.
+   * @param c The Composite to add the buttons to (normally occurrenceRadioButtons).
+   * @param l The SelectionListener (normally radioSelectionListener).
+   * @return The newly created button.
+   */
+  private Button addOccurenceRadioButton(int quantifier, Composite c, SelectionListener l)
+  {
+    Button result = new Button(c, SWT.RADIO);
+    result.setText(RegexNode.getQuantifierText(quantifier));
+    result.addSelectionListener(l);
+    return result;
+  }
+
+
+  /**
+   * Validates the regex in value.  If the regex is valid, clears the Wizard's error message.  If it's not valid,
+   *  sets the Wizard's error message accordingly.
+   *
+   * @return Whether the regex is valid.
+   */
+  private boolean validateRegex()
+  {
+
+    boolean isValid;
+    try
+    {
+      // We validate the regex by checking whether we get a ParseException.
+      // By default, we assume that it's valid unless we determine otherwise.
+      isValid = true;
+      displayRegexErrorMessage(null);
+      value.setStyleRange(null);
+
+      Pattern.compile(value.getText());
+    }
+    catch (PatternSyntaxException pe)
+    {
+      isValid = false;
+      displayRegexErrorMessage(pe.getMessage());
+
+      // An off-by-one bug in the xerces regex parser will sometimes return a location for the parseError that
+      //  is off the end of the string.  If this is the case, then we want to highlight the last character.
+      if (pe.getIndex() >= value.getText().length())
+      {
+        currentError.start = value.getText().length() - 1;
+      }
+      else
+      {
+        currentError.start = pe.getIndex();
+      }
+
+      if (debug)
+      {
+        System.out.println("Parse Error location: " + pe.getIndex());
+        System.out.println("currentError.start: " + currentError.start);
+      }
+
+      value.setStyleRange(currentError);
+
+    }
+
+    // Another bug in the xerces parser will sometimes throw a RuntimeException instead of a ParseException.
+    //  When we get a RuntimeException, we aren't provided with the additional information we need to highlight
+    //  the parse error.  So, we merely report that there is an error.
+    catch (RuntimeException re)
+    {
+      displayRegexErrorMessage("");
+      value.setStyleRange(null);
+      isValid = false;
+    }
+    
+    setPageComplete(isValid);    
+    return isValid;
+  }
+
+  
+  /**
+   * Manages the display of error messages.
+   * Sets the error message for type to errorMessage.  If errorMessage != null, then we set the Wizard's error message
+   * to errorMessage.  If errorMessage == null, then we check whether we have a pending message of another type.
+   * If we do, then it is displayed as the Wizard's error message.  If we don't, then the Wizard's error message field
+   * is cleared.
+   *
+   * @param errorMessage The text of the new error message.  A value of null indicates that the error message should
+   *  be cleared.
+   * @param type The error type, one of PARSE, TOKEN, or SELECTION.
+   */ 
+  private void displayErrorMessage(String errorMessage, int type)
+  {
+    String messageToDisplay = null;
+
+
+    currentErrorMessages[type] = errorMessage;
+
+    messageToDisplay = errorMessage;
+
+    for (int i = 0; i < NUM_ERROR_MESSAGE_TYPES; i++)
+    {
+      if (messageToDisplay != null)
+      {
+        break;
+      }
+      messageToDisplay = currentErrorMessages[i];
+    }
+
+    setErrorMessage(messageToDisplay);
+  }
+
+
+  /**
+   * Sets the Wizard's error message to message, preceded by a standard prefix.
+   *
+   * @param message The new error message (or null to clear it).
+   */
+  private void displayRegexErrorMessage (String errorMessage)
+  {
+    if (errorMessage == null)
+    {
+      displayErrorMessage(null, PARSE);
+    }
+    else
+    {
+    	if (errorMessage.trim().equals("")) // when there is no error message available.
+    	{
+        displayErrorMessage(XSDEditorPlugin.getXSDString("_UI_REGEX_WIZARD_INVALID_REGEX_ERROR"),
+                           PARSE);
+      }
+      else
+      {
+        displayErrorMessage(errorMessage, PARSE);
+      }
+    }
+  }
+
+
+  /**
+   * Updates the token status.  Sets isValidToken to status && the status of the other error type.
+   * If status is true, we clear the wizard's error message for this type; if it is false, we set it to errorMessage.
+   *
+   * @param status The new isValidToken value.
+   * @param errorMessage The new error message.
+   * @param type The type of the error (either TOKEN or SELECTION).
+   */
+  private void setTokenStatus (boolean status, String errorMessage, int type)
+  {
+    boolean otherTypeStatus =     (type == TOKEN) ? 
+                                  currentErrorMessages[SELECTION] == null :
+                                  currentErrorMessages[TOKEN] == null;
+    
+    isValidToken = status && otherTypeStatus;
+    add.setEnabled(isValidToken);
+
+    if (status)
+    {
+      displayErrorMessage(null, type);
+    }
+    else
+    {
+    	if (errorMessage != null && errorMessage.trim().equals("")) // when there is no error message available.
+    	{
+        displayErrorMessage(XSDEditorPlugin.getXSDString("_UI_REGEX_WIZARD_INVALID_TOKEN_ERROR"),
+                           type);
+      }
+      else
+      {
+        displayErrorMessage(errorMessage, type);
+      }
+    }
+  }
+
+  
+  /**
+   * Updates the token status.  Sets isValidToken to status && the status of the other error type.
+   * Also clears the wizard's error message for this type.
+   * Usually used to set isValidToken to true.
+   *
+   * @param status The new isValidToken value.
+   * @param type The type of the error (either TOKEN or SELECTION).
+   */
+  private void setTokenStatus(boolean status, int type)
+  {
+    setTokenStatus(status, null, type);
+  }
+
+
+
+  /**
+   * Sets the enabled status of the text fields and labels associated with the specified quantifier.
+   * If status is true, then fields and labels associated with other quantifiers are disabled.
+   * @param quantifier The quantifier whose elements' enabled status we wish to change
+   *   (as enumerated in RegexNode).
+   * @param status The new status of the elements.  If true, then all elements associated with other buttons
+   *               are disabled.
+   */    
+  private void setEnabledStatus(int quantifier, boolean status)
+  {
+    switch (quantifier)
+    {
+    
+    case RegexNode.REPEAT:
+      repeatValue.setEnabled(status);
+      if (status)
+      {
+        rangeMinValue.setEnabled(false);
+        rangeMaxValue.setEnabled(false);
+        rangeToLabel.setEnabled(false);
+      }
+      break;
+
+    case RegexNode.RANGE:
+      rangeMinValue.setEnabled(status);
+      rangeMaxValue.setEnabled(status);
+      rangeToLabel.setEnabled(status);
+      if (status)
+      {
+        repeatValue.setEnabled(false);
+      }
+      break;
+
+    }
+  }
+
+  /**
+   * Checks to see if there is a selection in value.  If there is not, we set the Wizard's error message accordingly.
+   * If there is, we update the contents of node.  If "Current Selection" is not the current token, then
+   * we clear the Selection error message.
+   */
+  private void updateCurrentSelectionStatus()
+  {
+    if (terms.getSelectionIndex() == RegexNode.SELECTION)
+    {
+      String selection = value.getSelectionText();
+      if (selection.equals(""))
+      {
+        setTokenStatus(false, XSDEditorPlugin.getXSDString("_UI_REGEX_WIZARD_INVALID_SELECTION_ERROR"), SELECTION);
+      }
+      else
+      {
+        setTokenStatus(true, SELECTION);
+        node.setContents(selection);
+        node.setHasParens(true);
+      }
+    }
+    else
+    {
+      setTokenStatus(true, SELECTION);
+    }
+  }
+
+  /**
+   * Updates the enabled status of the auto-escape checkbox.  If status is true, we enable the checkbox, and
+   * set its selection status and node's auto-escape status to the value of autoEscapeStatus.  If status is
+   * false, then we disable and deselect the checkbox, and set node's status to false.
+   *
+   * @param status The new enabled status.
+   */
+  private void setEscapeCheckboxEnabledStatus(boolean status)
+  {
+    if (status)
+    {
+      escapeCheckbox.setEnabled(true);
+      escapeCheckbox.setSelection(autoEscapeStatus);
+      node.setAutoEscapeStatus(autoEscapeStatus);
+    }
+    else
+    {
+      escapeCheckbox.setEnabled(false);
+      escapeCheckbox.setSelection(false);
+      node.setAutoEscapeStatus(false);
+    }
+  }
+
+
+  /**
+   * Returns the current regex flags.
+   */
+  String getFlags()
+  {
+    return regexFlags;
+  }
+
+  /**
+   * Returns the current XSDPattern model.
+   */
+  XSDPatternFacet getPattern()
+  {
+    return pattern;
+  }
+
+
+  /**
+   * Returns a string consisting of the values of min, max, and repeat stored in node.
+   * Used for debugging purposes only.
+   */  
+  private String getAllFieldValues()
+  {
+      String result = "";
+      result += "Min: " + node.getMin() + "\n";
+      result += "Max: " + node.getMax() + "\n";
+      result += "Repeat: " + node.getRepeat() + "\n";
+      result += "\n";
+      return result;
+  }
+  
+
+  /* Listener for the add button. */
+  class ButtonSelectListener implements SelectionListener
+  {
+    public void widgetDefaultSelected(SelectionEvent e)
+    {
+    }
+
+    // Precondition: isValidToken == true  
+    public void widgetSelected(SelectionEvent e)
+    {
+      if (!isValidToken) // should never happen
+      {
+        System.out.println("Attempted to add an invalid token.");
+        System.out.println(node.toString());
+        System.out.println(getAllFieldValues());
+        return;
+      }
+
+      // Whether there is anything selected in value.
+      boolean isActiveSelection = value.getSelectionCount() != 0;
+      
+      value.insert(node.toString());
+
+      if (terms.getSelectionIndex() == RegexNode.SELECTION)
+      {
+        updateCurrentSelectionStatus();
+      }
+
+      // If nothing is selected, then we need to advance the caret location.
+      if (!isActiveSelection)
+      {
+        value.setCaretOffset(value.getCaretOffset() + node.toString().length());
+      }
+
+      value.setFocus();
+
+    }
+
+  }
+ 
+
+  /* Listener for the terms combo box. */
+  class ComboListener implements Listener
+  {
+    public void handleEvent(Event e)
+    {
+      
+      updateCurrentSelectionStatus();
+
+      // If the user has typed in a token
+      if (terms.getSelectionIndex() == -1)
+      {
+        setEscapeCheckboxEnabledStatus(true);
+        node.setContents(terms.getText());
+        node.setHasParens(true);
+        
+
+        if (debug)
+        {
+          System.out.println(terms.getText());
+        }
+
+      }
+      else if (terms.getSelectionIndex() == RegexNode.SELECTION)
+      {
+        setEscapeCheckboxEnabledStatus(false);
+      }
+      else
+      {
+        node.setContents(RegexNode.getRegexTermValue(terms.getSelectionIndex()));
+        node.setHasParens(false);
+        setEscapeCheckboxEnabledStatus(false);
+      }
+    }
+  }
+
+
+  /* Listener for enabling/disabling caretLabel. */
+  class TextFocusListener implements FocusListener
+  {
+    public void focusGained(FocusEvent e)
+    {
+      setShowCaretLabel(false);
+    }
+    public void focusLost(FocusEvent e)
+    {
+      setShowCaretLabel(true);
+    }
+  }
+
+
+
+  /* Listener for the text fields. */
+  class TextListener implements Listener
+  {
+    public void handleEvent (Event e)
+    {
+
+      if (debug)
+      {
+        System.out.println("Inside TextListener handler");
+        System.out.println(e);
+        System.out.println(getAllFieldValues());
+      }
+
+
+      if ( (e.widget == value) && (e.type == SWT.Modify) )
+      {
+        pattern.setLexicalValue(value.getText());
+        validateRegex();
+      }
+
+      else if (e.widget == value && e.type == SWT.Selection)
+      {
+        if (terms.getSelectionIndex() == RegexNode.SELECTION)
+        {
+          updateCurrentSelectionStatus();
+        }
+      }
+
+      else if (e.widget == rangeMinValue)
+      {
+        boolean isValid = node.setMin(rangeMinValue.getText());
+
+        if (isValid)
+        {
+          setTokenStatus(true, null, TOKEN);
+        }
+        else
+        {
+          setTokenStatus(false,  XSDEditorPlugin.getXSDString("_UI_REGEX_WIZARD_INVALID_MIN_ERROR_SUFFIX"), TOKEN);
+        }
+      }
+
+      else if (e.widget == rangeMaxValue)
+      {
+        boolean isValid = node.setMax(rangeMaxValue.getText());
+
+        if (node.getMin() == RegexNode.EMPTY)
+        {
+          setTokenStatus(false, XSDEditorPlugin.getXSDString("_UI_REGEX_WIZARD_MISSING_MIN_ERROR_SUFFIX"), TOKEN);
+        }
+        else if (isValid)
+        {
+          setTokenStatus(true, null, TOKEN);
+        }
+        else
+        {
+          setTokenStatus(false, XSDEditorPlugin.getXSDString("_UI_REGEX_WIZARD_INVALID_MAX_ERROR_SUFFIX"), TOKEN);
+        }
+      }
+
+      else  // (e.widget == repeatValue)
+      {
+        boolean isValid = node.setRepeat(repeatValue.getText());
+        if (isValid)
+        {
+          setTokenStatus(true, null, TOKEN);
+        }
+        else
+        {
+          setTokenStatus(false, XSDEditorPlugin.getXSDString("_UI_REGEX_WIZARD_INVALID_REPEAT_ERROR_SUFFIX"), TOKEN);
+        }
+      }
+    }
+  }
+
+  /* Listener for the auto-escape checkbox. */
+  class CheckboxListener implements SelectionListener
+  {
+    public void widgetDefaultSelected(SelectionEvent e)
+    {
+    }
+
+    public void widgetSelected(SelectionEvent e)
+    {
+      boolean newStatus = !autoEscapeStatus;
+      node.setAutoEscapeStatus(newStatus);
+      autoEscapeStatus = newStatus;
+      
+      if (debug)
+      {
+        System.out.println("AutoEscape Status: " + node.getAutoEscapeStatus());
+      }
+    }
+
+  }
+
+
+  /* Listener for the radio buttons. */
+  class RadioSelectListener implements SelectionListener
+  {
+    public void widgetDefaultSelected(SelectionEvent e)
+    {
+    }
+
+    public void widgetSelected(SelectionEvent e)
+    {
+      if (debug)
+      {
+        System.out.println(getAllFieldValues());
+      }
+
+
+      int currentQuantifier = getQuantifier(e);
+
+      node.setQuantifier(currentQuantifier);
+
+      switch (currentQuantifier)
+      {
+      case RegexNode.SINGLE:                     
+      case RegexNode.STAR:
+      case RegexNode.PLUS:
+      case RegexNode.OPTIONAL:
+        setEnabledStatus(RegexNode.REPEAT, false);
+        setEnabledStatus(RegexNode.RANGE, false);
+        setTokenStatus(true, TOKEN);
+        break; 
+
+      case RegexNode.REPEAT:
+        setEnabledStatus(RegexNode.REPEAT, true);
+        setTokenStatus(node.hasValidRepeat(), XSDEditorPlugin.getXSDString("_UI_REGEX_WIZARD_INVALID_REPEAT_ERROR_SUFFIX"), TOKEN);
+        repeatValue.setFocus();
+        break;
+
+      case RegexNode.RANGE:
+        setEnabledStatus(RegexNode.RANGE, true);
+        String error = (node.hasValidMin()) ? 
+                            XSDEditorPlugin.getXSDString("_UI_REGEX_WIZARD_INVALID_MAX_ERROR_SUFFIX") : 
+                            XSDEditorPlugin.getXSDString("_UI_REGEX_WIZARD_INVALID_MIN_ERROR_SUFFIX");
+
+        setTokenStatus( node.hasValidMin() && node.hasValidMax(), error, TOKEN);
+        rangeMinValue.setFocus();
+        break;
+      }
+    }
+
+    private int getQuantifier(SelectionEvent e)
+    {
+
+      if (e.widget == singleRadio)
+      {
+        return RegexNode.SINGLE;
+      }
+      
+      else if (e.widget == starRadio)
+      {
+        return RegexNode.STAR;
+      }
+      
+      else if (e.widget == plusRadio)
+      {
+        return RegexNode.PLUS;
+      }
+      
+      else if (e.widget == optionalRadio)
+      {
+        return RegexNode.OPTIONAL;
+      }
+      
+      else if (e.widget == repeatRadio)
+      {
+        return RegexNode.REPEAT;
+      }
+      
+      else if (e.widget == rangeRadio)
+      {
+        return RegexNode.RANGE;
+      }
+      
+      else // can't get here
+      { 
+        return RegexNode.EMPTY;
+      }
+    } 
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/wizards/RegexNode.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/wizards/RegexNode.java
new file mode 100644
index 0000000..3dd0b63
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/wizards/RegexNode.java
@@ -0,0 +1,421 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 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.wizards;
+
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+
+
+class RegexNode
+{
+  private String contents;
+  private int min;
+  private int max;
+  private int repeat;
+  private int quantifier;
+  private boolean hasParens;
+  private boolean autoEscapeStatus;
+
+  
+  /* Quantifiers. */
+  public static final int SINGLE = 0;    
+  public static final int STAR = 1;
+  public static final int PLUS = 2;
+  public static final int OPTIONAL = 3;
+  public static final int REPEAT = 4; 
+  public static final int RANGE = 5;
+
+  /* Regex quantifiers.  First column is the on-screen textual representation, second column is the 
+   on-screen regex representation.  The two are concatenated together to form the on-screen
+   representation.
+   Indexing of this array must correspond to the values of the quantifier constants above.
+  */
+  private static final String[][] regexQuantifiers =
+  { 
+    { XSDEditorPlugin.getXSDString("_UI_REGEX_WIZARD_QUANTIFIER_SINGLE"),   ""  },
+    { XSDEditorPlugin.getXSDString("_UI_REGEX_WIZARD_QUANTIFIER_STAR"),     "*" },
+    { XSDEditorPlugin.getXSDString("_UI_REGEX_WIZARD_QUANTIFIER_PLUS"),     "+" },
+    { XSDEditorPlugin.getXSDString("_UI_REGEX_WIZARD_QUANTIFIER_OPTIONAL"), "?" },
+    { XSDEditorPlugin.getXSDString("_UI_REGEX_WIZARD_QUANTIFIER_REPEAT"),   ""  },
+    { XSDEditorPlugin.getXSDString("_UI_REGEX_WIZARD_QUANTIFIER_RANGE"),    ""  },
+  };
+
+
+  /* Regex tokens.  First column is the on-screen representation, second column is the regex representation. 
+     More tokens can be added, but it is assumed that "Current Selection" is the last element in the array.
+     If this is not the case, then the value of the SELECTION constant below will need to be changed 
+     accordingly.
+     Also note that because these are java Strings, backslashes must be escaped (this is only relevant to the
+     second column of the array).
+   */
+  private static final String[][] regexTerms =
+  { 
+    { XSDEditorPlugin.getXSDString("_UI_REGEX_WIZARD_TERM_ANY_CHAR"),   "."     },
+    { XSDEditorPlugin.getXSDString("_UI_REGEX_WIZARD_TERM_ALPHANUMERIC_CHAR"),   "\\w"     },
+    { XSDEditorPlugin.getXSDString("_UI_REGEX_WIZARD_TERM_WHITESPACE"), "\\s"   },
+    { XSDEditorPlugin.getXSDString("_UI_REGEX_WIZARD_TERM_DIGIT"),      "\\d"   },
+    { XSDEditorPlugin.getXSDString("_UI_REGEX_WIZARD_TERM_UPPER"),      "[A-Z]" },
+    { XSDEditorPlugin.getXSDString("_UI_REGEX_WIZARD_TERM_LOWER"),      "[a-z]" },
+    { XSDEditorPlugin.getXSDString("_UI_REGEX_WIZARD_TERM_SELECTION"),  ""      },
+  };
+
+  /* Token enumerated constants. */
+
+  // SELECTION must correspond to the index in regexTerms of "Current Selection".  This is assumed to be
+  //  the last element.
+  public static final int SELECTION = regexTerms.length - 1;
+
+  public static final int EMPTY = -1;
+
+  /* 
+  The metacharacters recognized by XML Schema.
+  Note that the double backslash ("\\") actually represents an escaped single backslash character ("\").
+  */ 
+  private static final String metacharacters = ".\\?*+{}()[]";
+
+
+  public static String getRegexTermText(int i)
+  {
+    if (i == SELECTION)
+    {
+      return regexTerms[i][0];
+    }
+    else
+    {
+      return regexTerms[i][0] + " ( " + regexTerms[i][1] + " )";
+    }
+  }
+
+  public static String getRegexTermValue(int i)
+  {
+    if (i == SELECTION) // shouldn't happen
+    {
+      return "";
+    }
+    else
+    {
+      return regexTerms[i][1];
+    }
+  }
+
+  public static int getNumRegexTerms()
+  {
+    return regexTerms.length;
+  }
+
+  public static String getQuantifierText(int i)
+  {
+    String result = regexQuantifiers[i][0];
+    
+    if (!regexQuantifiers[i][1].equals(""))
+    {
+      result += " ( ";
+      result += regexQuantifiers[i][1];
+      result += " )";
+    }
+
+    return result;
+  }
+
+  public RegexNode()
+  {
+    this.contents = "";
+    this.quantifier = SINGLE;
+    this.min = EMPTY;
+    this.max = EMPTY;
+    this.repeat = EMPTY;
+    this.hasParens = false;
+
+  }
+
+  
+  public String getContents()
+  {
+    return contents;
+  }
+  
+  public void setContents(String contents)
+  {
+    this.contents = contents;
+  }
+
+
+  public int getQuantifier()
+  {
+    return quantifier;
+  }
+
+  public void setQuantifier(int quantifier)
+  {
+    this.quantifier = quantifier;
+  }
+
+
+  public int getMin()
+  {
+    return min;
+  }
+
+  public void setMin(int min)
+  {
+    this.min = min;
+  }
+
+  /**
+   * Sets this.min to the integer representation of min iff min is a valid value (i.e. greater than 0).
+   * Sets this.min to EMPTY if it is not.
+   *
+   * @param min The new min value
+   * @returns Whether min was a valid value
+   */  
+  public boolean setMin(String min)
+  {
+    this.min = convertToInt(min);
+
+    // min > max is an invalid case, unless max is EMPTY (since EMPTY == -1).
+    if ( (this.max != EMPTY) && (this.min > this.max) )
+    {
+      return false;
+    }
+    
+    return (this.min >= 0);
+  }
+
+  
+  public int getMax()
+  {
+    return max;
+  }
+  
+  public void setMax(int max)
+  {
+    this.max = max;
+  }
+
+  /**
+   * Sets this.max to the integer representation of max iff max is a valid value (i.e. greater than 0).
+   * Sets this.max to EMPTY if it is not.
+   *
+   * @param max The new max value
+   * @returns Whether max was a valid value, or (whether max == the empty string && min has a valid value)
+   */ 
+  public boolean setMax(String max)
+  {
+    this.max = convertToInt(max);
+
+    // The empty string is a valid max value iff min has a valid value.
+    // This is due to the fact that {n,} means "at least n times" in regex parlance.
+    if (max.equals("") && this.min != EMPTY)
+    {
+      return true;
+    }
+    
+    else if (this.max < this.min)
+    {
+      return false;
+    }
+    
+    else
+    {
+      return (this.max >= 0);
+    }
+  }
+
+
+ 
+  public int getRepeat()
+  {
+    return repeat;
+  }
+
+  public void setRepeat(int repeat)
+  {
+    this.repeat = repeat;
+  }
+
+  /**
+   * Sets this.repeat to the integer representation of repeat iff repeat is a valid value (i.e. greater than 0).
+   * Sets this.repeat to EMPTY if it is not.
+   *
+   * @param repeat The new repeat value
+   * @returns Whether repeat was a valid value
+   */
+  public boolean setRepeat(String repeat)
+  {
+    this.repeat = convertToInt(repeat);
+    return (this.repeat >= 0);
+  }
+
+
+
+  /**
+   * Returns the integer representation of s.  If s is less than zero, or if s is not an int
+   * (i.e. if Integer.parseInt would throw a NumberFormatException), then returns EMPTY.
+   *
+   * @param s The String to convert.
+   * @returns The integer representation of s.
+   */
+  private int convertToInt(String s)
+  {
+    int result;
+    try
+    {
+      result = Integer.parseInt(s);
+      if (result < 0)
+      {
+        result = EMPTY;
+      }
+    }
+    catch (NumberFormatException e)
+    {
+      result = EMPTY;
+    }
+
+    return result;
+  }
+
+
+  public boolean getHasParens()
+  {
+    return hasParens;
+  }
+
+  public void setHasParens(boolean status)
+  {
+    this.hasParens = status;
+  }
+
+  public boolean getAutoEscapeStatus()
+  {
+    return autoEscapeStatus;
+  }
+
+  public void setAutoEscapeStatus(boolean status)
+  {
+    this.autoEscapeStatus = status;
+  }
+
+  /**
+   * Returns an escaped version of s.  In other words, each occurrence of a metacharacter ( .\?*+{}()[] )
+   * is replaced by that character preceded by a backslash.
+   *
+   * @param s The String to escape.
+   * @returns An escaped version of s.
+   */
+  private String addEscapeCharacters(String s)
+  {
+    StringBuffer result = new StringBuffer("");
+
+    for (int i = 0; i < s.length(); i++)
+    {
+      char currentChar = s.charAt(i);
+
+      if (isMetachar(currentChar))
+      {
+        result.append("\\"); // Note that this is an escaped backslash, not a double backslash.
+      }
+      result.append(currentChar);
+
+    }
+
+    return result.toString();
+  }
+
+  /**
+   * Checks whether c is a metacharacter as defined in the static variable metacharacters.
+   *
+   * @param c The character to check.
+   * @returns Whether c is a metacharacter.
+   */
+  private boolean isMetachar(char c)
+  {
+    return metacharacters.indexOf(c) != -1;
+  }
+  
+
+  public boolean hasValidMin()
+  {
+    return (min != EMPTY);
+  }
+
+  public boolean hasValidMax()
+  {
+    return(max != EMPTY);
+  }
+
+  public boolean hasValidRepeat()
+  {
+    return(repeat != EMPTY);
+  }
+
+  public String toString()
+  {
+    String result = "";
+    
+    if (hasParens)
+    {
+      result += "(";
+    }
+    
+    if (autoEscapeStatus)
+    {
+       result += addEscapeCharacters(contents);
+    }
+    else 
+    {
+      result += contents;
+    }
+
+
+    if (hasParens)
+    {
+      result += ")";
+    }
+    
+    switch (quantifier)
+    {
+      case STAR:
+        result += "*";
+        break;
+      
+      case PLUS:
+        result += "+";
+        break;
+      
+      case OPTIONAL:
+        result += "?";
+        break;
+      
+      case REPEAT:
+        result += "{" + repeat + "}";
+        break;
+      
+      case RANGE:
+        result += "{" + min + ",";
+        if (max == EMPTY)
+        {
+          result += "";
+        }
+        else
+        {
+          result += max;
+        }       
+        result += "}";
+        break;
+      
+      // SINGLE is a fall through           
+
+    }
+    return result;
+
+  }
+
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/wizards/RegexTestingPage.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/wizards/RegexTestingPage.java
new file mode 100644
index 0000000..6421e12
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/wizards/RegexTestingPage.java
@@ -0,0 +1,150 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 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
+ *******************************************************************************/
+// Based on version 1.6 of original xsdeditor
+package org.eclipse.wst.xsd.ui.internal.wizards;
+
+import java.util.regex.Pattern;
+
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.help.WorkbenchHelp;
+import org.eclipse.wst.xsd.editor.XSDEditorContextIds;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+import org.eclipse.wst.xsd.ui.internal.util.ViewUtility;
+
+
+public class RegexTestingPage extends WizardPage
+{
+  /* Validator from xerces package. */
+//  private RegularExpression validator;
+  
+  /* Displays the status of the match. */
+  private Label matchLabel;
+
+
+  /* The regex. */
+  private Text value;
+  
+  /* The string the user is trying to match against the regex. */
+  private StyledText testString;
+
+  public RegexTestingPage()
+  {
+    super(XSDEditorPlugin.getXSDString("_UI_REGEX_WIZARD_TESTING_PAGE_TITLE"));
+
+    setTitle(XSDEditorPlugin.getXSDString("_UI_REGEX_WIZARD_TESTING_PAGE_TITLE"));
+    setDescription(XSDEditorPlugin.getXSDString("_UI_REGEX_WIZARD_TESTING_PAGE_DESCRIPTION"));
+  }
+
+
+  public void createControl(Composite parent)
+  {
+    Composite composite = ViewUtility.createComposite(parent, 1);
+    WorkbenchHelp.setHelp(composite, XSDEditorContextIds.XSDR_TEST_PAGE);
+
+    matchLabel = new Label(composite, SWT.WRAP);
+    matchLabel.setText(XSDEditorPlugin.getXSDString("_UI_REGEX_WIZARD_TESTING_PAGE_DESCRIPTION"));
+    FontData[] fontData = matchLabel.getFont().getFontData();
+    GridData dataF = new GridData();
+    dataF.widthHint = 400;
+    dataF.heightHint = 6 * fontData[0].getHeight();
+    matchLabel.setLayoutData(dataF);
+    
+    Composite controls = new Composite(composite, SWT.NONE);
+    GridLayout controlsLayout = new GridLayout();
+    controlsLayout.numColumns = 2;
+    controls.setLayout(controlsLayout);
+    controls.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+    new Label(controls, SWT.LEFT).setText(XSDEditorPlugin.getXSDString("_UI_REGEX_WIZARD_REGEX_LABEL"));
+    value = new Text(controls, SWT.BORDER | SWT.READ_ONLY);
+    value.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+
+    new Label(controls, SWT.LEFT).setText(XSDEditorPlugin.getXSDString("_UI_REGEX_WIZARD_SAMPLE_TEXT"));
+    testString = new StyledText(controls, SWT.SINGLE | SWT.BORDER);
+    WorkbenchHelp.setHelp(testString, XSDEditorContextIds.XSDR_TEST_SAMPLE);
+    testString.addListener(SWT.Modify, new TestStringListener());
+    testString.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+    
+    controls.pack();
+    
+    Label separator = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
+    GC gc = new GC(separator);
+    Point pointSize = gc.stringExtent(XSDEditorPlugin.getXSDString("_UI_REGEX_WIZARD_TESTING_PAGE_DESCRIPTION"));
+    GridData gd = new GridData();
+    gd.widthHint = (int)(pointSize.x / 2 + gc.getAdvanceWidth('M')*11);
+    gd.horizontalAlignment= GridData.FILL;
+    separator.setLayoutData(gd);
+    
+    composite.pack();
+
+    setControl(composite);
+  }
+
+
+  private String getPatternValue()
+  {
+    return ( (RegexCompositionPage)getPreviousPage() ).getPattern().getLexicalValue();
+  }
+
+  private String getFlags()
+  {
+    return ( (RegexCompositionPage)getPreviousPage() ).getFlags();
+  }
+
+  public void setVisible(boolean visible)
+  {
+    super.setVisible(visible);
+
+    String pattern = getPatternValue();
+    getFlags();
+
+    value.setText(pattern);
+    
+    updateMatchStatus();
+
+    testString.setFocus();
+  }
+
+  class TestStringListener implements Listener
+  {
+    public void handleEvent(Event e)
+    {
+      updateMatchStatus();
+    }
+  }
+
+  private void updateMatchStatus()
+  {
+    if (Pattern.matches(getPatternValue(), testString.getText()))
+    {
+//      matchLabel.setText(XSDEditorPlugin.getXSDString("_UI_REGEX_WIZARD_MATCHES"));
+      setMessage(XSDEditorPlugin.getXSDString("_UI_REGEX_WIZARD_MATCHES"), 1);
+    }
+    else
+    {
+      setMessage(XSDEditorPlugin.getXSDString("_UI_REGEX_WIZARD_DOES_NOT_MATCH"), 2);
+//      matchLabel.setText(XSDEditorPlugin.getXSDString("_UI_REGEX_WIZARD_DOES_NOT_MATCH"));
+    }
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/wizards/RegexWizard.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/wizards/RegexWizard.java
new file mode 100644
index 0000000..62e393e
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/wizards/RegexWizard.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 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.wizards;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+import org.eclipse.xsd.XSDPatternFacet;
+import org.eclipse.xsd.impl.XSDFactoryImpl;
+
+
+public class RegexWizard extends Wizard 
+{
+  private RegexCompositionPage compositionPage;
+  private RegexTestingPage testingPage;
+
+  /* The original, unchanged pattern. */  
+  private XSDPatternFacet originalPattern;
+  
+  /* A copy of the original pattern that is passed into the wizard. */
+  private XSDPatternFacet modifiedPattern;
+
+  String pattern;
+
+  public RegexWizard(String expr)
+  {
+    super();
+    setWindowTitle(XSDEditorPlugin.getXSDString("_UI_REGEX_WIZARD_TITLE"));
+    setDefaultPageImageDescriptor(ImageDescriptor.createFromFile(XSDEditorPlugin.class, "icons/regx_wiz.gif"));
+
+    XSDFactoryImpl factory = new XSDFactoryImpl();
+    modifiedPattern = factory.createXSDPatternFacet();
+    modifiedPattern.setLexicalValue(expr);
+
+    originalPattern = factory.createXSDPatternFacet();
+    originalPattern.setLexicalValue(expr);
+
+    compositionPage = new RegexCompositionPage(modifiedPattern);
+    addPage(compositionPage);
+
+    testingPage = new RegexTestingPage();
+    addPage(testingPage);
+  }
+
+  public String getPattern()
+  {
+    return pattern;
+  }
+
+  public boolean performFinish()
+  {
+    pattern = modifiedPattern.getLexicalValue();
+    return true;
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/wizards/XSDLocationChoicePage.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/wizards/XSDLocationChoicePage.java
new file mode 100644
index 0000000..d824efb
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/wizards/XSDLocationChoicePage.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 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.wizards;
+
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+import org.eclipse.wst.xsd.ui.internal.util.ViewUtility;
+
+
+public class XSDLocationChoicePage extends WizardPage 
+{
+  protected Button radioButton1;
+  protected Button radioButton2;
+    
+  public XSDLocationChoicePage()
+  {
+    super("XSDLocationChoicePage");
+
+    this.setTitle(XSDEditorPlugin.getXSDString("_UI_WIZARD_INCLUDE_FILE_TITLE"));
+    this.setDescription(XSDEditorPlugin.getXSDString("_UI_WIZARD_INCLUDE_FILE_DESC"));
+  }
+    
+  public boolean isPageComplete()
+  {
+    return true;
+  }
+    
+  public void createControl(Composite parent)
+  {
+    Composite base = new Composite(parent, SWT.NONE);
+    base.setLayout(new GridLayout());
+      
+    ViewUtility.createLabel(base, XSDEditorPlugin.getXSDString("_UI_LABEL_INCLUDE_URL_FILE"));
+    Composite radioButtonsGroup = ViewUtility.createComposite(base, 1, true);
+
+    radioButton1 = ViewUtility.createRadioButton(radioButtonsGroup, 
+                                                 XSDEditorPlugin.getXSDString("_UI_RADIO_FILE"));
+      
+    radioButton2 = ViewUtility.createRadioButton(radioButtonsGroup,
+                                                 XSDEditorPlugin.getXSDString("_UI_RADIO_URL"));
+
+    radioButton1.setSelection(true);
+
+    setControl(base);
+  }
+
+  // actions on finish
+  public boolean performFinish()
+  {
+    return true;
+  }
+
+  public boolean isURL()
+  {
+    return radioButton2.getSelection();
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/wizards/XSDNewFilePage.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/wizards/XSDNewFilePage.java
new file mode 100644
index 0000000..98c8d23
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/wizards/XSDNewFilePage.java
@@ -0,0 +1,129 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 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.wizards;
+ 
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+
+
+public class XSDNewFilePage extends WizardNewFileCreationPage
+{
+  public XSDNewFilePage(IStructuredSelection selection) 
+  {
+    super(XSDEditorPlugin.getXSDString("_UI_CREATEXSD"), selection);
+    setTitle(XSDEditorPlugin.getXSDString("_UI_NEW_XML_SCHEMA_TITLE"));
+    setDescription(XSDEditorPlugin.getXSDString("_UI_CREATE_A_NEW_XML_SCHEMA_DESC"));
+  }
+
+  public void createControl(Composite parent) 
+  {
+    // inherit default container and name specification widgets
+    super.createControl(parent);
+
+    this.setFileName(computeDefaultFileName());
+
+    setPageComplete(validatePage());
+  }
+
+  protected boolean validatePage()
+  {
+    Path newName = new Path(getFileName());
+    String fullFileName = getFileName();
+    String extension = newName.getFileExtension();
+    if (extension == null || !extension.equalsIgnoreCase("xsd")) 
+    {
+      setErrorMessage(XSDEditorPlugin.getXSDString("_ERROR_FILENAME_MUST_END_XSD"));
+      return false;
+    }
+    else 
+    {
+      setErrorMessage(null);
+    }
+
+    // check for file should be case insensitive
+    String sameName = existsFileAnyCase(fullFileName);
+    if (sameName != null) 
+    {
+      setErrorMessage(XSDEditorPlugin.getPlugin().getString("_ERROR_FILE_ALREADY_EXISTS", sameName)); //$NON-NLS-1$
+      return false;
+    }
+
+    return super.validatePage();
+  }
+
+  public String defaultName = "NewXMLSchema"; //$NON-NLS-1$
+  public String defaultFileExtension = ".xsd"; //$NON-NLS-1$
+  public String[] filterExtensions = { "*.xsd"}; //$NON-NLS-1$
+
+  protected String computeDefaultFileName()
+  {
+    int count = 0;
+    String fileName = defaultName + defaultFileExtension;
+    IPath containerFullPath = getContainerFullPath();
+    if (containerFullPath != null)
+    {
+      while (true)
+      {
+        IPath path = containerFullPath.append(fileName);
+        if (ResourcesPlugin.getWorkspace().getRoot().exists(path))
+        {
+          count++;
+          fileName = defaultName + count + defaultFileExtension;
+        }
+        else
+        {
+          break;
+        }
+      }
+    }
+    return fileName;
+  }
+
+  // returns true if file of specified name exists in any case for selected container
+  protected String existsFileAnyCase(String fileName)
+  {
+    if ( (getContainerFullPath() != null) && (getContainerFullPath().isEmpty() == false)
+        && (fileName.compareTo("") != 0))
+    {
+      //look through all resources at the specified container - compare in upper case
+      IResource parent = ResourcesPlugin.getWorkspace().getRoot().findMember(getContainerFullPath());
+      if (parent instanceof IContainer)
+      {
+        IContainer container = (IContainer) parent;
+        try
+        {
+          IResource[] members = container.members();
+          String enteredFileUpper = fileName.toUpperCase();
+          for (int i=0; i<members.length; i++)
+          {
+            String resourceUpperName = members[i].getName().toUpperCase();
+            if (resourceUpperName.equals(enteredFileUpper))
+            {  
+              return members[i].getName();    
+            }
+          }
+        }
+        catch (CoreException e)
+        {
+        }
+      }
+    }
+    return null;
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/wizards/XSDSelectIncludeFileWizard.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/wizards/XSDSelectIncludeFileWizard.java
new file mode 100644
index 0000000..83b3810
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/wizards/XSDSelectIncludeFileWizard.java
@@ -0,0 +1,371 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 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.wizards;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.wst.common.ui.internal.viewers.SelectSingleFilePage;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+import org.eclipse.wst.xsd.ui.internal.util.ViewUtility;
+import org.eclipse.xsd.XSDSchema;
+import org.eclipse.xsd.util.XSDParser;
+
+
+/**
+ * Extend the base wizard to select a file from the project or outside the workbench
+ * and add error handling
+ */
+public class XSDSelectIncludeFileWizard extends Wizard implements INewWizard
+{
+  boolean isInclude;
+  XSDSchema mainSchema;
+  XSDSchema externalSchema;
+
+  XSDLocationChoicePage choicePage;
+  XSDSelectSingleFilePage filePage;
+  XSDURLPage urlPage;
+
+  IFile resultFile;
+  String resultURL;
+  String namespace = "";
+
+  public XSDSelectIncludeFileWizard(XSDSchema mainSchema, boolean isInclude,
+                                    String title, String desc, 
+                                    ViewerFilter filter,
+                                    IStructuredSelection selection)
+  {
+    super();
+    setWindowTitle(title);
+    setDefaultPageImageDescriptor(ImageDescriptor.createFromFile(XSDEditorPlugin.class, "icons/NewXSD.gif"));
+
+    setNeedsProgressMonitor(true);
+
+    // Choice Page
+    choicePage = new XSDLocationChoicePage();
+
+    // Select File Page
+    filePage = new XSDSelectSingleFilePage(PlatformUI.getWorkbench(),  selection, true);
+    filePage.setTitle(title);
+    filePage.setDescription(desc);
+    filePage.addFilter(filter);
+
+    // URL Page
+    urlPage = new XSDURLPage();
+    urlPage.setTitle(title);
+    urlPage.setDescription(XSDEditorPlugin.getXSDString("_UI_FILEDIALOG_SELECT_XML_URL"));
+    
+    this.mainSchema = mainSchema;
+    this.isInclude = isInclude;
+  }
+
+  public void init(IWorkbench aWorkbench, IStructuredSelection aSelection)
+  { 
+  }
+
+  public void addPages()
+  {
+    addPage(choicePage);
+    addPage(filePage);
+    addPage(urlPage);
+  }
+
+  public IWizardPage getNextPage(IWizardPage currentPage)
+  {
+    WizardPage nextPage = null;
+
+    if (currentPage == choicePage)
+    {
+      if (choicePage.isURL()) 
+      {
+        nextPage = urlPage;
+      }
+      else
+      {
+        nextPage = filePage;
+      }
+    }
+    return nextPage;
+  }
+
+  public boolean canFinish()
+  {
+    if (!choicePage.isURL())
+    {
+      return filePage.isPageComplete(); 
+    }
+    return true;
+  }
+
+  public boolean performFinish()
+  { 
+    if (choicePage.isURL())
+    {
+      try 
+      {
+        getContainer().run(false, true, urlPage.getRunnable());
+        resultURL = urlPage.getURL();
+      }
+      catch (Exception e)
+      {
+        return false;
+      }
+      return true;
+    }
+    else
+    {  
+      resultFile = filePage.getFile();
+    }
+    return true;
+  }
+
+  /**
+   * Get the MOF object that represents the external file
+   */
+  public XSDSchema getExternalSchema()
+  {
+    return externalSchema;
+  }
+
+  public IFile getResultFile()
+  {
+    return resultFile;
+  }
+
+  public String getURL()
+  {
+    return resultURL;
+  }
+  
+  public String getNamespace()
+  {
+  	return namespace;
+  }
+
+  /**
+   * Create a MOF model for the imported file
+   */
+  protected String doLoadExternalModel(IProgressMonitor monitor, String xsdModelFile, String xsdFileName)
+  { 
+    String errorMessage = null;
+    String currentNameSpace = mainSchema.getTargetNamespace();
+
+    monitor.beginTask("Loading XML Schema", 100);
+    monitor.worked(50);
+
+    XSDParser parser = new XSDParser();
+    parser.parse(xsdModelFile);
+
+    externalSchema = parser.getSchema();
+    if (externalSchema != null)
+    {
+      String extNamespace = externalSchema.getTargetNamespace();
+      namespace = extNamespace;
+     
+      if (externalSchema.getDiagnostics() != null &&
+          externalSchema.getDiagnostics().size() > 0)
+      {
+        errorMessage = XSDEditorPlugin.getPlugin().getString("_UI_INCORRECT_XML_SCHEMA", xsdFileName);
+      }  
+      else
+      {
+        if (isInclude) 
+        {  
+          // Check the namespace to make sure they are the same as current file
+          if (extNamespace != null)
+          {
+            if (currentNameSpace != null && !extNamespace.equals(currentNameSpace))
+            {
+              errorMessage = XSDEditorPlugin.getPlugin().getString("_UI_DIFFERENT_NAME_SPACE", xsdFileName);
+            }
+          }
+        }
+        else
+        {  
+          // Check the namespace to make sure they are different from the current file
+          if (extNamespace != null)
+          {
+            if (currentNameSpace != null && extNamespace.equals(currentNameSpace))
+            {
+              errorMessage = XSDEditorPlugin.getPlugin().getString("_UI_SAME_NAME_SPACE", xsdFileName);
+            }
+          }
+        }
+      }
+    }
+    else
+    {
+      errorMessage = XSDEditorPlugin.getPlugin().getString("_UI_INCORRECT_XML_SCHEMA", xsdFileName);
+    }
+
+    monitor.subTask("Finish Loading");
+    monitor.worked(80);
+
+    return errorMessage;
+  }
+
+ 
+  /**
+   * URL page
+   */
+  class XSDURLPage extends WizardPage
+  { 
+    Text urlField;
+    String saveString;
+
+    public XSDURLPage()
+    {
+      super("URLPage");
+    }
+
+    public void createControl(Composite parent)
+    {
+      Composite client = ViewUtility.createComposite(parent,2);
+      ViewUtility.setComposite(client);
+
+      ViewUtility.createLabel(client, XSDEditorPlugin.getXSDString("_UI_LABEL_URL"));
+      ViewUtility.createLabel(client, "");
+
+      urlField = ViewUtility.createTextField(client, 50);
+      saveString = "http://";
+      urlField.setText(saveString);
+
+      setControl(client);
+    }
+
+    public String getURL()
+    {
+      return urlField.getText();
+    }
+
+    private boolean openExternalSchema(IProgressMonitor monitor)
+    {
+      String text = urlField.getText();
+//      if (text.equals(saveString)) 
+//      {
+//        return false;
+//      }
+//      saveString = text;
+
+      if (text.equals(""))
+      {
+        setErrorMessage(XSDEditorPlugin.getXSDString("_UI_SPECIFY_URL"));
+        return false;
+      }
+
+      if ( !text.startsWith("http://") )
+      {
+        setErrorMessage(XSDEditorPlugin.getXSDString("_UI_URL_START_WITH"));
+        return false;
+      }
+
+      setErrorMessage(null);
+      String errorMessage = doLoadExternalModel(monitor, text, text);
+      if (errorMessage != null) 
+      {
+        setErrorMessage(errorMessage); 
+        return false;
+      }
+      else
+      {
+        return true;
+      }
+    }
+
+    public IRunnableWithProgress getRunnable()
+    {
+      return new IRunnableWithProgress()
+      {
+        public void run(IProgressMonitor monitor)   
+          throws InvocationTargetException, InterruptedException
+        {
+          if (monitor == null)
+          {
+            monitor= new NullProgressMonitor();
+          }
+          monitor.beginTask("", 6);
+        
+          boolean ok = openExternalSchema(monitor);
+
+          if (!ok) 
+          { 
+            throw new InvocationTargetException(new java.lang.Error());
+          }
+
+          monitor.done();
+        }
+      };
+    }
+  }
+
+  /**
+   * Select XML Schema File
+   */
+  class XSDSelectSingleFilePage extends SelectSingleFilePage
+  {
+    public XSDSelectSingleFilePage(IWorkbench workbench, IStructuredSelection selection, boolean isFileMandatory)
+    {          
+      super(workbench,selection,isFileMandatory);
+    }
+
+    private boolean openExternalSchema()
+    {
+      // Get the fully-qualified file name
+      IFile iFile = getFile();
+      if (iFile == null) 
+        return false;
+
+      setErrorMessage(null);
+
+      String xsdModelFile = iFile.getLocation().toOSString();
+      String xsdFileName = iFile.getName();
+      String errorMessage = doLoadExternalModel(new NullProgressMonitor(), xsdModelFile, xsdFileName);
+
+      if (errorMessage != null) 
+      {
+        setErrorMessage(errorMessage);
+        return false;
+      }
+      else
+      {
+        return true;
+      }
+    }
+
+    public boolean isPageComplete()
+    {  
+      if (choicePage.isURL()) 
+      {
+        return true;
+      }
+
+      if (super.isPageComplete()) 
+      {
+        return openExternalSchema();
+      }
+      return super.isPageComplete();
+    }
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/actions/AddFieldAction.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/actions/AddFieldAction.java
new file mode 100644
index 0000000..42ee0b4
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/actions/AddFieldAction.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.actions;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.wst.xsd.adt.facade.IComplexType;
+import org.eclipse.wst.xsd.adt.facade.IField;
+import org.eclipse.wst.xsd.editor.internal.adapters.XSDAdapterFactory;
+import org.eclipse.wst.xsd.ui.common.commands.BaseCommand;
+
+
+public class AddFieldAction extends BaseSelectionAction
+{   
+  public static String ID = "AddFieldAction"; 
+  
+  public AddFieldAction(IWorkbenchPart part)
+  {
+    super(part);
+    setId(ID);
+    setText("Add Field");  
+  }
+  
+  public void run()
+  {
+    if (getSelectedObjects().size() > 0)
+    {
+      Object o = getSelectedObjects().get(0);
+      IComplexType type = null;
+      
+      if (o instanceof IComplexType)
+      {  
+        type = (IComplexType)o; 
+      }
+      else if (o instanceof IField)
+      {
+        IField field = (IField)o;
+        type = field.getContainerType();
+      }
+      if (type != null)
+      {
+        Command command = ((IComplexType)type).getAddNewFieldCommand("");
+        if (command != null)
+        {  
+          getCommandStack().execute(command);
+          Adapter adapter = XSDAdapterFactory.getInstance().adapt(((BaseCommand)command).getAddedComponent());
+          if (adapter != null)
+            provider.setSelection(new StructuredSelection(adapter));
+        }
+        else
+        {
+           //TODO ... pop up a command not implemented message
+        }
+      }
+    }  
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/actions/BaseSelectionAction.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/actions/BaseSelectionAction.java
new file mode 100644
index 0000000..ee5c85f
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/actions/BaseSelectionAction.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.actions;
+
+import org.eclipse.gef.ui.actions.SelectionAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.wst.xsd.adt.facade.IComplexType;
+import org.eclipse.wst.xsd.adt.facade.IField;
+
+public abstract class BaseSelectionAction extends SelectionAction
+{
+  public static final String SEPARATOR_ID = "org.eclipse.jface.action.Separator";
+  public static final String SUBMENU_START_ID = "SUBMENU_START_ID: ";
+  public static final String SUBMENU_END_ID = "SUBMENU_END_ID: ";
+
+  protected ISelectionProvider provider;
+  
+  public BaseSelectionAction(IWorkbenchPart part)
+  {
+    super(part);
+  }
+  
+  /* (non-Javadoc)
+   * @see org.eclipse.gef.ui.actions.SelectionAction#getSelection()
+   */
+  protected ISelection getSelection()
+  {
+    // always get selection from selection provider first
+    if (provider!=null)
+      return provider.getSelection();
+    
+    return super.getSelection();
+  }
+  /* (non-Javadoc)
+   * @see org.eclipse.gef.ui.actions.SelectionAction#setSelectionProvider(org.eclipse.jface.viewers.ISelectionProvider)
+   */
+  public void setSelectionProvider(ISelectionProvider provider)
+  {
+    super.setSelectionProvider(provider);
+    this.provider = provider;
+  }
+  
+  /* (non-Javadoc)
+   * @see org.eclipse.wst.xsd.adt.actions.BaseSelectionAction#calculateEnabled()
+   */
+  protected boolean calculateEnabled()
+  {
+    if (getSelectedObjects().size() > 0)
+    {
+      Object o = getSelectedObjects().get(0);
+      if (o instanceof IComplexType)
+      {
+        return !((IComplexType)o).isReadOnly();
+      }
+      else if (o instanceof IField)
+      {
+        return !((IField)o).isReadOnly();
+      }
+    }
+    return true;
+  }
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/actions/DeleteAction.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/actions/DeleteAction.java
new file mode 100644
index 0000000..74bd725
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/actions/DeleteAction.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.actions;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.wst.xsd.adt.facade.IComplexType;
+import org.eclipse.wst.xsd.adt.facade.IField;
+import org.eclipse.wst.xsd.adt.facade.IModel;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+
+public class DeleteAction extends BaseSelectionAction
+{
+  public final static String ID = "org.eclipse.wst.xsd.editor.DeleteAction"; 
+  public DeleteAction(IWorkbenchPart part)
+  {
+    super(part);
+    setText("Delete");
+    setId(ID);
+    setImageDescriptor(XSDEditorPlugin.getImageDescriptor("icons/delete_obj.gif") );
+  }
+  
+  public void run()
+  {
+    Object selection = ((IStructuredSelection) getSelection()).getFirstElement();
+    Command command = null;
+    boolean doReselect = false;
+    IModel model = null;
+    if (selection instanceof IComplexType)
+    {
+      command = ((IComplexType)selection).getDeleteCommand();
+      model = ((IComplexType)selection).getModel();
+      doReselect = true;
+    }
+    else if (selection instanceof IField)
+    {
+      model = ((IField)selection).getModel();
+      if ( ((IField)selection).isGlobal())
+      {
+        doReselect = true;
+      }
+      command = ((IField)selection).getDeleteCommand();
+    }  
+    if (command != null)
+    {
+      command.execute();
+      if (model != null && doReselect)
+        provider.setSelection(new StructuredSelection(model));
+    }  
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/actions/SetInputToGraphView.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/actions/SetInputToGraphView.java
new file mode 100644
index 0000000..573f5ae
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/actions/SetInputToGraphView.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.actions;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.GraphicalViewer;
+import org.eclipse.gef.RootEditPart;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.wst.xsd.adt.design.DesignViewGraphicalViewer;
+import org.eclipse.wst.xsd.adt.design.editparts.RootContentEditPart;
+import org.eclipse.wst.xsd.adt.facade.IComplexType;
+
+public class SetInputToGraphView extends BaseSelectionAction
+{
+  public static String ID = "SetAsFocus";
+  IEditorPart editorPart;
+
+  public SetInputToGraphView(IWorkbenchPart part)
+  {
+    super(part);
+    setId(ID);
+    setText("Set As Focus");
+    if (part instanceof IEditorPart)
+    {
+      editorPart = (IEditorPart)part;
+    }  
+  }
+
+  protected boolean calculateEnabled()
+  {
+    return true;
+  }
+
+  public void run()
+  {
+    Object selection = ((IStructuredSelection) getSelection()).getFirstElement();
+    Object adapter = getWorkbenchPart().getAdapter(GraphicalViewer.class);
+
+    if (selection instanceof IComplexType)
+    {
+      IComplexType type = (IComplexType) selection;
+
+      if (adapter instanceof DesignViewGraphicalViewer)
+      {
+        DesignViewGraphicalViewer graphicalViewer = (DesignViewGraphicalViewer) adapter;
+        RootEditPart rootEditPart = graphicalViewer.getRootEditPart();
+        EditPart editPart = rootEditPart.getContents();
+        if (editPart instanceof RootContentEditPart)
+        {
+          if (editorPart != null)
+          {          
+            PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getNavigationHistory().markLocation(editorPart);
+          }  
+          ((RootContentEditPart) editPart).setInput(type);
+          ((RootContentEditPart) editPart).refresh();          
+          if (editorPart != null)
+          {
+            PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getNavigationHistory().markLocation(editorPart);
+          }
+        }
+      }
+    }
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/actions/ShowPropertiesViewAction.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/actions/ShowPropertiesViewAction.java
new file mode 100644
index 0000000..7752efc
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/actions/ShowPropertiesViewAction.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.actions;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+
+
+/**
+ * Show the properties view in the current perspective.
+ */
+public class ShowPropertiesViewAction extends BaseSelectionAction
+{
+	public static final String ID = "org.eclipse.wst.xsd.adt.actions.ShowPropertiesViewAction"; //$NON-NLS-1$
+	public static final String PROPERTIES_VIEW_ID = "org.eclipse.ui.views.PropertySheet"; //$NON-NLS-1$
+	
+  protected static ImageDescriptor enabledImage, disabledImage;
+
+	public ShowPropertiesViewAction(IWorkbenchPart part)
+  {
+		super(part);
+		setId(ID);
+		setText("Show properties");
+		setToolTipText(getText());
+    setImageDescriptor(XSDEditorPlugin.getImageDescriptor("icons/elcl16/showproperties_obj.gif") );
+	  setDisabledImageDescriptor(XSDEditorPlugin.getImageDescriptor("icons/dlcl16/showproperties_obj.gif") );
+	}
+  
+  protected boolean calculateEnabled()
+  {
+    return true;
+  }
+  
+  public void run()
+  {
+    try
+    {
+      getWorkbenchPart().getSite().getPage().showView(PROPERTIES_VIEW_ID);
+    }
+    catch (PartInitException pie)
+    {
+
+    }
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/DesignViewContextMenuProvider.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/DesignViewContextMenuProvider.java
new file mode 100644
index 0000000..67d6529
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/DesignViewContextMenuProvider.java
@@ -0,0 +1,152 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.design;
+
+import org.eclipse.gef.ContextMenuProvider;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPartViewer;
+import org.eclipse.gef.commands.CommandStack;
+import org.eclipse.gef.ui.actions.ActionRegistry;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.wst.xsd.adt.actions.BaseSelectionAction;
+import org.eclipse.wst.xsd.adt.design.editparts.model.IActionProvider;
+
+
+public class DesignViewContextMenuProvider extends ContextMenuProvider
+{
+  IEditorPart editor;  
+  ISelectionProvider selectionProvider;
+
+  /**
+   * Constructor for GraphContextMenuProvider.
+   * 
+   * @param selectionProvider
+   * @param editor
+   */
+  public DesignViewContextMenuProvider(IEditorPart editor, EditPartViewer viewer, ISelectionProvider selectionProvider)
+  {
+    super(viewer);
+    this.editor = editor;
+    this.selectionProvider = selectionProvider;
+  }
+
+  /**
+   * @see org.eclipse.gef.ui.parts.ContextMenuProvider#buildContextMenu(org.eclipse.jface.action.IMenuManager,
+   *      org.eclipse.gef.EditPartViewer)
+   */
+  public void buildContextMenu(IMenuManager menu)
+  {
+    IMenuManager currentMenu = menu;
+    menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+    ActionRegistry registry = getEditorActionRegistry();
+    ISelection selection = selectionProvider.getSelection();
+    
+    if (selection != null)
+    {
+      Object selectedObject = ((StructuredSelection) selection).getFirstElement();
+      
+      // Convert editparts to model objects as selections 
+      if (selectedObject instanceof EditPart)
+      {
+        selectedObject = ((EditPart)selectedObject).getModel();
+      }
+
+      if (selectedObject instanceof IActionProvider)
+      {
+        IActionProvider actionProvider = (IActionProvider) selectedObject;
+
+        String[] actions = actionProvider.getActions(null);
+        for (int i = 0; i < actions.length; i++)
+        {
+          String id = actions[i];
+          if (id.startsWith(BaseSelectionAction.SUBMENU_START_ID))
+          {
+            String text = id.substring(BaseSelectionAction.SUBMENU_START_ID.length());
+            IMenuManager subMenu = new MenuManager(text);
+            currentMenu.add(subMenu);
+            currentMenu = subMenu;
+          }
+          else if (id.startsWith(BaseSelectionAction.SUBMENU_END_ID))
+          {
+            currentMenu = getParentMenu(menu, currentMenu);
+          }
+          else if (id.equals(BaseSelectionAction.SEPARATOR_ID))
+          {
+            currentMenu.add(new Separator());
+          }
+          else
+          {
+            IAction action = registry.getAction(id);
+            if (action != null)
+            { 
+              action.isEnabled();
+              currentMenu.add(action);
+            }
+          }
+        }
+        menu.add(new Separator());       
+        menu.add(new Separator("refactoring-slot")); 
+        menu.add(new Separator());       
+        menu.add(new Separator("search-slot"));       
+        menu.add(new Separator());
+      }
+    }    
+    menu.add(new Separator());
+    //menu.add(registry.getAction("org.eclipse.wst.xsd.DeleteAction"));
+    //menu.add(new Separator());
+    //ShowPropertiesViewAction showPropertiesAction = (ShowPropertiesViewAction) registry.getAction(ShowPropertiesViewAction.ACTION_ID);
+    //showPropertiesAction.setPage(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage());
+    //menu.add(showPropertiesAction);
+  }
+
+  protected IMenuManager getParentMenu(IMenuManager root, IMenuManager child) {
+    IMenuManager parent = null;
+    
+    IContributionItem[] kids = root.getItems();
+    int index = 0;
+    while (index < kids.length && parent == null) {
+      IContributionItem item = kids[index];
+      if (item.equals(child)) {
+        parent = root;
+      }
+      else {
+        if (item instanceof IMenuManager) {
+          parent = getParentMenu((IMenuManager) item, child);
+        }
+      }
+      index++;
+    }
+    
+    return parent;
+  }
+
+  protected ActionRegistry getEditorActionRegistry()
+  {
+    return (ActionRegistry) editor.getAdapter(ActionRegistry.class);
+  }
+  protected CommandStack commandStack;
+
+  protected CommandStack getCommandStack()
+  {
+    if (commandStack == null)
+      commandStack = getViewer().getEditDomain().getCommandStack();
+    return commandStack;
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/DesignViewGraphicalViewer.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/DesignViewGraphicalViewer.java
new file mode 100644
index 0000000..2716912
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/DesignViewGraphicalViewer.java
@@ -0,0 +1,202 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.design;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.ui.parts.ScrollingGraphicalViewer;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.wst.xsd.adt.design.editparts.RootContentEditPart;
+import org.eclipse.wst.xsd.adt.editor.ADTSelectionManager;
+import org.eclipse.wst.xsd.adt.facade.IADTObject;
+import org.eclipse.wst.xsd.adt.facade.IField;
+import org.eclipse.wst.xsd.adt.facade.IModel;
+import org.eclipse.wst.xsd.adt.facade.IStructure;
+
+public class DesignViewGraphicalViewer extends ScrollingGraphicalViewer implements ISelectionChangedListener
+{
+  protected ADTSelectionChangedListener internalSelectionProvider = new ADTSelectionChangedListener();
+
+  public DesignViewGraphicalViewer(IEditorPart editor, ADTSelectionManager manager)
+  {
+    super();
+    setContextMenu(new DesignViewContextMenuProvider(editor, this, this));
+    editor.getEditorSite().registerContextMenu("org.eclipse.wst.xsd.ui.popup.graph", getContextMenu(), internalSelectionProvider, false);
+    
+    // make the internalSelectionProvider listen to graph view selection changes
+    addSelectionChangedListener(internalSelectionProvider);    
+    internalSelectionProvider.addSelectionChangedListener(manager);
+  }
+  
+
+  // this method is called when something changes in the selection manager
+  // (e.g. a selection occured from another view)
+  public void selectionChanged(SelectionChangedEvent event)
+  {
+    Object selectedObject = ((StructuredSelection) event.getSelection()).getFirstElement();
+    
+    // TODO (cs) It seems like there's way more selection going on than there should
+    // be!!  There's at least 2 selections getting fired when something is selected in the
+    // outline view.  Are we listening to too many things?
+    //
+    //if (event.getSource() instanceof ADTContentOutlinePage)
+    if (event.getSource() != internalSelectionProvider)
+    {
+      if (selectedObject instanceof IStructure)
+      {
+        ((RootContentEditPart) getContents()).setInput(selectedObject);
+      }
+      else if (selectedObject instanceof IField)
+      {
+        IField field = (IField)selectedObject;
+        if (field.isGlobal())
+        {  
+          ((RootContentEditPart) getContents()).setInput(selectedObject);
+        }
+      }
+      else if (selectedObject instanceof IModel)
+      {
+        IModel model = (IModel)selectedObject;
+        if (model.getTypes().size() > 0)
+        {  
+          selectedObject = model.getTypes().get(0);
+          ((RootContentEditPart) getContents()).setInput(selectedObject);
+        }  
+        EditPart editPart = getEditPart(getRootEditPart(), selectedObject);
+        if (editPart != null)
+          setSelection(new StructuredSelection(editPart));
+        else
+          setInput(null);
+        return;
+      }
+      
+      EditPart editPart = getEditPart(getRootEditPart(), selectedObject);
+      if (editPart != null)
+        setSelection(new StructuredSelection(editPart));
+    }
+  }
+  
+  /*
+   * We need to convert from edit part selections to model object selections
+   */
+  class ADTSelectionChangedListener implements ISelectionProvider, ISelectionChangedListener
+  {
+    protected List listenerList = new ArrayList();
+    protected ISelection selection = new StructuredSelection();
+
+    public void addSelectionChangedListener(ISelectionChangedListener listener)
+    {
+      listenerList.add(listener);
+    }
+
+    public void removeSelectionChangedListener(ISelectionChangedListener listener)
+    {
+      listenerList.remove(listener);
+    }
+
+    public ISelection getSelection()
+    {
+      return selection;
+    }
+
+    protected void notifyListeners(SelectionChangedEvent event)
+    {
+      for (Iterator i = listenerList.iterator(); i.hasNext();)
+      {
+        ISelectionChangedListener listener = (ISelectionChangedListener) i.next();
+        listener.selectionChanged(event);
+      }
+    }
+
+    public StructuredSelection convertSelectionFromEditPartToModel(ISelection editPartSelection)
+    {
+      List selectedModelObjectList = new ArrayList();
+      if (editPartSelection instanceof IStructuredSelection)
+      {
+        for (Iterator i = ((IStructuredSelection) editPartSelection).iterator(); i.hasNext();)
+        {
+          Object obj = i.next();
+          Object model = null;
+          if (obj instanceof EditPart)
+          {
+            EditPart editPart = (EditPart) obj;
+            model = editPart.getModel();
+          }
+          if (model != null)
+          {
+            selectedModelObjectList.add(model);
+          }
+        }
+      }
+      return new StructuredSelection(selectedModelObjectList);
+    }
+
+    public void setSelection(ISelection selection)
+    {
+      this.selection = selection;
+    }
+
+    public void selectionChanged(SelectionChangedEvent event)
+    {
+      ISelection newSelection = convertSelectionFromEditPartToModel(event.getSelection());
+      this.selection = newSelection;
+      SelectionChangedEvent newEvent = new SelectionChangedEvent(this, newSelection);
+      notifyListeners(newEvent);
+    }
+  }
+  
+  protected EditPart getEditPart(EditPart parent, Object object)
+  {
+    EditPart result = null;
+    for (Iterator i = parent.getChildren().iterator(); i.hasNext(); )
+    {
+      EditPart editPart = (EditPart)i.next();
+      if (editPart.getModel() == object)
+      {  
+        result = editPart;
+        break;
+      }
+    }             
+  
+    if (result == null)
+    { 
+      for (Iterator i = parent.getChildren().iterator(); i.hasNext(); )
+      {
+        EditPart editPart = getEditPart((EditPart)i.next(), object);
+        if (editPart != null)
+        {
+          result = editPart;
+          break;
+        }
+      }            
+    }
+  
+    return result;
+  }
+  
+  public void setInput(IADTObject object)
+  {
+    ((RootContentEditPart)getRootEditPart().getContents()).setInput(object);
+  }
+  
+  public IADTObject getInput()
+  {
+    return (IADTObject)((RootContentEditPart)getRootEditPart().getContents()).getInput();    
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/IAnnotationProvider.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/IAnnotationProvider.java
new file mode 100644
index 0000000..e11e149
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/IAnnotationProvider.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.design;
+
+public interface IAnnotationProvider
+{
+  String getNameAnnotationString();
+  String getNameAnnotationToolTipString();
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/directedit/ADTComboBoxCellEditor.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/directedit/ADTComboBoxCellEditor.java
new file mode 100644
index 0000000..2bad965
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/directedit/ADTComboBoxCellEditor.java
@@ -0,0 +1,367 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.design.directedit;
+
+import java.text.MessageFormat;
+import org.eclipse.jface.util.Assert;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CCombo;
+import org.eclipse.swt.events.FocusAdapter;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.TraverseEvent;
+import org.eclipse.swt.events.TraverseListener;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.wst.xsd.adt.edit.ComponentReferenceEditManager;
+import org.eclipse.wst.xsd.adt.edit.IComponentDialog;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+
+/*
+ * This is a copy of ComboBoxCellEditor.
+ * We need to apply and deactivate the combo on a single click (not on a double click like
+ * the ComboBoxCellEditor).
+ */
+public class ADTComboBoxCellEditor extends CellEditor
+{
+
+  /**
+   * The list of items to present in the combo box.
+   */
+  private String[] items;
+
+  /**
+   * The zero-based index of the selected item.
+   */
+  int selection;
+
+  /**
+   * The custom combo box control.
+   */
+  CCombo comboBox;
+
+  /**
+   * Used to determine if the value should be applied to the cell.
+   */
+  private boolean continueApply;
+
+  private Object selectedValue;
+  //private Object setObject;
+  private ComponentReferenceEditManager componentReferenceEditManager;
+
+  /**
+   * Default ComboBoxCellEditor style
+   */
+  private static final int defaultStyle = SWT.NONE;
+
+
+  /**
+   * Creates a new cell editor with a combo containing the given list of choices
+   * and parented under the given control. The cell editor value is the
+   * zero-based index of the selected item. Initially, the cell editor has no
+   * cell validator and the first item in the list is selected.
+   * 
+   * @param parent
+   *          the parent control
+   * @param items
+   *          the list of strings for the combo box
+   */
+  public ADTComboBoxCellEditor(Composite parent, String[] items, ComponentReferenceEditManager editManager)
+  {
+    super(parent, defaultStyle);
+    setItems(items);
+    componentReferenceEditManager = editManager;
+  }
+
+  /**
+   * Returns the list of choices for the combo box
+   * 
+   * @return the list of choices for the combo box
+   */
+  public String[] getItems()
+  {
+    return this.items;
+  }
+
+  /**
+   * Sets the list of choices for the combo box
+   * 
+   * @param items
+   *          the list of choices for the combo box
+   */
+  public void setItems(String[] items)
+  {
+    Assert.isNotNull(items);
+    this.items = items;
+    populateComboBoxItems();
+  }
+
+  /*
+   * (non-Javadoc) Method declared on CellEditor.
+   */
+  protected Control createControl(Composite parent)
+  {
+
+    comboBox = new CCombo(parent, getStyle() | SWT.READ_ONLY);
+    comboBox.setFont(parent.getFont());
+
+    comboBox.addKeyListener(new KeyAdapter()
+    {
+      // hook key pressed - see PR 14201
+      public void keyPressed(KeyEvent e)
+      {
+        keyReleaseOccured(e);
+      }
+    });
+
+    comboBox.addSelectionListener(new SelectionAdapter()
+    {
+      public void widgetDefaultSelected(SelectionEvent event)
+      {
+        applyEditorValueAndDeactivate();
+      }
+
+      public void widgetSelected(SelectionEvent event)
+      {
+        Object newValue = null;
+        continueApply = true;
+        selection = comboBox.getSelectionIndex();
+        String stringSelection = items[selection];
+
+        if (stringSelection.equals("Browse..."))
+        {
+           newValue = invokeDialog(componentReferenceEditManager.getBrowseDialog());
+        }
+        else if (stringSelection.equals("New..."))
+        {
+           newValue = invokeDialog(componentReferenceEditManager.getNewDialog());
+        }
+
+        if (continueApply)
+        {
+          if (newValue == null)
+          {
+            int index = comboBox.getSelectionIndex();
+            if (index != -1)
+            {
+              selectedValue = comboBox.getItem(index);
+            }
+          }
+          else
+          {
+            selectedValue = newValue;
+          }
+
+          applyEditorValueAndDeactivate();
+        }
+      }
+    });
+
+    comboBox.addTraverseListener(new TraverseListener()
+    {
+      public void keyTraversed(TraverseEvent e)
+      {
+        if (e.detail == SWT.TRAVERSE_ESCAPE || e.detail == SWT.TRAVERSE_RETURN)
+        {
+          e.doit = false;
+        }
+      }
+    });
+
+    comboBox.addFocusListener(new FocusAdapter()
+    {
+      public void focusLost(FocusEvent e)
+      {
+        ADTComboBoxCellEditor.this.focusLost();
+      }
+    });
+    return comboBox;
+  }
+
+  private Object invokeDialog(IComponentDialog dialog)
+  {
+    Object newValue = null;
+
+    if (dialog == null)
+    {
+      return null;
+    }
+
+    //dialog.setInitialComponent(setObject);
+    if (dialog.createAndOpen() == Window.OK)
+    {
+      newValue = dialog.getSelectedComponent();
+    }
+    else
+    {
+      continueApply = false;
+    }
+
+    return newValue;
+  }
+
+  /**
+   * The <code>ComboBoxCellEditor</code> implementation of this
+   * <code>CellEditor</code> framework method returns the zero-based index of
+   * the current selection.
+   * 
+   * @return the zero-based index of the current selection wrapped as an
+   *         <code>Integer</code>
+   */
+  protected Object doGetValue()
+  {
+    return new Integer(selection);
+  }
+
+  /*
+   * (non-Javadoc) Method declared on CellEditor.
+   */
+  protected void doSetFocus()
+  {
+    comboBox.setFocus();
+  }
+
+  /**
+   * The <code>ComboBoxCellEditor</code> implementation of this
+   * <code>CellEditor</code> framework method sets the minimum width of the
+   * cell. The minimum width is 10 characters if <code>comboBox</code> is not
+   * <code>null</code> or <code>disposed</code> eles it is 60 pixels to make
+   * sure the arrow button and some text is visible. The list of CCombo will be
+   * wide enough to show its longest item.
+   */
+  public LayoutData getLayoutData()
+  {
+    LayoutData layoutData = super.getLayoutData();
+    if ((comboBox == null) || comboBox.isDisposed())
+      layoutData.minimumWidth = 60;
+    else
+    {
+      // make the comboBox 10 characters wide
+      GC gc = new GC(comboBox);
+      layoutData.minimumWidth = (gc.getFontMetrics().getAverageCharWidth() * 10) + 10;
+      gc.dispose();
+    }
+    return layoutData;
+  }
+
+  /**
+   * The <code>ComboBoxCellEditor</code> implementation of this
+   * <code>CellEditor</code> framework method accepts a zero-based index of a
+   * selection.
+   * 
+   * @param value
+   *          the zero-based index of the selection wrapped as an
+   *          <code>Integer</code>
+   */
+  protected void doSetValue(Object value)
+  {
+    Assert.isTrue(comboBox != null && (value instanceof Integer));
+    selection = ((Integer) value).intValue();
+    comboBox.select(selection);
+  }
+
+  /**
+   * Updates the list of choices for the combo box for the current control.
+   */
+  private void populateComboBoxItems()
+  {
+    if (comboBox != null && items != null)
+    {
+      comboBox.removeAll();
+      for (int i = 0; i < items.length; i++)
+        comboBox.add(items[i], i);
+
+      setValueValid(true);
+      selection = 0;
+    }
+  }
+
+  /**
+   * Applies the currently selected value and deactiavates the cell editor
+   */
+  void applyEditorValueAndDeactivate()
+  {
+    // must set the selection before getting value
+    selection = comboBox.getSelectionIndex();
+    Object newValue = doGetValue();
+    markDirty();
+    boolean isValid = isCorrect(newValue);
+    setValueValid(isValid);
+    if (!isValid)
+    {
+      // try to insert the current value into the error message.
+      setErrorMessage(MessageFormat.format(getErrorMessage(), new Object[] { items[selection] }));
+    }
+    fireApplyEditorValue();
+    deactivate();
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.jface.viewers.CellEditor#focusLost()
+   */
+  protected void focusLost()
+  {
+    if (isActivated())
+    {
+      applyEditorValueAndDeactivate();
+    }
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.jface.viewers.CellEditor#keyReleaseOccured(org.eclipse.swt.events.KeyEvent)
+   */
+  protected void keyReleaseOccured(KeyEvent keyEvent)
+  {
+    if (keyEvent.character == '\u001b')
+    { // Escape character
+      fireCancelEditor();
+    }
+    else if (keyEvent.character == '\t')
+    { // tab key
+      applyEditorValueAndDeactivate();
+    }
+  }
+
+  //public void setSetObject(Object object)
+  //{
+  //  setObject = object;
+  //}
+
+  public Object getSelectedValue()
+  {
+    return selectedValue;
+  }
+
+  /*
+   * TODO: rmah: This should be moved to WSDLEditorPlugin.java
+   */
+  private IEditorPart getActiveEditor()
+  {
+    IWorkbench workbench = XSDEditorPlugin.getDefault().getWorkbench();
+    IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
+    IEditorPart editorPart = workbenchWindow.getActivePage().getActiveEditor();
+
+    return editorPart;
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/directedit/ComboBoxCellEditorManager.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/directedit/ComboBoxCellEditorManager.java
new file mode 100644
index 0000000..c919aec
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/directedit/ComboBoxCellEditorManager.java
@@ -0,0 +1,224 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.design.directedit;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.tools.CellEditorLocator;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.ComboBoxCellEditor;
+import org.eclipse.jface.viewers.ICellEditorListener;
+import org.eclipse.swt.custom.CCombo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+
+public abstract class ComboBoxCellEditorManager extends DirectEditManager// implements
+                                                                          // DirectEditPolicyDelegate
+{
+  protected Label label;
+
+  public ComboBoxCellEditorManager(GraphicalEditPart source, Label label)
+  {
+    super(source, ComboBoxCellEditor.class, new InternalCellEditorLocator(label));
+    this.label = label;
+  }
+
+  protected void initCellEditor()
+  {
+    String initialLabelText = label.getText();
+
+    CCombo combo = (CCombo) getCellEditor().getControl();
+    combo.setFont(label.getFont());
+    combo.setForeground(label.getForegroundColor());
+    combo.setBackground(label.getBackgroundColor());
+    combo.setVisibleItemCount(20);
+
+    /*
+     * combo.addKeyListener(new KeyAdapter() { // hook key pressed - see PR
+     * 14201 public void keyPressed(KeyEvent keyEvent) { if (keyEvent.character ==
+     * 'z') { getCellEditor().applyEditorValue(); } } });
+     */
+    ICellEditorListener cellEditorListener = new ICellEditorListener()
+    {
+      public void cancelEditor()
+      {
+      }
+
+      public void applyEditorValue()
+      {
+      }
+
+      public void editorValueChanged(boolean old, boolean newState)
+      {
+      }
+    };
+    getCellEditor().addListener(cellEditorListener);
+
+    String[] item = combo.getItems();
+    for (int i = 0; i < item.length; i++)
+    {
+      if (item[i].equals(initialLabelText))
+      {
+        getCellEditor().setValue(new Integer(i));
+        break;
+      }
+    }
+  }
+
+  // hack... for some reason the ComboBoxCellEditor does't fire an
+  // editorValueChanged to set the dirty flag
+  // unless we overide this method to return true, the manager is not notified
+  // of changes made in the cell editor
+  protected boolean isDirty()
+  {
+    return true;
+  }
+
+  protected CellEditor createCellEditorOn(Composite composite)
+  {
+    boolean isLabelTextInList = false;
+    List list = computeComboContent();
+    for (Iterator i = list.iterator(); i.hasNext();)
+    {
+      String string = (String) i.next();
+      if (string.equals(label.getText()))
+      {
+        isLabelTextInList = true;
+        break;
+      }
+    }
+
+    if (!isLabelTextInList)
+    {
+      list.add(label.getText());
+    }
+
+    List sortedList = computeSortedList(list);
+    String[] stringArray = new String[sortedList.size()];
+    for (int i = 0; i < stringArray.length; i++)
+    {
+      stringArray[i] = (String) sortedList.get(i);
+    }
+    return createCellEditor(composite, stringArray);
+  }
+  
+  protected CellEditor createCellEditor(Composite composite, String[] stringArray)
+  {
+    return new ComboBoxCellEditor(composite, stringArray);    
+  }
+
+  protected List computeSortedList(List list)
+  {
+    return list;
+  }
+
+  protected abstract List computeComboContent();
+
+  protected abstract void performModify(Object value);
+
+  public static class InternalCellEditorLocator implements CellEditorLocator
+  {
+    protected Label label;
+
+    public InternalCellEditorLocator(Label label)
+    {
+      this.label = label;
+    }
+
+    public void relocate(CellEditor celleditor)
+    {
+      CCombo combo = (CCombo) celleditor.getControl();
+
+      // TODO: We're pulling a fast one here..... This is assuming we're using a
+      // CCombo as our widget
+      // Our eventual 'Combo' may not even use CCombo so this will most likely
+      // get replaced.
+      // int dropDownButtonSizeX = 16;
+
+      Rectangle labelParentBounds = label.getBounds().getCopy();
+      label.translateToAbsolute(labelParentBounds);
+
+      int x = labelParentBounds.x;
+      int y = labelParentBounds.y;
+      int widthK = labelParentBounds.width;
+      int height = labelParentBounds.height;
+      combo.setBounds(x, y + 1, widthK, height - 2);
+    }
+  }
+
+  // implements DirectEditPolicyDelegate
+  // 
+  public void performEdit(CellEditor cellEditor)
+  {
+    ADTComboBoxCellEditor comboCellEditor = (ADTComboBoxCellEditor) cellEditor;
+    CCombo combo = (CCombo) getCellEditor().getControl();
+    int index = combo.getSelectionIndex();
+    if (index != -1)
+    {
+      Object value = combo.getItem(index);
+      if (comboCellEditor.getSelectedValue() != null)
+      {
+        value = comboCellEditor.getSelectedValue();
+      }
+
+      performModify(value);
+    }
+    else
+    {
+      String typedValue = combo.getText();
+      if (combo.indexOf(typedValue) != -1)
+      {
+        performModify(typedValue);
+      }
+      else
+      {
+        String closeMatch = getCloseMatch(typedValue, combo.getItems());
+        if (closeMatch != null)
+        {
+          performModify(closeMatch);
+        }
+        else
+        {
+          Display.getCurrent().beep();
+        }
+      }
+    }
+  }
+
+  protected String getCloseMatch(String value, String[] items)
+  {
+    int matchIndex = -1;
+
+    for (int i = 0; i < items.length; i++)
+    {
+      String item = items[i];
+      String a = getLocalName(value);
+      String b = getLocalName(item);
+      if (a.equalsIgnoreCase(b))
+      {
+        matchIndex = i;
+        break;
+      }
+    }
+    return matchIndex != -1 ? items[matchIndex] : null;
+  }
+
+  protected String getLocalName(String string)
+  {
+    int index = string.indexOf(":");
+    return (index != -1) ? string.substring(index + 1) : string;
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/directedit/ElementReferenceDirectEditManager.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/directedit/ElementReferenceDirectEditManager.java
new file mode 100644
index 0000000..1054a7c
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/directedit/ElementReferenceDirectEditManager.java
@@ -0,0 +1,178 @@
+package org.eclipse.wst.xsd.adt.design.directedit;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.draw2d.Label;
+import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification;
+import org.eclipse.wst.xsd.adt.edit.ComponentReferenceEditManager;
+import org.eclipse.wst.xsd.adt.facade.IField;
+import org.eclipse.wst.xsd.editor.XSDElementReferenceEditManager;
+
+public class ElementReferenceDirectEditManager extends ComboBoxCellEditorManager
+{
+  protected AbstractGraphicalEditPart editPart;
+  protected IField setObject;
+
+  public ElementReferenceDirectEditManager(IField parameter, AbstractGraphicalEditPart source, Label label)
+  {
+    super(source, label);
+    editPart = source;
+    setObject = parameter;
+  }
+
+  protected CellEditor createCellEditorOn(Composite composite)
+  {
+    return super.createCellEditorOn(composite);
+  }
+
+  protected List computeComboContent()
+  {
+    List list = new ArrayList();
+    ComponentReferenceEditManager editManager = getComponentReferenceEditManager();
+    if (editManager != null)
+    {
+       list.add("Browse...");
+       list.add("New...");
+       ComponentSpecification[] quickPicks = editManager.getQuickPicks();
+       if (quickPicks != null)
+       {
+         for (int i=0; i < quickPicks.length; i++)
+         {
+           ComponentSpecification componentSpecification = quickPicks[i];
+           list.add(componentSpecification.getName());
+         }  
+       }
+       ComponentSpecification[] history = editManager.getHistory();
+       if (history != null)
+       {
+         for (int i=0; i < history.length; i++)
+         {
+           ComponentSpecification componentSpecification = history[i];
+           list.add(componentSpecification.getName());
+         }  
+       }
+    } 
+    return list; 
+  }
+
+  protected ComponentSpecification getComponentSpecificationForValue(String value)
+  {
+    ComponentReferenceEditManager editManager = getComponentReferenceEditManager();
+    if (editManager != null)
+    {  
+      ComponentSpecification[] quickPicks = editManager.getQuickPicks();
+      if (quickPicks != null)
+      {
+        for (int i=0; i < quickPicks.length; i++)
+        {
+          ComponentSpecification componentSpecification = quickPicks[i];
+          if (value.equals(componentSpecification.getName()))
+          {
+            return componentSpecification;
+          }                
+        }  
+      }
+      ComponentSpecification[] history = editManager.getHistory();
+      if (history != null)
+      {
+        for (int i=0; i < history.length; i++)
+        {
+          ComponentSpecification componentSpecification = history[i];
+          if (value.equals(componentSpecification.getName()))
+          {  
+            return componentSpecification;
+          }
+        }  
+      }
+    }
+    return null;
+  }
+  
+  public void performModify(Object value)
+  {
+    ComponentReferenceEditManager editManager = getComponentReferenceEditManager();
+    if (editManager == null)
+    {
+      return;
+    }
+    
+    // our crude combo box can only work with 'String' objects
+    // if we get a String back we need to do some clever mapping to get the ComponentSpecification 
+    //    
+    if (value instanceof String)
+    {
+      value = getComponentSpecificationForValue((String)value);     
+    }  
+    // we assume the selected value is always of the form of a ComponentSpecification
+    // 
+    if (value instanceof ComponentSpecification)      
+    {
+      // we need to perform an asyncExec here since the 'host' editpart may be
+      // removed as a side effect of performing the action           
+      DelayedSetElementReferenceRunnable runnable = new DelayedSetElementReferenceRunnable(editManager, setObject, (ComponentSpecification)value);
+      //runnable.run();
+      Display.getCurrent().asyncExec(runnable);
+    }
+  }
+
+  protected List computeSortedList(List list)
+  {
+    // return TypesHelper.sortList(list);
+    return list;
+  }
+  
+  protected CellEditor createCellEditor(Composite composite, String[] stringArray)
+  {
+    ADTComboBoxCellEditor cellEditor = new ADTComboBoxCellEditor(composite, stringArray, getComponentReferenceEditManager());
+    //((ADTComboBoxCellEditor) cellEditor).setObjectToModify(setObject);
+    return cellEditor;
+  }
+
+  protected ComponentReferenceEditManager getComponentReferenceEditManager()
+  {
+    ComponentReferenceEditManager result = null;
+    IEditorPart editor = getActiveEditor();
+    if (editor != null)
+    {
+      result = (ComponentReferenceEditManager)editor.getAdapter(XSDElementReferenceEditManager.class);
+    }  
+    return result;
+  }
+  
+  private IEditorPart getActiveEditor()
+  {
+    IWorkbench workbench = PlatformUI.getWorkbench();
+    IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
+    IEditorPart editorPart = workbenchWindow.getActivePage().getActiveEditor();
+    return editorPart;
+  }    
+  
+  protected static class DelayedSetElementReferenceRunnable implements Runnable
+  {
+    protected ComponentReferenceEditManager componentReferenceEditManager;
+    protected ComponentSpecification newValue;
+    protected IField field;
+
+    public DelayedSetElementReferenceRunnable(ComponentReferenceEditManager componentReferenceEditManager,
+    		IField setObject, ComponentSpecification selectedValue)
+    {
+      this.componentReferenceEditManager = componentReferenceEditManager;
+      newValue = selectedValue;
+      field = setObject;
+    }
+
+    public void run()
+    {
+      componentReferenceEditManager.modifyComponentReference(field, newValue);
+    }
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/directedit/LabelCellEditorLocator.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/directedit/LabelCellEditorLocator.java
new file mode 100644
index 0000000..2e187eb
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/directedit/LabelCellEditorLocator.java
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.design.directedit;
+
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.tools.CellEditorLocator;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.wst.xsd.adt.design.editparts.BaseFieldEditPart;
+import org.eclipse.wst.xsd.adt.design.editparts.INamedEditPart;
+import org.eclipse.wst.xsd.adt.design.figures.IFieldFigure;
+
+public class LabelCellEditorLocator implements CellEditorLocator
+{
+  private INamedEditPart namedEditPart;
+  private Point cursorLocation;
+
+  public LabelCellEditorLocator(INamedEditPart namedEditPart, Point cursorLocation)
+  {
+    this.namedEditPart = namedEditPart;
+    this.cursorLocation = cursorLocation;
+  }
+
+  public void relocate(CellEditor celleditor)
+  {
+    Text text = (Text) celleditor.getControl();
+    
+    if (text.getBounds().x <= 0)
+    {
+      Label label = namedEditPart.getNameLabelFigure();
+      
+      int widthToRemove = 0;
+      // HACK 
+      if (namedEditPart instanceof BaseFieldEditPart)
+      {
+        BaseFieldEditPart field = (BaseFieldEditPart)namedEditPart;
+        IFieldFigure fieldFigure = field.getFieldFigure();     
+        widthToRemove = fieldFigure.getTypeLabel().getBounds().width;       
+        //TODO: !! perhaps the IFieldFigure should just have a method to compute this?
+        //Label typeAnnotationLabel = ((FieldFigure) field.getFigure()).getTypeAnnotationLabel();
+        //Label nameAnnotationLabel = ((FieldFigure) field.getFigure()).getNameAnnotationLabel();
+        //widthToRemove = typeLabel.getBounds().width + typeAnnotationLabel.getBounds().width + nameAnnotationLabel.getBounds().width;
+      }
+      
+      Rectangle boundingRect = label.getTextBounds();
+
+      // Reduce the width by the amount we shifted along the x-axis
+      int delta = Math.abs(boundingRect.x - label.getParent().getBounds().x);
+
+      label.getParent().translateToAbsolute(boundingRect);
+      org.eclipse.swt.graphics.Rectangle trim = text.computeTrim(0, 0, 0, 0);
+      boundingRect.translate(trim.x, trim.y);
+      boundingRect.height = boundingRect.height - trim.y;
+
+      boundingRect.width = label.getParent().getBounds().width - delta - widthToRemove;
+      text.setBounds(boundingRect.x, boundingRect.y, boundingRect.width, boundingRect.height);
+
+      // Translate point
+      Point translatedPoint = new Point(cursorLocation.x - boundingRect.x, cursorLocation.y - boundingRect.y);
+
+      // Calculate text offset corresponding to the translated point
+      text.setSelection(0, 0);
+      int xCaret = text.getCaretLocation().x;
+      int offset = text.getCaretPosition();
+      while (xCaret < translatedPoint.x)
+      {
+        text.setSelection(offset + 1, offset + 1);
+        xCaret = text.getCaretLocation().x;
+        int newOffset = text.getCaretPosition();
+        if (newOffset == offset)
+        {
+          break;
+        }
+        offset++;
+      }
+      text.setSelection(offset, offset);
+    }
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/directedit/LabelEditManager.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/directedit/LabelEditManager.java
new file mode 100644
index 0000000..1b621eb
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/directedit/LabelEditManager.java
@@ -0,0 +1,132 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.design.directedit;
+
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.tools.CellEditorLocator;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.TextCellEditor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.part.CellEditorActionHandler;
+import org.eclipse.wst.xsd.adt.design.editparts.INamedEditPart;
+
+public class LabelEditManager extends DirectEditManager {
+
+	private IActionBars actionBars;
+	private CellEditorActionHandler actionHandler;
+	private IAction copy, cut, paste, undo, redo, find, selectAll, delete;
+	private Font scaledFont;
+
+	public LabelEditManager(GraphicalEditPart source, CellEditorLocator locator) {
+		super(source, null, locator);
+	}
+
+	/**
+	 * @see org.eclipse.gef.tools.DirectEditManager#bringDown()
+	 */
+	protected void bringDown() {
+		if (actionHandler != null) {
+			actionHandler.dispose();
+			actionHandler = null;
+		}
+		if (actionBars != null) {
+			restoreSavedActions(actionBars);
+			actionBars.updateActionBars();
+			actionBars = null;
+		}
+
+		Font disposeFont = scaledFont;
+		scaledFont = null;
+		super.bringDown();
+		if (disposeFont != null)
+			disposeFont.dispose();
+	}
+	
+	public void showFeedback() {
+//    super.showFeedback();
+		getEditPart().showSourceFeedback(getDirectEditRequest());
+	}
+
+	protected CellEditor createCellEditorOn(Composite composite) {
+		return new TextCellEditor(composite, SWT.SINGLE | SWT.WRAP);
+	}
+
+	protected void initCellEditor() {
+		Text text = (Text)getCellEditor().getControl();
+		Label label = ((INamedEditPart) getEditPart()).getNameLabelFigure();
+    
+		if (label != null) {
+			scaledFont = label.getFont();
+			
+			Color color = label.getBackgroundColor();
+			text.setBackground(color);
+			
+			String initialLabelText = label.getText();
+			getCellEditor().setValue(initialLabelText);
+		}
+		else {
+			scaledFont = label.getParent().getFont();
+			text.setBackground(label.getParent().getBackgroundColor());
+		}
+		
+		FontData data = scaledFont.getFontData()[0];
+		Dimension fontSize = new Dimension(0, data.getHeight());
+		label.getParent().translateToAbsolute(fontSize);
+		data.setHeight(fontSize.height);
+		scaledFont = new Font(null, data);
+		
+		text.setFont(scaledFont);
+//		text.selectAll();
+
+		// Hook the cell editor's copy/paste actions to the actionBars so that they can
+		// be invoked via keyboard shortcuts.
+		actionBars = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
+				.getActiveEditor().getEditorSite().getActionBars();
+		saveCurrentActions(actionBars);
+		actionHandler = new CellEditorActionHandler(actionBars);
+		actionHandler.addCellEditor(getCellEditor());
+		actionBars.updateActionBars();
+	}
+
+	private void restoreSavedActions(IActionBars actionBars){
+		actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), copy);
+		actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(), paste);
+		actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), delete);
+		actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), selectAll);
+		actionBars.setGlobalActionHandler(ActionFactory.CUT.getId(), cut);
+		actionBars.setGlobalActionHandler(ActionFactory.FIND.getId(), find);
+		actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(), undo);
+		actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(), redo);
+	}
+
+	private void saveCurrentActions(IActionBars actionBars) {
+		copy = actionBars.getGlobalActionHandler(ActionFactory.COPY.getId());
+		paste = actionBars.getGlobalActionHandler(ActionFactory.PASTE.getId());
+		delete = actionBars.getGlobalActionHandler(ActionFactory.DELETE.getId());
+		selectAll = actionBars.getGlobalActionHandler(ActionFactory.SELECT_ALL.getId());
+		cut = actionBars.getGlobalActionHandler(ActionFactory.CUT.getId());
+		find = actionBars.getGlobalActionHandler(ActionFactory.FIND.getId());
+		undo = actionBars.getGlobalActionHandler(ActionFactory.UNDO.getId());
+		redo = actionBars.getGlobalActionHandler(ActionFactory.REDO.getId());
+	}
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/directedit/TypeReferenceDirectEditManager.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/directedit/TypeReferenceDirectEditManager.java
new file mode 100644
index 0000000..61daa07
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/directedit/TypeReferenceDirectEditManager.java
@@ -0,0 +1,186 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.design.directedit;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.draw2d.Label;
+import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification;
+import org.eclipse.wst.xsd.adt.edit.ComponentReferenceEditManager;
+import org.eclipse.wst.xsd.adt.facade.IField;
+import org.eclipse.wst.xsd.editor.XSDTypeReferenceEditManager;
+
+public class TypeReferenceDirectEditManager extends ComboBoxCellEditorManager
+{
+  protected AbstractGraphicalEditPart editPart;
+  protected IField setObject;
+
+  public TypeReferenceDirectEditManager(IField parameter, AbstractGraphicalEditPart source, Label label)
+  {
+    super(source, label);
+    editPart = source;
+    setObject = parameter;
+  }
+
+  protected CellEditor createCellEditorOn(Composite composite)
+  {
+    return super.createCellEditorOn(composite);
+  }
+
+  protected List computeComboContent()
+  {
+    List list = new ArrayList();
+    ComponentReferenceEditManager editManager = getComponentReferenceEditManager();
+    if (editManager != null)
+    {
+       list.add("Browse...");
+       list.add("New...");
+       ComponentSpecification[] quickPicks = editManager.getQuickPicks();
+       if (quickPicks != null)
+       {
+         for (int i=0; i < quickPicks.length; i++)
+         {
+           ComponentSpecification componentSpecification = quickPicks[i];
+           list.add(componentSpecification.getName());
+         }  
+       }
+       ComponentSpecification[] history = editManager.getHistory();
+       if (history != null)
+       {
+         for (int i=0; i < history.length; i++)
+         {
+           ComponentSpecification componentSpecification = history[i];
+           list.add(componentSpecification.getName());
+         }  
+       }
+    } 
+    return list; 
+  }
+
+  protected ComponentSpecification getComponentSpecificationForValue(String value)
+  {
+    ComponentReferenceEditManager editManager = getComponentReferenceEditManager();
+    if (editManager != null)
+    {  
+      ComponentSpecification[] quickPicks = editManager.getQuickPicks();
+      if (quickPicks != null)
+      {
+        for (int i=0; i < quickPicks.length; i++)
+        {
+          ComponentSpecification componentSpecification = quickPicks[i];
+          if (value.equals(componentSpecification.getName()))
+          {
+            return componentSpecification;
+          }                
+        }  
+      }
+      ComponentSpecification[] history = editManager.getHistory();
+      if (history != null)
+      {
+        for (int i=0; i < history.length; i++)
+        {
+          ComponentSpecification componentSpecification = history[i];
+          if (value.equals(componentSpecification.getName()))
+          {  
+            return componentSpecification;
+          }
+        }  
+      }
+    }
+    return null;
+  }
+  
+  public void performModify(Object value)
+  {
+    ComponentReferenceEditManager editManager = getComponentReferenceEditManager();
+    if (editManager == null)
+    {
+      return;
+    }
+    
+    // our crude combo box can only work with 'String' objects
+    // if we get a String back we need to do some clever mapping to get the ComponentSpecification 
+    //    
+    if (value instanceof String)
+    {
+      value = getComponentSpecificationForValue((String)value);     
+    }  
+    // we assume the selected value is always of the form of a ComponentSpecification
+    // 
+    if (value instanceof ComponentSpecification)      
+    {
+      // we need to perform an asyncExec here since the 'host' editpart may be
+      // removed as a side effect of performing the action           
+      DelayedSetTypeRunnable runnable = new DelayedSetTypeRunnable(editManager, setObject, (ComponentSpecification)value);
+      //runnable.run();
+      Display.getCurrent().asyncExec(runnable);
+    }
+  }
+
+  protected List computeSortedList(List list)
+  {
+    // return TypesHelper.sortList(list);
+    return list;
+  }
+  
+  protected CellEditor createCellEditor(Composite composite, String[] stringArray)
+  {
+    ADTComboBoxCellEditor cellEditor = new ADTComboBoxCellEditor(composite, stringArray, getComponentReferenceEditManager());
+    //((ADTComboBoxCellEditor) cellEditor).setObjectToModify(setObject);
+    return cellEditor;
+  }
+
+  protected ComponentReferenceEditManager getComponentReferenceEditManager()
+  {
+    ComponentReferenceEditManager result = null;
+    IEditorPart editor = getActiveEditor();
+    if (editor != null)
+    {
+        result = (ComponentReferenceEditManager)editor.getAdapter(XSDTypeReferenceEditManager.class);
+    }  
+    return result;
+  }
+  
+  private IEditorPart getActiveEditor()
+  {
+    IWorkbench workbench = PlatformUI.getWorkbench();
+    IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
+    IEditorPart editorPart = workbenchWindow.getActivePage().getActiveEditor();
+    return editorPart;
+  }    
+  
+  protected static class DelayedSetTypeRunnable implements Runnable
+  {
+    protected ComponentReferenceEditManager componentReferenceEditManager;
+    protected ComponentSpecification newValue;
+    protected IField field;
+
+    public DelayedSetTypeRunnable(ComponentReferenceEditManager componentReferenceEditManager, IField setObject, ComponentSpecification selectedValue)
+    {
+      this.componentReferenceEditManager = componentReferenceEditManager;
+      newValue = selectedValue;
+      field = setObject;
+    }
+
+    public void run()
+    {
+      componentReferenceEditManager.modifyComponentReference(field, newValue);
+    }
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/ADTEditPartFactory.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/ADTEditPartFactory.java
new file mode 100644
index 0000000..b7b5f53
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/ADTEditPartFactory.java
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.design.editparts;
+
+import org.eclipse.draw2d.ToolbarLayout;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPartFactory;
+import org.eclipse.jface.util.Assert;
+import org.eclipse.wst.xsd.adt.design.editparts.model.AbstractModelCollection;
+import org.eclipse.wst.xsd.adt.design.editparts.model.Compartment;
+import org.eclipse.wst.xsd.adt.design.editparts.model.FocusTypeColumn;
+import org.eclipse.wst.xsd.adt.facade.IComplexType;
+import org.eclipse.wst.xsd.adt.facade.IField;
+import org.eclipse.wst.xsd.adt.facade.IModel;
+import org.eclipse.wst.xsd.adt.facade.IStructure;
+
+public class ADTEditPartFactory implements EditPartFactory
+{
+  public EditPart createEditPart(EditPart context, Object model)
+  {
+    EditPart child = null;
+    if (model instanceof Compartment)
+    {
+      child = new CompartmentEditPart();
+    }      
+    else if (model instanceof AbstractModelCollection)
+    {
+      child = new ColumnEditPart();
+      if (model instanceof FocusTypeColumn)
+      {
+        ColumnEditPart columnEditPart = (ColumnEditPart)child;
+        columnEditPart.setSpacing(60);
+        columnEditPart.setMinorAlignment(ToolbarLayout.ALIGN_CENTER);
+      }  
+    }
+    else if (model instanceof IComplexType)
+    {
+      child = new ComplexTypeEditPart();
+    }
+    else if (model instanceof IStructure)
+    {
+      child = new StructureEditPart();
+    }  
+    else if (model instanceof IField)
+    {
+      if (context instanceof CompartmentEditPart)
+      {  
+        child = new FieldEditPart();
+      }
+      else
+      {
+        child = new TopLevelFieldEditPart();
+      }  
+    }
+    else if (model instanceof IModel)
+    {
+      child = new RootContentEditPart();
+    }
+
+    checkChild(child, model);
+
+    return child;
+  }
+
+  /**
+   * Subclasses can override and not check for null
+   * 
+   * @param child
+   * @param model
+   */
+  protected void checkChild(EditPart child, Object model)
+  {
+    if (child == null)
+    {
+      Thread.dumpStack();
+    }
+    Assert.isNotNull(child);
+    child.setModel(model);
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/BaseEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/BaseEditPart.java
new file mode 100644
index 0000000..86d4c10
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/BaseEditPart.java
@@ -0,0 +1,156 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.design.editparts;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.EditPartFactory;
+import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
+import org.eclipse.gef.editparts.ScalableRootEditPart;
+import org.eclipse.gef.editparts.ZoomListener;
+import org.eclipse.gef.editparts.ZoomManager;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.wst.xsd.adt.design.editparts.model.IActionProvider;
+import org.eclipse.wst.xsd.adt.design.editparts.model.IFeedbackHandler;
+import org.eclipse.wst.xsd.adt.design.figures.IFigureFactory;
+import org.eclipse.wst.xsd.adt.facade.IADTObject;
+import org.eclipse.wst.xsd.adt.facade.IADTObjectListener;
+
+public abstract class BaseEditPart extends AbstractGraphicalEditPart implements IActionProvider, IADTObjectListener, IFeedbackHandler
+{
+  protected static final String[] EMPTY_ACTION_ARRAY = {};
+ 
+  public IFigureFactory getFigureFactory()
+  {
+    EditPartFactory factory = getViewer().getEditPartFactory();
+    Assert.isTrue(factory instanceof IFigureFactory, "EditPartFactory must be an instanceof of IFigureFactory");    
+    return (IFigureFactory)factory; 
+  }
+  
+  public String[] getActions(Object object)
+  {
+    Object model = getModel();
+    if (model instanceof IActionProvider)
+    {
+      return ((IActionProvider)model).getActions(object);
+    }  
+    return EMPTY_ACTION_ARRAY;
+  }
+  
+  protected void addActionsToList(List list, IAction[] actions)
+  {
+    for (int i = 0; i < actions.length; i++)
+    {
+      list.add(actions[i]);
+    }  
+  }
+  
+  public void activate()
+  {
+    super.activate();
+    Object model = getModel();
+    if (model instanceof IADTObject)
+    {
+      IADTObject object = (IADTObject)model;
+      object.registerListener(this);
+    }
+    
+    if (getZoomManager() != null)
+      getZoomManager().addZoomListener(zoomListener);
+
+  }
+  
+  public void deactivate()
+  {
+    try
+    {
+    Object model = getModel();
+    if (model instanceof IADTObject)
+    {
+      IADTObject object = (IADTObject)model;
+      object.unregisterListener(this);
+    }   
+    
+    if (getZoomManager() != null)
+      getZoomManager().removeZoomListener(zoomListener);    
+    }
+    finally
+    {
+      super.deactivate();
+    }  
+  }  
+  
+  public void propertyChanged(Object object, String property)
+  {
+    refresh();
+  }
+  
+  public void refresh() {
+    super.refresh();
+
+    // Tell our children to refresh (note, this is NOT the function of 
+    // refreshChildren(), strangely enough)
+    for(Iterator i = getChildren().iterator(); i.hasNext(); )
+    {
+      Object obj = i.next();
+      if (obj instanceof BaseEditPart)
+      {
+        ((BaseEditPart)obj).refresh();
+      }
+      else if (obj instanceof AbstractGraphicalEditPart)
+      {
+        ((AbstractGraphicalEditPart)obj).refresh();
+      }
+      
+    }
+  }
+
+  public void addFeedback()
+  {
+  }
+
+  public void removeFeedback()
+  {
+  }
+  
+  public ZoomManager getZoomManager()
+  {
+    return ((ScalableRootEditPart)getRoot()).getZoomManager();
+  }
+  
+  public Rectangle getZoomedBounds(Rectangle r)
+  {
+    double factor = getZoomManager().getZoom();
+    int x = (int)Math.round(r.x * factor);
+    int y = (int)Math.round(r.y * factor);
+    int width = (int)Math.round(r.width * factor);
+    int height = (int)Math.round(r.height * factor);
+
+    return new Rectangle(x, y, width, height);
+  }
+  
+  private ZoomListener zoomListener = new ZoomListener()
+  {
+    public void zoomChanged(double zoom)
+    {
+      handleZoomChanged();
+    }
+  };
+
+  protected void handleZoomChanged()
+  {
+    refreshVisuals();
+  }
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/BaseFieldEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/BaseFieldEditPart.java
new file mode 100644
index 0000000..7a46fce
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/BaseFieldEditPart.java
@@ -0,0 +1,359 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.design.editparts;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.gef.DragTracker;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.LayerConstants;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.RequestConstants;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.requests.LocationRequest;
+import org.eclipse.wst.xsd.adt.design.directedit.ComboBoxCellEditorManager;
+import org.eclipse.wst.xsd.adt.design.directedit.ElementReferenceDirectEditManager;
+import org.eclipse.wst.xsd.adt.design.directedit.LabelCellEditorLocator;
+import org.eclipse.wst.xsd.adt.design.directedit.LabelEditManager;
+import org.eclipse.wst.xsd.adt.design.directedit.TypeReferenceDirectEditManager;
+import org.eclipse.wst.xsd.adt.design.editparts.model.FocusTypeColumn;
+import org.eclipse.wst.xsd.adt.design.editpolicies.ADTDirectEditPolicy;
+import org.eclipse.wst.xsd.adt.design.editpolicies.ADTSelectionFeedbackEditPolicy;
+import org.eclipse.wst.xsd.adt.design.editpolicies.IADTUpdateCommand;
+import org.eclipse.wst.xsd.adt.design.figures.IFieldFigure;
+import org.eclipse.wst.xsd.adt.facade.IField;
+import org.eclipse.wst.xsd.adt.facade.IType;
+import org.eclipse.wst.xsd.editor.internal.adapters.XSDElementDeclarationAdapter;
+
+public class BaseFieldEditPart extends BaseTypeConnectingEditPart implements INamedEditPart
+{
+  protected TypeReferenceConnection connectionFigure;
+  protected ADTDirectEditPolicy adtDirectEditPolicy = new ADTDirectEditPolicy();
+  TypeUpdateCommand typeUpdateCommand = new TypeUpdateCommand();
+  ElementReferenceUpdateCommand elementUpdateCommand = new ElementReferenceUpdateCommand();
+  
+  protected IFigure createFigure()
+  {          
+    IFieldFigure figure = getFigureFactory().createFieldFigure(getModel());    
+    figure.setForegroundColor(ColorConstants.black);
+    return figure;
+  }
+  
+  public IFieldFigure getFieldFigure()
+  {
+    return (IFieldFigure)figure;
+  }
+  
+
+  public void activate()
+  {
+    super.activate();
+    activateConnection();
+  }
+  
+  public void deactivate()
+  {
+    deactivateConnection();
+    super.deactivate();
+  }
+
+  protected boolean shouldDrawConnection()
+  {
+    boolean result = false;
+    
+    // For now we only want to produce outbound lines from a Field to a Type
+    // when the field in contained in the 'focus' edit part    
+    for (EditPart parent = getParent(); parent != null; parent = parent.getParent())
+    {  
+      if (parent.getModel() instanceof FocusTypeColumn)
+      {        
+        result = true;
+        break;
+      }  
+    }    
+    return result;
+  }
+  
+  public TypeReferenceConnection createConnectionFigure()
+  {
+    connectionFigure = null;
+    IField field = (IField)getModel();
+    IType type = field.getType();
+    if (type != null) // && type.isComplexType())
+    {      
+      AbstractGraphicalEditPart referenceTypePart = (AbstractGraphicalEditPart)getViewer().getEditPartRegistry().get(type);
+      if (referenceTypePart != null)
+      {
+        connectionFigure = new TypeReferenceConnection();
+
+        if (getFigure().getParent() == referenceTypePart.getFigure())
+        {
+          connectionFigure.setSourceAnchor(new CenteredConnectionAnchor(getFigure(), CenteredConnectionAnchor.LEFT, 1)); 
+        }
+        else
+        {
+          connectionFigure.setSourceAnchor(new CenteredConnectionAnchor(getFigure(), CenteredConnectionAnchor.RIGHT, 5));
+        }
+        int targetAnchorYOffset = 8;
+
+        connectionFigure.setTargetAnchor(new CenteredConnectionAnchor(referenceTypePart.getFigure(), CenteredConnectionAnchor.HEADER_LEFT, 0, targetAnchorYOffset)); 
+        connectionFigure.setHighlight(false);
+      }
+    }    
+    return connectionFigure;
+  }
+
+
+  protected void createEditPolicies()
+  {
+    installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, adtDirectEditPolicy);
+    installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new ADTSelectionFeedbackEditPolicy());
+  }
+
+  public void refresh()
+  {
+    super.refresh();
+    
+    // todo... perhaps this is aggressive?
+    // really we only need to update the connection when the IType changes
+    
+    deactivateConnection();
+    activateConnection();      
+  }
+
+  protected void refreshVisuals()
+  {
+    super.refreshVisuals();
+    IFieldFigure figure = getFieldFigure();
+    IField field = (IField) getModel();
+    
+    figure.getNameLabel().setText(field.getName());
+    figure.getTypeLabel().setText(field.getTypeName());
+    figure.refreshVisuals(getModel());
+
+    figure.recomputeLayout();
+
+    ((GraphicalEditPart)getRoot()).getFigure().invalidateTree();
+  }
+
+  public DragTracker getDragTracker(Request request)
+  {
+    return super.getDragTracker(request);
+  }
+  
+  /*
+  public IAction[] getActions(Object object)
+  {
+    // when a FieldEditPart is selected it provides it's own actions
+    // as well as those of it's parent 'type' edit part
+    List list = new ArrayList();
+    EditPart compartment = getParent();
+    if (compartment != null)
+    {  
+      EditPart type = compartment.getParent();
+      if (type != null && type instanceof IActionProvider)
+      {
+        IActionProvider provider = (IActionProvider)type;
+        addActionsToList(list, provider.getActions(object));
+      }
+    }
+    addActionsToList(list, super.getActions(object));
+    IAction[] result = new IAction[list.size()];
+    list.toArray(result);
+    return result;
+  }*/
+  
+  public Label getNameLabelFigure()
+  {
+    return getFieldFigure().getNameLabel();
+  }
+
+  public void performDirectEdit(Point cursorLocation)
+  {
+    
+  }
+  
+  public void performRequest(Request request)
+  {  
+    if (request.getType() == RequestConstants.REQ_DIRECT_EDIT||
+        request.getType() == RequestConstants.REQ_OPEN)
+    {
+      IFieldFigure fieldFigure = getFieldFigure();
+      Object model = getModel();
+      if (request instanceof LocationRequest)
+      {
+        LocationRequest locationRequest = (LocationRequest)request;
+        Point p = locationRequest.getLocation();
+       
+        if (hitTest(fieldFigure.getTypeLabel(), p))
+        {
+          TypeReferenceDirectEditManager manager = new TypeReferenceDirectEditManager((IField)model, this, fieldFigure.getTypeLabel());
+          typeUpdateCommand.setDelegate(manager);
+          adtDirectEditPolicy.setUpdateCommand(typeUpdateCommand);
+          manager.show();
+        }
+        else if (hitTest(fieldFigure.getNameLabel(), p))
+        {
+        	if ( model instanceof XSDElementDeclarationAdapter ){
+        		XSDElementDeclarationAdapter elementDecAdapter = ((XSDElementDeclarationAdapter) model);
+        		if ( elementDecAdapter.isElementDeclarationReference() ){
+        			ElementReferenceDirectEditManager manager =
+        				new ElementReferenceDirectEditManager((IField)model, this, fieldFigure.getNameLabel());
+        			elementUpdateCommand.setDelegate(manager);
+        			adtDirectEditPolicy.setUpdateCommand(elementUpdateCommand);
+        			manager.show();
+        		}
+        		else {
+        			LabelEditManager manager = new LabelEditManager(this, new LabelCellEditorLocator(this, p));
+        			NameUpdateCommandWrapper wrapper = new NameUpdateCommandWrapper();
+        			adtDirectEditPolicy.setUpdateCommand(wrapper);
+        			manager.show();
+        		}
+        	}
+        }
+      }
+    }
+  }
+  
+  
+  class NameUpdateCommandWrapper extends Command implements IADTUpdateCommand
+  {
+    Command command;
+    protected DirectEditRequest request;
+    
+    public NameUpdateCommandWrapper()
+    {
+      super("Update Name");
+    }
+
+    public void setRequest(DirectEditRequest request)
+    {
+      this.request = request;
+    }
+    
+    public void execute()
+    {
+      IField field = (IField)getModel();
+      Object newValue = request.getCellEditor().getValue();
+      if (newValue instanceof String)
+      {
+        command = field.getUpdateNameCommand((String)newValue);
+      }
+      if (command != null)
+        command.execute();
+    }
+  }
+  
+  class TypeUpdateCommand extends Command implements IADTUpdateCommand
+  {
+    protected ComboBoxCellEditorManager delegate;
+    protected DirectEditRequest request;
+    
+    public TypeUpdateCommand()
+    {
+      super("Update type");
+    }
+
+    public void setDelegate(ComboBoxCellEditorManager delegate)
+    {                                           
+      this.delegate = delegate;
+    }
+    
+    public void setRequest(DirectEditRequest request)
+    {
+      this.request = request;
+    }
+    
+    public void execute()
+    {
+      if (delegate != null)
+      {
+        delegate.performEdit(request.getCellEditor());
+      }
+    }
+
+    public boolean canExecute()
+    {
+      return true;
+    }
+  }
+  
+  class ElementReferenceUpdateCommand extends Command implements IADTUpdateCommand
+  {
+	    protected ComboBoxCellEditorManager delegate;
+	    protected DirectEditRequest request;
+	    
+	    public ElementReferenceUpdateCommand()
+	    {
+	      super("Update element reference");
+	    }
+
+	    public void setDelegate(ComboBoxCellEditorManager delegate)
+	    {
+	      this.delegate = delegate;
+	    }
+
+	    public void setRequest(DirectEditRequest request)
+	    {
+	      this.request = request;
+	    }
+
+	    public void execute()
+	    {
+	      if (delegate != null)
+	      {
+	        delegate.performEdit(request.getCellEditor());
+	      }
+	    }
+
+	    public boolean canExecute()
+	    {
+	      return true;
+	    }
+  }
+
+
+  TypeReferenceConnection connectionFeedbackFigure;
+
+  public void addFeedback()
+  {
+    // Put back connection figure so it won't get overlayed by other non highlighted connections
+    if (connectionFigure != null)
+    {
+      connectionFeedbackFigure = new TypeReferenceConnection();
+      connectionFeedbackFigure.setSourceAnchor(connectionFigure.getSourceAnchor());
+      connectionFeedbackFigure.setTargetAnchor(connectionFigure.getTargetAnchor());
+      connectionFeedbackFigure.setHighlight(true);
+      getLayer(LayerConstants.FEEDBACK_LAYER).add(connectionFeedbackFigure);
+    }
+     super.addFeedback();
+     getFieldFigure().addSelectionFeedback();
+  }
+  
+  public void removeFeedback()
+  {
+    if (connectionFeedbackFigure != null)
+    {
+      connectionFeedbackFigure.setHighlight(false);
+      getLayer(LayerConstants.FEEDBACK_LAYER).remove(connectionFeedbackFigure);
+    }
+    connectionFeedbackFigure = null;
+    super.removeFeedback();
+    getFieldFigure().removeSelectionFeedback();
+  }
+}
+
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/BaseTypeConnectingEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/BaseTypeConnectingEditPart.java
new file mode 100644
index 0000000..bc74d6d
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/BaseTypeConnectingEditPart.java
@@ -0,0 +1,145 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.design.editparts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.LayerConstants;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.wst.xsd.adt.design.editparts.model.IFeedbackHandler;
+import org.eclipse.wst.xsd.adt.design.editpolicies.IADTUpdateCommand;
+import org.eclipse.wst.xsd.adt.facade.IType;
+
+/**
+ * This class provides some base function to enable drawing connections to a referenced type
+ *
+ */
+public abstract class BaseTypeConnectingEditPart extends BaseEditPart implements IFeedbackHandler
+{
+  private TypeReferenceConnection connectionFigure;  
+  
+  public void activate()
+  {
+    super.activate();
+    // TODO (cs) revisit this, perhaps has Randy for his advice
+    // it seems that the edit parts required for the target end of the connections
+    // are not always layed available when active is called.  So we need to delay
+    // the activateConnection() until a short time later.  For now the only way I can think
+    // of doing this is via an asyncExec.
+    //
+    Display.getCurrent().asyncExec(new Runnable()
+    {
+      public void run()
+      {
+        if (isActive())
+        {  
+          activateConnection();
+        }  
+      }
+    });   
+  }
+  
+  public void deactivate()
+  {
+    deactivateConnection();
+    super.deactivate();
+  }
+
+  protected void activateConnection()
+  {
+    // If appropriate, create our connectionFigure and add it to the appropriate layer
+    if (connectionFigure == null && shouldDrawConnection())
+    {
+      connectionFigure = createConnectionFigure();
+      if (connectionFigure != null)
+      {  
+        // Add our editpolicy as a listener on the connection, so it can stay in synch
+        //connectionFigure.addPropertyChangeListener((AttributeSelectionFeedbackPolicy) getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE));
+        //connectionFigure.addMouseListener(this);
+        getLayer(LayerConstants.CONNECTION_LAYER).add(connectionFigure);
+      }  
+    }
+  }
+  
+  protected void deactivateConnection()
+  {
+    // if we have a connection, remove it
+    if (connectionFigure != null)
+    {
+      getLayer(LayerConstants.CONNECTION_LAYER).remove(connectionFigure);
+      // Remove our editpolicy listener(s)
+      //connectionFigure.removePropertyChangeListener((AttributeSelectionFeedbackPolicy) getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE));
+      //connectionFigure.removeMouseListener(this);
+      connectionFigure = null;
+    }
+  }  
+  
+  protected boolean shouldDrawConnection()
+  {
+    return true;
+  }
+  
+  public abstract TypeReferenceConnection createConnectionFigure();
+  
+  public void addFeedback()
+  {
+    if (connectionFigure != null)
+    {
+      connectionFigure.setHighlight(true);
+    }
+  }
+  
+  public void removeFeedback()
+  {
+    if (connectionFigure != null)
+    {
+      connectionFigure.setHighlight(false);
+    }
+  }
+  
+  protected class NameUpdateCommandWrapper extends Command implements IADTUpdateCommand
+  {
+    Command command;
+    protected DirectEditRequest request;
+    
+    public NameUpdateCommandWrapper()
+    {
+      super("Update Name");
+    }
+
+    public void setRequest(DirectEditRequest request)
+    {
+      this.request = request;
+    }
+    
+    public void execute()
+    {
+      IType iType = (IType)getModel();
+      Object newValue = request.getCellEditor().getValue();
+      if (newValue instanceof String)
+      {
+        command = iType.getUpdateNameCommand((String)newValue);
+      }
+      if (command != null)
+        command.execute();
+    }
+  }
+
+  public boolean hitTest(IFigure target, Point location)
+  {
+    Rectangle b = target.getBounds().getCopy();
+    target.translateToAbsolute(b);  
+    return b.contains(location);
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/BoxEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/BoxEditPart.java
new file mode 100644
index 0000000..60815cf
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/BoxEditPart.java
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.design.editparts;
+
+import java.util.List;
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.LineBorder;
+import org.eclipse.draw2d.ToolbarLayout;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.ui.actions.ActionRegistry;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.wst.xsd.adt.design.editparts.model.Compartment;
+import org.eclipse.wst.xsd.adt.design.editpolicies.ADTSelectionFeedbackEditPolicy;
+import org.eclipse.wst.xsd.adt.outline.ITreeElement;
+import org.eclipse.wst.xsd.adt.typeviz.design.figures.BoxFigure;
+import org.eclipse.wst.xsd.adt.design.editpolicies.SimpleDirectEditPolicy;
+
+public abstract class BoxEditPart extends BaseTypeConnectingEditPart //IFeedbackHandler
+{  
+  protected List compartmentList = null;
+  protected SimpleDirectEditPolicy simpleDirectEditPolicy = new SimpleDirectEditPolicy();
+
+  protected Compartment[] getCompartments()
+  {
+    return null;
+  }
+  
+  protected IFigure createFigure()
+  {
+    BoxFigure figure = new BoxFigure();
+    LineBorder boxLineBorder = new LineBorder(1);
+    figure.setBorder(boxLineBorder);    
+    ToolbarLayout toolbarLayout = new ToolbarLayout();
+    toolbarLayout.setStretchMinorAxis(true);
+    figure.setLayoutManager(toolbarLayout);
+    // we should organize ITreeElement and integrate it with the facade
+    if (getModel() instanceof ITreeElement)
+    {
+      figure.getNameLabel().setIcon(((ITreeElement)getModel()).getImage());
+    }
+    return figure;
+  }
+  
+  public IFigure getContentPane()
+  {
+    return ((BoxFigure)getFigure()).getContentPane();
+  }
+    
+  protected void createEditPolicies()
+  {
+    installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new ADTSelectionFeedbackEditPolicy());
+    installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, simpleDirectEditPolicy);
+  }
+  
+   
+  public void addFeedback()
+  {
+    BoxFigure boxFigure = (BoxFigure)figure;
+    LineBorder boxFigureLineBorder = (LineBorder)boxFigure.getBorder();
+    boxFigureLineBorder.setWidth(2);
+    boxFigureLineBorder.setColor(ColorConstants.darkBlue);  
+    boxFigure.getHeadingFigure().setSelected(true);
+    figure.repaint();
+    super.addFeedback();
+  }
+  
+  public void removeFeedback()
+  {
+    BoxFigure boxFigure = (BoxFigure)figure;
+    LineBorder boxFigureLineBorder = (LineBorder)boxFigure.getBorder();
+    boxFigureLineBorder.setWidth(1);
+    boxFigureLineBorder.setColor(ColorConstants.black);
+    boxFigure.getHeadingFigure().setSelected(false);
+    figure.repaint();
+    super.removeFeedback();    
+  }
+  
+  protected ActionRegistry getEditorActionRegistry(IEditorPart editor)
+  {
+    return (ActionRegistry) editor.getAdapter(ActionRegistry.class);
+  }
+}  
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/CenteredConnectionAnchor.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/CenteredConnectionAnchor.java
new file mode 100644
index 0000000..3e19c6f
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/CenteredConnectionAnchor.java
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.design.editparts;
+
+import org.eclipse.draw2d.AbstractConnectionAnchor;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.wst.xsd.editor.internal.design.figures.CenteredIconFigure;
+
+public class CenteredConnectionAnchor extends AbstractConnectionAnchor
+{
+  public static final int TOP = 0;
+  public static final int BOTTOM = 1;
+  public static final int LEFT = 2;
+  public static final int RIGHT = 3;
+
+  public static final int HEADER_LEFT = 4;
+  public static final int HEADER_RIGHT = 5;
+
+  private int location;
+  private int inset;
+  private int offset = 0;
+
+  public CenteredConnectionAnchor(IFigure owner, int location, int inset)
+  {
+    super(owner);
+    this.location = location;
+    this.inset = inset;
+  }
+
+  public CenteredConnectionAnchor(IFigure owner, int location, int inset, int offset)
+  {
+    this(owner, location, inset);
+    this.offset = offset;
+  }
+
+  public Point getLocation(Point reference)
+  {
+    Rectangle r = getOwner().getBounds();
+    int x, y;
+    switch (location)
+    {
+    case TOP:
+      x = r.right() - r.width / 2 + offset;
+      y = r.y + inset;
+      break;
+    case BOTTOM:
+      x = r.right() - r.width / 2 + offset;
+      y = r.bottom() - inset;
+      break;
+    case LEFT:
+      x = r.x + inset;
+      y = r.bottom() - r.height / 2 + offset;
+      break;
+    case RIGHT:
+      x = r.right() - inset;
+      y = r.bottom() - r.height / 2 + offset;
+      break;
+    case HEADER_LEFT:
+      x = r.x + inset;
+      y = r.y + offset;
+      break;
+    case HEADER_RIGHT:
+      x = r.right() - inset;
+      y = r.y + offset;
+      break;
+
+    default:
+      x = r.right() - r.width / 2;
+      y = r.bottom() - r.height / 2;
+    }
+    Point p = new Point(x, y);
+
+    if (!(getOwner() instanceof CenteredIconFigure))
+    {
+      getOwner().translateToAbsolute(p);
+    }
+    else
+    {
+      getOwner().translateToAbsolute(p);
+    }
+    return p;
+  }
+
+  public Point getReferencePoint()
+  {
+    return getLocation(null);
+  }
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/ColumnEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/ColumnEditPart.java
new file mode 100644
index 0000000..f6352ae
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/ColumnEditPart.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.design.editparts;
+
+import java.util.List;
+
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.ToolbarLayout;
+import org.eclipse.wst.xsd.adt.design.editparts.model.AbstractModelCollection;
+import org.eclipse.wst.xsd.adt.facade.IComplexType;
+
+public class ColumnEditPart extends BaseEditPart
+{         
+  protected int spacing = 20;  
+  protected int minorAlignment = -1;
+  
+  protected IFigure createFigure()
+  {
+    Figure figure = new Figure();
+    ToolbarLayout layout = new ToolbarLayout(false);
+    if (minorAlignment != -1)
+    {  
+      layout.setMinorAlignment(minorAlignment);
+    }  
+    layout.setStretchMinorAxis(false);
+    layout.setSpacing(spacing);
+    figure.setLayoutManager(layout);
+    return figure;
+  }
+  
+  public void setSpacing(int spacing)
+  {
+    this.spacing = spacing;
+    if (figure != null)
+    {  
+      ((ToolbarLayout)figure.getLayoutManager()).setSpacing(spacing);
+    }  
+  }
+  
+  public IComplexType getComplexType()
+  {
+    return (IComplexType)getModel();   
+  }
+
+  protected void createEditPolicies()
+  {
+    // TODO Auto-generated method stub
+  }
+  
+  protected List getModelChildren()
+  { 
+    AbstractModelCollection collection = (AbstractModelCollection)getModel();
+    return collection.getChildren();
+  }
+
+  public int getMinorAlignment()
+  {
+    return minorAlignment;
+  }
+
+  public void setMinorAlignment(int minorAlignment)
+  {
+    this.minorAlignment = minorAlignment;
+  }
+}
+
+
+
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/CompartmentEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/CompartmentEditPart.java
new file mode 100644
index 0000000..b5724e0
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/CompartmentEditPart.java
@@ -0,0 +1,135 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.design.editparts;
+
+import java.util.List;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.wst.xsd.adt.design.editparts.model.Annotation;
+import org.eclipse.wst.xsd.adt.design.editparts.model.Compartment;
+import org.eclipse.wst.xsd.adt.design.figures.ICompartmentFigure;
+import org.eclipse.wst.xsd.adt.facade.IField;
+
+// TODO (cs) common-up with BoxEditPart (?)
+public class CompartmentEditPart extends BaseEditPart // implements
+                                                      // IFeedbackHandler
+{
+  Annotation annotation = new Annotation();
+
+  protected IFigure createFigure()
+  {
+    ICompartmentFigure figure = getFigureFactory().createCompartmentFigure(getModel());
+    return figure;
+  }
+
+  public IFigure getContentPane()
+  {
+    return getCompartmentFigure().getContentPane();
+  }
+
+  protected void createEditPolicies()
+  {
+    // installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new
+    // SelectionFeedbackEditPolicy(this));
+  }
+
+  protected void addChildVisual(EditPart childEditPart, int index)
+  {
+    Object model = childEditPart.getModel();
+
+    IFigure child = ((GraphicalEditPart) childEditPart).getFigure();
+
+    if (model instanceof IField)
+    {
+      getCompartmentFigure().getContentPane().add(child, index);
+      return;
+    }
+    else if (model instanceof Annotation)
+    {
+      getCompartmentFigure().getAnnotationPane().add(child);
+      return;
+    }
+    super.addChildVisual(childEditPart, index);
+  }
+
+  protected void removeChildVisual(EditPart childEditPart)
+  {
+    Object model = childEditPart.getModel();
+    IFigure child = ((GraphicalEditPart) childEditPart).getFigure();
+
+    if (model instanceof IField)
+    {
+      getCompartmentFigure().getContentPane().remove(child);
+      return;
+    }
+    else if (model instanceof Annotation)
+    {
+      getCompartmentFigure().getAnnotationPane().remove(child);
+      return;
+    }
+    super.removeChildVisual(childEditPart);
+  }
+
+  protected Compartment getCompartment()
+  {
+    return (Compartment) getModel();
+  }
+
+  protected List getModelChildren()
+  {
+    List children = getCompartment().getChildren();
+    children.add(annotation);
+    return children;
+  }
+  
+  public void setModel(Object model)
+  {
+    super.setModel(model);
+    annotation.setCompartment(getCompartment());
+  }
+
+  protected void refreshChildren()
+  {
+    super.refreshChildren();
+    // ((AbstractGraphicalEditPart)getParent()).getContentPane().invalidate();
+  }
+
+  protected void refreshVisuals()
+  {
+    super.refreshVisuals();
+  }
+
+  public void addFeedback()
+  {
+    // getFigure().setBackgroundColor(ColorConstants.blue);
+    // ((CompartmentFigure)getFigure()).setBorderColor(ColorConstants.black);
+    getFigure().repaint();
+  }
+
+  public void removeFeedback()
+  {
+    // getFigure().setBackgroundColor(ColorConstants.lightBlue);
+    // ((CompartmentFigure)getFigure()).setBorderColor(ColorConstants.lightGray);
+    getFigure().repaint();
+  }
+  
+  public ICompartmentFigure getCompartmentFigure()
+  {
+    return (ICompartmentFigure)figure;
+  }
+
+  public void addNotify()
+  {  
+    super.addNotify();
+    getCompartmentFigure().editPartAttached(this);   
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/ComplexTypeEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/ComplexTypeEditPart.java
new file mode 100644
index 0000000..6445ee8
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/ComplexTypeEditPart.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.design.editparts;
+
+import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
+import org.eclipse.wst.xsd.adt.design.editparts.model.FocusTypeColumn;
+import org.eclipse.wst.xsd.adt.facade.IComplexType;
+import org.eclipse.wst.xsd.adt.facade.IType;
+
+public class ComplexTypeEditPart extends StructureEditPart
+{   
+  protected boolean shouldDrawConnection()
+  {
+    if (getParent().getModel() instanceof FocusTypeColumn)
+    {  
+      IComplexType complexType = (IComplexType)getModel();
+      return complexType.getSuperType() != null;
+    } 
+    return false;
+  }
+  
+  public TypeReferenceConnection createConnectionFigure()
+  {
+    TypeReferenceConnection connectionFigure = null;
+    IComplexType complexType = (IComplexType)getModel();
+    IType type = complexType.getSuperType();
+    if (type != null && type.isComplexType())
+    {      
+      AbstractGraphicalEditPart referenceTypePart = (AbstractGraphicalEditPart)getViewer().getEditPartRegistry().get(type);
+      if (referenceTypePart != null)
+      {
+        connectionFigure = new TypeReferenceConnection();
+        // draw a line out from the top         
+        connectionFigure.setSourceAnchor(new CenteredConnectionAnchor(getFigure(), CenteredConnectionAnchor.TOP, 1));
+        
+        // TODO (cs) need to draw the target anchor to look like a UML inheritance relationship
+        // adding a label to the connection would help to
+        connectionFigure.setTargetAnchor(new CenteredConnectionAnchor(referenceTypePart.getFigure(), CenteredConnectionAnchor.BOTTOM, 0, 0)); 
+        connectionFigure.setHighlight(false);
+      }
+    }    
+    return connectionFigure;
+  }
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/FieldEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/FieldEditPart.java
new file mode 100644
index 0000000..20d4377
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/FieldEditPart.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.design.editparts;
+
+
+public class FieldEditPart extends BaseFieldEditPart
+{
+  public void addNotify()
+  {
+    super.addNotify();
+    getFieldFigure().editPartAttached(this);
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/INamedEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/INamedEditPart.java
new file mode 100644
index 0000000..089b8b6
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/INamedEditPart.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.design.editparts;
+
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+
+public interface INamedEditPart
+{
+  public Label getNameLabelFigure();
+
+  public void performDirectEdit(Point cursorLocation);
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/RootContentEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/RootContentEditPart.java
new file mode 100644
index 0000000..a046556
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/RootContentEditPart.java
@@ -0,0 +1,140 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.design.editparts;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Panel;
+import org.eclipse.draw2d.ToolbarLayout;
+import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
+import org.eclipse.wst.xsd.adt.design.editparts.model.FocusTypeColumn;
+import org.eclipse.wst.xsd.adt.design.editparts.model.ReferencedTypeColumn;
+import org.eclipse.wst.xsd.adt.facade.IADTObject;
+import org.eclipse.wst.xsd.adt.facade.IComplexType;
+import org.eclipse.wst.xsd.adt.facade.IField;
+import org.eclipse.wst.xsd.adt.facade.IModel;
+import org.eclipse.wst.xsd.adt.facade.IStructure;
+import org.eclipse.wst.xsd.adt.facade.IType;
+import org.eclipse.wst.xsd.editor.internal.design.layouts.ContainerLayout;
+
+public class RootContentEditPart extends AbstractGraphicalEditPart
+{
+  List collections = null;
+  Figure contentPane;
+  
+  protected IFigure createFigure()
+  {    
+    Panel panel = new Panel();    
+    // why do we need to use a container layout? can we just set a
+    // margin border and get the same effect?
+    ContainerLayout clayout = new ContainerLayout();
+    clayout.setBorder(60);
+    panel.setLayoutManager(clayout);
+    
+    contentPane = new Figure();
+    panel.add(contentPane);
+        
+    ToolbarLayout layout = new ToolbarLayout(true);
+    layout.setStretchMinorAxis(false);
+    layout.setSpacing(100);
+    contentPane.setLayoutManager(layout);
+    return panel;
+  }
+  
+  public IFigure getContentPane()
+  {
+    return contentPane;
+  }
+  
+  
+  public IComplexType getSelectedComplexType()
+  {
+    IComplexType result = null;
+    IModel model = (IModel)getModel();
+    List types = model.getTypes();
+    if (types.size() > 0)
+    {
+      if (types.get(0) instanceof IComplexType) 
+        result = (IComplexType)types.get(0);
+    }  
+    return result;
+  }
+
+  protected void createEditPolicies()
+  {
+    // TODO Auto-generated method stub
+  }
+  
+  protected List getModelChildren()
+  { 
+    collections = new ArrayList();
+    if (getModel() != null)
+    {
+      Object obj = getModel();
+      IADTObject focusObject = null;
+      if (obj instanceof IStructure)
+      {
+        focusObject = (IStructure)obj;
+      }
+      else if (obj instanceof IField)
+      {
+        focusObject = (IField)obj;
+      }  
+      else if (obj instanceof IModel)
+      {
+        focusObject = getSelectedComplexType();
+      }
+      else if (obj instanceof IType)
+      {
+        if (((IType)obj).isFocusAllowed())
+        {
+          focusObject = (IType)obj;
+        }
+      }
+      if (focusObject != null)
+      {
+        collections.add(new FocusTypeColumn(focusObject));
+        collections.add(new ReferencedTypeColumn(focusObject));
+      }
+    }
+    return collections;
+  }
+  
+  public void setInput(Object component)
+  {
+    setModel(component);
+    refresh();
+  }
+  
+  public Object getInput()
+  {
+    return getModel();
+  }
+  
+  public void refresh()
+  {
+    super.refresh();
+    // the connections are not refreshed
+    for(Iterator i = getChildren().iterator(); i.hasNext(); )
+    {
+      Object obj = i.next();
+      if (obj instanceof AbstractGraphicalEditPart)
+      {
+        ((AbstractGraphicalEditPart)obj).refresh();
+      }
+    }
+
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/RootEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/RootEditPart.java
new file mode 100644
index 0000000..ba0fcbb
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/RootEditPart.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.design.editparts;
+
+import org.eclipse.draw2d.BendpointConnectionRouter;
+import org.eclipse.draw2d.ConnectionLayer;
+import org.eclipse.gef.LayerConstants;
+import org.eclipse.gef.editparts.ScalableRootEditPart;
+
+public class RootEditPart extends ScalableRootEditPart implements org.eclipse.gef.RootEditPart
+{  
+  public void activate()
+  {
+    super.activate();
+    // Set up Connection layer with a router, if it doesn't already have one
+    ConnectionLayer connectionLayer = (ConnectionLayer) getLayer(LayerConstants.CONNECTION_LAYER);
+    if (connectionLayer != null)
+    {  
+      connectionLayer.setConnectionRouter(new BendpointConnectionRouter());
+    }
+    refresh();
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/StructureEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/StructureEditPart.java
new file mode 100644
index 0000000..0189d58
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/StructureEditPart.java
@@ -0,0 +1,197 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.design.editparts;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.RequestConstants;
+import org.eclipse.gef.requests.LocationRequest;
+import org.eclipse.gef.ui.actions.ActionRegistry;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.wst.xsd.adt.actions.SetInputToGraphView;
+import org.eclipse.wst.xsd.adt.design.editparts.model.Compartment;
+import org.eclipse.wst.xsd.adt.design.editpolicies.ADTDirectEditPolicy;
+import org.eclipse.wst.xsd.adt.design.editpolicies.ADTSelectionFeedbackEditPolicy;
+import org.eclipse.wst.xsd.adt.design.figures.IStructureFigure;
+import org.eclipse.wst.xsd.adt.facade.IStructure;
+import org.eclipse.wst.xsd.editor.internal.adapters.XSDComplexTypeDefinitionAdapter;
+import org.eclipse.wst.xsd.ui.common.actions.OpenInNewEditor;
+import org.eclipse.xsd.XSDComplexTypeDefinition;
+import org.eclipse.xsd.XSDSchema;
+
+public class StructureEditPart extends BaseTypeConnectingEditPart implements INamedEditPart
+{  
+  protected List compartmentList = null;
+  protected ADTDirectEditPolicy adtDirectEditPolicy = new ADTDirectEditPolicy();
+
+  /**
+   * TODO cs... I'm sure this has something to do with the way we wanted to rework compartment creation
+   * I suppose we could have subclasses override this method instead of getModelChildren()
+   * 
+   * @deprecated
+   */
+  protected Compartment[] getCompartments()
+  {
+    return null;
+  }
+  
+  protected IFigure createFigure()
+  {
+    IStructureFigure figure = getFigureFactory().createStructureFigure(getModel());
+    return figure;
+  }
+  
+  public IStructureFigure getStructureFigure()
+  {
+    return (IStructureFigure)getFigure();
+  }
+  
+  public IFigure getContentPane()
+  {
+    return getStructureFigure().getContentPane();
+  }
+  
+  
+  protected void createEditPolicies()
+  {
+    installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new ADTSelectionFeedbackEditPolicy());
+    installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, adtDirectEditPolicy);
+  }
+  
+  protected IStructure getStructure()
+  {
+    return (IStructure)getModel();
+  }
+  
+  protected List getModelChildren()
+  {
+    if (compartmentList == null)
+    {
+      compartmentList = new ArrayList();
+      
+      // TODO.. this needs to be moved to the xsd specific version of this class 
+      compartmentList.add(new Compartment(getStructure(), "attribute"));
+      compartmentList.add(new Compartment(getStructure(), "element"));   
+    }  
+    return compartmentList;
+  }
+  
+  protected void refreshChildren()
+  {   
+    super.refreshChildren();
+    //getFigure().invalidateTree();    
+  }
+  
+  protected void refreshVisuals()
+  {
+    super.refreshVisuals();
+    getStructureFigure().refreshVisuals(getModel());
+  }
+  
+  public void addFeedback()
+  {
+    getStructureFigure().addSelectionFeedback();
+    super.addFeedback();
+  }
+  
+  public void removeFeedback()
+  {
+    getStructureFigure().removeSelectionFeedback();
+    super.removeFeedback();    
+  }
+
+  public Label getNameLabelFigure()
+  {
+    return getStructureFigure().getNameLabel();
+  }
+
+  public void performDirectEdit(Point cursorLocation)
+  {
+    
+  }
+
+  public void performRequest(Request request)
+  {  
+    if (request.getType() == RequestConstants.REQ_DIRECT_EDIT ||
+        request.getType() == RequestConstants.REQ_OPEN)
+    {
+      
+      Object model = getModel();
+      if (request instanceof LocationRequest)
+      {
+        LocationRequest locationRequest = (LocationRequest)request;
+        Point p = locationRequest.getLocation();
+// uncomment for direct edit of name (add else)
+//        if (hitTest(getNameLabelFigure(), p))
+//        {
+//          LabelEditManager manager = new LabelEditManager(this, new LabelCellEditorLocator(this, p));
+//          NameUpdateCommandWrapper wrapper = new NameUpdateCommandWrapper();
+//          adtDirectEditPolicy.setUpdateCommand(wrapper);
+//          manager.show();
+//        }
+       
+         
+        if (getStructureFigure().hitTestHeader(p))
+        {          
+          // TODO: !!! This should be moved to the adt-xsd package
+          // 
+          if (model instanceof XSDComplexTypeDefinitionAdapter)     
+          {
+            XSDComplexTypeDefinitionAdapter adapter = (XSDComplexTypeDefinitionAdapter)model;
+            XSDComplexTypeDefinition ct = (XSDComplexTypeDefinition)adapter.getTarget();
+            IWorkbench workbench = PlatformUI.getWorkbench();
+            IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
+            IEditorPart editorPart = workbenchWindow.getActivePage().getActiveEditor();
+            Object schema = editorPart.getAdapter(XSDSchema.class);
+            ActionRegistry registry = getEditorActionRegistry(editorPart);
+            if (registry != null)
+            {
+              if (schema == ct.getSchema())
+              {
+                IAction action = registry.getAction(SetInputToGraphView.ID);
+                action.run();
+              }
+              else
+              {
+                IAction action = registry.getAction(OpenInNewEditor.ID);
+                action.run();
+              }
+            }
+          }          
+        }
+      }
+    }
+  }
+  
+  protected ActionRegistry getEditorActionRegistry(IEditorPart editor)
+  {
+    return (ActionRegistry) editor.getAdapter(ActionRegistry.class);
+  }
+  
+  protected boolean shouldDrawConnection()
+  {
+    return false;
+  }
+  
+  public TypeReferenceConnection createConnectionFigure()
+  {
+    return null;
+  }
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/TopLevelFieldEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/TopLevelFieldEditPart.java
new file mode 100644
index 0000000..901f420
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/TopLevelFieldEditPart.java
@@ -0,0 +1,105 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.design.editparts;
+
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.RequestConstants;
+import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
+import org.eclipse.gef.requests.LocationRequest;
+import org.eclipse.wst.xsd.adt.design.directedit.LabelCellEditorLocator;
+import org.eclipse.wst.xsd.adt.design.directedit.LabelEditManager;
+import org.eclipse.wst.xsd.adt.design.editpolicies.ADTDirectEditPolicy;
+import org.eclipse.wst.xsd.adt.design.editpolicies.ADTSelectionFeedbackEditPolicy;
+import org.eclipse.wst.xsd.adt.facade.IField;
+import org.eclipse.wst.xsd.adt.facade.IType;
+import org.eclipse.wst.xsd.adt.typeviz.design.figures.BoxFigure;
+
+public class TopLevelFieldEditPart extends BoxEditPart implements INamedEditPart
+{
+  protected ADTDirectEditPolicy adtDirectEditPolicy = new ADTDirectEditPolicy();
+  
+  protected boolean shouldDrawConnection()
+  {
+    IField field = (IField)getModel();
+    IType type = field.getType();
+    return (type != null && type.isComplexType());
+  }
+  
+  public TypeReferenceConnection createConnectionFigure()
+  {
+    TypeReferenceConnection connectionFigure = null;
+    IField field = (IField)getModel();
+    IType type = field.getType();
+    if (type != null && type.isComplexType())
+    {      
+      AbstractGraphicalEditPart referenceTypePart = (AbstractGraphicalEditPart)getViewer().getEditPartRegistry().get(type);
+      if (referenceTypePart != null)
+      {
+        connectionFigure = new TypeReferenceConnection();   
+        connectionFigure.setSourceAnchor(new CenteredConnectionAnchor(getFigure(), CenteredConnectionAnchor.RIGHT, 5));
+        int targetAnchorYOffset = 16;        
+        connectionFigure.setTargetAnchor(new CenteredConnectionAnchor(referenceTypePart.getFigure(), CenteredConnectionAnchor.HEADER_LEFT, 0, targetAnchorYOffset)); 
+        connectionFigure.setHighlight(false);
+      }
+    }    
+    return connectionFigure;
+  }  
+  
+  protected void createEditPolicies()
+  {
+    super.createEditPolicies();
+    installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, adtDirectEditPolicy);
+    installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new ADTSelectionFeedbackEditPolicy());
+  }
+
+  protected void refreshVisuals()
+  {
+    IField field = (IField)getModel();
+    BoxFigure boxFigure = (BoxFigure)getFigure();
+    boxFigure.getNameLabel().setText(field.getName());
+    super.refreshVisuals();
+  }
+  
+  public Label getNameLabelFigure()
+  {
+    BoxFigure boxFigure = (BoxFigure)getFigure();
+    return boxFigure.getNameLabel();
+  }
+
+  public void performDirectEdit(Point cursorLocation)
+  {
+   
+  }
+  
+  public void performRequest(Request request)
+  {  
+    if (request.getType() == RequestConstants.REQ_DIRECT_EDIT||
+        request.getType() == RequestConstants.REQ_OPEN)
+    {
+      if (request instanceof LocationRequest)
+      {
+        LocationRequest locationRequest = (LocationRequest)request;
+        Point p = locationRequest.getLocation();
+       
+        if (hitTest(getNameLabelFigure(), p))
+        {
+          LabelEditManager manager = new LabelEditManager(this, new LabelCellEditorLocator(this, p));
+          NameUpdateCommandWrapper wrapper = new NameUpdateCommandWrapper();
+          adtDirectEditPolicy.setUpdateCommand(wrapper);
+          manager.show();
+        }
+      }
+    }
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/TypeReferenceConnection.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/TypeReferenceConnection.java
new file mode 100644
index 0000000..d4eef12
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/TypeReferenceConnection.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.design.editparts;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.ConnectionRouter;
+import org.eclipse.draw2d.ManhattanConnectionRouter;
+import org.eclipse.draw2d.PolygonDecoration;
+import org.eclipse.draw2d.PolylineConnection;
+import org.eclipse.swt.graphics.Color;
+
+public class TypeReferenceConnection extends PolylineConnection
+{
+  protected boolean highlight = false;
+  protected static final Color activeConnection = ColorConstants.black;
+  protected static final Color inactiveConnection = new Color(null, 198, 195, 198);
+
+  /**
+   * Default constructor
+   */
+  public TypeReferenceConnection()
+  {
+    super();
+    setTargetDecoration(new PolygonDecoration());
+  }
+  
+  
+
+  public void setConnectionRouter(ConnectionRouter cr)
+  {
+    if (cr != null && getConnectionRouter() != null && !(getConnectionRouter() instanceof ManhattanConnectionRouter))
+      super.setConnectionRouter(cr);
+  }
+
+  /**
+   * @return Returns the current highlight status.
+   */
+  public boolean isHighlighted()
+  {
+    return highlight;
+  }
+
+  /**
+   * @param highlight
+   *          The highlight to set.
+   */
+  public void setHighlight(boolean highlight)
+  {
+    this.highlight = highlight;
+    // Update our connection to use the correct colouring
+    setForegroundColor(highlight ? activeConnection : inactiveConnection);
+    setOpaque(highlight);
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/model/AbstractModelCollection.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/model/AbstractModelCollection.java
new file mode 100644
index 0000000..37d1e33
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/model/AbstractModelCollection.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.design.editparts.model;
+
+import java.util.List;
+import org.eclipse.wst.xsd.adt.facade.IADTObject;
+import org.eclipse.wst.xsd.adt.facade.IADTObjectListener;
+
+public abstract class AbstractModelCollection implements IADTObject
+{
+  IADTObject model;
+  String kind;
+  
+  public AbstractModelCollection(IADTObject model, String kind)
+  {
+    this.model = model;
+    this.kind = kind;
+  }
+
+  public Object getModel()
+  {
+    return model;
+  }
+
+  public void setModel(IADTObject model)
+  {
+    this.model = model;
+  }
+
+  public String getKind()
+  {
+    return kind;
+  }
+
+  public void setKind(String kind)
+  {
+    this.kind = kind;
+  }
+  
+  public abstract List getChildren();
+
+  public void registerListener(IADTObjectListener listener)
+  {
+    model.registerListener(listener);
+  }
+
+  public void unregisterListener(IADTObjectListener listener)
+  {
+    model.unregisterListener(listener);
+  }   
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/model/Annotation.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/model/Annotation.java
new file mode 100644
index 0000000..fee40af
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/model/Annotation.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.design.editparts.model;
+
+import org.eclipse.wst.xsd.adt.facade.IStructure;
+
+public class Annotation
+{
+  Compartment compartment;
+  public Annotation()
+  {
+    super();
+  }
+  
+  public void setCompartment(Compartment compartment)
+  {
+    this.compartment = compartment;
+  }
+  
+  public Compartment getCompartment()
+  {
+    return compartment;
+  }
+  
+  public IStructure getOwner()
+  {
+    return compartment.getOwner();
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/model/Compartment.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/model/Compartment.java
new file mode 100644
index 0000000..6de4ff2
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/model/Compartment.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.design.editparts.model;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.wst.xsd.adt.facade.IADTObject;
+import org.eclipse.wst.xsd.adt.facade.IADTObjectListener;
+import org.eclipse.wst.xsd.adt.facade.IField;
+import org.eclipse.wst.xsd.adt.facade.IStructure;
+
+public class Compartment implements IADTObject
+{
+  String kind;
+  IStructure owner;
+
+  public Compartment(IStructure owner, String kind)
+  {
+    this.kind = kind;
+    this.owner = owner;
+  }
+
+  public List getChildren()
+  {
+    List list = new ArrayList();
+    for (Iterator i = owner.getFields().iterator(); i.hasNext();)
+    {
+      IField field = (IField) i.next();
+      if (kind == null || kind.equals(field.getKind()))
+      {
+        list.add(field);
+      }
+    }
+    return list;
+  }
+
+  public String getKind()
+  {
+    return kind;
+  }
+  
+  public IStructure getOwner()
+  {
+    return owner;
+  }
+
+  public void registerListener(IADTObjectListener listener)
+  {
+    // really we want to listen to the owner
+    owner.registerListener(listener);
+  }
+
+  public void unregisterListener(IADTObjectListener listener)
+  {
+    // really we want to listen to the owner
+    owner.unregisterListener(listener);
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/model/FocusTypeColumn.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/model/FocusTypeColumn.java
new file mode 100644
index 0000000..81272c3
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/model/FocusTypeColumn.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.design.editparts.model;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.wst.xsd.adt.facade.IADTObject;
+import org.eclipse.wst.xsd.adt.facade.IField;
+import org.eclipse.wst.xsd.adt.facade.IStructure;
+import org.eclipse.wst.xsd.adt.facade.IType;
+
+public class FocusTypeColumn extends AbstractModelCollection
+{  
+  public FocusTypeColumn(IADTObject model)
+  {
+    super(model, "FocusTypeColumn");
+  }
+
+  public List getChildren()
+  {
+    List result = new ArrayList();  
+    if (model instanceof IType)
+    {
+      IType type = (IType)model;
+      if (type.getSuperType() != null)
+      {  
+        result.add(type.getSuperType());
+      }
+      result.add(type);
+    }  
+    else if (model instanceof IField ||
+             model instanceof IStructure)
+    {   
+      result.add(model);
+    }       
+    return result;       
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/model/IActionProvider.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/model/IActionProvider.java
new file mode 100644
index 0000000..46d812c
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/model/IActionProvider.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.design.editparts.model;
+
+
+
+public interface IActionProvider
+{
+  public String[] getActions(Object object);
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/model/IFeedbackHandler.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/model/IFeedbackHandler.java
new file mode 100644
index 0000000..a8f6ca3
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/model/IFeedbackHandler.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.design.editparts.model;
+
+public interface IFeedbackHandler
+{
+  public void addFeedback();
+  public void removeFeedback();
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/model/ReferencedTypeColumn.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/model/ReferencedTypeColumn.java
new file mode 100644
index 0000000..761a59a
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editparts/model/ReferencedTypeColumn.java
@@ -0,0 +1,132 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.design.editparts.model;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.wst.xsd.adt.facade.IADTObject;
+import org.eclipse.wst.xsd.adt.facade.IADTObjectListener;
+import org.eclipse.wst.xsd.adt.facade.IField;
+import org.eclipse.wst.xsd.adt.facade.IStructure;
+import org.eclipse.wst.xsd.adt.facade.IType;
+
+public class ReferencedTypeColumn extends AbstractModelCollection
+{
+  List listenerList = new ArrayList();
+  InternalListener internalListener = new InternalListener();
+  
+  // todo... really this this model object should listen
+  // to the parent of the IType
+  //
+  public ReferencedTypeColumn(IADTObject model)
+  {
+    super(model, "ReferencedTypeColumn");
+    model.registerListener(internalListener);
+    internalListener.recomputeSubListeners();
+  }
+
+  public List getChildren()
+  {
+    List result = new ArrayList();  
+    if (model instanceof IStructure)
+    {
+      IStructure structure = (IStructure)model;
+      for (Iterator i = structure.getFields().iterator(); i.hasNext(); )
+      {
+        IField field = (IField)i.next();
+        IType type = field.getType();
+        if (type != null)  // && type.isComplexType())
+        {
+          if (!result.contains(type))
+          {
+            if (type.isFocusAllowed())
+              result.add(type);
+          }  
+        }  
+      }        
+    }  
+    else if (model instanceof IField)
+    {
+      IField field = (IField)model;
+      IType type = field.getType();
+      if (type != null) //  && type.isComplexType())
+      {
+        if (type.isFocusAllowed())
+          result.add(type);        
+      }
+    }  
+    return result;
+  }  
+  
+  public void registerListener(IADTObjectListener listener)
+  {
+    listenerList.add(listener);
+  }
+
+  public void unregisterListener(IADTObjectListener listener)
+  {
+    listenerList.remove(listener);
+  }   
+  
+  protected void notifyListeners(Object changedObject, String property)
+  {
+    List clonedListenerList = new ArrayList();
+    clonedListenerList.addAll(listenerList);
+    for (Iterator i = clonedListenerList.iterator(); i.hasNext(); )
+    {
+      IADTObjectListener listener = (IADTObjectListener)i.next();
+      listener.propertyChanged(this, null);
+    } 
+  }   
+  
+  protected class InternalListener implements IADTObjectListener
+  {
+    List fields = new ArrayList();
+
+    void recomputeSubListeners()
+    {
+      if (model instanceof IStructure)
+      {  
+        // remove old ones
+        for (Iterator i = fields.iterator(); i.hasNext();)
+        {
+          IField field = (IField) i.next();
+          field.unregisterListener(this);
+        }
+        // add new ones
+        fields.clear();
+        IStructure complexType = (IStructure) model;
+        for (Iterator i = complexType.getFields().iterator(); i.hasNext();)
+        {
+          IField field = (IField) i.next();
+          fields.add(field);
+          field.registerListener(this);
+        }
+      }
+    }
+
+    public void propertyChanged(Object object, String property)
+    {
+      if (object == model)
+      {
+        // we need to update the fields we're listening too
+        // since these may have changed
+        recomputeSubListeners();
+      }
+      else if (object instanceof IField)
+      {
+        System.out.println("field changed!!! " + fields.size() + " " + object);
+      }  
+      notifyListeners(object, property);
+    }
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editpolicies/ADTDirectEditPolicy.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editpolicies/ADTDirectEditPolicy.java
new file mode 100644
index 0000000..d06be2d
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editpolicies/ADTDirectEditPolicy.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.design.editpolicies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.DirectEditPolicy;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.wst.xsd.adt.design.directedit.ComboBoxCellEditorManager;
+
+public class ADTDirectEditPolicy extends DirectEditPolicy
+{
+  protected ComboBoxCellEditorManager delegate;
+  protected IADTUpdateCommand command;
+
+  public ADTDirectEditPolicy()
+  {
+    super();
+  }
+
+  
+  public void setUpdateCommand(IADTUpdateCommand command)
+  {
+    this.command = command;
+  }
+  
+  protected void showCurrentEditValue(DirectEditRequest request) 
+  {      
+    getHostFigure().getUpdateManager().performUpdate();
+  }
+
+  protected Command getDirectEditCommand(DirectEditRequest request)
+  {
+    command.setRequest(request);
+    return (Command)command; 
+  }
+
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editpolicies/ADTSelectionFeedbackEditPolicy.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editpolicies/ADTSelectionFeedbackEditPolicy.java
new file mode 100644
index 0000000..4d391fb
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editpolicies/ADTSelectionFeedbackEditPolicy.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.design.editpolicies;
+
+import org.eclipse.gef.editpolicies.SelectionEditPolicy;
+import org.eclipse.wst.xsd.adt.design.editparts.model.IFeedbackHandler;
+
+public class ADTSelectionFeedbackEditPolicy extends SelectionEditPolicy
+{
+
+  public ADTSelectionFeedbackEditPolicy()
+  {
+    super();
+  }
+
+  protected void hideSelection()
+  {
+    if (getHost() instanceof IFeedbackHandler)
+    {
+      ((IFeedbackHandler) getHost()).removeFeedback();
+    }
+  }
+
+  protected void showSelection()
+  {
+    if (getHost() instanceof IFeedbackHandler)
+    {
+      ((IFeedbackHandler) getHost()).addFeedback();
+    }
+  }
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editpolicies/DirectEditPolicyDelegate.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editpolicies/DirectEditPolicyDelegate.java
new file mode 100644
index 0000000..d4b33a1
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editpolicies/DirectEditPolicyDelegate.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.design.editpolicies;
+   
+import org.eclipse.jface.viewers.CellEditor;
+
+public interface DirectEditPolicyDelegate
+{       
+  public void performEdit(CellEditor cellEditor);  
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editpolicies/IADTUpdateCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editpolicies/IADTUpdateCommand.java
new file mode 100644
index 0000000..56d9092
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editpolicies/IADTUpdateCommand.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.design.editpolicies;
+
+import org.eclipse.gef.requests.DirectEditRequest;
+
+public interface IADTUpdateCommand
+{
+  void setRequest(DirectEditRequest request);
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editpolicies/SimpleDirectEditPolicy.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editpolicies/SimpleDirectEditPolicy.java
new file mode 100644
index 0000000..9363426
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/editpolicies/SimpleDirectEditPolicy.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.design.editpolicies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.DirectEditPolicy;
+import org.eclipse.gef.requests.DirectEditRequest;
+                                   
+public class SimpleDirectEditPolicy extends DirectEditPolicy 
+{
+  protected DirectEditPolicyDelegate delegate;
+
+  public void setDelegate(DirectEditPolicyDelegate delegate)
+  {                                           
+    this.delegate = delegate;
+  }
+
+  protected org.eclipse.gef.commands.Command getDirectEditCommand(final DirectEditRequest request) 
+  { 
+  	return new Command() //AbstractCommand()
+    {
+      public void execute()
+      {                       
+        if (delegate != null)
+        {
+          delegate.performEdit(request.getCellEditor());
+        }  
+      }     
+  
+      public void redo()
+      {
+      }  
+  
+      public void undo()
+      {
+      }     
+  
+      public boolean canExecute()
+      {
+        return true;
+      }
+    };
+  }
+  
+  protected void showCurrentEditValue(DirectEditRequest request) 
+  {      
+  	//hack to prevent async layout from placing the cell editor twice.
+  	getHostFigure().getUpdateManager().performUpdate();
+  }
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/figures/IADTFigure.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/figures/IADTFigure.java
new file mode 100644
index 0000000..ce7b14b
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/figures/IADTFigure.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.design.figures;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.gef.EditPart;
+
+public interface IADTFigure extends IFigure
+{
+  void editPartAttached(EditPart owner); 
+  void addSelectionFeedback();
+  void removeSelectionFeedback();
+  void refreshVisuals(Object model);
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/figures/ICompartmentFigure.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/figures/ICompartmentFigure.java
new file mode 100644
index 0000000..9eff72f
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/figures/ICompartmentFigure.java
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.design.figures;
+
+import org.eclipse.draw2d.IFigure;
+
+public interface ICompartmentFigure extends IADTFigure
+{
+  IFigure getContentPane();
+  IFigure getAnnotationPane();  
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/figures/IFieldFigure.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/figures/IFieldFigure.java
new file mode 100644
index 0000000..d310271
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/figures/IFieldFigure.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.design.figures;
+
+import org.eclipse.draw2d.Label;
+
+
+public interface IFieldFigure extends IADTFigure
+{
+  Label getTypeLabel();
+  Label getNameLabel();
+  Label getNameAnnotationLabel();
+  Label getTypeAnnotationLabel();
+  void recomputeLayout();
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/figures/IFigureFactory.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/figures/IFigureFactory.java
new file mode 100644
index 0000000..893222b
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/figures/IFigureFactory.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.design.figures;
+
+public interface IFigureFactory
+{
+  IFieldFigure createFieldFigure(Object model);
+  IStructureFigure createStructureFigure(Object model);
+  ICompartmentFigure createCompartmentFigure(Object model);
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/figures/IStructureFigure.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/figures/IStructureFigure.java
new file mode 100644
index 0000000..7e7cbc5
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/design/figures/IStructureFigure.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.design.figures;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+
+public interface IStructureFigure extends IADTFigure
+{
+  IFigure getContentPane();
+  Label getNameLabel();
+  boolean hitTestHeader(Point point);  
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/edit/ComponentReferenceEditManager.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/edit/ComponentReferenceEditManager.java
new file mode 100644
index 0000000..21b9ded
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/edit/ComponentReferenceEditManager.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.edit;
+
+import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification;
+import org.eclipse.wst.common.ui.internal.search.dialogs.IComponentDescriptionProvider;
+
+public interface ComponentReferenceEditManager
+{
+  public IComponentDialog getBrowseDialog();
+  public IComponentDialog getNewDialog();
+  public void modifyComponentReference(Object referencingObject, ComponentSpecification referencedComponent);
+  public IComponentDescriptionProvider getComponentDescriptionProvider();
+  
+  public ComponentSpecification[] getQuickPicks();
+  public ComponentSpecification[] getHistory();
+  public void addToHistory(ComponentSpecification component);  
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/edit/IComponentDialog.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/edit/IComponentDialog.java
new file mode 100644
index 0000000..f18e8f0
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/edit/IComponentDialog.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.edit;
+
+import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification;
+
+public interface IComponentDialog  {
+  
+	/*
+	 * Set the Object being set
+	 */
+	public void setInitialSelection(ComponentSpecification componentSpecification);
+	
+	/*
+	 * Return the Object which should be used as the type.
+	 */
+	public ComponentSpecification getSelectedComponent();
+	
+	/*
+	 * Used to open the Dialog
+	 */
+	public int createAndOpen();
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/editor/ADTMultiPageEditor.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/editor/ADTMultiPageEditor.java
new file mode 100644
index 0000000..80e75d9
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/editor/ADTMultiPageEditor.java
@@ -0,0 +1,421 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.editor;
+
+import java.util.ArrayList;
+import java.util.EventObject;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.gef.DefaultEditDomain;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.GraphicalViewer;
+import org.eclipse.gef.LayerConstants;
+import org.eclipse.gef.MouseWheelHandler;
+import org.eclipse.gef.MouseWheelZoomHandler;
+import org.eclipse.gef.commands.CommandStack;
+import org.eclipse.gef.commands.CommandStackListener;
+import org.eclipse.gef.editparts.ZoomManager;
+import org.eclipse.gef.ui.actions.ActionRegistry;
+import org.eclipse.gef.ui.actions.UpdateAction;
+import org.eclipse.gef.ui.actions.ZoomInAction;
+import org.eclipse.gef.ui.actions.ZoomOutAction;
+import org.eclipse.gef.ui.parts.SelectionSynchronizer;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.ide.IDE;
+import org.eclipse.ui.part.MultiPageEditorPart;
+import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor;
+import org.eclipse.wst.xsd.adt.actions.BaseSelectionAction;
+import org.eclipse.wst.xsd.adt.actions.SetInputToGraphView;
+import org.eclipse.wst.xsd.adt.design.DesignViewGraphicalViewer;
+import org.eclipse.wst.xsd.adt.design.editparts.ADTEditPartFactory;
+import org.eclipse.wst.xsd.adt.design.editparts.RootEditPart;
+import org.eclipse.wst.xsd.adt.facade.IModel;
+import org.eclipse.wst.xsd.adt.outline.ADTContentOutlinePage;
+import org.eclipse.wst.xsd.adt.outline.ADTContentOutlineProvider;
+import org.eclipse.wst.xsd.adt.outline.ADTLabelProvider;
+
+/**
+ * </ul>
+ * <li>page 0 graph
+ * <li>page 1 source
+ * </ul>
+ */
+public abstract class ADTMultiPageEditor extends MultiPageEditorPart implements IResourceChangeListener, CommandStackListener, ITabbedPropertySheetPageContributor
+{
+  protected IContentOutlinePage fOutlinePage;
+  protected long lastModificationStamp;
+  protected DesignViewGraphicalViewer graphicalViewer;
+  
+  protected IModel model;
+  private DefaultEditDomain editDomain;
+  private SelectionSynchronizer synchronizer;
+  private ActionRegistry actionRegistry;
+  private List selectionActions = new ArrayList();
+  private List stackActions = new ArrayList();
+  private List propertyActions = new ArrayList();
+  protected ADTSelectionManager selectionManager;
+
+  /**
+   * Creates a multi-page editor example.
+   */
+  public ADTMultiPageEditor()
+  {
+    super();
+    DefaultEditDomain defaultGEFEditDomain = new DefaultEditDomain(this);
+    setEditDomain(defaultGEFEditDomain);
+  }
+
+  public String getContributorId()
+  {
+    return "org.eclipse.wst.xsd.editor";
+  }
+  
+  
+  public ADTSelectionManager getSelectionManager()
+  {
+    if (selectionManager == null)
+    {
+      selectionManager = new ADTSelectionManager(this);
+    }
+    return selectionManager;
+  }
+
+  protected void createGraphPage()
+  {
+    Composite parent = new Composite(getContainer(), SWT.NONE);
+    parent.setLayout(new FillLayout());
+
+    graphicalViewer = new DesignViewGraphicalViewer(this, getSelectionProvider());//getSelectionManager(), xsdModelAdapterFactory);
+    graphicalViewer.createControl(parent);
+    getEditDomain().addViewer(graphicalViewer);
+    
+    configureGraphicalViewer();
+    hookGraphicalViewer();
+    initializeGraphicalViewer();
+    int index = addPage(parent);
+    setPageText(index, "Design");
+  }
+
+  protected ADTSelectionManager selectionProvider;
+  public ADTSelectionManager getSelectionProvider()
+  {
+    return selectionProvider;
+  }
+  
+  /**
+   * Creates the pages of the multi-page editor.
+   */
+  protected void createPages()
+  {
+    model = buildModel((IFileEditorInput)getEditorInput());
+    
+    selectionProvider = getSelectionManager();
+    getEditorSite().setSelectionProvider(selectionProvider);
+    
+    createGraphPage();
+  }
+
+  /**
+   * The <code>MultiPageEditorPart</code> implementation of this
+   * <code>IWorkbenchPart</code> method disposes all nested editors.
+   * Subclasses may extend.
+   */
+  public void dispose()
+  {
+    getCommandStack().removeCommandStackListener(this);
+    ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
+    getActionRegistry().dispose();
+    super.dispose();
+  }
+
+  /**
+   * Saves the multi-page editor's document.
+   */
+  public void doSave(IProgressMonitor monitor)
+  {
+    getEditor(1).doSave(monitor); 
+    getCommandStack().markSaveLocation();
+  }
+
+  /**
+   * Saves the multi-page editor's document as another file. Also updates the
+   * text for page 0's tab, and updates this multi-page editor's input to
+   * correspond to the nested editor's.
+   */
+  public void doSaveAs()
+  {
+    IEditorPart editor = getEditor(0);
+    editor.doSaveAs();
+    setPageText(0, editor.getTitle());
+    setInput(editor.getEditorInput());
+  }
+
+  /*
+   * (non-Javadoc) Method declared on IEditorPart
+   */
+  public void gotoMarker(IMarker marker)
+  {
+    setActivePage(0);
+    IDE.gotoMarker(getEditor(0), marker);
+  }
+
+  /**
+   * The <code>MultiPageEditorExample</code> implementation of this method
+   * checks that the input is an instance of <code>IFileEditorInput</code>.
+   */
+  public void init(IEditorSite site, IEditorInput editorInput) throws PartInitException
+  {
+    if (!(editorInput instanceof IFileEditorInput))
+      throw new PartInitException("Invalid Input: Must be IFileEditorInput");
+    super.init(site, editorInput);
+    
+    getCommandStack().addCommandStackListener(this);
+    initializeActionRegistry();
+    
+    String title = null;
+    if (getEditorInput() != null) {
+      title = getEditorInput().getName();
+    }
+    setPartName(title);
+  }
+
+  /*
+   * (non-Javadoc) Method declared on IEditorPart.
+   */
+  public boolean isSaveAsAllowed()
+  {
+    return true;
+  }
+
+  /**
+   * Calculates the contents of page 2 when the it is activated.
+   */
+  protected void pageChange(int newPageIndex)
+  {
+    super.pageChange(newPageIndex);
+    if (newPageIndex == 1)
+    {
+    }
+  }
+
+  abstract public IModel buildModel(IFileEditorInput editorInput);
+  
+  protected void initializeActionRegistry()
+  {
+    createActions();
+  }
+
+  protected void createActions()
+  {
+    ActionRegistry registry = getActionRegistry();
+    
+    BaseSelectionAction action = new SetInputToGraphView(this);
+    action.setSelectionProvider(getSelectionManager());
+    registry.registerAction(action);
+  }
+
+
+  public IModel getModel()
+  {
+    return model;
+  }
+
+  //protected XSDModelAdapterFactoryImpl xsdModelAdapterFactory;
+  //protected XSDAdapterFactoryLabelProvider adapterFactoryLabelProvider;
+
+  public Object getAdapter(Class type)
+  {
+    Object result = null;
+    if (type == ZoomManager.class)
+      return graphicalViewer.getProperty(ZoomManager.class.toString());
+    
+    if (type == ISelectionProvider.class)
+    {
+      result = getSelectionManager();
+    }    
+    /*
+    if (type == org.eclipse.ui.views.properties.IPropertySheetPage.class)
+    {
+      // PropertySheetPage page = new PropertySheetPage();
+      // page.setRootEntry(new UndoablePropertySheetEntry(getCommandStack()));
+      XSDTabbedPropertiesPage page = new XSDTabbedPropertiesPage(this);
+      return page;
+    }*/
+    if (type == GraphicalViewer.class)
+      return graphicalViewer;
+    if (type == CommandStack.class)
+      return getCommandStack();
+    if (type == ActionRegistry.class)
+      return getActionRegistry();
+    if (type == EditPart.class && graphicalViewer != null)
+      return graphicalViewer.getRootEditPart();
+    if (type == IFigure.class && graphicalViewer != null)
+      return ((GraphicalEditPart) graphicalViewer.getRootEditPart()).getFigure();
+
+    if (type == IContentOutlinePage.class)
+    {
+      if (fOutlinePage == null || fOutlinePage.getControl() == null || fOutlinePage.getControl().isDisposed())
+      {
+        ADTContentOutlinePage outlinePage = new ADTContentOutlinePage(this);
+        ADTContentOutlineProvider adtContentProvider = new ADTContentOutlineProvider();
+        outlinePage.setContentProvider(adtContentProvider);
+        ADTLabelProvider adtLabelProvider = new ADTLabelProvider();
+        outlinePage.setLabelProvider(adtLabelProvider);
+        outlinePage.setModel(getModel());
+        
+        fOutlinePage = outlinePage;
+      }
+      return fOutlinePage;
+    }
+
+    return super.getAdapter(type);
+  }
+
+  protected DefaultEditDomain getEditDomain()
+  {
+    return editDomain;
+  }
+
+
+  protected void configureGraphicalViewer()
+  {
+    graphicalViewer.getControl().setBackground(ColorConstants.listBackground);
+
+    // Set the root edit part
+    // ScalableFreeformRootEditPart root = new ScalableFreeformRootEditPart();
+    RootEditPart root = new RootEditPart();
+
+    List zoomLevels = new ArrayList(3);
+    zoomLevels.add(ZoomManager.FIT_ALL);
+    zoomLevels.add(ZoomManager.FIT_WIDTH);
+    zoomLevels.add(ZoomManager.FIT_HEIGHT);
+    root.getZoomManager().setZoomLevelContributions(zoomLevels);
+
+    IAction zoomIn = new ZoomInAction(root.getZoomManager());
+    IAction zoomOut = new ZoomOutAction(root.getZoomManager());
+    getActionRegistry().registerAction(zoomIn);
+    getActionRegistry().registerAction(zoomOut);
+
+    getSite().getKeyBindingService().registerAction(zoomIn);
+    getSite().getKeyBindingService().registerAction(zoomOut);
+
+    //ConnectionLayer connectionLayer = (ConnectionLayer) root.getLayer(LayerConstants.CONNECTION_LAYER);
+    //connectionLayer.setConnectionRouter(new BendpointConnectionRouter());
+    IFigure feedbackLayer = root.getLayer(LayerConstants.FEEDBACK_LAYER);
+
+    //connectionLayer.setConnectionRouter(new ShortestPathConnectionRouter(connectionLayer));
+    // connectionLayer.setVisible(false);
+
+    // Zoom
+    ZoomManager manager = (ZoomManager) graphicalViewer.getProperty(ZoomManager.class.toString());
+    if (manager != null)
+      manager.setZoom(1.0);
+    // Scroll-wheel Zoom
+    graphicalViewer.setProperty(MouseWheelHandler.KeyGenerator.getKey(SWT.CTRL), MouseWheelZoomHandler.SINGLETON);
+
+    
+    
+    graphicalViewer.setRootEditPart(root);
+    graphicalViewer.setEditPartFactory(new ADTEditPartFactory());
+  }
+
+  protected void hookGraphicalViewer()
+  {
+    getSelectionSynchronizer().addViewer(graphicalViewer);
+    getSelectionManager().addSelectionChangedListener(graphicalViewer);
+  }
+
+  protected SelectionSynchronizer getSelectionSynchronizer()
+  {
+    if (synchronizer == null)
+      synchronizer = new SelectionSynchronizer();
+    return synchronizer;
+  }
+
+  protected void initializeGraphicalViewer()
+  {
+    graphicalViewer.setContents(model);
+  }
+
+  protected void setEditDomain(DefaultEditDomain ed)
+  {
+    this.editDomain = ed;
+  }
+
+  protected CommandStack getCommandStack()
+  {
+    return getEditDomain().getCommandStack();
+  }
+
+  protected ActionRegistry getActionRegistry()
+  {
+    if (actionRegistry == null)
+      actionRegistry = new ActionRegistry();
+    return actionRegistry;
+  }
+
+  public void commandStackChanged(EventObject event)
+  {
+    updateActions(stackActions);
+    firePropertyChange(PROP_DIRTY);
+  }
+
+  /**
+   * From GEF GraphicalEditor A convenience method for updating a set of actions
+   * defined by the given List of action IDs. The actions are found by looking
+   * up the ID in the {@link #getActionRegistry() action registry}. If the
+   * corresponding action is an {@link UpdateAction}, it will have its
+   * <code>update()</code> method called.
+   * 
+   * @param actionIds
+   *          the list of IDs to update
+   */
+  protected void updateActions(List actionIds)
+  {
+    ActionRegistry registry = getActionRegistry();
+    Iterator iter = actionIds.iterator();
+    while (iter.hasNext())
+    {
+      IAction action = registry.getAction(iter.next());
+      if (action instanceof UpdateAction)
+        ((UpdateAction) action).update();
+    }
+  }
+
+  /**
+   * Returns <code>true</code> if the command stack is dirty
+   * 
+   * @see org.eclipse.ui.ISaveablePart#isDirty()
+   */
+  public boolean isDirty()
+  {
+    super.isDirty();
+    return getCommandStack().isDirty();
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/editor/ADTSelectionManager.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/editor/ADTSelectionManager.java
new file mode 100644
index 0000000..5b67d6d
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/editor/ADTSelectionManager.java
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.editor;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.ui.part.MultiPageEditorPart;
+import org.eclipse.ui.part.MultiPageSelectionProvider;
+
+public class ADTSelectionManager extends MultiPageSelectionProvider implements ISelectionProvider, ISelectionChangedListener
+{
+
+  public ADTSelectionManager(MultiPageEditorPart multiPageEditor)
+  {
+    super(multiPageEditor);
+  }
+
+  /* (non-Javadoc)
+   * @see org.eclipse.jface.viewers.ISelectionProvider#addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener)
+   */
+  public void addSelectionChangedListener(ISelectionChangedListener listener)
+  {
+    listenerList.add(listener);
+  }
+
+  /* (non-Javadoc)
+   * @see org.eclipse.jface.viewers.ISelectionProvider#getSelection()
+   */
+  public ISelection getSelection()
+  {
+//    System.out.println("getSelection() = " + currentSelection);
+    return currentSelection;
+  }
+
+  /* (non-Javadoc)
+   * @see org.eclipse.jface.viewers.ISelectionProvider#removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener)
+   */
+  public void removeSelectionChangedListener(ISelectionChangedListener listener)
+  {
+    listenerList.remove(listener);
+  }
+
+  /* (non-Javadoc)
+   * @see org.eclipse.jface.viewers.ISelectionProvider#setSelection(org.eclipse.jface.viewers.ISelection)
+   */
+  public void setSelection(ISelection selection)
+  {
+    setSelection(selection, this);
+  }
+
+  /* (non-Javadoc)
+   * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
+   */
+  public void selectionChanged(SelectionChangedEvent event)
+  {
+    if (enableNotify)
+    {
+      setSelection(event.getSelection(), event.getSelectionProvider());
+    }
+  }
+
+  
+  protected List listenerList = new ArrayList();
+  protected ISelection currentSelection;
+  protected boolean enableNotify = true;
+
+  public boolean getEnableNotify()
+  {
+    return enableNotify;
+  }
+  
+  public void setSelection(ISelection selection, ISelectionProvider source)
+  {  
+    //System.out.println("ADTSelectionManager.setSelection(" + selection + ")");
+    if (enableNotify)
+    {
+      currentSelection = selection;
+      enableNotify = false;
+      try
+      {
+        SelectionChangedEvent event = new SelectionChangedEvent(source, selection);
+        List copyOfListenerList = new ArrayList(listenerList);
+        for (Iterator i = copyOfListenerList.iterator(); i.hasNext(); )
+        {
+          ISelectionChangedListener listener = (ISelectionChangedListener)i.next();
+          listener.selectionChanged(event);
+        }
+      }
+      catch (Exception e)
+      {
+        e.printStackTrace();
+      }
+      finally
+      {
+        enableNotify = true;
+      }
+    }
+  }      
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/facade/IADTObject.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/facade/IADTObject.java
new file mode 100644
index 0000000..77d6b5f
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/facade/IADTObject.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.facade;
+
+public interface IADTObject
+{
+    public void registerListener(IADTObjectListener listener);
+    public void unregisterListener(IADTObjectListener listener);  
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/facade/IADTObjectListener.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/facade/IADTObjectListener.java
new file mode 100644
index 0000000..5fafdbf
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/facade/IADTObjectListener.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.facade;
+
+public interface IADTObjectListener
+{
+  public void propertyChanged(Object object, String property);  
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/facade/IComplexType.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/facade/IComplexType.java
new file mode 100644
index 0000000..3f3c4ea
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/facade/IComplexType.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.facade;
+
+
+
+public interface IComplexType extends IType, IStructure
+{
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/facade/IField.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/facade/IField.java
new file mode 100644
index 0000000..a0c85d2
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/facade/IField.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.facade;
+
+import org.eclipse.gef.commands.Command;
+
+public interface IField extends IADTObject
+{
+  String getKind();
+  String getName();
+  String getTypeName();
+  String getTypeNameQualifier();
+  IModel getModel();
+  IType getType();
+  IComplexType getContainerType();
+  int getMinOccurs();
+  int getMaxOccurs();
+  boolean isGlobal();
+  boolean isReadOnly();
+  
+  Command getUpdateMinOccursCommand(int minOccurs);
+  Command getUpdateMaxOccursCommand(int maxOccurs);
+  Command getUpdateTypeNameCommand(String typeName, String quailifier);
+  Command getUpdateNameCommand(String name); 
+  Command getDeleteCommand();  
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/facade/IModel.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/facade/IModel.java
new file mode 100644
index 0000000..7e904b2
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/facade/IModel.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.facade;
+
+import java.util.List;
+
+public interface IModel extends IADTObject
+{
+  List getTypes();
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/facade/IStructure.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/facade/IStructure.java
new file mode 100644
index 0000000..3e0e012
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/facade/IStructure.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.facade;
+
+import java.util.List;
+import org.eclipse.gef.commands.Command;
+
+public interface IStructure extends IADTObject
+{
+  String getName();
+  List getFields();
+  IModel getModel();
+  Command getAddNewFieldCommand(String fieldKind);
+  Command getDeleteCommand();  
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/facade/IType.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/facade/IType.java
new file mode 100644
index 0000000..1cbe3aa
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/facade/IType.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.facade;
+
+import org.eclipse.gef.commands.Command;
+
+public interface IType extends IADTObject
+{ 
+  IType getSuperType();
+  String getName();
+  String getQualifier();
+  boolean isComplexType();
+  boolean isReadOnly();
+  boolean isFocusAllowed();
+  
+  Command getUpdateNameCommand(String newName);
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/outline/ADTContentOutlinePage.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/outline/ADTContentOutlinePage.java
new file mode 100644
index 0000000..0765069
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/outline/ADTContentOutlinePage.java
@@ -0,0 +1,201 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.outline;
+
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.ui.part.MultiPageSelectionProvider;
+import org.eclipse.ui.views.contentoutline.ContentOutlinePage;
+import org.eclipse.wst.xsd.adt.design.DesignViewContextMenuProvider;
+import org.eclipse.wst.xsd.adt.editor.ADTMultiPageEditor;
+import org.eclipse.xsd.XSDConcreteComponent;
+import org.eclipse.xsd.XSDSchema;
+
+public class ADTContentOutlinePage extends ContentOutlinePage
+{
+  protected ADTMultiPageEditor editor;
+  protected int level = 0;
+  protected Object model;
+  protected ITreeContentProvider contentProvider;
+  protected ILabelProvider labelProvider;
+  protected MultiPageSelectionProvider selectionManager;
+  protected SelectionManagerSelectionChangeListener selectionManagerSelectionChangeListener = new SelectionManagerSelectionChangeListener();
+  protected TreeSelectionChangeListener treeSelectionChangeListener = new TreeSelectionChangeListener();
+
+  /**
+   * 
+   */
+  public ADTContentOutlinePage(ADTMultiPageEditor editor)
+  {
+    super();
+    this.editor = editor;
+  }
+
+  public void setModel(Object newModel)
+  {
+    model = newModel;
+  }
+
+  public void setContentProvider(ITreeContentProvider contentProvider)
+  {
+    this.contentProvider = contentProvider;
+  }
+
+  public void setLabelProvider(ILabelProvider labelProvider)
+  {
+    this.labelProvider = labelProvider;
+  }
+
+  // expose
+  public TreeViewer getTreeViewer()
+  {
+    return super.getTreeViewer();
+  }
+
+  public void createControl(Composite parent)
+  {
+    super.createControl(parent);
+    getTreeViewer().setContentProvider(contentProvider);
+    getTreeViewer().setLabelProvider(labelProvider);
+    getTreeViewer().setInput(model);
+    getTreeViewer().addSelectionChangedListener(this);
+    MenuManager menuManager = new MenuManager("#popup");//$NON-NLS-1$
+    menuManager.setRemoveAllWhenShown(true);
+    Menu menu = menuManager.createContextMenu(getTreeViewer().getControl());
+    getTreeViewer().getControl().setMenu(menu);
+    setSelectionManager(editor.getSelectionManager());
+    
+    // Create menu...for now reuse graph's.  Note edit part viewer = null
+    DesignViewContextMenuProvider menuProvider = new DesignViewContextMenuProvider(editor, null, (ISelectionProvider)editor.getSelectionManager());
+    menuManager.addMenuListener(menuProvider);
+    getSite().registerContextMenu("org.eclipse.wst.xsd.ui.popup.outline", menuManager, editor.getSelectionManager());
+
+    // enable popupMenus extension
+    // getSite().registerContextMenu("org.eclipse.wst.xsdeditor.ui.popup.outline",
+    // menuManager, xsdEditor.getSelectionManager());
+
+    // cs... why are we doing this from the outline view?
+    //
+    // xsdTextEditor.getXSDEditor().getSelectionManager().setSelection(new
+    // StructuredSelection(xsdTextEditor.getXSDSchema()));
+    // drill down from outline view
+    getTreeViewer().getControl().addMouseListener(new MouseAdapter()
+    {
+      public void mouseDoubleClick(MouseEvent e)
+      {
+        ISelection iSelection = getTreeViewer().getSelection();
+        if (iSelection instanceof StructuredSelection)
+        {
+          StructuredSelection selection = (StructuredSelection) iSelection;
+          Object obj = selection.getFirstElement();
+          if (obj instanceof XSDConcreteComponent)
+          {
+            XSDConcreteComponent comp = (XSDConcreteComponent) obj;
+            if (comp.getContainer() instanceof XSDSchema)
+            {
+              // getXSDEditor().getGraphViewer().setInput(obj);
+            }
+          }
+        }
+
+      }
+    });
+  }
+
+  class XSDKeyListener extends KeyAdapter
+  {
+  }
+
+  public void dispose()
+  {
+    contentProvider.dispose();
+    super.dispose();
+  }
+
+  public void setExpandToLevel(int i)
+  {
+    level = i;
+  }
+
+  public void setInput(Object value)
+  {
+    getTreeViewer().setInput(value);
+    getTreeViewer().expandToLevel(level);
+  }
+
+  // public ISelection getSelection()
+  // {
+  // if (getTreeViewer() == null)
+  // return StructuredSelection.EMPTY;
+  // return getTreeViewer().getSelection();
+  // }
+  public void setSelectionManager(MultiPageSelectionProvider newSelectionManager)
+  {
+    TreeViewer treeViewer = getTreeViewer();
+    // disconnect from old one
+    if (selectionManager != null)
+    {
+      selectionManager.removeSelectionChangedListener(selectionManagerSelectionChangeListener);
+      treeViewer.removeSelectionChangedListener(treeSelectionChangeListener);
+    }
+    selectionManager = newSelectionManager;
+    // connect to new one
+    if (selectionManager != null)
+    {
+      selectionManager.addSelectionChangedListener(selectionManagerSelectionChangeListener);
+      treeViewer.addSelectionChangedListener(treeSelectionChangeListener);
+    }
+  }
+
+  class SelectionManagerSelectionChangeListener implements ISelectionChangedListener
+  {
+    public void selectionChanged(SelectionChangedEvent event)
+    {
+      if (event.getSelectionProvider() != getTreeViewer())
+      {
+        getTreeViewer().setSelection(event.getSelection(), true);
+      }
+    }
+  }
+
+  class TreeSelectionChangeListener implements ISelectionChangedListener
+  {
+    public void selectionChanged(SelectionChangedEvent event)
+    {
+      if (selectionManager != null)
+      {
+        ISelection selection = event.getSelection();
+        if (selection instanceof IStructuredSelection)
+        {
+          IStructuredSelection structuredSelection = (IStructuredSelection) selection;
+          Object o = structuredSelection.getFirstElement();
+          if (o != null)
+          {
+            selectionManager.setSelection(structuredSelection);
+          }
+        }
+      }
+    }
+  }
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/outline/ADTContentOutlineProvider.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/outline/ADTContentOutlineProvider.java
new file mode 100644
index 0000000..0264e9c
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/outline/ADTContentOutlineProvider.java
@@ -0,0 +1,138 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.outline;
+
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.wst.xsd.adt.facade.IADTObject;
+import org.eclipse.wst.xsd.adt.facade.IADTObjectListener;
+
+public class ADTContentOutlineProvider implements ITreeContentProvider, IADTObjectListener
+{
+  protected Viewer viewer = null;
+  protected Object oldInput, newInput;
+
+  public ADTContentOutlineProvider()
+  {
+    super();
+  }
+
+  /* (non-Javadoc)
+   * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
+   */
+  public Object[] getChildren(Object parentElement)
+  {
+    if (parentElement instanceof ITreeElement)
+    {
+      Object[] children = ((ITreeElement) parentElement).getChildren();
+      if (children != null)
+      {
+        int length = children.length;
+        for (int i = 0; i < length; i++)
+        {
+          Object child = children[i];
+          if (child instanceof IADTObject)
+          {
+            ((IADTObject) child).registerListener(this);
+          }
+        }
+      }
+      return children;
+    }
+    return null;
+  }
+
+  /* (non-Javadoc)
+   * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
+   */
+  public Object getParent(Object element)
+  {
+    return null;
+  }
+
+  /* (non-Javadoc)
+   * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
+   */
+  public boolean hasChildren(Object element)
+  {
+    if (element instanceof ITreeElement)
+    {
+      return ((ITreeElement) element).hasChildren();
+    }
+    return false;
+  }
+
+  /* (non-Javadoc)
+   * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
+   */
+  public Object[] getElements(Object inputElement)
+  {
+    return getChildren(inputElement);
+  }
+
+  /* (non-Javadoc)
+   * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+   */
+  public void dispose()
+  {
+    Object input = viewer.getInput();
+    if (input instanceof IADTObject)
+    {
+      removeListener((IADTObject) input);
+    }
+  }
+
+  /* (non-Javadoc)
+   * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+   */
+  public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
+  {
+    this.viewer = viewer;
+    this.oldInput = oldInput;
+    this.newInput = newInput;
+  }
+
+  /* (non-Javadoc)
+   * @see org.eclipse.wst.xsd.adt.facade.IADTObjectListener#propertyChanged(java.lang.Object, java.lang.String)
+   */
+  public void propertyChanged(Object object, String property)
+  {
+    if (viewer instanceof TreeViewer)
+    {
+      TreeViewer treeViewer = (TreeViewer) viewer;
+      treeViewer.refresh(object);
+      treeViewer.reveal(object);
+    }
+  }
+
+  /**
+   * @param model
+   */
+  private void removeListener(IADTObject model)
+  {
+    model.unregisterListener(this);
+    Object[] children = getChildren(model);
+    if (children != null)
+    {
+      int length = children.length;
+      for (int i = 0; i < length; i++)
+      {
+        Object child = children[i];
+        if (child instanceof IADTObject)
+        {
+          removeListener((IADTObject) child);
+        }
+      }
+    }
+  }
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/outline/ADTLabelProvider.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/outline/ADTLabelProvider.java
new file mode 100644
index 0000000..d662507
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/outline/ADTLabelProvider.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.outline;
+
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.swt.graphics.Image;
+
+public class ADTLabelProvider implements ILabelProvider
+{
+
+  public ADTLabelProvider()
+  {
+    super();
+  }
+
+  /* (non-Javadoc)
+   * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
+   */
+  public Image getImage(Object element)
+  {
+    if (element instanceof ITreeElement)
+    {
+      return ((ITreeElement)element).getImage();
+    }
+    return null;
+  }
+
+  /* (non-Javadoc)
+   * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
+   */
+  public String getText(Object element)
+  {
+    if (element instanceof ITreeElement)
+    {
+      return ((ITreeElement)element).getText();
+    }
+    return "";
+  }
+
+  /* (non-Javadoc)
+   * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)
+   */
+  public void addListener(ILabelProviderListener listener)
+  {
+  }
+
+  /* (non-Javadoc)
+   * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
+   */
+  public void dispose()
+  {
+  }
+
+  /* (non-Javadoc)
+   * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String)
+   */
+  public boolean isLabelProperty(Object element, String property)
+  {
+    return false;
+  }
+
+  /* (non-Javadoc)
+   * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)
+   */
+  public void removeListener(ILabelProviderListener listener)
+  {
+
+  }
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/outline/ITreeElement.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/outline/ITreeElement.java
new file mode 100644
index 0000000..49304a7
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/outline/ITreeElement.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.outline;
+
+import org.eclipse.swt.graphics.Image;
+
+public interface ITreeElement
+{
+  public final static ITreeElement[] EMPTY_LIST = {};
+  ITreeElement[] getChildren();
+  ITreeElement getParent();
+  boolean hasChildren();
+  String getText();
+  Image getImage();
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/properties/ADTTabbedPropertySheetPage.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/properties/ADTTabbedPropertySheetPage.java
new file mode 100644
index 0000000..d31d2ee
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/adt/properties/ADTTabbedPropertySheetPage.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.adt.properties;
+
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
+
+
+public class ADTTabbedPropertySheetPage extends TabbedPropertySheetPage
+{
+  public ADTTabbedPropertySheetPage(ITabbedPropertySheetPageContributor tabbedPropertySheetPageContributor)
+  {
+    super(tabbedPropertySheetPageContributor);
+  }
+
+  /* (non-Javadoc)
+   * @see org.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
+   */
+  public void selectionChanged(IWorkbenchPart part, ISelection selection) {
+
+      Object selected = ((StructuredSelection)selection).getFirstElement();
+//      if (selected instanceof EditPart)
+//      {
+//        Object model = ((EditPart)selected).getModel();
+//        selection = new StructuredSelection(model);
+//      }
+      super.selectionChanged(part, selection);
+  }
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/actions/AddXSDAttributeDeclarationAction.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/actions/AddXSDAttributeDeclarationAction.java
new file mode 100644
index 0000000..f5b054e
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/actions/AddXSDAttributeDeclarationAction.java
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.actions;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.wst.xsd.editor.internal.adapters.XSDAdapterFactory;
+import org.eclipse.wst.xsd.editor.internal.adapters.XSDBaseAdapter;
+import org.eclipse.wst.xsd.ui.common.commands.AddXSDAttributeDeclarationCommand;
+import org.eclipse.xsd.XSDAttributeGroupDefinition;
+import org.eclipse.xsd.XSDAttributeUse;
+import org.eclipse.xsd.XSDComplexTypeDefinition;
+import org.eclipse.xsd.XSDConcreteComponent;
+import org.eclipse.xsd.XSDSchema;
+
+public class AddXSDAttributeDeclarationAction extends XSDBaseAction
+{
+  public static String ID = "AddXSDAttributeAction";
+
+  public AddXSDAttributeDeclarationAction(IWorkbenchPart part)
+  {
+    super(part);
+    setText("Add Attribute");
+    setId(ID);
+  }
+
+  public void run()
+  {
+    Object selection = ((IStructuredSelection) getSelection()).getFirstElement();
+
+    if (selection instanceof XSDBaseAdapter)
+    {
+      selection = ((XSDBaseAdapter) selection).getTarget();
+    }
+    AddXSDAttributeDeclarationCommand command = null;
+    if (selection instanceof XSDComplexTypeDefinition)
+    {
+      command = new AddXSDAttributeDeclarationCommand("Add Attribute", (XSDComplexTypeDefinition) selection);
+      getCommandStack().execute(command);
+    }
+    else if (selection instanceof XSDAttributeUse)
+    {
+      XSDAttributeUse xsdAttributeUse = (XSDAttributeUse) selection;
+      XSDConcreteComponent parent = null;
+      XSDComplexTypeDefinition ct = null;
+      for (parent = xsdAttributeUse.getContainer(); parent != null;)
+      {
+        if (parent instanceof XSDComplexTypeDefinition)
+        {
+          ct = (XSDComplexTypeDefinition) parent;
+          break;
+        }
+        parent = parent.getContainer();
+      }
+      if (ct != null)
+      {
+        command = new AddXSDAttributeDeclarationCommand("Add Attribute", ct);
+        getCommandStack().execute(command);
+      }
+    }
+    else if (selection instanceof XSDAttributeGroupDefinition)
+    {
+      command = new AddXSDAttributeDeclarationCommand("Add Attribute", (XSDAttributeGroupDefinition)selection);
+      getCommandStack().execute(command);
+    }
+    else if (selection instanceof XSDSchema)
+    {
+      command = new AddXSDAttributeDeclarationCommand("Add Attribute", (XSDSchema)selection);
+      getCommandStack().execute(command);
+    }
+    
+    if (command != null)
+    {
+      Adapter adapter = XSDAdapterFactory.getInstance().adapt(command.getAddedComponent());
+      if (adapter != null)
+        provider.setSelection(new StructuredSelection(adapter));
+    }
+
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/actions/AddXSDAttributeGroupDefinitionAction.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/actions/AddXSDAttributeGroupDefinitionAction.java
new file mode 100644
index 0000000..29daef2
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/actions/AddXSDAttributeGroupDefinitionAction.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.actions;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.wst.xsd.editor.internal.adapters.XSDAdapterFactory;
+import org.eclipse.wst.xsd.editor.internal.adapters.XSDBaseAdapter;
+import org.eclipse.wst.xsd.ui.common.commands.AddXSDAttributeGroupDefinitionCommand;
+import org.eclipse.xsd.XSDComplexTypeDefinition;
+import org.eclipse.xsd.XSDSchema;
+
+public class AddXSDAttributeGroupDefinitionAction extends XSDBaseAction
+{
+  public static String ID = "AddXSDAttributeGroupDefinitionAction";
+
+  public AddXSDAttributeGroupDefinitionAction(IWorkbenchPart part)
+  {
+    super(part);
+    setText("Add Attribute Group");
+    setId(ID);
+  }
+
+  public void run()
+  {
+    Object selection = ((IStructuredSelection) getSelection()).getFirstElement();
+
+    if (selection instanceof XSDBaseAdapter)
+    {
+      selection = ((XSDBaseAdapter) selection).getTarget();
+    }
+
+    AddXSDAttributeGroupDefinitionCommand command = null;
+    if (selection instanceof XSDComplexTypeDefinition)
+    {
+      command = new AddXSDAttributeGroupDefinitionCommand("Add Attribute Group Ref", (XSDComplexTypeDefinition) selection);
+      getCommandStack().execute(command);
+    }
+    else if (selection instanceof XSDSchema)
+    {
+      command = new AddXSDAttributeGroupDefinitionCommand("Add Attribute Group Definition", (XSDSchema) selection);
+      getCommandStack().execute(command);
+    }
+
+    if (command != null)
+    {
+      Adapter adapter = XSDAdapterFactory.getInstance().adapt(command.getAddedComponent());
+      if (adapter != null)
+        provider.setSelection(new StructuredSelection(adapter));
+    }
+
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/actions/AddXSDComplexTypeDefinitionAction.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/actions/AddXSDComplexTypeDefinitionAction.java
new file mode 100644
index 0000000..2c9cb5e
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/actions/AddXSDComplexTypeDefinitionAction.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.actions;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.wst.xsd.editor.internal.adapters.XSDAdapterFactory;
+import org.eclipse.wst.xsd.editor.internal.adapters.XSDBaseAdapter;
+import org.eclipse.wst.xsd.ui.common.commands.AddXSDComplexTypeDefinitionCommand;
+import org.eclipse.xsd.XSDSchema;
+
+public class AddXSDComplexTypeDefinitionAction extends XSDBaseAction
+{
+  public static final String ID = "org.eclipse.wst.xsd.editor.AddXSDComplexTypeDefinitionAction";
+
+  public AddXSDComplexTypeDefinitionAction(IWorkbenchPart part)
+  {
+    super(part);
+    setText("Add Complex Type");
+    setId(ID);
+  }
+
+  public void run()
+  {
+    Object selection = ((IStructuredSelection) getSelection()).getFirstElement();
+
+    if (selection instanceof XSDBaseAdapter)
+    {
+      selection = ((XSDBaseAdapter) selection).getTarget();
+    }
+
+    if (selection instanceof XSDSchema)
+    {
+      AddXSDComplexTypeDefinitionCommand command = new AddXSDComplexTypeDefinitionCommand("Add Complex Type", (XSDSchema) selection);
+      getCommandStack().execute(command);
+      Adapter adapter = XSDAdapterFactory.getInstance().adapt(command.getAddedComponent());
+      if (adapter != null)
+        provider.setSelection(new StructuredSelection(adapter));
+    }
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/actions/AddXSDElementAction.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/actions/AddXSDElementAction.java
new file mode 100644
index 0000000..cb0482d
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/actions/AddXSDElementAction.java
@@ -0,0 +1,126 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.actions;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.wst.xsd.editor.internal.adapters.XSDAdapterFactory;
+import org.eclipse.wst.xsd.editor.internal.adapters.XSDBaseAdapter;
+import org.eclipse.wst.xsd.ui.common.commands.AddXSDElementCommand;
+import org.eclipse.xsd.XSDAttributeUse;
+import org.eclipse.xsd.XSDComplexTypeDefinition;
+import org.eclipse.xsd.XSDConcreteComponent;
+import org.eclipse.xsd.XSDElementDeclaration;
+import org.eclipse.xsd.XSDModelGroup;
+import org.eclipse.xsd.XSDModelGroupDefinition;
+import org.eclipse.xsd.XSDSchema;
+
+//revisit this and see if we can reuse AddFieldAction??
+
+public class AddXSDElementAction extends XSDBaseAction
+{
+  public static String ID = "org.eclipse.wst.xsd.ui.common.actions.AddXSDElementAction";
+  public static String REF_ID = "org.eclipse.wst.xsd.ui.common.actions.AddXSDElementReferenceAction";
+  boolean isReference;
+  
+  public AddXSDElementAction(IWorkbenchPart part, String id, String label, boolean isReference)
+  {
+    super(part);
+    setText(label);
+    setId(id);
+    this.isReference = isReference;
+  }
+
+  public void run()
+  {
+    Object selection = ((IStructuredSelection) getSelection()).getFirstElement();
+
+    if (selection instanceof XSDBaseAdapter)
+    {
+      selection = ((XSDBaseAdapter) selection).getTarget();
+    }
+    AddXSDElementCommand command = null;
+    if (selection instanceof XSDComplexTypeDefinition)
+    {
+      command = new AddXSDElementCommand(getText(), (XSDComplexTypeDefinition) selection);
+      command.setReference(isReference);
+      getCommandStack().execute(command);
+    }
+    else if (selection instanceof XSDModelGroupDefinition)
+    {
+      command = new AddXSDElementCommand(getText(), (XSDModelGroupDefinition) selection);
+      command.setReference(isReference);
+      getCommandStack().execute(command);
+    }
+    else if (selection instanceof XSDSchema)
+    {
+      command = new AddXSDElementCommand(getText(), (XSDSchema) selection);
+      getCommandStack().execute(command);
+    }
+    else if (selection instanceof XSDModelGroup)
+    {
+      XSDModelGroup modelGroup = (XSDModelGroup) selection;
+      XSDConcreteComponent component = modelGroup.getContainer();
+      XSDComplexTypeDefinition ct = null;
+      while (component != null)
+      {
+        if (component instanceof XSDComplexTypeDefinition)
+        {
+          ct = (XSDComplexTypeDefinition) component;
+          break;
+        }
+        component = component.getContainer();
+      }
+
+      if (ct != null)
+      {
+        command = new AddXSDElementCommand(getText(), (XSDModelGroup) selection, ct);
+      }
+      else
+      {
+        command = new AddXSDElementCommand(getText(), (XSDModelGroup) selection);
+      }
+      command.setReference(isReference);
+      getCommandStack().execute(command);
+    }
+    else if (selection instanceof XSDElementDeclaration || selection instanceof XSDAttributeUse)
+    {
+      XSDConcreteComponent xsdConcreteComponent = (XSDConcreteComponent) selection;
+      XSDConcreteComponent parent = null;
+      XSDComplexTypeDefinition ct = null;
+      for (parent = xsdConcreteComponent.getContainer(); parent != null; )
+      {
+        if (parent instanceof XSDComplexTypeDefinition)
+        {
+          ct = (XSDComplexTypeDefinition)parent;
+          break;
+        }
+        parent = parent.getContainer();
+      }
+      if (ct != null)
+      {
+        command = new AddXSDElementCommand(getText(), ct);
+        command.setReference(isReference);
+        getCommandStack().execute(command);
+      }
+    }
+    
+    if (command != null)
+    {
+      Adapter adapter = XSDAdapterFactory.getInstance().adapt(command.getAddedComponent());
+      if (adapter != null)
+        provider.setSelection(new StructuredSelection(adapter));
+    }
+  }
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/actions/AddXSDModelGroupAction.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/actions/AddXSDModelGroupAction.java
new file mode 100644
index 0000000..4fc6840
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/actions/AddXSDModelGroupAction.java
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.actions;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+import org.eclipse.wst.xsd.editor.internal.adapters.XSDAdapterFactory;
+import org.eclipse.wst.xsd.editor.internal.adapters.XSDBaseAdapter;
+import org.eclipse.wst.xsd.ui.common.commands.AddXSDModelGroupCommand;
+import org.eclipse.xsd.XSDComplexTypeDefinition;
+import org.eclipse.xsd.XSDCompositor;
+import org.eclipse.xsd.XSDConcreteComponent;
+import org.eclipse.xsd.XSDElementDeclaration;
+import org.eclipse.xsd.XSDModelGroup;
+
+public class AddXSDModelGroupAction extends XSDBaseAction
+{
+  public static String SEQUENCE_ID = "AddXSDSequenceModelGroupAction";
+  public static String CHOICE_ID = "AddXSDChoiceModelGroupAction";
+  public static String ALL_ID = "AddXSDAllModelGroupAction";
+  XSDCompositor xsdCompositor;
+
+  public AddXSDModelGroupAction(IWorkbenchPart part, XSDCompositor compositor, String ID)
+  {
+    super(part);
+    setText(getLabel(compositor));
+    setId(ID);
+    this.xsdCompositor = compositor;
+  }
+
+  public void run()
+  {
+    Object selection = ((IStructuredSelection) getSelection()).getFirstElement();
+    if (selection instanceof XSDBaseAdapter)
+    {
+      XSDConcreteComponent xsdComponent = (XSDConcreteComponent) ((XSDBaseAdapter) selection).getTarget();
+      AddXSDModelGroupCommand command = null;
+      if (xsdComponent instanceof XSDElementDeclaration)
+      {
+        XSDElementDeclaration xsdElementDeclaration = (XSDElementDeclaration) xsdComponent;
+
+        command = new AddXSDModelGroupCommand(getLabel(xsdCompositor), xsdElementDeclaration, xsdCompositor);
+        getCommandStack().execute(command);
+      }
+      else if (xsdComponent instanceof XSDModelGroup)
+      {
+        XSDModelGroup xsdModelGroup = (XSDModelGroup) xsdComponent;
+
+        command = new AddXSDModelGroupCommand(getLabel(xsdCompositor), xsdModelGroup, xsdCompositor);
+        getCommandStack().execute(command);
+      }
+      else if (xsdComponent instanceof XSDComplexTypeDefinition)
+      {
+        command = new AddXSDModelGroupCommand(getLabel(xsdCompositor), xsdComponent, xsdCompositor);
+        getCommandStack().execute(command);
+      }
+     
+      if (command != null)
+      {
+        Adapter adapter = XSDAdapterFactory.getInstance().adapt(command.getAddedComponent());
+        if (adapter != null)
+          provider.setSelection(new StructuredSelection(adapter));
+      }
+
+    }
+  }
+
+  private String getLabel(XSDCompositor compositor)
+  {
+    String result = XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_SEQUENCE"); //$NON-NLS-1$
+    if (compositor != null)
+    {
+      if (compositor == XSDCompositor.CHOICE_LITERAL)
+      {
+        result = XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_CHOICE"); //$NON-NLS-1$
+      }
+      else if (compositor == XSDCompositor.ALL_LITERAL)
+      {
+        result = XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ALL");//$NON-NLS-1$
+      }
+    }
+    return result;
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/actions/AddXSDModelGroupDefinitionAction.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/actions/AddXSDModelGroupDefinitionAction.java
new file mode 100644
index 0000000..2f2a542
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/actions/AddXSDModelGroupDefinitionAction.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.actions;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.wst.xsd.editor.internal.adapters.XSDAdapterFactory;
+import org.eclipse.wst.xsd.editor.internal.adapters.XSDBaseAdapter;
+import org.eclipse.wst.xsd.ui.common.commands.AddXSDModelGroupDefinitionCommand;
+import org.eclipse.xsd.XSDConcreteComponent;
+
+public class AddXSDModelGroupDefinitionAction extends XSDBaseAction
+{
+  public static final String MODELGROUPDEFINITION_ID = "AddXSDModelGroupDefinitionAction";
+  public static final String MODELGROUPDEFINITIONREF_ID = "AddXSDModelGroupDefinitionRefAction";
+  boolean isReference;
+
+  public AddXSDModelGroupDefinitionAction(IWorkbenchPart part, boolean isReference)
+  {
+    super(part);
+    this.isReference = isReference;
+    if (isReference)
+    {
+      setText("Add Group Ref");
+      setId(MODELGROUPDEFINITION_ID);
+    }
+    else
+    {
+      setText("Add Group");
+      setId(MODELGROUPDEFINITIONREF_ID);
+    }
+  }
+
+  public void run()
+  {
+    Object selection = ((IStructuredSelection) getSelection()).getFirstElement();
+    XSDConcreteComponent xsdConcreteComponent = null;
+    if (selection instanceof XSDBaseAdapter)
+    {
+      xsdConcreteComponent = (XSDConcreteComponent) ((XSDBaseAdapter) selection).getTarget();
+    }
+    if (xsdConcreteComponent != null)
+    {
+      AddXSDModelGroupDefinitionCommand command = new AddXSDModelGroupDefinitionCommand(getText(), xsdConcreteComponent, isReference);
+      getCommandStack().execute(command);
+      Adapter adapter = XSDAdapterFactory.getInstance().adapt(command.getAddedComponent());
+      if (adapter != null)
+        provider.setSelection(new StructuredSelection(adapter));
+    }
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/actions/AddXSDSimpleTypeDefinitionAction.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/actions/AddXSDSimpleTypeDefinitionAction.java
new file mode 100644
index 0000000..14ee444
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/actions/AddXSDSimpleTypeDefinitionAction.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.actions;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.wst.xsd.editor.internal.adapters.XSDBaseAdapter;
+import org.eclipse.wst.xsd.ui.common.commands.AddXSDSimpleTypeDefinitionCommand;
+import org.eclipse.xsd.XSDSchema;
+
+public class AddXSDSimpleTypeDefinitionAction extends XSDBaseAction
+{
+  public static final String ID = "org.eclipse.wst.xsd.editor.AddXSDSimpleTypeDefinitionAction";
+
+  public AddXSDSimpleTypeDefinitionAction(IWorkbenchPart part)
+  {
+    super(part);
+    setText("Add Simple Type");
+    setId(ID);
+  }
+
+  public void run()
+  {
+    Object selection = ((IStructuredSelection) getSelection()).getFirstElement();
+
+    if (selection instanceof XSDBaseAdapter)
+    {
+      selection = ((XSDBaseAdapter) selection).getTarget();
+    }
+
+    if (selection instanceof XSDSchema)
+    {
+      AddXSDSimpleTypeDefinitionCommand command = new AddXSDSimpleTypeDefinitionCommand("Add Simple Type", (XSDSchema) selection);
+      getCommandStack().execute(command);
+    }
+  }
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/actions/DeleteXSDConcreteComponentAction.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/actions/DeleteXSDConcreteComponentAction.java
new file mode 100644
index 0000000..ff9b772
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/actions/DeleteXSDConcreteComponentAction.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.actions;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+import org.eclipse.wst.xsd.editor.internal.adapters.XSDBaseAdapter;
+import org.eclipse.wst.xsd.ui.common.commands.DeleteCommand;
+import org.eclipse.xsd.XSDConcreteComponent;
+
+public class DeleteXSDConcreteComponentAction extends XSDBaseAction
+{
+  public static final String DELETE_XSD_COMPONENT_ID = "org.eclipse.wst.xsd.ui.common.actions.DeleteXSDConcreteComponentAction";   //$NON-NLS-1$
+
+  public DeleteXSDConcreteComponentAction(IWorkbenchPart part)
+  {
+    super(part);
+    setText("Delete");
+    setId(DELETE_XSD_COMPONENT_ID);
+    setImageDescriptor(XSDEditorPlugin.getImageDescriptor("icons/delete_obj.gif") );
+  }
+
+  public void run()
+  {
+    Object selection = ((IStructuredSelection) getSelection()).getFirstElement();
+
+    if (selection instanceof XSDBaseAdapter)
+    {
+      selection = ((XSDBaseAdapter) selection).getTarget();
+    }
+
+    if (selection instanceof XSDConcreteComponent)
+    {
+      DeleteCommand command = new DeleteCommand(getText(), (XSDConcreteComponent) selection);
+      getCommandStack().execute(command);
+    }
+
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/actions/OpenInNewEditor.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/actions/OpenInNewEditor.java
new file mode 100644
index 0000000..1e781a7
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/actions/OpenInNewEditor.java
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.actions;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.wst.common.uriresolver.internal.util.URIHelper;
+import org.eclipse.wst.xsd.adt.actions.BaseSelectionAction;
+import org.eclipse.wst.xsd.editor.InternalXSDMultiPageEditor;
+import org.eclipse.wst.xsd.editor.internal.adapters.XSDComplexTypeDefinitionAdapter;
+import org.eclipse.xsd.XSDComplexTypeDefinition;
+
+public class OpenInNewEditor extends BaseSelectionAction
+{
+  public static final String ID = "OpenInNewEditor";
+
+  public OpenInNewEditor(IWorkbenchPart part)
+  {
+    super(part);
+    setText("Open In New Editor");
+    setId(ID);
+  }
+
+  protected boolean calculateEnabled()
+  {
+    return true;
+  }
+
+  public void run()
+  {
+    Object selection = ((IStructuredSelection) getSelection()).getFirstElement();
+
+    if (selection instanceof XSDComplexTypeDefinitionAdapter)
+    {
+      XSDComplexTypeDefinitionAdapter xsdAdapter = (XSDComplexTypeDefinitionAdapter) selection;
+      XSDComplexTypeDefinition fComponent = (XSDComplexTypeDefinition) xsdAdapter.getTarget();
+
+      if (fComponent.getSchema() != null)
+      {
+        String schemaLocation = URIHelper.removePlatformResourceProtocol(fComponent.getSchema().getSchemaLocation());
+        IPath schemaPath = new Path(schemaLocation);
+        IFile schemaFile = ResourcesPlugin.getWorkspace().getRoot().getFile(schemaPath);
+        if (schemaFile != null && schemaFile.exists())
+        {
+          IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+          if (workbenchWindow != null)
+          {
+            IWorkbenchPage page = workbenchWindow.getActivePage();
+            try
+            {
+              // TODO: Should use this to open in default editor
+              // IEditorPart editorPart = IDE.openEditor(page, schemaFile, true);
+              IEditorPart editorPart = page.openEditor(new FileEditorInput(schemaFile), "org.eclipse.wst.xsd.editor.InternalXSDMultiPageEditor", true);
+
+              if (editorPart instanceof InternalXSDMultiPageEditor)
+              {
+                InternalXSDMultiPageEditor xsdEditor = (InternalXSDMultiPageEditor) editorPart;
+
+                xsdEditor.openOnGlobalReference(fComponent);
+              }
+
+            }
+            catch (PartInitException pie)
+            {
+            }
+          }
+        }
+      }
+
+    }
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/actions/SetMultiplicityAction.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/actions/SetMultiplicityAction.java
new file mode 100644
index 0000000..ad92a70
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/actions/SetMultiplicityAction.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.actions;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.wst.xsd.editor.internal.adapters.XSDBaseAdapter;
+import org.eclipse.wst.xsd.ui.common.commands.SetMultiplicityCommand;
+import org.eclipse.xsd.XSDConcreteComponent;
+
+public class SetMultiplicityAction extends XSDBaseAction
+{
+  public static String REQUIRED_ID = "org.eclipse.wst.xsd.ui.common.actions.SetMultiplicity.REQUIRED_ID";
+  public static String ZERO_OR_ONE_ID = "org.eclipse.wst.xsd.ui.common.actions.SetMultiplicity.ZERO_OR_ONE_ID";
+  public static String ZERO_OR_MORE_ID = "org.eclipse.wst.xsd.ui.common.actions.SetMultiplicity.ZERO_OR_MORE_ID";
+  public static String ONE_OR_MORE_ID = "org.eclipse.wst.xsd.ui.common.actions.SetMultiplicity.ONE_OR_MORE_ID";
+  
+  SetMultiplicityCommand command;
+  
+  public SetMultiplicityAction(IWorkbenchPart part, String label, String ID)
+  {
+    super(part);
+    setText(label);
+    setId(ID);
+    command = new SetMultiplicityCommand(label);
+  }
+  
+  public void setMaxOccurs(int i)
+  {
+    command.setMaxOccurs(i);
+  }
+
+  public void setMinOccurs(int i)
+  {
+    command.setMinOccurs(i);
+  }
+
+  public void run()
+  {
+    Object selection = ((IStructuredSelection) getSelection()).getFirstElement();
+
+    XSDConcreteComponent xsdConcreteComponent = null;
+    if (selection instanceof XSDBaseAdapter)
+    {
+      xsdConcreteComponent = (XSDConcreteComponent)((XSDBaseAdapter) selection).getTarget();
+    }
+    if (xsdConcreteComponent != null)
+    {
+      command.setXSDConcreteComponent(xsdConcreteComponent);
+      getCommandStack().execute(command);
+    }
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/actions/SetTypeAction.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/actions/SetTypeAction.java
new file mode 100644
index 0000000..1040e95
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/actions/SetTypeAction.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.actions;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.wst.xsd.editor.internal.adapters.XSDBaseAdapter;
+import org.eclipse.wst.xsd.ui.common.commands.SetTypeCommand;
+import org.eclipse.xsd.XSDConcreteComponent;
+
+public class SetTypeAction extends XSDBaseAction
+{
+  public static final String SET_NEW_TYPE_ID = "SetTypeAction_AddType";
+  public static final String SELECT_EXISTING_TYPE_ID = "SetTypeAction_ExistingType";
+
+  SetTypeCommand command;
+
+  public SetTypeAction(String label, String ID, IWorkbenchPart part)
+  {
+    super(part);
+    setText(label);
+    setId(ID);
+  }
+
+  public void run()
+  {
+    Object selection = ((IStructuredSelection) getSelection()).getFirstElement();
+
+    if (selection instanceof XSDBaseAdapter)
+    {
+      Object target = ((XSDBaseAdapter) selection).getTarget();
+
+      if (target instanceof XSDConcreteComponent)
+      {
+        command = new SetTypeCommand(getText(), getId(), (XSDConcreteComponent) target);
+        command.setAdapter((XSDBaseAdapter) selection);
+        getCommandStack().execute(command);
+      }
+    }
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/actions/XSDBaseAction.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/actions/XSDBaseAction.java
new file mode 100644
index 0000000..7374229
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/actions/XSDBaseAction.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.actions;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.wst.xsd.adt.actions.BaseSelectionAction;
+import org.eclipse.wst.xsd.editor.internal.adapters.XSDBaseAdapter;
+import org.eclipse.xsd.XSDConcreteComponent;
+import org.eclipse.xsd.XSDSchema;
+
+public class XSDBaseAction extends BaseSelectionAction
+{
+
+  public XSDBaseAction(IWorkbenchPart part)
+  {
+    super(part);
+  }
+
+  protected boolean calculateEnabled()
+  {
+    if (getWorkbenchPart() instanceof IEditorPart)
+    {
+      IEditorPart owningEditor = (IEditorPart)getWorkbenchPart();
+      
+      Object selection = ((IStructuredSelection) getSelection()).getFirstElement();
+      if (selection instanceof XSDBaseAdapter)
+      {
+        selection = ((XSDBaseAdapter) selection).getTarget();
+      }
+      XSDSchema xsdSchema = null;
+      if (selection instanceof XSDConcreteComponent)
+      {
+        xsdSchema = ((XSDConcreteComponent)selection).getSchema();
+      }
+      
+      if (xsdSchema != null && xsdSchema == owningEditor.getAdapter(XSDSchema.class))
+      {
+        return true;
+      }
+    }
+    return false;
+  }
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/AddAppInfoAttributeCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/AddAppInfoAttributeCommand.java
new file mode 100644
index 0000000..7d4117d
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/AddAppInfoAttributeCommand.java
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.commands;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.wst.xml.core.internal.contentmodel.util.DOMNamespaceInfoManager;
+import org.eclipse.wst.xml.core.internal.contentmodel.util.NamespaceInfo;
+import org.eclipse.xsd.XSDAttributeDeclaration;
+import org.eclipse.xsd.XSDConcreteComponent;
+import org.w3c.dom.Element;
+
+public class AddAppInfoAttributeCommand extends AddAppInfoCommand
+{
+  private static DOMNamespaceInfoManager manager = new DOMNamespaceInfoManager();
+  private XSDAttributeDeclaration attribute;
+  private boolean appInfoAttributeAdded = false;
+  private boolean prefixAdded = false;
+  private String attributeQName;
+  private String namespacePrefix;
+  
+  XSDConcreteComponent component;
+
+
+  public AddAppInfoAttributeCommand(String label, XSDConcreteComponent component,
+      XSDAttributeDeclaration attribute)
+  {
+    super(label);
+    this.component = component;
+    this.attribute = attribute;
+  }
+
+  public void execute()
+  {
+    namespacePrefix = handleNamespacePrefices();
+    
+    attributeQName = namespacePrefix + ":" + attribute.getName();
+    String value = component.getElement().getAttribute(attributeQName);
+    if ( value == null) {
+      appInfoAttributeAdded = true;
+      component.getElement().setAttribute(attributeQName, "");
+    }
+  }
+
+  public void undo()
+  {
+    super.undo();
+    // TODO (allison) remove the namespace prefix when applicable as well
+    if (appInfoAttributeAdded){
+      component.getElement().removeAttribute(attributeQName);
+    }
+  }
+
+  /** Create a namespace prefix if needed, other wise retrieve 
+   * a predefined namespace prefix
+   * @return   */
+  private String handleNamespacePrefices()
+  {
+    Element schemaElement = component.getSchema().getElement();
+    String prefix = null;
+    
+    // If target namespace of the attribute already exists
+    List namespacePrefices = manager.getNamespaceInfoList(schemaElement);
+    for (int i = 0; i < namespacePrefices.size(); i++){
+      NamespaceInfo info = (NamespaceInfo) namespacePrefices.get(i);
+      if ( info.uri.equals(attribute.getTargetNamespace())) {
+        prefix = info.prefix;
+      }
+    }
+    
+    // Create unquie namespace prefix
+    if ( prefix == null){
+      prefixAdded = true;
+      prefix = createUniquePrefix(component);
+    }
+
+    NamespaceInfo info = new NamespaceInfo(attribute.getTargetNamespace(), prefix, "");
+    List infoList = new ArrayList(1);
+    infoList.add(info);
+    manager.addNamespaceInfo(schemaElement, infoList, false);
+    return prefix;
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/AddAppInfoCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/AddAppInfoCommand.java
new file mode 100644
index 0000000..133cd8e
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/AddAppInfoCommand.java
@@ -0,0 +1,35 @@
+package org.eclipse.wst.xsd.ui.common.commands;
+
+import java.util.Map;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.wst.xsd.ui.common.properties.sections.appinfo.SpecificationForAppinfoSchema;
+import org.eclipse.xsd.XSDConcreteComponent;
+
+public class AddAppInfoCommand extends Command
+{
+  protected SpecificationForAppinfoSchema appInfoSchemaSpec;
+
+  protected AddAppInfoCommand(String label)
+  {
+    super(label);
+  }
+
+  public void setSchemaProperties(SpecificationForAppinfoSchema appInfoSchemaSpec)
+  {
+    this.appInfoSchemaSpec = appInfoSchemaSpec;
+  }
+  
+  protected String createUniquePrefix(XSDConcreteComponent component)
+  {
+    String prefix = "sdo";
+    Map prefMapper = component.getSchema().getQNamePrefixToNamespaceMap();
+    if ( prefMapper.get(prefix) != null){
+      int i = 1;
+      while ( prefMapper.get(prefix + i) != null)
+        i++;
+      prefix += i;
+    }
+    return prefix;
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/AddAppInfoElementCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/AddAppInfoElementCommand.java
new file mode 100644
index 0000000..a0cbe17
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/AddAppInfoElementCommand.java
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.commands;
+
+import java.util.List;
+
+import org.eclipse.wst.xsd.ui.common.properties.sections.appinfo.SpecificationForAppinfoSchema;
+import org.eclipse.wst.xsd.ui.common.util.XSDCommonUIUtils;
+import org.eclipse.xsd.XSDAnnotation;
+import org.eclipse.xsd.XSDConcreteComponent;
+import org.eclipse.xsd.XSDElementDeclaration;
+import org.eclipse.xsd.XSDSchema;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+public class AddAppInfoElementCommand extends AddAppInfoCommand
+{
+  XSDConcreteComponent input;
+  XSDElementDeclaration element;
+  Element appInfo;
+
+  public AddAppInfoElementCommand(String label, XSDConcreteComponent input, XSDElementDeclaration element)
+  {
+    super(label);
+    this.input = input;
+    this.element = element;
+  }
+
+  public void execute()
+  {
+    super.execute();
+    addAnnotationSet(input.getSchema(), appInfoSchemaSpec);
+  }
+
+  public void undo()
+  {
+    super.undo();
+    XSDAnnotation xsdAnnotation = XSDCommonUIUtils.getInputXSDAnnotation(input, false);
+    xsdAnnotation.getElement().removeChild(appInfo);
+    List appInfos = xsdAnnotation.getApplicationInformation();
+    appInfos.remove(appInfo);
+    xsdAnnotation.updateElement();
+
+  }
+
+  public void setSchemaProperties(SpecificationForAppinfoSchema appInfoSchemaSpec)
+  {
+    this.appInfoSchemaSpec = appInfoSchemaSpec;
+  }
+
+  public void addAnnotationSet(XSDSchema xsdSchema, SpecificationForAppinfoSchema asiSpec)
+  {
+    XSDAnnotation xsdAnnotation = XSDCommonUIUtils.getInputXSDAnnotation(input, true);
+    addAnnotationSet(asiSpec, xsdAnnotation);
+  }
+
+  private void addAnnotationSet(SpecificationForAppinfoSchema asiProperties, XSDAnnotation xsdAnnotation)
+  {
+    appInfo = xsdAnnotation.createApplicationInformation(asiProperties.getNamespaceURI());
+
+    if (appInfo != null)
+    {
+      Document doc = appInfo.getOwnerDocument();
+
+      Element rootElement = doc.createElementNS(asiProperties.getNamespaceURI(), element.getName());
+      
+      String prefix = createUniquePrefix(input);
+      rootElement.setPrefix(prefix);
+
+      Attr nsURIAttribute = doc.createAttribute("xmlns:"+prefix);
+      nsURIAttribute.setValue(asiProperties.getNamespaceURI());
+      rootElement.setAttributeNode(nsURIAttribute);
+      appInfo.appendChild(rootElement);
+
+      xsdAnnotation.getElement().appendChild(appInfo);
+      List appInfos = xsdAnnotation.getApplicationInformation();
+      appInfos.add(appInfo);
+      xsdAnnotation.updateElement();
+    }
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/AddDocumentationCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/AddDocumentationCommand.java
new file mode 100644
index 0000000..8ed0c27
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/AddDocumentationCommand.java
@@ -0,0 +1,121 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.commands;
+
+import java.util.List;
+
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
+import org.eclipse.wst.xsd.ui.common.util.XSDCommonUIUtils;
+import org.eclipse.xsd.XSDAnnotation;
+import org.eclipse.xsd.XSDConcreteComponent;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+public class AddDocumentationCommand extends BaseCommand
+{
+  XSDAnnotation xsdAnnotation;
+  XSDConcreteComponent input;
+  String newValue, oldValue;
+  boolean documentationExists;
+  Element documentationElement;
+
+  public AddDocumentationCommand(String label, XSDAnnotation xsdAnnotation, XSDConcreteComponent input, String newValue, String oldValue)
+  {
+    super(label);
+    this.xsdAnnotation = xsdAnnotation;
+    this.input = input;
+    this.newValue = newValue;
+    this.oldValue = oldValue;
+  }
+
+  public void execute()
+  {
+    xsdAnnotation = XSDCommonUIUtils.getInputXSDAnnotation((XSDConcreteComponent) input, true);
+    Element element = xsdAnnotation.getElement();
+
+    List documentationList = xsdAnnotation.getUserInformation();
+    documentationElement = null;
+    documentationExists = false;
+    if (documentationList.size() > 0)
+    {
+      documentationExists = true;
+      documentationElement = (Element) documentationList.get(0);
+    }
+
+    if (documentationElement == null)
+    {
+      documentationElement = xsdAnnotation.createUserInformation(null);
+      element.appendChild(documentationElement);
+      formatChild(documentationElement);
+      // Defect in model....I create it but the model object doesn't appear
+      // to be updated
+      xsdAnnotation.updateElement();
+      xsdAnnotation.setElement(element);
+    }
+
+    try
+    {
+      if (documentationElement.hasChildNodes())
+      {
+        if (documentationElement instanceof IDOMElement)
+        {
+          IDOMElement domElement = (IDOMElement) documentationElement;
+
+          Node firstChild = documentationElement.getFirstChild();
+          Node lastChild = documentationElement.getLastChild();
+          int start = 0;
+          int end = 0;
+
+          IDOMModel model = domElement.getModel();
+          IDOMDocument doc = model.getDocument();
+          IDOMNode first = null;
+          if (firstChild instanceof IDOMNode)
+          {
+            first = (IDOMNode) firstChild;
+            start = first.getStartOffset();
+          }
+          if (lastChild instanceof IDOMNode)
+          {
+            IDOMNode last = (IDOMNode) lastChild;
+            end = last.getEndOffset();
+          }
+
+          if (domElement != null)
+          {
+            oldValue = domElement.getModel().getStructuredDocument().get(start, end - start);
+            domElement.getModel().getStructuredDocument().replaceText(documentationElement, start, end - start, newValue);
+          }
+        }
+      }
+      else
+      {
+        if (newValue.length() > 0)
+        {
+          oldValue = "";
+          Node childNode = documentationElement.getOwnerDocument().createTextNode(newValue);
+          documentationElement.appendChild(childNode);
+        }
+      }
+    }
+    catch (Exception e)
+    {
+
+    }
+  }
+
+  public void undo()
+  {
+    super.undo();
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/AddEnumerationsCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/AddEnumerationsCommand.java
new file mode 100644
index 0000000..90cdc4c
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/AddEnumerationsCommand.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.commands;
+
+import org.eclipse.xsd.XSDEnumerationFacet;
+import org.eclipse.xsd.XSDFactory;
+import org.eclipse.xsd.XSDSimpleTypeDefinition;
+import org.eclipse.xsd.util.XSDSchemaBuildingTools;
+
+public class AddEnumerationsCommand extends BaseCommand
+{
+  XSDSimpleTypeDefinition simpleType;
+  String value;
+  
+  public AddEnumerationsCommand(String label, XSDSimpleTypeDefinition simpleType)
+  {
+    super(label);
+    this.simpleType = simpleType;
+  }
+  
+  public void setValue(String value)
+  {
+    this.value = value; 
+  }
+
+  public void execute()
+  {
+    XSDFactory factory = XSDSchemaBuildingTools.getXSDFactory();
+    XSDEnumerationFacet enumerationFacet = factory.createXSDEnumerationFacet();
+    enumerationFacet.setLexicalValue(value);
+    simpleType.getFacetContents().add(enumerationFacet);
+    formatChild(simpleType.getElement());
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/AddExtensibilityElementCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/AddExtensibilityElementCommand.java
new file mode 100644
index 0000000..26a2e7b
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/AddExtensibilityElementCommand.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.commands;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.wst.xsd.ui.common.properties.sections.appinfo.SpecificationForAppinfoSchema;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+public class AddExtensibilityElementCommand extends Command
+{
+  Element input, elementToAdd;
+  SpecificationForAppinfoSchema appInfoSchemaSpec;
+
+  public AddExtensibilityElementCommand(String label, Element input, Element elementToAdd)
+  {
+    super(label);
+    this.input = input;
+    this.elementToAdd = elementToAdd;
+  }
+
+  public void execute()
+  {
+    super.execute();
+    addElement();
+  }
+
+  public void undo()
+  {
+    super.undo();
+    // TODO
+  }
+
+  public void setSchemaProperties(SpecificationForAppinfoSchema appInfoSchemaSpec)
+  {
+    this.appInfoSchemaSpec = appInfoSchemaSpec;
+  }
+
+  private void addElement()
+  {
+    if (input != null)
+    {
+      Document doc = input.getOwnerDocument();
+      String name = elementToAdd.getAttribute("name");
+      try
+      {
+        Element rootElement = doc.createElementNS(appInfoSchemaSpec.getNamespaceURI(), name);
+        String prefix = input.getPrefix();
+        rootElement.setPrefix(prefix);
+        String xmlns = (prefix == null || prefix.equals("")) ? "xmlns" : "xmlns:" + prefix;
+        Attr nsURIAttribute = doc.createAttribute(xmlns);
+        nsURIAttribute.setValue(appInfoSchemaSpec.getNamespaceURI());
+        rootElement.setAttributeNode(nsURIAttribute);
+        input.appendChild(rootElement);
+
+      }
+      catch (Exception e)
+      {
+
+      }
+
+    }
+  }
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/AddXSDAttributeDeclarationCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/AddXSDAttributeDeclarationCommand.java
new file mode 100644
index 0000000..0f0a15f
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/AddXSDAttributeDeclarationCommand.java
@@ -0,0 +1,164 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.commands;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.wst.xsd.ui.common.util.XSDCommonUIUtils;
+import org.eclipse.xsd.XSDAttributeDeclaration;
+import org.eclipse.xsd.XSDAttributeGroupDefinition;
+import org.eclipse.xsd.XSDAttributeUse;
+import org.eclipse.xsd.XSDComplexTypeDefinition;
+import org.eclipse.xsd.XSDConcreteComponent;
+import org.eclipse.xsd.XSDFactory;
+import org.eclipse.xsd.XSDModelGroup;
+import org.eclipse.xsd.XSDSchema;
+import org.eclipse.xsd.XSDTypeDefinition;
+import org.w3c.dom.Text;
+
+public class AddXSDAttributeDeclarationCommand extends BaseCommand
+{
+  XSDComplexTypeDefinition xsdComplexTypeDefinition;
+  XSDModelGroup xsdModelGroup;
+//  XSDSchema xsdSchema;
+  XSDConcreteComponent parent;
+
+  public AddXSDAttributeDeclarationCommand(String label, XSDComplexTypeDefinition xsdComplexTypeDefinition)
+  {
+    super(label);
+    this.xsdComplexTypeDefinition = xsdComplexTypeDefinition;
+  }
+  
+  public AddXSDAttributeDeclarationCommand(String label, XSDConcreteComponent parent)
+  {
+    super(label);
+    this.parent = parent;
+  }
+
+  public void execute()
+  {
+    XSDAttributeDeclaration attribute = XSDFactory.eINSTANCE.createXSDAttributeDeclaration();
+    if (parent == null)
+    {
+      attribute.setName(getNewName("Attribute")); //$NON-NLS-1$
+      attribute.setTypeDefinition(xsdComplexTypeDefinition.getSchema().getSchemaForSchema().resolveSimpleTypeDefinition("string")); //$NON-NLS-1$
+
+      XSDAttributeUse attributeUse = XSDFactory.eINSTANCE.createXSDAttributeUse();
+      attributeUse.setAttributeDeclaration(attribute);
+      attributeUse.setContent(attribute);
+
+      if (xsdComplexTypeDefinition.getAttributeContents() != null)
+      {
+        xsdComplexTypeDefinition.getAttributeContents().add(attributeUse);
+        formatChild(xsdComplexTypeDefinition.getElement());
+      }
+      addedXSDConcreteComponent = attributeUse;
+    }
+    else
+    {
+      attribute.setTypeDefinition(parent.getSchema().getSchemaForSchema().resolveSimpleTypeDefinition("string")); //$NON-NLS-1$
+      if (parent instanceof XSDSchema)
+      {
+        attribute.setName(XSDCommonUIUtils.createUniqueElementName("NewAttribute", parent.getSchema().getAttributeDeclarations()));
+        XSDSchema xsdSchema = (XSDSchema)parent;
+        Text textNode = xsdSchema.getDocument().createTextNode("\n");
+        xsdSchema.getElement().appendChild(textNode);
+        xsdSchema.getContents().add(attribute);
+      }
+      else if (parent instanceof XSDAttributeGroupDefinition)
+      {
+        List list = new ArrayList();
+        Iterator i = ((XSDAttributeGroupDefinition)parent).getResolvedAttributeGroupDefinition().getAttributeUses().iterator();
+        while (i.hasNext())
+        {
+          XSDAttributeUse use = (XSDAttributeUse)i.next();
+          list.add(use.getAttributeDeclaration());
+        }
+        attribute.setName(XSDCommonUIUtils.createUniqueElementName("NewAttribute", list));
+        XSDAttributeUse attributeUse = XSDFactory.eINSTANCE.createXSDAttributeUse();
+        attributeUse.setAttributeDeclaration(attribute);
+        attributeUse.setContent(attribute);
+ 
+        ((XSDAttributeGroupDefinition)parent).getResolvedAttributeGroupDefinition().getContents().add(attributeUse);
+        formatChild(parent.getElement());
+      }
+      addedXSDConcreteComponent = attribute;
+    }
+  }
+
+  ArrayList names;
+
+  protected String getNewName(String description)
+  {
+    String candidateName = "New" + description; //$NON-NLS-1$
+    XSDConcreteComponent parent = xsdComplexTypeDefinition;
+    names = new ArrayList();
+    int i = 1;
+    if (parent instanceof XSDComplexTypeDefinition)
+    {
+      XSDComplexTypeDefinition ct = (XSDComplexTypeDefinition) parent;
+      walkUpInheritance(ct);
+
+      boolean ready = false;
+      while (!ready)
+      {
+        ready = true;
+        for (Iterator iter = names.iterator(); iter.hasNext();)
+        {
+          String attrName = (String) iter.next();
+          if (candidateName.equals(attrName))
+          {
+            ready = false;
+            candidateName = "New" + description + String.valueOf(i); //$NON-NLS-1$
+            i++;
+          }
+        }
+      }
+    }
+    return candidateName;
+  }
+
+  private void walkUpInheritance(XSDComplexTypeDefinition ct)
+  {
+    updateNames(ct);
+    XSDTypeDefinition typeDef = ct.getBaseTypeDefinition();
+    if (ct != ct.getRootType())
+    {
+      if (typeDef instanceof XSDComplexTypeDefinition)
+      {
+        XSDComplexTypeDefinition ct2 = (XSDComplexTypeDefinition) typeDef;
+        walkUpInheritance(ct2);
+      }
+    }
+  }
+
+  private void updateNames(XSDComplexTypeDefinition ct)
+  {
+    Iterator iter = ct.getAttributeContents().iterator();
+    while (iter.hasNext())
+    {
+      Object obj = iter.next();
+      if (obj instanceof XSDAttributeUse)
+      {
+        XSDAttributeUse use = (XSDAttributeUse) obj;
+        XSDAttributeDeclaration attr = use.getAttributeDeclaration();
+        String attrName = attr.getName();
+        if (attrName != null)
+        {
+          names.add(attrName);
+        }
+      }
+    }
+
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/AddXSDAttributeGroupDefinitionCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/AddXSDAttributeGroupDefinitionCommand.java
new file mode 100644
index 0000000..2bf259f
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/AddXSDAttributeGroupDefinitionCommand.java
@@ -0,0 +1,148 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.commands;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.wst.xsd.ui.common.util.XSDCommonUIUtils;
+import org.eclipse.xsd.XSDAttributeDeclaration;
+import org.eclipse.xsd.XSDAttributeGroupDefinition;
+import org.eclipse.xsd.XSDAttributeUse;
+import org.eclipse.xsd.XSDComplexTypeDefinition;
+import org.eclipse.xsd.XSDConcreteComponent;
+import org.eclipse.xsd.XSDFactory;
+import org.eclipse.xsd.XSDSchema;
+import org.eclipse.xsd.XSDTypeDefinition;
+import org.w3c.dom.Text;
+
+public class AddXSDAttributeGroupDefinitionCommand extends BaseCommand
+{
+  XSDComplexTypeDefinition xsdComplexTypeDefinition;
+  XSDSchema xsdSchema;
+
+  public AddXSDAttributeGroupDefinitionCommand(String label, XSDComplexTypeDefinition xsdComplexTypeDefinition)
+  {
+    super(label);
+    this.xsdComplexTypeDefinition = xsdComplexTypeDefinition;
+  }
+
+  public AddXSDAttributeGroupDefinitionCommand(String label, XSDSchema xsdSchema)
+  {
+    super(label);
+    this.xsdSchema = xsdSchema;
+  }
+
+  public void execute()
+  {
+    XSDAttributeGroupDefinition attributeGroup = XSDFactory.eINSTANCE.createXSDAttributeGroupDefinition();
+    if (xsdSchema == null)
+    {
+      attributeGroup.setName(getNewName("AttributeGroup")); //$NON-NLS-1$
+
+      List list = xsdComplexTypeDefinition.getSchema().getAttributeGroupDefinitions();
+      if (list.size() > 0)
+      {
+        attributeGroup.setResolvedAttributeGroupDefinition((XSDAttributeGroupDefinition) list.get(0));
+      }
+      else
+      {
+        attributeGroup.setName(null);
+        XSDAttributeGroupDefinition attributeGroup2 = XSDFactory.eINSTANCE.createXSDAttributeGroupDefinition();
+        attributeGroup2.setName(XSDCommonUIUtils.createUniqueElementName("NewAttributeGroup", xsdComplexTypeDefinition.getSchema().getAttributeGroupDefinitions()));
+        xsdComplexTypeDefinition.getSchema().getContents().add(attributeGroup2);
+        attributeGroup.setResolvedAttributeGroupDefinition(attributeGroup2);
+      }
+
+      if (xsdComplexTypeDefinition.getAttributeContents() != null)
+      {
+        xsdComplexTypeDefinition.getAttributeContents().add(attributeGroup);
+      }
+      addedXSDConcreteComponent = attributeGroup;
+    }
+    else
+    {
+      attributeGroup.setName(XSDCommonUIUtils.createUniqueElementName("NewAttributeGroup", xsdSchema.getAttributeGroupDefinitions()));
+      Text textNode = xsdSchema.getDocument().createTextNode("\n");
+      xsdSchema.getElement().appendChild(textNode);
+      xsdSchema.getContents().add(attributeGroup);
+      addedXSDConcreteComponent = attributeGroup;
+    }
+  }
+
+  ArrayList names;
+
+  protected String getNewName(String description)
+  {
+    String candidateName = "New" + description; //$NON-NLS-1$
+    XSDConcreteComponent parent = xsdComplexTypeDefinition;
+    names = new ArrayList();
+    int i = 1;
+    if (parent instanceof XSDComplexTypeDefinition)
+    {
+      XSDComplexTypeDefinition ct = (XSDComplexTypeDefinition) parent;
+      walkUpInheritance(ct);
+
+      boolean ready = false;
+      while (!ready)
+      {
+        ready = true;
+        for (Iterator iter = names.iterator(); iter.hasNext();)
+        {
+          String attrName = (String) iter.next();
+          if (candidateName.equals(attrName))
+          {
+            ready = false;
+            candidateName = "New" + description + String.valueOf(i); //$NON-NLS-1$
+            i++;
+          }
+        }
+      }
+    }
+    return candidateName;
+  }
+
+  private void walkUpInheritance(XSDComplexTypeDefinition ct)
+  {
+    updateNames(ct);
+    XSDTypeDefinition typeDef = ct.getBaseTypeDefinition();
+    if (ct != ct.getRootType())
+    {
+      if (typeDef instanceof XSDComplexTypeDefinition)
+      {
+        XSDComplexTypeDefinition ct2 = (XSDComplexTypeDefinition) typeDef;
+        walkUpInheritance(ct2);
+      }
+    }
+  }
+
+  private void updateNames(XSDComplexTypeDefinition ct)
+  {
+    Iterator iter = ct.getAttributeContents().iterator();
+    while (iter.hasNext())
+    {
+      Object obj = iter.next();
+      if (obj instanceof XSDAttributeUse)
+      {
+        XSDAttributeUse use = (XSDAttributeUse) obj;
+        XSDAttributeDeclaration attr = use.getAttributeDeclaration();
+        String attrName = attr.getName();
+        if (attrName != null)
+        {
+          names.add(attrName);
+        }
+      }
+    }
+
+  }
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/AddXSDComplexTypeDefinitionCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/AddXSDComplexTypeDefinitionCommand.java
new file mode 100644
index 0000000..6cfe1af
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/AddXSDComplexTypeDefinitionCommand.java
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.commands;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.xsd.XSDComplexTypeDefinition;
+import org.eclipse.xsd.XSDConcreteComponent;
+import org.eclipse.xsd.XSDElementDeclaration;
+import org.eclipse.xsd.XSDFactory;
+import org.eclipse.xsd.XSDSchema;
+import org.eclipse.xsd.XSDTypeDefinition;
+import org.eclipse.xsd.util.XSDSchemaBuildingTools;
+import org.w3c.dom.Text;
+
+public final class AddXSDComplexTypeDefinitionCommand extends BaseCommand
+{
+  protected XSDConcreteComponent parent;
+  protected XSDComplexTypeDefinition createdComplexType;
+  private String nameToAdd;
+  
+  public AddXSDComplexTypeDefinitionCommand(String label, XSDConcreteComponent parent)
+  {
+    super(label);
+    this.parent = parent;
+  }
+  
+  public void setNameToAdd(String nameToAdd)
+  {
+    this.nameToAdd = nameToAdd;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.gef.commands.Command#execute()
+   */
+  public void execute()
+  {
+    XSDFactory factory = XSDSchemaBuildingTools.getXSDFactory();
+    XSDComplexTypeDefinition complexType = factory.createXSDComplexTypeDefinition();
+    addedXSDConcreteComponent = complexType;
+    String newName = getNewName(nameToAdd == null ? "NewXSDComplexType" : nameToAdd, parent.getSchema());
+    complexType.setName(newName);
+    if (parent instanceof XSDSchema)
+    {
+      try
+      {
+        XSDSchema xsdSchema = (XSDSchema)parent;
+        Text textNode = xsdSchema.getDocument().createTextNode("\n");
+        xsdSchema.getElement().appendChild(textNode);
+        xsdSchema.getContents().add(complexType);
+      }
+      catch (Exception e)
+      {
+        e.printStackTrace();
+      } 
+    }
+    else if (parent instanceof XSDElementDeclaration)
+    {
+      ((XSDElementDeclaration) parent).setAnonymousTypeDefinition((XSDComplexTypeDefinition) complexType);
+      formatChild(parent.getElement());
+    }
+    createdComplexType = complexType;
+  }
+
+  protected String getNewName(String description, XSDSchema schema)
+  {
+    String candidateName = description; //$NON-NLS-1$
+    int i = 1;
+
+    List list = schema.getTypeDefinitions();
+    List listOfNames = new ArrayList();
+    for (Iterator iter = list.iterator(); iter.hasNext();)
+    {
+      XSDTypeDefinition typeDef = (XSDTypeDefinition) iter.next();
+      String name = typeDef.getName();
+      if (name == null)
+        name = "";
+      if (typeDef.getTargetNamespace() == schema.getTargetNamespace())
+        listOfNames.add(name);
+    }
+
+    boolean flag = true;
+    while (flag)
+    {
+      if (!listOfNames.contains(candidateName))
+      {
+        flag = false;
+        break;
+      }
+      candidateName = description + String.valueOf(i); //$NON-NLS-1$
+      i++;
+    }
+
+    return candidateName;
+  }
+
+  public XSDComplexTypeDefinition getCreatedComplexType()
+  {
+    return createdComplexType;
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/AddXSDElementCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/AddXSDElementCommand.java
new file mode 100644
index 0000000..efa2dda
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/AddXSDElementCommand.java
@@ -0,0 +1,287 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.commands;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.wst.xsd.ui.common.util.XSDCommonUIUtils;
+import org.eclipse.xsd.XSDComplexTypeContent;
+import org.eclipse.xsd.XSDComplexTypeDefinition;
+import org.eclipse.xsd.XSDCompositor;
+import org.eclipse.xsd.XSDConcreteComponent;
+import org.eclipse.xsd.XSDElementDeclaration;
+import org.eclipse.xsd.XSDFactory;
+import org.eclipse.xsd.XSDModelGroup;
+import org.eclipse.xsd.XSDModelGroupDefinition;
+import org.eclipse.xsd.XSDParticle;
+import org.eclipse.xsd.XSDSchema;
+import org.eclipse.xsd.XSDSimpleTypeDefinition;
+import org.eclipse.xsd.util.XSDSchemaBuildingTools;
+import org.w3c.dom.Text;
+
+public class AddXSDElementCommand extends BaseCommand
+{
+  XSDComplexTypeDefinition xsdComplexTypeDefinition;
+  XSDModelGroupDefinition xsdModelGroupDefinition;
+  XSDModelGroup xsdModelGroup;
+  XSDSchema xsdSchema;
+  boolean isReference;
+private String nameToAdd;
+
+  public AddXSDElementCommand()
+  {
+    super();
+  }
+
+  public AddXSDElementCommand(String label, XSDComplexTypeDefinition xsdComplexTypeDefinition)
+  {
+    super(label);
+    this.xsdComplexTypeDefinition = xsdComplexTypeDefinition;
+    xsdModelGroup = getModelGroup(xsdComplexTypeDefinition);
+  }
+
+  public AddXSDElementCommand(String label, XSDModelGroupDefinition xsdModelGroupDefinition)
+  {
+    super(label);
+    this.xsdModelGroupDefinition = xsdModelGroupDefinition;
+    xsdModelGroup = getModelGroup(xsdModelGroupDefinition);
+  }
+  
+  public AddXSDElementCommand(String label, XSDModelGroup xsdModelGroup, XSDComplexTypeDefinition xsdComplexTypeDefinition)
+  {
+    super(label);
+    this.xsdModelGroup = xsdModelGroup;
+    this.xsdComplexTypeDefinition = xsdComplexTypeDefinition;
+  }
+
+  public AddXSDElementCommand(String label, XSDModelGroup xsdModelGroup)
+  {
+    super(label);
+    this.xsdModelGroup = xsdModelGroup;
+  }
+
+  public AddXSDElementCommand(String label, XSDSchema xsdSchema)
+  {
+    super(label);
+    this.xsdSchema = xsdSchema;
+  }
+
+  public void setReference(boolean isReference)
+  {
+    this.isReference = isReference;
+  }
+  
+  public void setNameToAdd(String name){
+	  nameToAdd = name;
+  }
+  
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.gef.commands.Command#execute()
+   */
+  public void execute()
+  {
+    if (xsdSchema != null)
+    {
+      XSDElementDeclaration element = createGlobalXSDElementDeclaration();
+      Text textNode = xsdSchema.getDocument().createTextNode("\n");
+      xsdSchema.getElement().appendChild(textNode);
+      xsdSchema.getContents().add(element);
+      addedXSDConcreteComponent = element;
+    }
+    else if (xsdModelGroupDefinition != null)
+    {
+      if (xsdModelGroup == null)
+      {
+        XSDFactory factory = XSDSchemaBuildingTools.getXSDFactory();
+        XSDParticle particle = factory.createXSDParticle();
+        xsdModelGroup = factory.createXSDModelGroup();
+        xsdModelGroup.setCompositor(XSDCompositor.SEQUENCE_LITERAL);
+        particle.setContent(xsdModelGroup);
+      }
+      if (!isReference)
+      {
+        xsdModelGroup.getContents().add(createXSDElementDeclaration());
+      }
+      else
+      {
+        xsdModelGroup.getContents().add(createXSDElementReference());
+      }
+    }
+    else if (xsdComplexTypeDefinition == null && xsdModelGroup != null)
+    {
+      xsdSchema = xsdModelGroup.getSchema();
+      if (!isReference)
+      {
+        xsdModelGroup.getContents().add(createXSDElementDeclaration());
+      }
+      else
+      {
+        xsdModelGroup.getContents().add(createXSDElementReference());
+      }
+      formatChild(xsdModelGroup.getElement());
+    }
+    else
+    {
+      if (xsdModelGroup == null)
+      {
+        XSDFactory factory = XSDSchemaBuildingTools.getXSDFactory();
+        XSDParticle particle = factory.createXSDParticle();
+        xsdModelGroup = factory.createXSDModelGroup();
+        xsdModelGroup.setCompositor(XSDCompositor.SEQUENCE_LITERAL);
+        particle.setContent(xsdModelGroup);
+        xsdComplexTypeDefinition.setContent(particle);
+      }
+      xsdSchema = xsdComplexTypeDefinition.getSchema();
+      
+      if (!isReference)
+      {
+        xsdModelGroup.getContents().add(createXSDElementDeclarationForComplexType());
+      }
+      else
+      {
+        xsdModelGroup.getContents().add(createXSDElementReference());
+      }
+      formatChild(xsdModelGroup.getElement());
+    }
+    
+  }
+  
+  protected XSDParticle createXSDElementDeclaration()
+  {
+    XSDSimpleTypeDefinition type = xsdModelGroup.getSchema().getSchemaForSchema().resolveSimpleTypeDefinition("string");
+
+    XSDElementDeclaration element = XSDFactory.eINSTANCE.createXSDElementDeclaration();
+
+    ArrayList usedAttributeNames = new ArrayList();
+    usedAttributeNames.addAll(XSDCommonUIUtils.getChildElements(xsdModelGroup));
+    element.setName(XSDCommonUIUtils.createUniqueElementName(
+    		nameToAdd == null ? "NewElement" : nameToAdd , xsdSchema.getElementDeclarations()));
+    element.setTypeDefinition(type);
+
+    XSDParticle particle = XSDFactory.eINSTANCE.createXSDParticle();
+    particle.setContent(element);
+    addedXSDConcreteComponent = element;
+    return particle;
+  }
+
+  protected XSDParticle createXSDElementReference()
+  {
+    List list = xsdModelGroup.getSchema().getElementDeclarations();
+    XSDElementDeclaration referencedElement = null;
+    if (list.size() > 0)
+    {
+      referencedElement = (XSDElementDeclaration)list.get(0);
+    }
+    else
+    {
+      referencedElement = createGlobalXSDElementDeclaration();
+      Text textNode = xsdSchema.getDocument().createTextNode("\n");
+      xsdSchema.getElement().appendChild(textNode);
+      xsdSchema.getContents().add(referencedElement);
+    }
+
+    XSDElementDeclaration element = XSDFactory.eINSTANCE.createXSDElementDeclaration();
+    
+    element.setResolvedElementDeclaration(referencedElement);
+    XSDParticle particle = XSDFactory.eINSTANCE.createXSDParticle();
+    particle.setContent(element);
+    addedXSDConcreteComponent = element;
+    return particle;
+  }
+
+  protected XSDParticle createXSDElementDeclarationForComplexType()
+  {
+    XSDSimpleTypeDefinition type = xsdModelGroup.getSchema().getSchemaForSchema().resolveSimpleTypeDefinition("string");
+
+    XSDElementDeclaration element = XSDFactory.eINSTANCE.createXSDElementDeclaration();
+
+    ArrayList usedAttributeNames = new ArrayList();
+    usedAttributeNames.addAll(XSDCommonUIUtils.getAllAttributes(xsdComplexTypeDefinition));
+    usedAttributeNames.addAll(XSDCommonUIUtils.getInheritedAttributes(xsdComplexTypeDefinition));
+    element.setName(XSDCommonUIUtils.createUniqueElementName(
+    		nameToAdd == null ? "NewElement" : nameToAdd , usedAttributeNames));
+    element.setTypeDefinition(type);
+
+    XSDParticle particle = XSDFactory.eINSTANCE.createXSDParticle();
+    particle.setContent(element);
+    addedXSDConcreteComponent = element;
+    return particle;
+  }
+
+  protected XSDElementDeclaration createGlobalXSDElementDeclaration()
+  {
+    XSDSimpleTypeDefinition type = xsdSchema.getSchemaForSchema().resolveSimpleTypeDefinition("string");
+    XSDFactory factory = XSDSchemaBuildingTools.getXSDFactory();
+    XSDElementDeclaration element = factory.createXSDElementDeclaration();
+
+    element.setName(XSDCommonUIUtils.createUniqueElementName(
+    		nameToAdd == null ? "NewElement" : nameToAdd , xsdSchema.getElementDeclarations()));
+    element.setTypeDefinition(type);
+
+    return element;
+  }
+  
+  public XSDModelGroup getModelGroup(XSDModelGroupDefinition modelGroupDef)
+  {
+    return modelGroupDef.getModelGroup();
+  }
+
+  //PORT
+  public XSDModelGroup getModelGroup(XSDComplexTypeDefinition cType)
+  {
+    XSDParticle particle = cType.getComplexType();
+
+    if (particle == null)
+    {
+      return null;
+    }
+    
+    Object particleContent = particle.getContent();
+    XSDModelGroup group = null;
+
+    if (particleContent instanceof XSDModelGroupDefinition)
+    {
+      group = ((XSDModelGroupDefinition) particleContent).getResolvedModelGroupDefinition().getModelGroup();
+    }
+    else if (particleContent instanceof XSDModelGroup)
+    {
+      group = (XSDModelGroup) particleContent;
+    }
+
+    if (group == null)
+    {
+      return null;
+    }
+
+    if (group.getContents().isEmpty() || group.eResource() != cType.eResource())
+    {
+      if (cType.getBaseType() != null)
+      {
+        XSDComplexTypeContent content = cType.getContent();
+        if (content instanceof XSDParticle)
+        {
+          group = (XSDModelGroup) ((XSDParticle) content).getContent();
+        }
+      }
+    }
+
+    return group;
+  }
+  
+  public XSDConcreteComponent getAddedComponent()
+  {
+    return super.getAddedComponent();
+  }
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/AddXSDModelGroupCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/AddXSDModelGroupCommand.java
new file mode 100644
index 0000000..4821c85
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/AddXSDModelGroupCommand.java
@@ -0,0 +1,143 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.commands;
+
+import org.eclipse.xsd.XSDComplexTypeDefinition;
+import org.eclipse.xsd.XSDCompositor;
+import org.eclipse.xsd.XSDConcreteComponent;
+import org.eclipse.xsd.XSDElementDeclaration;
+import org.eclipse.xsd.XSDFactory;
+import org.eclipse.xsd.XSDModelGroup;
+import org.eclipse.xsd.XSDParticle;
+import org.eclipse.xsd.XSDSimpleTypeDefinition;
+import org.eclipse.xsd.util.XSDSchemaBuildingTools;
+
+public class AddXSDModelGroupCommand extends BaseCommand
+{
+  XSDConcreteComponent parent;
+  XSDCompositor xsdCompositor;
+  XSDModelGroup newModelGroup;
+
+  public AddXSDModelGroupCommand(String label, XSDConcreteComponent parent, XSDCompositor xsdCompositor)
+  {
+    super(label);
+    this.parent = parent;
+    this.xsdCompositor = xsdCompositor;
+  }
+
+  public void execute()
+  {
+    XSDConcreteComponent owner = getOwner();
+    if (owner != null)
+    {
+      XSDParticle particle = XSDFactory.eINSTANCE.createXSDParticle(); 
+      newModelGroup = createModelGroup();
+      particle.setContent(newModelGroup);
+
+      XSDComplexTypeDefinition ctd = (XSDComplexTypeDefinition)owner;
+      ctd.setContent(particle);
+    }
+    formatChild(parent.getElement());
+  }
+  
+  public void undo()
+  {
+    super.undo();
+    
+    if (parent instanceof XSDModelGroup)
+    {
+      XSDModelGroup model = (XSDModelGroup) parent;
+      model.getContents().remove(newModelGroup.getContainer());
+    }
+  }
+  
+  private XSDConcreteComponent getOwner()
+  {
+    XSDConcreteComponent owner = null;
+    if (parent instanceof XSDElementDeclaration)
+    {
+      XSDElementDeclaration ed = (XSDElementDeclaration)parent;      
+      if (ed.getTypeDefinition() != null) 
+      {
+        if (ed.getAnonymousTypeDefinition() == null)
+        {
+          ed.setTypeDefinition(null);
+          XSDComplexTypeDefinition td = XSDFactory.eINSTANCE.createXSDComplexTypeDefinition();
+          ed.setAnonymousTypeDefinition(td);
+          owner = ed.getTypeDefinition();
+        }
+        else
+        {
+          XSDComplexTypeDefinition td = XSDFactory.eINSTANCE.createXSDComplexTypeDefinition();
+          ed.setAnonymousTypeDefinition(td);
+          owner = td;        
+        }
+      }        
+      else if (ed.getAnonymousTypeDefinition() == null)
+      {
+        XSDComplexTypeDefinition td = XSDFactory.eINSTANCE.createXSDComplexTypeDefinition();
+        ed.setAnonymousTypeDefinition(td);
+        owner = td;        
+      }
+      else if (ed.getAnonymousTypeDefinition() instanceof XSDComplexTypeDefinition)
+      {
+        owner = ed.getAnonymousTypeDefinition();
+      }
+      else if (ed.getAnonymousTypeDefinition() instanceof XSDSimpleTypeDefinition)
+      {
+        XSDComplexTypeDefinition td = XSDFactory.eINSTANCE.createXSDComplexTypeDefinition();
+        ed.setAnonymousTypeDefinition(td);
+        owner = td;        
+      }
+    }
+    else if (parent instanceof XSDModelGroup)
+    {
+      newModelGroup = createModelGroup();
+      ((XSDModelGroup) parent).getContents().add(newModelGroup.getContainer());
+    }
+    else if (parent instanceof XSDComplexTypeDefinition)
+    {
+      XSDComplexTypeDefinition ct = (XSDComplexTypeDefinition)parent;
+      owner = parent;
+      if (ct.getContent() instanceof XSDParticle)
+      {
+        XSDParticle particle = (XSDParticle)ct.getContent();
+        if (particle.getContent() instanceof XSDModelGroup)
+        {
+          owner = null;
+          newModelGroup = createModelGroup();
+          XSDModelGroup newParent = (XSDModelGroup)particle.getContent();
+          newParent.getContents().add(newModelGroup.getContainer());
+        }
+        
+      }
+    }
+    return owner;
+  }
+  
+
+  protected boolean adopt(XSDConcreteComponent model)
+  {
+    return false;
+  }
+  
+  protected XSDModelGroup createModelGroup()
+  {
+    
+    XSDFactory factory = XSDSchemaBuildingTools.getXSDFactory();
+    XSDParticle particle = factory.createXSDParticle();
+    XSDModelGroup modelGroup = factory.createXSDModelGroup();
+    modelGroup.setCompositor(xsdCompositor);
+    particle.setContent(modelGroup);
+    addedXSDConcreteComponent = modelGroup;
+    return modelGroup;
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/AddXSDModelGroupDefinitionCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/AddXSDModelGroupDefinitionCommand.java
new file mode 100644
index 0000000..0947ee5
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/AddXSDModelGroupDefinitionCommand.java
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.commands;
+
+import java.util.List;
+
+import org.eclipse.wst.xsd.ui.common.util.XSDCommonUIUtils;
+import org.eclipse.xsd.XSDCompositor;
+import org.eclipse.xsd.XSDConcreteComponent;
+import org.eclipse.xsd.XSDFactory;
+import org.eclipse.xsd.XSDModelGroup;
+import org.eclipse.xsd.XSDModelGroupDefinition;
+import org.eclipse.xsd.XSDParticle;
+import org.eclipse.xsd.util.XSDSchemaBuildingTools;
+import org.w3c.dom.Text;
+
+public class AddXSDModelGroupDefinitionCommand extends BaseCommand
+{
+  XSDConcreteComponent parent;
+  boolean isReference;
+
+  public AddXSDModelGroupDefinitionCommand(String label, XSDConcreteComponent parent, boolean isReference)
+  {
+    super(label);
+    this.parent = parent;
+    this.isReference = isReference;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.gef.commands.Command#execute()
+   */
+  public void execute()
+  {
+    if (!isReference)
+    {
+      XSDModelGroupDefinition def= createXSDModelGroupDefinition();
+      addedXSDConcreteComponent = def;
+    }
+    else
+    {
+      XSDFactory factory = XSDSchemaBuildingTools.getXSDFactory();
+      XSDModelGroupDefinition def = factory.createXSDModelGroupDefinition();
+      XSDParticle particle = XSDFactory.eINSTANCE.createXSDParticle();
+      particle.setContent(def);
+      List list = parent.getSchema().getModelGroupDefinitions();
+      if (list.size() > 0)
+      {
+        def.setResolvedModelGroupDefinition((XSDModelGroupDefinition) list.get(0));
+      }
+      else
+      {
+        XSDModelGroupDefinition newGroupDef = createXSDModelGroupDefinition();
+        def.setResolvedModelGroupDefinition(newGroupDef);
+      }
+
+      if (parent instanceof XSDModelGroup)
+      {
+        ((XSDModelGroup) parent).getContents().add(particle);
+      }
+      formatChild(def.getElement());
+      addedXSDConcreteComponent = def;
+    }
+  }
+
+  protected XSDModelGroupDefinition createXSDModelGroupDefinition()
+  {
+    XSDFactory factory = XSDSchemaBuildingTools.getXSDFactory();
+    XSDModelGroupDefinition def = factory.createXSDModelGroupDefinition();
+    List list = parent.getSchema().getModelGroupDefinitions();
+    String newName = XSDCommonUIUtils.createUniqueElementName("ModelGroupDefinition", list);
+    def.setName(newName);
+
+    XSDModelGroup modelGroup = createModelGroup();
+    def.setModelGroup(modelGroup);
+    Text textNode = parent.getSchema().getDocument().createTextNode("\n");
+    parent.getSchema().getElement().appendChild(textNode);
+    parent.getSchema().getContents().add(def);
+    formatChild(def.getElement());
+    return def;
+  }
+
+  protected XSDModelGroup createModelGroup()
+  {
+    XSDFactory factory = XSDSchemaBuildingTools.getXSDFactory();
+    XSDParticle particle = factory.createXSDParticle();
+    XSDModelGroup modelGroup = factory.createXSDModelGroup();
+    modelGroup.setCompositor(XSDCompositor.SEQUENCE_LITERAL);
+    particle.setContent(modelGroup);
+
+    return modelGroup;
+  }
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/AddXSDSimpleTypeDefinitionCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/AddXSDSimpleTypeDefinitionCommand.java
new file mode 100644
index 0000000..64f7b36
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/AddXSDSimpleTypeDefinitionCommand.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.commands;
+
+import org.eclipse.wst.xsd.ui.common.util.XSDCommonUIUtils;
+import org.eclipse.xsd.XSDAttributeDeclaration;
+import org.eclipse.xsd.XSDConcreteComponent;
+import org.eclipse.xsd.XSDElementDeclaration;
+import org.eclipse.xsd.XSDFactory;
+import org.eclipse.xsd.XSDSchema;
+import org.eclipse.xsd.XSDSimpleTypeDefinition;
+import org.eclipse.xsd.util.XSDConstants;
+import org.w3c.dom.Text;
+
+public final class AddXSDSimpleTypeDefinitionCommand extends BaseCommand
+{
+  XSDConcreteComponent parent;
+  XSDSimpleTypeDefinition createdSimpleType;
+  private String nameToAdd;
+  
+  public AddXSDSimpleTypeDefinitionCommand(String label, XSDConcreteComponent parent)
+  {
+    super(label);
+    this.parent = parent;
+  }
+
+  public void setNameToAdd(String nameToAdd)
+  {
+    this.nameToAdd = nameToAdd;
+  }
+  
+  public void execute()
+  {
+    XSDSimpleTypeDefinition typeDef = XSDFactory.eINSTANCE.createXSDSimpleTypeDefinition();
+    typeDef.setBaseTypeDefinition(parent.getSchema().getSchemaForSchema().resolveSimpleTypeDefinition(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, "string"));
+
+    if (parent instanceof XSDSchema)
+    {
+      typeDef.setName(XSDCommonUIUtils.createUniqueElementName(nameToAdd == null ? "XSDSimpleType" : nameToAdd, ((XSDSchema) parent).getTypeDefinitions()));
+      createdSimpleType = typeDef;
+      try
+      {
+        XSDSchema xsdSchema = (XSDSchema)parent;
+        Text textNode = xsdSchema.getDocument().createTextNode("\n");
+        xsdSchema.getElement().appendChild(textNode);
+        xsdSchema.getContents().add(typeDef);
+      }
+      catch (Exception e)
+      {
+    
+      }
+    }
+    else if (parent instanceof XSDElementDeclaration)
+    {
+      ((XSDElementDeclaration) parent).setAnonymousTypeDefinition(typeDef);
+    }
+    else if (parent instanceof XSDAttributeDeclaration)
+    {
+      ((XSDAttributeDeclaration) parent).setAnonymousTypeDefinition(typeDef);
+    }
+    formatChild(createdSimpleType.getElement());
+  }
+
+  public XSDSimpleTypeDefinition getCreatedSimpleType()
+  {
+    return createdSimpleType;
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/BaseCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/BaseCommand.java
new file mode 100644
index 0000000..b8c4803
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/BaseCommand.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.commands;
+
+import org.eclipse.gef.commands.Command;
+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.xsd.XSDConcreteComponent;
+import org.w3c.dom.Element;
+
+public class BaseCommand extends Command
+{
+  XSDConcreteComponent addedXSDConcreteComponent;
+
+  public BaseCommand()
+  {
+    super();
+  }
+
+  public BaseCommand(String label)
+  {
+    super(label);
+  }
+  
+  public XSDConcreteComponent getAddedComponent()
+  {
+    return addedXSDConcreteComponent;
+  }
+
+  protected void formatChild(Element child)
+  {
+    if (child instanceof IDOMNode)
+    {
+      IDOMModel model = ((IDOMNode)child).getModel();
+      try
+      {
+        // tell the model that we are about to make a big model change
+        model.aboutToChangeModel();
+        
+        IStructuredFormatProcessor formatProcessor = new FormatProcessorXML();
+        formatProcessor.formatNode(child);
+      }
+      finally
+      {
+        // tell the model that we are done with the big model change
+        model.changedModel(); 
+      }
+    }
+  }
+ 
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/ChangeToLocalSimpleTypeCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/ChangeToLocalSimpleTypeCommand.java
new file mode 100644
index 0000000..c17c9f3
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/ChangeToLocalSimpleTypeCommand.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.commands;
+
+import org.eclipse.xsd.XSDAttributeDeclaration;
+import org.eclipse.xsd.XSDElementDeclaration;
+import org.eclipse.xsd.XSDFactory;
+import org.eclipse.xsd.XSDFeature;
+import org.eclipse.xsd.XSDSimpleTypeDefinition;
+
+public class ChangeToLocalSimpleTypeCommand extends BaseCommand
+{
+  XSDFeature parent;
+  XSDSimpleTypeDefinition anonymousSimpleType;
+  XSDSimpleTypeDefinition currentType;
+
+  public ChangeToLocalSimpleTypeCommand(String label, XSDFeature parent)
+  {
+    super(label);
+    this.parent = parent;
+
+//    if (parent instanceof XSDElementDeclaration)
+//    {
+//      XSDElementDeclaration element = (XSDElementDeclaration) parent;
+//      XSDTypeDefinition aType = element.getResolvedElementDeclaration().getTypeDefinition();
+//
+//      if (aType instanceof XSDSimpleTypeDefinition)
+//      {
+//        currentType = (XSDSimpleTypeDefinition) aType;
+//      }
+//    }
+  }
+
+  public void execute()
+  {
+//    anonymousSimpleType = XSDFactory.eINSTANCE.createXSDSimpleTypeDefinition();
+//    anonymousSimpleType.setBaseTypeDefinition(currentType);
+    if (parent instanceof XSDElementDeclaration)
+    {
+      ((XSDElementDeclaration)parent).setAnonymousTypeDefinition(anonymousSimpleType);
+    }
+    else if (parent instanceof XSDAttributeDeclaration)
+    {
+      ((XSDAttributeDeclaration)parent).setAnonymousTypeDefinition(anonymousSimpleType);
+    }
+    formatChild(parent.getElement());
+  }
+  
+  public void setAnonymousSimpleType(XSDSimpleTypeDefinition anonymousSimpleType)
+  {
+    this.anonymousSimpleType = anonymousSimpleType;
+  }
+
+  public XSDSimpleTypeDefinition getAnonymousType()
+  {
+    if (anonymousSimpleType == null)
+    {
+      anonymousSimpleType = XSDFactory.eINSTANCE.createXSDSimpleTypeDefinition();
+      anonymousSimpleType.setBaseTypeDefinition(currentType);
+    }
+    return anonymousSimpleType;
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/DeleteCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/DeleteCommand.java
new file mode 100644
index 0000000..eee0802
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/DeleteCommand.java
@@ -0,0 +1,120 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.commands;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.wst.xsd.editor.internal.adapters.XSDVisitor;
+import org.eclipse.xsd.XSDAttributeDeclaration;
+import org.eclipse.xsd.XSDAttributeGroupDefinition;
+import org.eclipse.xsd.XSDAttributeUse;
+import org.eclipse.xsd.XSDComplexTypeDefinition;
+import org.eclipse.xsd.XSDConcreteComponent;
+import org.eclipse.xsd.XSDElementDeclaration;
+import org.eclipse.xsd.XSDEnumerationFacet;
+import org.eclipse.xsd.XSDModelGroup;
+import org.eclipse.xsd.XSDModelGroupDefinition;
+import org.eclipse.xsd.XSDParticle;
+import org.eclipse.xsd.XSDSchema;
+import org.eclipse.xsd.XSDSimpleTypeDefinition;
+
+public class DeleteCommand extends BaseCommand
+{
+  XSDConcreteComponent target;
+
+  public DeleteCommand(String label, XSDConcreteComponent target)
+  {
+    super(label);
+    this.target = target;
+  }
+
+  public void execute()
+  {
+    XSDVisitor visitor = new XSDVisitor()
+    {
+      public void visitElementDeclaration(org.eclipse.xsd.XSDElementDeclaration element)
+      {
+        if (element.getTypeDefinition() == target)
+        {
+          XSDSimpleTypeDefinition type = target.getSchema().getSchemaForSchema().resolveSimpleTypeDefinition("string");
+          element.setTypeDefinition(type);
+        }
+        super.visitElementDeclaration(element);
+      }
+    };
+
+    XSDConcreteComponent parent = target.getContainer();
+
+    if (target instanceof XSDModelGroup || target instanceof XSDElementDeclaration || target instanceof XSDModelGroupDefinition)
+    {
+      if (parent instanceof XSDParticle)
+      {
+        if (parent.getContainer() instanceof XSDModelGroup)
+        {
+          XSDModelGroup modelGroup = (XSDModelGroup) ((XSDParticle) parent).getContainer();
+
+          modelGroup.getContents().remove(parent);
+        }
+      }
+      else if (parent instanceof XSDSchema)
+      {
+        visitor.visitSchema(target.getSchema());
+        ((XSDSchema) parent).getContents().remove(target);
+      }
+
+    }
+    else if (target instanceof XSDAttributeDeclaration)
+    {
+      if (parent instanceof XSDAttributeUse)
+      {
+        EObject obj = parent.eContainer();
+        XSDComplexTypeDefinition complexType = null;
+        while (obj != null)
+        {
+          if (obj instanceof XSDComplexTypeDefinition)
+          {
+            complexType = (XSDComplexTypeDefinition) obj;
+            break;
+          }
+          obj = obj.eContainer();
+        }
+        if (complexType != null)
+        {
+          complexType.getAttributeContents().remove((XSDAttributeUse) parent);
+        }
+
+        if (parent.getContainer() instanceof XSDAttributeGroupDefinition)
+        {
+          XSDAttributeGroupDefinition attrGroup = (XSDAttributeGroupDefinition) parent.getContainer();
+
+          attrGroup.getContents().remove(parent);
+        }
+      }
+    }
+    else if (target instanceof XSDAttributeGroupDefinition &&
+             parent instanceof XSDComplexTypeDefinition)
+    {
+      ((XSDComplexTypeDefinition)parent).getAttributeContents().remove(target);
+    }
+    else if (target instanceof XSDEnumerationFacet)
+    {
+      XSDEnumerationFacet enumerationFacet = (XSDEnumerationFacet)target;
+      enumerationFacet.getSimpleTypeDefinition().getFacetContents().remove(enumerationFacet);
+    }
+    else
+    {
+      if (parent instanceof XSDSchema)
+      {
+        visitor.visitSchema(target.getSchema());
+        ((XSDSchema) parent).getContents().remove(target);
+      }
+    }
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/RemoveAppInfoAttrCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/RemoveAppInfoAttrCommand.java
new file mode 100644
index 0000000..031e975
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/RemoveAppInfoAttrCommand.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.commands;
+
+import org.eclipse.gef.commands.Command;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+
+public class RemoveAppInfoAttrCommand extends Command 
+{
+	Element hostElement;
+	Attr attr;
+	
+	public RemoveAppInfoAttrCommand(String label, Element hostElement, Attr attr)
+	{
+		super(label);
+		this.hostElement = hostElement;
+		this.attr = attr;
+	}
+	
+	public void execute()
+	{
+		super.execute();
+		hostElement.removeAttributeNode(attr);
+	}
+	
+	public void undo()
+	{
+		super.undo();
+		//TODO implement me
+	}
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/RemoveAppInfoElementCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/RemoveAppInfoElementCommand.java
new file mode 100644
index 0000000..fabfe62
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/RemoveAppInfoElementCommand.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.commands;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.xsd.XSDAnnotation;
+import org.w3c.dom.Node;
+
+public class RemoveAppInfoElementCommand extends Command
+{
+  XSDAnnotation xsdAnnotation;
+  Node appInfo;
+
+  public RemoveAppInfoElementCommand(String label, XSDAnnotation xsdAnnotation, Node appInfo)
+  {
+    super(label);
+    this.xsdAnnotation = xsdAnnotation;
+    this.appInfo = appInfo;
+  }
+
+  public void execute()
+  {
+    super.execute();
+    xsdAnnotation.getApplicationInformation().remove(appInfo);
+    xsdAnnotation.getElement().removeChild(appInfo);
+    xsdAnnotation.updateElement();
+  }
+
+  public void undo()
+  {
+    super.undo();
+    xsdAnnotation.getApplicationInformation().add(appInfo);
+    xsdAnnotation.getElement().appendChild(appInfo);
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/SetMultiplicityCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/SetMultiplicityCommand.java
new file mode 100644
index 0000000..1810fde
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/SetMultiplicityCommand.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.commands;
+
+import org.eclipse.xsd.XSDConcreteComponent;
+import org.eclipse.xsd.XSDParticle;
+import org.eclipse.xsd.XSDParticleContent;
+
+public class SetMultiplicityCommand extends BaseCommand
+{
+  XSDConcreteComponent parent;
+  int maxOccurs, minOccurs;
+
+  /**
+   * @param parent
+   */
+  public SetMultiplicityCommand(String label)
+  {
+    super(label);
+  }
+  
+  public void setMaxOccurs(int i)
+  {
+    maxOccurs=i;
+  }
+
+  public void setMinOccurs(int i)
+  {
+    minOccurs=i;    
+  }
+
+  public void setXSDConcreteComponent(XSDConcreteComponent parent)
+  {
+    this.parent = parent;
+  }
+  
+  /* (non-Javadoc)
+   * @see org.eclipse.wst.xsd.ui.internal.commands.AbstractCommand#run()
+   */
+  public void execute()
+  {
+    if (parent instanceof XSDParticleContent)
+    {
+      XSDParticleContent xsdParticleContent = (XSDParticleContent)parent;
+      XSDParticle xsdParticle = (XSDParticle)xsdParticleContent.getContainer();
+      if (maxOccurs < 0)
+      {
+        maxOccurs = XSDParticle.UNBOUNDED;
+      }
+      xsdParticle.setMaxOccurs(maxOccurs);
+      xsdParticle.setMinOccurs(minOccurs);
+    }
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/SetTypeCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/SetTypeCommand.java
new file mode 100644
index 0000000..2c02f61
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/SetTypeCommand.java
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.commands;
+
+import org.eclipse.jface.window.Window;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification;
+import org.eclipse.wst.xsd.adt.edit.ComponentReferenceEditManager;
+import org.eclipse.wst.xsd.adt.edit.IComponentDialog;
+import org.eclipse.wst.xsd.editor.internal.adapters.XSDBaseAdapter;
+import org.eclipse.wst.xsd.ui.common.actions.SetTypeAction;
+import org.eclipse.xsd.XSDConcreteComponent;
+import org.eclipse.xsd.XSDElementDeclaration;
+
+public class SetTypeCommand extends BaseCommand
+{
+  XSDConcreteComponent parent;
+  private boolean continueApply;
+  XSDBaseAdapter adapter;
+  String action;
+
+  public SetTypeCommand(String label, String ID, XSDConcreteComponent parent)
+  {
+    super(label);
+    this.parent = parent;
+    this.action = ID;
+  }
+  
+  public void setAdapter(XSDBaseAdapter adapter)
+  {
+    this.adapter = adapter;
+  }
+
+  public void execute()
+  {
+    ComponentReferenceEditManager componentReferenceEditManager = getComponentReferenceEditManager();
+    continueApply = true; 
+    if (parent instanceof XSDElementDeclaration)
+    {
+      if (action.equals(SetTypeAction.SET_NEW_TYPE_ID))
+      {
+        ComponentSpecification newValue = (ComponentSpecification)invokeDialog(componentReferenceEditManager.getNewDialog());
+        if (continueApply)
+          componentReferenceEditManager.modifyComponentReference(adapter, newValue);
+      }
+      else
+      {
+        ComponentSpecification newValue = (ComponentSpecification)invokeDialog(componentReferenceEditManager.getBrowseDialog());
+        if (continueApply)
+          componentReferenceEditManager.modifyComponentReference(adapter, newValue);
+      }
+      formatChild(parent.getElement());
+    }
+
+  }
+
+  private Object invokeDialog(IComponentDialog dialog)
+  {
+    Object newValue = null;
+
+    if (dialog == null)
+    {
+      return null;
+    }
+
+    if (dialog.createAndOpen() == Window.OK)
+    {
+      newValue = dialog.getSelectedComponent();
+    }
+    else
+    {
+      continueApply = false;
+    }
+
+    return newValue;
+  }
+
+  protected ComponentReferenceEditManager getComponentReferenceEditManager()
+  {
+    ComponentReferenceEditManager result = null;
+    IEditorPart editor = getActiveEditor();
+    if (editor != null)
+    {
+      result = (ComponentReferenceEditManager)editor.getAdapter(ComponentReferenceEditManager.class);
+    }  
+    return result;
+  }
+  
+  private IEditorPart getActiveEditor()
+  {
+    IWorkbench workbench = PlatformUI.getWorkbench();
+    IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
+    IEditorPart editorPart = workbenchWindow.getActivePage().getActiveEditor();
+    return editorPart;
+  }    
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/SetXSDFacetValueCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/SetXSDFacetValueCommand.java
new file mode 100644
index 0000000..33c3523
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/SetXSDFacetValueCommand.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.commands;
+
+import org.eclipse.xsd.XSDFacet;
+
+public class SetXSDFacetValueCommand extends BaseCommand
+{
+  protected XSDFacet facet;
+  protected String value;
+  
+  public SetXSDFacetValueCommand(String label, XSDFacet facet)
+  {
+    super(label);
+    this.facet = facet;
+  }
+  
+  public void setValue(String value)
+  {
+    this.value = value; 
+  }
+  
+  public void execute()
+  {
+    facet.setLexicalValue(value);
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/UpdateComponentReferenceAndManageDirectivesCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/UpdateComponentReferenceAndManageDirectivesCommand.java
new file mode 100644
index 0000000..fddfcf3
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/UpdateComponentReferenceAndManageDirectivesCommand.java
@@ -0,0 +1,26 @@
+package org.eclipse.wst.xsd.ui.common.commands;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.xsd.XSDComponent;
+import org.eclipse.xsd.XSDConcreteComponent;
+
+public abstract class UpdateComponentReferenceAndManageDirectivesCommand extends Command{
+	  protected XSDConcreteComponent concreteComponent;
+	  protected String componentName;
+	  protected String componentNamespace;
+	  protected IFile file;
+
+	  public UpdateComponentReferenceAndManageDirectivesCommand(XSDConcreteComponent concreteComponent, String componentName, String componentNamespace, IFile file)
+	  {
+	    this.concreteComponent = concreteComponent;
+	    this.componentName = componentName;
+	    this.componentNamespace = componentNamespace;
+	    this.file = file;
+	  }  
+
+	  protected abstract XSDComponent computeComponent();
+	  
+	  public abstract void execute() ;
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/UpdateContentModelCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/UpdateContentModelCommand.java
new file mode 100644
index 0000000..0faa3e5
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/UpdateContentModelCommand.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.commands;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.xsd.XSDCompositor;
+import org.eclipse.xsd.XSDModelGroup;
+
+public class UpdateContentModelCommand extends Command
+{
+  XSDModelGroup xsdModelGroup;
+  XSDCompositor oldXSDCompositor, newXSDCompositor;
+  
+  
+  public UpdateContentModelCommand(String label, XSDModelGroup xsdModelGroup, XSDCompositor xsdCompositor)
+  {
+    super(label);
+    this.xsdModelGroup = xsdModelGroup;
+    this.newXSDCompositor = xsdCompositor;
+    this.oldXSDCompositor = xsdModelGroup.getCompositor();
+  }
+
+  
+  public void execute()
+  {
+    super.execute();
+    xsdModelGroup.setCompositor(newXSDCompositor);
+    
+  }
+    
+  public void undo()
+  {
+    xsdModelGroup.setCompositor(oldXSDCompositor);
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/UpdateElementReferenceAndManageDirectivesCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/UpdateElementReferenceAndManageDirectivesCommand.java
new file mode 100644
index 0000000..e07dbca
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/UpdateElementReferenceAndManageDirectivesCommand.java
@@ -0,0 +1,135 @@
+package org.eclipse.wst.xsd.ui.common.commands;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.xsd.XSDComponent;
+import org.eclipse.xsd.XSDConcreteComponent;
+import org.eclipse.xsd.XSDElementDeclaration;
+import org.eclipse.xsd.XSDFactory;
+import org.eclipse.xsd.XSDImport;
+import org.eclipse.xsd.XSDSchema;
+import org.eclipse.xsd.XSDSchemaDirective;
+import org.eclipse.xsd.util.XSDResourceImpl;
+
+public class UpdateElementReferenceAndManageDirectivesCommand extends 
+UpdateComponentReferenceAndManageDirectivesCommand{
+
+	public UpdateElementReferenceAndManageDirectivesCommand(XSDConcreteComponent concreteComponent,
+			String componentName, String componentNamespace, IFile file)
+	{
+		super(concreteComponent, componentName, componentNamespace, file);
+	}
+	
+	protected XSDComponent computeComponent()
+	{
+		XSDElementDeclaration result = null;
+		XSDSchema schema = concreteComponent.getSchema();
+		XSDSchemaDirective directive = null;
+		
+		// TODO (cs) handle case where namespace==null
+		//
+		if (componentNamespace != null)
+		{  
+			
+			// lets see if the element is already visible to our schema
+			result = getDefinedComponent(schema, componentName, componentNamespace);                     
+			if (result == null)
+			{
+				// TODO (cs) we need to provide a separate command to do this part
+				//
+				// apparently the element is not yet visible, we need to add includes/imports to get to it
+				if (componentNamespace.equals(schema.getTargetNamespace()))
+				{
+					// we need to add an include
+					directive =XSDFactory.eINSTANCE.createXSDInclude();
+				}
+				else
+				{
+					// we need to add an import
+					XSDImport xsdImport = XSDFactory.eINSTANCE.createXSDImport();
+					xsdImport.setNamespace(componentNamespace);
+					directive = xsdImport;              
+				}  
+				
+				// TODO (cs) we need to compute a relative URI to make this nicer!
+				//
+				String fileURI = file.getLocationURI().toString();
+				if (fileURI.startsWith("file:/") && !fileURI.startsWith("file:///"))
+				{
+					fileURI = "file:///" + fileURI.substring(6);
+				}   
+				directive.setSchemaLocation(fileURI);
+				
+				// TODO (cs) we should at the directive 'next' in the list of directives
+				// for now I'm just adding as the first thing in the schema :-(         
+				//
+				schema.getContents().add(0, directive);           
+				XSDSchema resolvedSchema = directive.getResolvedSchema();        
+				
+				if (resolvedSchema == null)
+				{
+					System.out.println("resolvedSchema is null!!!");
+					Resource resource  = concreteComponent.eResource().getResourceSet().createResource(URI.createURI(fileURI));          
+					if (resource instanceof XSDResourceImpl)
+					{
+						try
+						{
+							resource.load(null);
+							XSDResourceImpl resourceImpl = (XSDResourceImpl)resource;
+							resolvedSchema = resourceImpl.getSchema();
+							if (resolvedSchema != null)
+							{
+								System.out.println("Strange... managed to make the schema resovle myself 8-P" + resource);
+								directive.setResolvedSchema(resolvedSchema);
+							}
+						}
+						catch (Exception e)
+						{
+							
+						}
+					}  
+				}
+				if (resolvedSchema != null)
+				{  
+					result = getDefinedComponent(resolvedSchema, componentName, componentNamespace);
+				}    
+				else 
+				{
+					// TODO (cs) consider setting some error state so that the client can provide a  pop-dialog error
+					// we should also remove the import/include so save from cluttering the file with bogus directives                           
+				}
+			}   
+		}  
+		return result;
+	}
+
+	private XSDElementDeclaration getDefinedComponent(XSDSchema schema,
+			String componentName, String componentNamespace) {
+	    XSDElementDeclaration result = schema.resolveElementDeclaration(componentNamespace, componentName);
+	    if (result.eContainer() == null)
+	    {
+	      result = null;
+	    }
+	    return result;
+	}
+
+	public void execute() {
+	    try
+	    {
+	    XSDComponent elementDef = computeComponent();
+	    if (elementDef != null)
+	    {
+	      UpdateElementReferenceCommand command = new UpdateElementReferenceCommand(
+	    		  "Update Element Reference", (XSDElementDeclaration) concreteComponent,
+	    		  (XSDElementDeclaration) elementDef);
+	      command.execute();
+	    }
+	    }
+	    catch (Exception e)
+	    {
+	      e.printStackTrace();
+	    }
+	}
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/UpdateElementReferenceCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/UpdateElementReferenceCommand.java
new file mode 100644
index 0000000..5f05506
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/UpdateElementReferenceCommand.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.commands;
+
+import org.eclipse.xsd.XSDElementDeclaration;
+
+public class UpdateElementReferenceCommand extends BaseCommand
+{
+  XSDElementDeclaration element, ref;
+
+  public UpdateElementReferenceCommand(String label, XSDElementDeclaration element, XSDElementDeclaration ref)
+  {
+    super(label);
+    this.element = element;
+    this.ref = ref;
+  }
+
+  public void execute()
+  {
+    element.setResolvedElementDeclaration(ref);
+  }
+  
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/UpdateMaxOccursCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/UpdateMaxOccursCommand.java
new file mode 100644
index 0000000..a1f0ff4
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/UpdateMaxOccursCommand.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.commands;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.xsd.XSDParticle;
+import org.eclipse.xsd.util.XSDConstants;
+import org.w3c.dom.Element;
+
+public class UpdateMaxOccursCommand extends Command
+{
+	private int oldMaxOccurs;
+	private int newMaxOccurs;
+  private boolean removeMaxOccursAttribute;
+	
+	XSDParticle particle;
+
+  public UpdateMaxOccursCommand(String label, XSDParticle particle, int MaxOccurs)
+	{
+		super(label);
+		this.newMaxOccurs = MaxOccurs;
+		this.particle = particle;
+	}
+	
+	public void execute()
+	{
+    Element element = particle.getElement();
+    String currentMax = element.getAttribute(XSDConstants.MAXOCCURS_ATTRIBUTE);
+    removeMaxOccursAttribute = (currentMax == null)? true: false;
+		oldMaxOccurs = particle.getMaxOccurs();
+		particle.setMaxOccurs(newMaxOccurs);
+	}
+	
+	public void redo()
+	{
+		execute();
+	}
+	
+	public void undo()
+	{
+    if (removeMaxOccursAttribute)
+    {
+      particle.unsetMaxOccurs();
+    }
+    else
+    {
+		  particle.setMaxOccurs(oldMaxOccurs);
+    }
+	}
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/UpdateMinOccursCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/UpdateMinOccursCommand.java
new file mode 100644
index 0000000..457e4c6
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/UpdateMinOccursCommand.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.commands;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.xsd.XSDAttributeUse;
+import org.eclipse.xsd.XSDAttributeUseCategory;
+import org.eclipse.xsd.XSDComponent;
+import org.eclipse.xsd.XSDParticle;
+import org.eclipse.xsd.util.XSDConstants;
+import org.w3c.dom.Element;
+
+public class UpdateMinOccursCommand extends Command
+{
+  private int oldMinOccurs;
+  private int newMinOccurs;
+  private boolean removeMinOccursAttribute;
+
+  XSDComponent component;
+
+  public UpdateMinOccursCommand(String label, XSDComponent component, int minOccurs)
+  {
+    super(label);
+    this.newMinOccurs = minOccurs;
+    this.component = component;
+  }
+
+  public void execute()
+  {
+
+    Element element = component.getElement();
+    String currentMin = element.getAttribute(XSDConstants.MINOCCURS_ATTRIBUTE);
+    removeMinOccursAttribute = (currentMin == null) ? true : false;
+
+    if (component instanceof XSDParticle)
+    {
+      oldMinOccurs = ((XSDParticle) component).getMinOccurs();
+      ((XSDParticle) component).setMinOccurs(newMinOccurs);
+    }
+    else if (component instanceof XSDAttributeUse)
+    {
+      oldMinOccurs = (((XSDAttributeUse) component).getUse() == XSDAttributeUseCategory.REQUIRED_LITERAL ? 1 : 0);
+      if (newMinOccurs == 1)
+        ((XSDAttributeUse) component).setUse(XSDAttributeUseCategory.REQUIRED_LITERAL);
+      else
+        ((XSDAttributeUse) component).setUse(XSDAttributeUseCategory.OPTIONAL_LITERAL);
+    }
+  }
+
+  public void undo()
+  {
+    if (component instanceof XSDParticle)
+    {
+      if (removeMinOccursAttribute)
+      {
+        ((XSDParticle) component).unsetMinOccurs();
+      }
+      else
+      {
+        ((XSDParticle) component).setMinOccurs(oldMinOccurs);
+      }
+    }
+    else if (component instanceof XSDAttributeUse)
+    {
+      if (removeMinOccursAttribute)
+      {
+        ((XSDParticle) component).unsetMinOccurs();
+      }
+      else
+      {
+        if (oldMinOccurs == 1)
+          ((XSDAttributeUse) component).setUse(XSDAttributeUseCategory.REQUIRED_LITERAL);
+        else
+          ((XSDAttributeUse) component).setUse(XSDAttributeUseCategory.OPTIONAL_LITERAL);
+      }
+    }
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/UpdateNameCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/UpdateNameCommand.java
new file mode 100644
index 0000000..b2fd461
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/UpdateNameCommand.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.commands;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.xsd.XSDComplexTypeDefinition;
+import org.eclipse.xsd.XSDNamedComponent;
+
+public class UpdateNameCommand extends Command
+{
+  private String oldName;
+  private String newName;
+  private XSDNamedComponent component;
+
+  public UpdateNameCommand(String label, XSDNamedComponent component, String newName)
+  {
+    super(label);
+
+    if (component instanceof XSDComplexTypeDefinition && component.getName() == null && component.eContainer() instanceof XSDNamedComponent && ((XSDNamedComponent) component.eContainer()).getName() != null)
+    {
+      component = (XSDNamedComponent) component.eContainer();
+    }
+
+    this.component = component;
+    this.newName = newName;
+    this.oldName = component.getName();
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.gef.commands.Command#execute()
+   */
+  public void execute()
+  {
+    component.setName(newName);
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/UpdateNumericBoundsFacetCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/UpdateNumericBoundsFacetCommand.java
new file mode 100644
index 0000000..26598e1
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/UpdateNumericBoundsFacetCommand.java
@@ -0,0 +1,157 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.commands;
+
+import org.eclipse.xsd.XSDFactory;
+import org.eclipse.xsd.XSDMaxExclusiveFacet;
+import org.eclipse.xsd.XSDMaxInclusiveFacet;
+import org.eclipse.xsd.XSDMinExclusiveFacet;
+import org.eclipse.xsd.XSDMinInclusiveFacet;
+import org.eclipse.xsd.XSDSimpleTypeDefinition;
+
+public class UpdateNumericBoundsFacetCommand extends BaseCommand
+{
+  XSDSimpleTypeDefinition xsdSimpleType;
+  String max, min;
+  boolean includeMin, includeMax;
+  private boolean doUpdateMax = false, doUpdateMin = false;
+  XSDMinInclusiveFacet minInclusiveFacet;
+  XSDMinExclusiveFacet minExclusiveFacet;
+  XSDMaxInclusiveFacet maxInclusiveFacet;
+  XSDMaxExclusiveFacet maxExclusiveFacet;
+
+
+  public UpdateNumericBoundsFacetCommand(String label, XSDSimpleTypeDefinition xsdSimpleType, boolean includeMin, boolean includeMax)
+  {
+    super(label);
+    this.xsdSimpleType = xsdSimpleType;
+    this.includeMin = includeMin;
+    this.includeMax = includeMax;
+    
+    minInclusiveFacet = xsdSimpleType.getMinInclusiveFacet();
+    minExclusiveFacet = xsdSimpleType.getMinExclusiveFacet();
+    maxInclusiveFacet = xsdSimpleType.getMaxInclusiveFacet();
+    maxExclusiveFacet = xsdSimpleType.getMaxExclusiveFacet();
+
+  }
+
+  public void setMin(String min)
+  {
+    this.min = min;
+    doUpdateMin = true;
+  }
+  
+  public void setMax(String max)
+  {
+    this.max = max;
+    doUpdateMax = true;
+  }
+
+  public void execute()
+  {    
+    if (doUpdateMin)
+    {
+      if (includeMin)
+      {
+        if (minInclusiveFacet == null && min != null)
+        {
+          minInclusiveFacet = XSDFactory.eINSTANCE.createXSDMinInclusiveFacet();
+          minInclusiveFacet.setLexicalValue(min);
+          xsdSimpleType.getFacetContents().add(minInclusiveFacet);
+          
+          if (minExclusiveFacet != null)
+          {
+            xsdSimpleType.getFacetContents().remove(minExclusiveFacet);
+          }
+        }
+        else if (minInclusiveFacet != null && min != null)
+        {
+          minInclusiveFacet.setLexicalValue(min);
+        }
+        else if (minInclusiveFacet != null && min == null)
+        {
+          xsdSimpleType.getFacetContents().remove(minInclusiveFacet);
+        }
+      }
+      else // !includeMin
+      {
+        if (minExclusiveFacet == null && min != null)
+        {
+          minExclusiveFacet = XSDFactory.eINSTANCE.createXSDMinExclusiveFacet();
+          minExclusiveFacet.setLexicalValue(min);
+          xsdSimpleType.getFacetContents().add(minExclusiveFacet);
+          
+          if (minInclusiveFacet != null)
+          {
+            xsdSimpleType.getFacetContents().remove(minInclusiveFacet);
+          }
+        }
+        else if (minExclusiveFacet != null && min != null)
+        {
+          minExclusiveFacet.setLexicalValue(min);
+        }
+        else if (minExclusiveFacet != null && min == null)
+        {
+          xsdSimpleType.getFacetContents().remove(minExclusiveFacet);
+        }
+      }
+    }
+    else if (doUpdateMax)
+    {
+      if (includeMax)
+      {
+        if (maxInclusiveFacet == null && max != null)
+        {
+          maxInclusiveFacet = XSDFactory.eINSTANCE.createXSDMaxInclusiveFacet();
+          maxInclusiveFacet.setLexicalValue(max);
+          xsdSimpleType.getFacetContents().add(maxInclusiveFacet);
+          
+          if (maxExclusiveFacet != null)
+          {
+            xsdSimpleType.getFacetContents().remove(maxExclusiveFacet);
+          }
+        }
+        else if (maxInclusiveFacet != null && max != null)
+        {
+          maxInclusiveFacet.setLexicalValue(max);
+        }
+        else if (maxInclusiveFacet != null && max == null)
+        {
+          xsdSimpleType.getFacetContents().remove(maxInclusiveFacet);
+        }
+      }
+      else // !includeMax
+      {
+        if (maxExclusiveFacet == null && max != null)
+        {
+          maxExclusiveFacet = XSDFactory.eINSTANCE.createXSDMaxExclusiveFacet();
+          maxExclusiveFacet.setLexicalValue(max);
+          xsdSimpleType.getFacetContents().add(maxExclusiveFacet);
+          
+          if (maxInclusiveFacet != null)
+          {
+            xsdSimpleType.getFacetContents().remove(maxInclusiveFacet);
+          }
+        }
+        else if (maxExclusiveFacet != null && max != null)
+        {
+          maxExclusiveFacet.setLexicalValue(max);
+        }
+        else if (maxExclusiveFacet != null && max == null)
+        {
+          xsdSimpleType.getFacetContents().remove(maxExclusiveFacet);
+        }
+      }
+    }
+
+    formatChild(xsdSimpleType.getElement());
+  }  
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/UpdateStringLengthFacetCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/UpdateStringLengthFacetCommand.java
new file mode 100644
index 0000000..48d0f63
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/UpdateStringLengthFacetCommand.java
@@ -0,0 +1,223 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.commands;
+
+import org.eclipse.xsd.XSDFactory;
+import org.eclipse.xsd.XSDLengthFacet;
+import org.eclipse.xsd.XSDMaxLengthFacet;
+import org.eclipse.xsd.XSDMinLengthFacet;
+import org.eclipse.xsd.XSDSimpleTypeDefinition;
+
+public class UpdateStringLengthFacetCommand extends BaseCommand
+{
+  XSDSimpleTypeDefinition xsdSimpleType;
+  String max, min;
+  private boolean doUpdateMax = false, doUpdateMin = false;
+
+  public UpdateStringLengthFacetCommand(String label, XSDSimpleTypeDefinition xsdSimpleType)
+  {
+    super(label);
+    this.xsdSimpleType = xsdSimpleType;
+  }
+  
+  public void setMin(String min)
+  {
+    this.min = min;
+    doUpdateMin = true;
+  }
+  
+  public void setMax(String max)
+  {
+    this.max = max;
+    doUpdateMax = true;
+  }
+  
+  public void execute()
+  {
+    XSDLengthFacet lengthFacet = xsdSimpleType.getEffectiveLengthFacet();
+    XSDMinLengthFacet minLengthFacet = xsdSimpleType.getEffectiveMinLengthFacet();
+    XSDMaxLengthFacet maxLengthFacet = xsdSimpleType.getEffectiveMaxLengthFacet();
+    
+    String currentLength = null, currentMin = null, currentMax = null;
+    if (lengthFacet != null)
+    {
+      currentLength = lengthFacet.getLexicalValue();
+    }
+    if (minLengthFacet != null)
+    {
+      currentMin = minLengthFacet.getLexicalValue();
+    }
+    if (maxLengthFacet != null)
+    {
+      currentMax = maxLengthFacet.getLexicalValue();
+    }
+
+    if (doUpdateMax && !doUpdateMin)
+    {
+      if (maxLengthFacet != null)
+      {
+        if (max != null)
+        {
+          if (max.equals(currentMin))
+          {
+            lengthFacet = XSDFactory.eINSTANCE.createXSDLengthFacet();
+            lengthFacet.setLexicalValue(max);
+            xsdSimpleType.getFacetContents().add(lengthFacet);
+            xsdSimpleType.getFacetContents().remove(maxLengthFacet);
+            xsdSimpleType.getFacetContents().remove(minLengthFacet);
+          }
+          else
+          {
+            if (lengthFacet != null)
+            {
+              xsdSimpleType.getFacetContents().remove(lengthFacet);
+            }
+            if (minLengthFacet == null && currentLength != null)
+            {
+              minLengthFacet = XSDFactory.eINSTANCE.createXSDMinLengthFacet();
+              minLengthFacet.setLexicalValue(currentLength);
+              xsdSimpleType.getFacetContents().add(minLengthFacet);
+            }
+            maxLengthFacet.setLexicalValue(max);
+          }
+        }
+        else
+        {
+          xsdSimpleType.getFacetContents().remove(maxLengthFacet);
+        }
+      }
+      else
+      {
+        if (currentMin != null && currentMin.equals(max))
+        {
+          if (lengthFacet == null)
+          {
+            lengthFacet = XSDFactory.eINSTANCE.createXSDLengthFacet();
+            xsdSimpleType.getFacetContents().add(lengthFacet);
+          }
+          lengthFacet.setLexicalValue(max);
+          xsdSimpleType.getFacetContents().remove(minLengthFacet);
+        }
+        else if (currentLength != null && !currentLength.equals(max))
+        {
+          xsdSimpleType.getFacetContents().remove(lengthFacet);
+
+          if (max != null)
+          {
+            maxLengthFacet = XSDFactory.eINSTANCE.createXSDMaxLengthFacet();
+            maxLengthFacet.setLexicalValue(max);
+            xsdSimpleType.getFacetContents().add(maxLengthFacet);
+          }
+          
+          minLengthFacet = XSDFactory.eINSTANCE.createXSDMinLengthFacet();
+          minLengthFacet.setLexicalValue(currentLength);
+          xsdSimpleType.getFacetContents().add(minLengthFacet);
+        }
+        else
+        {
+          if (lengthFacet != null)
+          {
+            xsdSimpleType.getFacetContents().remove(lengthFacet);
+            
+            minLengthFacet = XSDFactory.eINSTANCE.createXSDMinLengthFacet();
+            minLengthFacet.setLexicalValue(currentLength);
+            xsdSimpleType.getFacetContents().add(minLengthFacet);
+
+          }
+          maxLengthFacet = XSDFactory.eINSTANCE.createXSDMaxLengthFacet();
+          maxLengthFacet.setLexicalValue(max);
+          xsdSimpleType.getFacetContents().add(maxLengthFacet);
+        }
+      }
+    }
+    else if (!doUpdateMax && doUpdateMin)
+    {
+      if (minLengthFacet != null)
+      {
+        if (min != null)
+        {
+          if (min.equals(currentMax))
+          {
+            lengthFacet = XSDFactory.eINSTANCE.createXSDLengthFacet();
+            lengthFacet.setLexicalValue(min);
+            xsdSimpleType.getFacetContents().add(lengthFacet);
+            xsdSimpleType.getFacetContents().remove(maxLengthFacet);
+            xsdSimpleType.getFacetContents().remove(minLengthFacet);
+          }
+          else
+          {
+            if (lengthFacet != null)
+            {
+              xsdSimpleType.getFacetContents().remove(lengthFacet);
+            }
+            if (maxLengthFacet == null && currentLength != null)
+            {
+              maxLengthFacet = XSDFactory.eINSTANCE.createXSDMaxLengthFacet();
+              maxLengthFacet.setLexicalValue(currentLength);
+              xsdSimpleType.getFacetContents().add(maxLengthFacet);
+            }
+            minLengthFacet.setLexicalValue(min);
+          }
+        }
+        else
+        {
+          xsdSimpleType.getFacetContents().remove(minLengthFacet);
+        }
+      }
+      else
+      {
+        if (currentMax != null && currentMax.equals(min))
+        {
+          if (lengthFacet == null)
+          {
+            lengthFacet = XSDFactory.eINSTANCE.createXSDLengthFacet();
+            xsdSimpleType.getFacetContents().add(lengthFacet);
+          }
+          lengthFacet.setLexicalValue(min);
+          xsdSimpleType.getFacetContents().remove(maxLengthFacet);
+        }
+        else if (currentLength != null && !currentLength.equals(min))
+        {
+          xsdSimpleType.getFacetContents().remove(lengthFacet);
+
+          if (min != null)
+          {
+            minLengthFacet = XSDFactory.eINSTANCE.createXSDMinLengthFacet();
+            minLengthFacet.setLexicalValue(min);
+            xsdSimpleType.getFacetContents().add(minLengthFacet);
+          }
+
+          maxLengthFacet = XSDFactory.eINSTANCE.createXSDMaxLengthFacet();
+          maxLengthFacet.setLexicalValue(currentLength);
+          xsdSimpleType.getFacetContents().add(maxLengthFacet);
+        }
+        else
+        {
+          minLengthFacet = XSDFactory.eINSTANCE.createXSDMinLengthFacet();
+          minLengthFacet.setLexicalValue(min);
+          xsdSimpleType.getFacetContents().add(minLengthFacet);
+
+          if (lengthFacet != null)
+          {
+            xsdSimpleType.getFacetContents().remove(lengthFacet);
+
+            maxLengthFacet = XSDFactory.eINSTANCE.createXSDMaxLengthFacet();
+            maxLengthFacet.setLexicalValue(currentLength);
+            xsdSimpleType.getFacetContents().add(maxLengthFacet);
+          }
+        }
+      }
+    }
+    formatChild(xsdSimpleType.getElement());
+
+  }
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/UpdateTypeReferenceAndManageDirectivesCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/UpdateTypeReferenceAndManageDirectivesCommand.java
new file mode 100644
index 0000000..157c1a9
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/UpdateTypeReferenceAndManageDirectivesCommand.java
@@ -0,0 +1,155 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.commands;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.xsd.XSDComponent;
+import org.eclipse.xsd.XSDConcreteComponent;
+import org.eclipse.xsd.XSDFactory;
+import org.eclipse.xsd.XSDImport;
+import org.eclipse.xsd.XSDSchema;
+import org.eclipse.xsd.XSDSchemaDirective;
+import org.eclipse.xsd.XSDTypeDefinition;
+import org.eclipse.xsd.util.XSDConstants;
+import org.eclipse.xsd.util.XSDResourceImpl;
+
+public class UpdateTypeReferenceAndManageDirectivesCommand extends UpdateComponentReferenceAndManageDirectivesCommand
+{
+
+  public UpdateTypeReferenceAndManageDirectivesCommand(XSDConcreteComponent concreteComponent,
+		  String componentName, String componentNamespace, IFile file)
+  {
+	  super(concreteComponent, componentName, componentNamespace, file);
+  }
+
+  public XSDComponent computeComponent()
+  {
+    XSDComponent result = null;
+    XSDSchema schema = concreteComponent.getSchema();
+    XSDSchemaDirective directive = null;
+    
+    // TODO (cs) handle case where namespace==null
+    //
+    if (componentNamespace != null)
+    {  
+      if (XSDConstants.isSchemaForSchemaNamespace(componentNamespace))
+      {
+        // this is the easy case, its just a built-in type
+        //
+        result = getDefinedComponent(schema, componentName, componentNamespace);        
+      }  
+      else
+      {
+        // lets see if the type is already visible to our schema
+        result = getDefinedComponent(schema, componentName, componentNamespace);                     
+        if (result == null)
+        {
+          // TODO (cs) we need to provide a separate command to do this part
+          // TODO (trung) directives in the outline view does not get updated
+          // apparently the type is not yet visible, we need to add includes/imports to get to it
+          if (componentNamespace.equals(schema.getTargetNamespace()))
+          {
+            // we need to add an include
+            directive =XSDFactory.eINSTANCE.createXSDInclude();
+          }
+          else
+          {
+            // we need to add an import
+            XSDImport xsdImport = XSDFactory.eINSTANCE.createXSDImport();
+            xsdImport.setNamespace(componentNamespace);
+            directive = xsdImport;              
+          }  
+          
+          // TODO (cs) we need to compute a relative URI to make this nicer!
+          //
+          String fileURI = file.getLocationURI().toString();
+          if (fileURI.startsWith("file:/") && !fileURI.startsWith("file:///"))
+          {
+            fileURI = "file:///" + fileURI.substring(6);
+          }   
+          directive.setSchemaLocation(fileURI);
+          
+          // TODO (cs) we should at the directive 'next' in the list of directives
+          // for now I'm just adding as the first thing in the schema :-(         
+          //
+          schema.getContents().add(0, directive);           
+          XSDSchema resolvedSchema = directive.getResolvedSchema();        
+         
+          if (resolvedSchema == null)
+          {
+            System.out.println("resolvedSchema is null!!!");
+            Resource resource  = concreteComponent.eResource().getResourceSet().createResource(URI.createURI(fileURI));          
+            if (resource instanceof XSDResourceImpl)
+            {
+              try
+              {
+              resource.load(null);
+              XSDResourceImpl resourceImpl = (XSDResourceImpl)resource;
+              resolvedSchema = resourceImpl.getSchema();
+              if (resolvedSchema != null)
+              {
+                System.out.println("Strange... managed to make the schema resovle myself 8-P" + resource);
+                directive.setResolvedSchema(resolvedSchema);
+              }
+              }
+              catch (Exception e)
+              {
+                
+              }
+            }  
+          }
+          if (resolvedSchema != null)
+          {  
+            result = getDefinedComponent(resolvedSchema, componentName, componentNamespace);
+          }    
+          else 
+          {
+            // TODO (cs) consider setting some error state so that the client can provide a  pop-dialog error
+            // we should also remove the import/include so save from cluttering the file with bogus directives                           
+          }
+        }
+      }   
+    }  
+    return result;
+  }
+ 
+  
+  private XSDTypeDefinition getDefinedComponent(XSDSchema schema, String componentName, String componentNamespace)
+  {
+    XSDTypeDefinition result = schema.resolveTypeDefinition(componentNamespace, componentName);
+    if (result.eContainer() == null)
+    {
+      result = null;
+    }      
+    return result;
+  }
+  
+  
+  public void execute()
+  {
+    try
+    {
+    XSDComponent td = computeComponent();
+    if (td != null && td instanceof XSDTypeDefinition)
+    {
+      UpdateTypeReferenceCommand command = new UpdateTypeReferenceCommand(
+    		  concreteComponent, (XSDTypeDefinition) td);
+      command.execute();
+    }
+    }
+    catch (Exception e)
+    {
+      e.printStackTrace();
+    }
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/UpdateTypeReferenceCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/UpdateTypeReferenceCommand.java
new file mode 100644
index 0000000..b9b9a8a
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/UpdateTypeReferenceCommand.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.commands;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.xsd.XSDAttributeDeclaration;
+import org.eclipse.xsd.XSDAttributeUse;
+import org.eclipse.xsd.XSDConcreteComponent;
+import org.eclipse.xsd.XSDElementDeclaration;
+import org.eclipse.xsd.XSDSimpleTypeDefinition;
+import org.eclipse.xsd.XSDTypeDefinition;
+
+public class UpdateTypeReferenceCommand extends Command
+{
+  XSDConcreteComponent concreteComponent;
+  XSDTypeDefinition newType;
+  
+  public UpdateTypeReferenceCommand(XSDConcreteComponent concreteComponent, XSDTypeDefinition newType)
+  {
+    this.concreteComponent = concreteComponent;
+    this.newType = newType;
+  }
+   
+  public void execute()
+  {
+    
+    if (concreteComponent instanceof XSDElementDeclaration)
+    {
+      setElementType((XSDElementDeclaration)concreteComponent);
+    }  
+    else if (concreteComponent instanceof XSDAttributeUse)
+    {
+      setAttributeType((XSDAttributeUse)concreteComponent);      
+    }  
+    else if (concreteComponent instanceof XSDAttributeDeclaration)
+    {
+      setAttributeType((XSDAttributeDeclaration)concreteComponent);
+    }  
+  }
+ 
+  protected void setElementType(XSDElementDeclaration ed)
+  {
+    ed = ed.getResolvedElementDeclaration();
+    if (ed != null)
+    {  
+      ed.setTypeDefinition(newType);
+    }      
+  }
+  
+  protected void setAttributeType(XSDAttributeUse attributeUse)
+  {
+    setAttributeType(attributeUse.getAttributeDeclaration());
+  }
+  
+  protected void setAttributeType(XSDAttributeDeclaration ad)
+  {
+    ad = ad.getResolvedAttributeDeclaration();
+    if (ad != null && newType instanceof XSDSimpleTypeDefinition)
+    {
+      ad.setTypeDefinition((XSDSimpleTypeDefinition)newType);
+    }  
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/UpdateXSDPatternFacetCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/UpdateXSDPatternFacetCommand.java
new file mode 100644
index 0000000..2880469
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/UpdateXSDPatternFacetCommand.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.commands;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.xsd.XSDFactory;
+import org.eclipse.xsd.XSDPatternFacet;
+import org.eclipse.xsd.XSDSimpleTypeDefinition;
+
+public class UpdateXSDPatternFacetCommand extends BaseCommand
+{
+  public static final int ADD = 0;
+  public static final int DELETE = 1;
+  public static final int UPDATE = 2;
+  
+  XSDSimpleTypeDefinition xsdSimpleTypeDefinition;
+  String value;
+  int actionType;
+  XSDPatternFacet patternToEdit;
+  
+  public UpdateXSDPatternFacetCommand(String label, XSDSimpleTypeDefinition xsdSimpleTypeDefinition, int actionType)
+  {
+    super(label);
+    this.xsdSimpleTypeDefinition = xsdSimpleTypeDefinition;
+    this.actionType = actionType;
+    
+  }
+  
+  public void setValue(String value)
+  {
+    this.value = value;
+  }
+  
+  public void setPatternToEdit(XSDPatternFacet patternToEdit)
+  {
+    this.patternToEdit = patternToEdit;
+  }
+
+  public void execute()
+  {
+    if (actionType == ADD)
+    {
+      XSDPatternFacet pattern = XSDFactory.eINSTANCE.createXSDPatternFacet();
+      pattern.setLexicalValue(value);
+      xsdSimpleTypeDefinition.getFacetContents().add(pattern);
+    }
+    else if (actionType == DELETE)
+    {
+      Assert.isNotNull(patternToEdit);
+      if (xsdSimpleTypeDefinition.getFacetContents().contains(patternToEdit))
+        xsdSimpleTypeDefinition.getFacetContents().remove(patternToEdit);
+    }
+    else if (actionType == UPDATE)
+    {
+      Assert.isNotNull(patternToEdit);
+      patternToEdit.setLexicalValue(value);
+    }
+    formatChild(xsdSimpleTypeDefinition.getElement());
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/UpdateXSDWhiteSpaceFacetCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/UpdateXSDWhiteSpaceFacetCommand.java
new file mode 100644
index 0000000..05b64d6
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/commands/UpdateXSDWhiteSpaceFacetCommand.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.commands;
+
+import org.eclipse.xsd.XSDFactory;
+import org.eclipse.xsd.XSDSimpleTypeDefinition;
+import org.eclipse.xsd.XSDWhiteSpace;
+import org.eclipse.xsd.XSDWhiteSpaceFacet;
+
+public class UpdateXSDWhiteSpaceFacetCommand extends BaseCommand
+{
+  XSDSimpleTypeDefinition xsdSimpleTypeDefinition;
+  boolean doAddFacet;
+  
+  public UpdateXSDWhiteSpaceFacetCommand(String label, XSDSimpleTypeDefinition xsdSimpleType, boolean doAddFacet)
+  {
+    super(label);
+    this.xsdSimpleTypeDefinition = xsdSimpleType;
+    this.doAddFacet = doAddFacet;
+  }
+
+  public void execute()
+  {
+    XSDWhiteSpaceFacet whitespaceFacet = xsdSimpleTypeDefinition.getWhiteSpaceFacet();
+    
+    if (doAddFacet)
+    {
+      if (whitespaceFacet == null)
+      {
+        whitespaceFacet = XSDFactory.eINSTANCE.createXSDWhiteSpaceFacet();
+        xsdSimpleTypeDefinition.getFacetContents().add(whitespaceFacet);
+      }
+      whitespaceFacet.setLexicalValue(XSDWhiteSpace.COLLAPSE_LITERAL.getName());
+    }
+    else
+    {
+      if (whitespaceFacet != null)
+      {
+        xsdSimpleTypeDefinition.getFacetContents().remove(whitespaceFacet);
+      }
+    }
+    formatChild(xsdSimpleTypeDefinition.getElement());    
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/providers/XSDSectionLabelProvider.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/providers/XSDSectionLabelProvider.java
new file mode 100644
index 0000000..b633a98
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/providers/XSDSectionLabelProvider.java
@@ -0,0 +1,153 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.properties.providers;
+
+import org.eclipse.jface.util.Assert;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.wst.xsd.adt.outline.ITreeElement;
+import org.eclipse.wst.xsd.editor.Messages;
+import org.eclipse.wst.xsd.editor.internal.adapters.XSDAdapterFactory;
+import org.eclipse.wst.xsd.editor.internal.adapters.XSDBaseAdapter;
+import org.eclipse.xsd.XSDAttributeDeclaration;
+import org.eclipse.xsd.XSDConcreteComponent;
+import org.eclipse.xsd.XSDElementDeclaration;
+import org.eclipse.xsd.XSDModelGroupDefinition;
+import org.eclipse.xsd.XSDSchema;
+import org.w3c.dom.Element;
+
+public class XSDSectionLabelProvider extends LabelProvider
+{
+  /**
+   * 
+   */
+  public XSDSectionLabelProvider()
+  {
+    super();
+  }
+
+  /**
+   * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
+   */
+  public Image getImage(Object object)
+  {
+    if (object == null || object.equals(StructuredSelection.EMPTY))
+    {
+      return null;
+    }
+    Image result = null;
+    if (object instanceof StructuredSelection)
+    {
+      Object selected = ((StructuredSelection) object).getFirstElement();
+
+      if (selected instanceof XSDConcreteComponent)
+      {
+        XSDBaseAdapter adapter = (XSDBaseAdapter)XSDAdapterFactory.getInstance().adapt((XSDConcreteComponent)selected);
+        if (adapter instanceof ITreeElement)
+        {
+          return ((ITreeElement)adapter).getImage();
+        }
+        
+      }
+    }
+    return result;
+  }
+
+  /**
+   * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
+   */
+  public String getText(Object object)
+  {
+    if (object == null || object.equals(StructuredSelection.EMPTY))
+    {
+      return "No items selected";
+    }
+
+    String result = null;
+
+    boolean isReference = false;
+    Object selected = null;
+    if (object instanceof StructuredSelection)
+    {
+      selected = ((StructuredSelection) object).getFirstElement();
+
+      if (selected instanceof XSDConcreteComponent)
+      {
+        if (selected instanceof XSDElementDeclaration)
+        {
+          XSDElementDeclaration xsdElementDeclaration = (XSDElementDeclaration) selected;
+          if (xsdElementDeclaration.isElementDeclarationReference())
+          {
+            isReference = true;
+          }
+        } else if (selected instanceof XSDAttributeDeclaration)
+        {
+          if (((XSDAttributeDeclaration) selected).isAttributeDeclarationReference())
+          {
+            isReference = true;
+          }
+        } else if (selected instanceof XSDModelGroupDefinition)
+        {
+          if (((XSDModelGroupDefinition) selected).isModelGroupDefinitionReference())
+          {
+            isReference = true;
+          }
+        }
+        StringBuffer sb = new StringBuffer();
+        Element element = ((XSDConcreteComponent) selected).getElement();
+        if (element != null)
+        {
+          sb.append(((XSDConcreteComponent) selected).getElement().getLocalName());
+
+          if (isReference)
+          {
+            sb.append(" ");//$NON-NLS-1$
+            sb.append(Messages.UI_PAGE_HEADING_REFERENCE);
+          }
+
+          IWorkbench workbench = PlatformUI.getWorkbench();
+          IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
+          IEditorPart editorPart = workbenchWindow.getActivePage().getActiveEditor();
+          XSDSchema xsdSchema = ((XSDConcreteComponent) selected).getSchema();
+          if (xsdSchema != editorPart.getAdapter(XSDSchema.class))
+          {
+            sb.append(" (" + Messages.UI_LABEL_READ_ONLY + ")"); //$NON-NLS-1$
+          }
+          return sb.toString();
+        }
+        else
+        {
+          return "(" + Messages.UI_LABEL_READ_ONLY + ")"; //$NON-NLS-1$
+        }
+      }
+
+      if (object instanceof Element)
+      {
+        return ((Element) object).getLocalName();
+      }
+    }
+
+    return result;
+  }
+
+  private Object getObject(Object objects, boolean multiple[])
+  {
+    Assert.isNotNull(objects);
+    Object object = null;
+    return object;
+  }
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/AbstractSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/AbstractSection.java
new file mode 100644
index 0000000..ba785f2
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/AbstractSection.java
@@ -0,0 +1,366 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.properties.sections;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.commands.CommandStack;
+import org.eclipse.jface.action.IStatusLineManager;
+import org.eclipse.jface.action.SubContributionManager;
+import org.eclipse.jface.action.SubStatusLineManager;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.IViewSite;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.forms.FormColors;
+import org.eclipse.ui.views.properties.tabbed.AbstractPropertySection;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+import org.eclipse.xsd.XSDComponent;
+import org.eclipse.xsd.XSDConcreteComponent;
+import org.eclipse.xsd.XSDSchema;
+
+public abstract class AbstractSection extends AbstractPropertySection implements SelectionListener, Listener
+{
+  protected Composite composite;
+  protected PaintListener painter;
+  protected XSDSchema xsdSchema;
+  protected Object input;
+  protected boolean isReadOnly;
+  protected boolean listenerEnabled = true;
+  protected boolean isSimple;
+  protected CustomListener customListener = new CustomListener();
+  protected IEditorPart owningEditor;
+  private IStatusLineManager statusLine;
+  
+  public static final Image ICON_ERROR = XSDEditorPlugin.getDefault().getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK);
+  
+  public AbstractSection()
+  {
+    super();
+  }
+  
+  public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage)
+  {
+    super.createControls(parent, aTabbedPropertySheetPage);
+    isSimple = getIsSimple();
+    createContents(parent);
+  }
+  
+  protected abstract void createContents(Composite parent);
+
+    protected PaintListener createPainter() {
+        return new PaintListener() {
+
+            public void paintControl(PaintEvent e) {
+                Rectangle bounds = composite.getClientArea();
+                GC gc = e.gc;
+
+                gc.setForeground(gc.getBackground());
+                gc.setBackground(getWidgetFactory().getColors().getColor(
+                    FormColors.TB_BG));
+
+//                gc.fillGradientRectangle(4 + bounds.width / 2, 0,
+//                    bounds.width / 2 - 9, bounds.height, false);
+
+                gc.setForeground(getWidgetFactory().getColors().getColor(
+                    FormColors.TB_BORDER));
+//                gc.drawLine(bounds.width - 5, 0, bounds.width - 5,
+//                    bounds.height);
+            }
+
+        };
+
+    }
+    
+    public void dispose()
+    {
+        if (composite != null && ! composite.isDisposed() && painter != null)
+            composite.removePaintListener(painter);
+        
+        super.dispose();
+    }
+
+    public void setInput(IWorkbenchPart part, ISelection selection) {
+        super.setInput(part, selection);
+        isSimple = getIsSimple();
+        Object input = ((IStructuredSelection)selection).getFirstElement();
+        this.input = input;
+        
+        if (input instanceof XSDConcreteComponent)
+        {
+          xsdSchema = ((XSDConcreteComponent)input).getSchema();
+        }
+        
+        // set owning editor of this section
+        if (part!=null)
+        {
+            if (part instanceof IEditorPart)
+            {
+                owningEditor = (IEditorPart)part;
+            }
+            else
+            {
+                owningEditor = part.getSite().getWorkbenchWindow().getActivePage().getActiveEditor();
+            }
+        }
+        if (xsdSchema == owningEditor.getAdapter(XSDSchema.class))
+        {
+          isReadOnly = false;
+        }
+        else
+        {
+          isReadOnly = true;
+        }
+
+    }
+
+    public void refresh()
+    {
+      super.refresh();
+
+      if (isReadOnly)
+      {
+        composite.setEnabled(false);
+      }
+      else
+      {
+        composite.setEnabled(true);
+      }
+    }
+
+    public void applyAllListeners(Control control)
+    {
+      control.addListener(SWT.Modify, customListener);
+      control.addListener(SWT.FocusOut, customListener);
+      control.addListener(SWT.KeyDown, customListener);
+    }
+    
+    public void applyModifyListeners(Control control)
+    {
+      control.addListener(SWT.Modify, customListener);
+      control.addListener(SWT.FocusOut, customListener);
+    }
+
+    public void applyKeyListener(Control control)
+    {
+      control.addListener(SWT.KeyDown, customListener);
+    }
+
+    public void removeListeners(Control control)
+    {
+      control.removeListener(SWT.Modify, customListener);
+      control.removeListener(SWT.FocusOut, customListener);
+      control.removeListener(SWT.KeyDown, customListener);
+    }
+    
+    public void doWidgetDefaultSelected(SelectionEvent e)
+    {}
+    
+    public void doWidgetSelected(SelectionEvent e)
+    {}
+
+    public void widgetSelected(SelectionEvent e)
+    {
+      if (isListenerEnabled() &&
+          input != null &&
+          !isReadOnly) 
+      {
+        doWidgetSelected(e);
+      }
+    }
+
+    public void widgetDefaultSelected(SelectionEvent e)
+    {
+      if (isListenerEnabled() &&
+          input != null &&
+          !isReadOnly) 
+      {
+        doWidgetDefaultSelected(e);
+      }
+    }
+
+    /**
+     * Get the value of listenerEnabled.
+     * @return value of listenerEnabled.
+     */
+    public boolean isListenerEnabled() 
+    {
+      return listenerEnabled;
+    }
+    
+    /**
+     * Set the value of listenerEnabled.
+     * @param v  Value to assign to listenerEnabled.
+     */
+    public void setListenerEnabled(boolean  v) 
+    {
+      this.listenerEnabled = v;
+    }
+
+    /**
+     * Sent when an event that the receiver has registered for occurs.
+     *
+     * @param event the event which occurred
+     */
+    public void handleEvent(Event event)
+    {
+      if (isListenerEnabled() && !isReadOnly) 
+      {
+        doHandleEvent(event);
+      }
+    }
+
+    /**
+     * Subclasses should override
+     * @param event
+     */
+    protected void doHandleEvent(Event event)
+    {
+    }
+
+    protected IEditorPart getActiveEditor()
+    {
+      IWorkbench workbench = PlatformUI.getWorkbench();
+      IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
+      IEditorPart editorPart = workbenchWindow.getActivePage().getActiveEditor();
+      this.owningEditor = editorPart;
+      return editorPart;
+    }
+    
+    public CommandStack getCommandStack()
+    {
+      Object commandStack = owningEditor.getAdapter(CommandStack.class); 
+          
+      if (commandStack==null)
+          return null;
+      else
+          return (CommandStack)commandStack;
+    }
+    
+    public boolean getIsSimple()
+    {
+      return false;
+    }
+    
+    
+    
+    /**
+     * Intended to display error messages.
+     * @return
+     */
+    private IStatusLineManager getStatusLineManager()
+    {
+      if (statusLine==null && getPart()!=null)
+      {
+        if(getPart().getSite() instanceof IEditorSite)
+          statusLine = ((IEditorSite)getPart().getSite()).getActionBars().getStatusLineManager();
+        else if (getPart().getSite() instanceof IViewSite)
+          statusLine = ((IViewSite)getPart().getSite()).getActionBars().getStatusLineManager();
+        
+        /* 
+         * We must manually set the visibility of the status line since the action bars are from the editor
+         * which means the status line only shows up when the editor is in focus (by default).
+         * Note only a SubStatusLineManager can set the visibility.
+         */
+        if (statusLine instanceof SubStatusLineManager)
+          ((SubStatusLineManager)statusLine).setVisible(true);
+      }
+      
+      return statusLine;
+    }
+
+    /**
+     * Display an error message in the status line.
+     * Call setErrorMessage(null) to clear the status line.
+     * @param text 
+     */
+    public void setErrorMessage(String text)
+    {
+      IStatusLineManager statusLine = getStatusLineManager();
+
+      if (statusLine!=null)
+      {
+        if (text==null || text.length()<1)
+          statusLine.setErrorMessage(null);
+        else
+          statusLine.setErrorMessage(ICON_ERROR, text);
+
+        // ensure our message gets displayed
+        if (statusLine instanceof SubContributionManager)
+          ((SubContributionManager)statusLine).setVisible(true);
+        
+        statusLine.update(true);
+      }
+    }
+
+    
+    protected EObject getModel()
+    {
+      return (XSDComponent)input;
+    }
+
+    
+    class CustomListener implements Listener
+    {
+      boolean handlingEvent = false;
+      public void handleEvent(Event event)
+      {
+        if (isListenerEnabled() && !isReadOnly) 
+        {
+          switch (event.type)
+          {
+            case SWT.KeyDown :
+            {
+              if (event.character == SWT.CR)
+              {
+                if (!handlingEvent)
+                {
+                  handlingEvent = true;
+                  doHandleEvent(event);
+                  handlingEvent = false;
+                }
+              }
+              break;
+            }
+            case SWT.FocusOut :
+            {
+              if (!handlingEvent)
+              {
+                handlingEvent = true;
+                doHandleEvent(event);
+                handlingEvent = false;
+              }
+              break;
+            }
+          }
+        }
+      }
+    }
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/AbstractSectionDescriptor.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/AbstractSectionDescriptor.java
new file mode 100644
index 0000000..19a3545
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/AbstractSectionDescriptor.java
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.properties.sections;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.viewers.IFilter;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.views.properties.tabbed.ISection;
+import org.eclipse.ui.views.properties.tabbed.ISectionDescriptor;
+import org.eclipse.xsd.XSDConcreteComponent;
+import org.w3c.dom.Element;
+
+public class AbstractSectionDescriptor implements ISectionDescriptor
+{
+  /**
+   * 
+   */
+  public AbstractSectionDescriptor()
+  {
+    super();
+  }
+
+  /* (non-Javadoc)
+   * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getId()
+   */
+  public String getId()
+  {
+    return "";
+  }
+
+  /* (non-Javadoc)
+   * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getFilter()
+   */
+  public IFilter getFilter()
+  {
+    return null;
+  }
+
+  /* (non-Javadoc)
+   * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getInputTypes()
+   */
+  public List getInputTypes()
+  {
+    List list = new ArrayList();
+    list.add(XSDConcreteComponent.class);
+    return list;
+  }
+
+  /* (non-Javadoc)
+   * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getSectionClass()
+   */
+  public ISection getSectionClass()
+  {
+    return null;
+  }
+
+  /* (non-Javadoc)
+   * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getTargetTab()
+   */
+  public String getTargetTab()
+  {
+    return null;
+  }
+
+  /* (non-Javadoc)
+   * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#appliesTo(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
+   */
+  public boolean appliesTo(IWorkbenchPart part, ISelection selection)
+  {
+    Object object = null;
+    if (selection instanceof StructuredSelection)
+    {
+      StructuredSelection structuredSelection = (StructuredSelection)selection;
+      object = structuredSelection.getFirstElement();
+      if (object instanceof XSDConcreteComponent || object instanceof Element)
+      {
+        return true;
+      }
+    }
+    return false;
+  }
+
+  /* (non-Javadoc)
+   * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#getAfterSection()
+   */
+  public String getAfterSection()
+  {
+    return "";
+  }
+
+  
+  public int getEnablesFor()
+  {
+	return ENABLES_FOR_ANY;
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/AnnotationSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/AnnotationSection.java
new file mode 100644
index 0000000..9ec3844
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/AnnotationSection.java
@@ -0,0 +1,153 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.properties.sections;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
+import org.eclipse.wst.xsd.ui.common.commands.AddDocumentationCommand;
+import org.eclipse.wst.xsd.ui.common.util.XSDCommonUIUtils;
+import org.eclipse.xsd.XSDAnnotation;
+import org.eclipse.xsd.XSDConcreteComponent;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+public class AnnotationSection extends AbstractSection
+{
+  Text simpleText;
+
+  public void createContents(Composite parent)
+  {
+    composite = getWidgetFactory().createFlatFormComposite(parent);
+
+    simpleText = getWidgetFactory().createText(composite, "", SWT.V_SCROLL | SWT.H_SCROLL); //$NON-NLS-1$
+    simpleText.addListener(SWT.Modify, this);
+
+    FormData data = new FormData();
+    data.left = new FormAttachment(0, 1);
+    data.right = new FormAttachment(100, -1);
+    data.top = new FormAttachment(0, 1);
+    data.bottom = new FormAttachment(100, -1);
+    simpleText.setLayoutData(data);
+  }
+
+  public AnnotationSection()
+  {
+    super();
+  }
+
+  /*
+   * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh()
+   */
+  public void refresh()
+  {
+    super.refresh();
+    setListenerEnabled(false);
+    if (input instanceof XSDConcreteComponent)
+    {
+      XSDAnnotation xsdAnnotation = XSDCommonUIUtils.getInputXSDAnnotation((XSDConcreteComponent) input, false);
+      setInitialText(xsdAnnotation);
+    }
+    setListenerEnabled(true);
+  }
+
+  public void doHandleEvent(Event event)
+  {
+    if (input instanceof XSDConcreteComponent)
+    {
+      if (event.widget == simpleText)
+      {
+        AddDocumentationCommand command = new AddDocumentationCommand("Add Documentation", null, (XSDConcreteComponent) input, simpleText.getText(), "");
+        getCommandStack().execute(command);
+      }
+    }
+
+  }
+
+  public boolean shouldUseExtraSpace()
+  {
+    return true;
+  }
+
+  public void dispose()
+  {
+
+  }
+
+  private void setInitialText(XSDAnnotation an)
+  {
+    if (an != null)
+    {
+      try
+      {
+        List documentationList = an.getUserInformation();
+        if (documentationList.size() > 0)
+        {
+          Element docElement = (Element) documentationList.get(0);
+          if (docElement != null)
+          {
+            simpleText.setText(doSerialize(docElement));
+          }
+        }
+      }
+      catch (Exception e)
+      {
+
+      }
+    }
+    else
+    {
+      simpleText.setText("");
+    }
+  }
+
+  private String doSerialize(Element element) throws IOException
+  {
+    String source = "";
+
+    Node firstChild = element.getFirstChild();
+    Node lastChild = element.getLastChild();
+    int start = 0;
+    int end = 0;
+
+    if (element instanceof IDOMElement)
+    {
+      IDOMElement domElement = (IDOMElement) element;
+      IDOMModel model = domElement.getModel();
+      IDOMDocument doc = model.getDocument();
+
+      if (firstChild instanceof IDOMNode)
+      {
+        IDOMNode first = (IDOMNode) firstChild;
+        start = first.getStartOffset();
+      }
+      if (lastChild instanceof IDOMNode)
+      {
+        IDOMNode last = (IDOMNode) lastChild;
+        end = last.getEndOffset();
+      }
+      source = doc.getSource().substring(start, end);
+    }
+
+    return source;
+  }
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/ApplicationInfoSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/ApplicationInfoSection.java
new file mode 100644
index 0000000..ef4181d
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/ApplicationInfoSection.java
@@ -0,0 +1,586 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.properties.sections;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.SashForm;
+import org.eclipse.swt.events.MouseTrackAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.part.PageBook;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+import org.eclipse.wst.xsd.ui.common.commands.AddAppInfoAttributeCommand;
+import org.eclipse.wst.xsd.ui.common.commands.AddAppInfoCommand;
+import org.eclipse.wst.xsd.ui.common.commands.AddAppInfoElementCommand;
+import org.eclipse.wst.xsd.ui.common.commands.RemoveAppInfoAttrCommand;
+import org.eclipse.wst.xsd.ui.common.commands.RemoveAppInfoElementCommand;
+import org.eclipse.wst.xsd.ui.common.properties.sections.appinfo.AddApplicationInfoDialog;
+import org.eclipse.wst.xsd.ui.common.properties.sections.appinfo.ApplicationInformationPropertiesRegistry;
+import org.eclipse.wst.xsd.ui.common.properties.sections.appinfo.ApplicationInformationTableTreeViewer;
+import org.eclipse.wst.xsd.ui.common.properties.sections.appinfo.SpecificationForAppinfoSchema;
+import org.eclipse.wst.xsd.ui.common.util.XSDCommonUIUtils;
+import org.eclipse.xsd.XSDAnnotation;
+import org.eclipse.xsd.XSDAttributeDeclaration;
+import org.eclipse.xsd.XSDConcreteComponent;
+import org.eclipse.xsd.XSDElementDeclaration;
+import org.eclipse.xsd.util.XSDConstants;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+public class ApplicationInfoSection extends AbstractSection
+{
+  protected static final Image DEFAULT_ELEMENT_ICON = XSDEditorPlugin.getXSDImage("icons/XSDElement.gif");
+  protected static final Image DEFAULT_ATTR_ICON = XSDEditorPlugin.getXSDImage("icons/XSDAttribute.gif");
+  protected ApplicationInformationTableTreeViewer tableTree;
+  protected TableViewer extensibleElementsTable;
+  protected Label extensibilityElementsLabel, contentLabel;
+  protected ISelectionChangedListener elementSelectionChangedListener;
+
+  private Text simpleText;
+  private Composite page, pageBook1, pageBook2;
+  private Button textRadioButton, structureRadioButton;
+  private Button addButton, removeButton;
+  private PageBook pageBook;
+
+  /**
+   * 
+   */
+  public ApplicationInfoSection()
+  {
+    super();
+  }
+
+  public void createContents(Composite parent)
+  {
+    composite = getWidgetFactory().createFlatFormComposite(parent);
+
+    GridLayout gridLayout = new GridLayout();
+    gridLayout.marginTop = 0;
+    gridLayout.marginBottom = 0;
+    gridLayout.numColumns = 1;
+    composite.setLayout(gridLayout);
+
+    GridData gridData = new GridData();
+
+    page = getWidgetFactory().createComposite(composite);
+    gridLayout = new GridLayout();
+    gridLayout.marginTop = 0;
+    gridLayout.marginBottom = 0;
+    gridLayout.numColumns = 1;
+    page.setLayout(gridLayout);
+
+    gridData = new GridData();
+    gridData.grabExcessHorizontalSpace = true;
+    gridData.grabExcessVerticalSpace = true;
+    gridData.verticalAlignment = GridData.FILL;
+    gridData.horizontalAlignment = GridData.FILL;
+    page.setLayoutData(gridData);
+
+    pageBook = new PageBook(page, SWT.FLAT);
+    gridData = new GridData();
+    gridData.grabExcessHorizontalSpace = true;
+    gridData.grabExcessVerticalSpace = true;
+    gridData.verticalAlignment = GridData.FILL;
+    gridData.horizontalAlignment = GridData.FILL;
+    pageBook.setLayoutData(gridData);
+
+    pageBook2 = getWidgetFactory().createComposite(pageBook, SWT.FLAT);
+
+    gridLayout = new GridLayout();
+    gridLayout.marginHeight = 2;
+    gridLayout.marginWidth = 2;
+    gridLayout.numColumns = 1;
+    pageBook2.setLayout(gridLayout);
+
+    gridData = new GridData();
+    gridData.grabExcessHorizontalSpace = true;
+    gridData.grabExcessVerticalSpace = true;
+    gridData.verticalAlignment = GridData.FILL;
+    gridData.horizontalAlignment = GridData.FILL;
+    pageBook2.setLayoutData(gridData);
+
+    SashForm sashForm = new SashForm(pageBook2, SWT.HORIZONTAL);
+    gridData = new GridData();
+    gridData.grabExcessHorizontalSpace = true;
+    gridData.grabExcessVerticalSpace = true;
+    gridData.verticalAlignment = GridData.FILL;
+    gridData.horizontalAlignment = GridData.FILL;
+    sashForm.setLayoutData(gridData);
+
+    Composite leftContent = getWidgetFactory().createComposite(sashForm, SWT.FLAT);
+    gridLayout = new GridLayout();
+    gridLayout.numColumns = 1;
+    leftContent.setLayout(gridLayout);
+
+    extensibilityElementsLabel = getWidgetFactory().createLabel(leftContent, "Extensibility Items");
+    extensibleElementsTable = new TableViewer(leftContent, SWT.FLAT | SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.LINE_SOLID);
+    gridLayout = new GridLayout();
+    gridLayout.numColumns = 1;
+    extensibleElementsTable.getTable().setLayout(gridLayout);
+    gridData = new GridData();
+    gridData.grabExcessHorizontalSpace = true;
+    gridData.grabExcessVerticalSpace = true;
+    gridData.verticalAlignment = GridData.FILL;
+    gridData.horizontalAlignment = GridData.FILL;
+    extensibleElementsTable.getTable().setLayoutData(gridData);
+    extensibleElementsTable.setContentProvider(new ElementTableContentProvider());
+    extensibleElementsTable.setLabelProvider(new ElementTableLabelProvider());
+    elementSelectionChangedListener = new ElementSelectionChangedListener();
+    extensibleElementsTable.addSelectionChangedListener(elementSelectionChangedListener);
+    extensibleElementsTable.getTable().addMouseTrackListener(new MouseTrackAdapter()
+    {
+      public void mouseHover(org.eclipse.swt.events.MouseEvent e)
+      {
+        ISelection selection = extensibleElementsTable.getSelection();
+        if (selection instanceof StructuredSelection)
+        {
+          Object obj = ((StructuredSelection) selection).getFirstElement();
+          if (obj instanceof Element)
+          {
+            Element element = (Element) obj;
+            ApplicationInformationPropertiesRegistry registry = XSDEditorPlugin.getDefault().getApplicationInformationPropertiesRegistry();
+            // ApplicationSpecificSchemaProperties[] properties =
+            // registry.getAllApplicationSpecificSchemaProperties();
+            // ApplicationSpecificSchemaProperties[] properties =
+            // (ApplicationSpecificSchemaProperties[])
+            // registry.getAllApplicationSpecificSchemaProperties().toArray(new
+            // ApplicationSpecificSchemaProperties[0]);
+            List properties = registry.getAllApplicationSpecificSchemaProperties();
+
+            int length = properties.size();
+            for (int i = 0; i < length; i++)
+            {
+              SpecificationForAppinfoSchema current = (SpecificationForAppinfoSchema) properties.get(i);
+              if (current.getNamespaceURI().equals(element.getNamespaceURI()))
+              {
+                extensibleElementsTable.getTable().setToolTipText(current.getDescription());
+                break;
+              }
+            }
+          }
+        }
+      };
+
+    });
+
+    Composite rightContent = getWidgetFactory().createComposite(sashForm, SWT.FLAT);
+
+    contentLabel = getWidgetFactory().createLabel(rightContent, "Content");
+
+    Composite testComp = getWidgetFactory().createComposite(rightContent, SWT.FLAT);
+
+    gridLayout = new GridLayout();
+    gridLayout.marginTop = 0;
+    gridLayout.marginBottom = 0;
+    gridLayout.marginLeft = 0;
+    gridLayout.marginRight = 0;
+    gridLayout.numColumns = 1;
+    gridLayout.marginHeight = 3;
+    gridLayout.marginWidth = 3;
+    rightContent.setLayout(gridLayout);
+
+    gridData = new GridData();
+    gridData.grabExcessHorizontalSpace = true;
+    gridData.grabExcessVerticalSpace = true;
+    gridData.verticalAlignment = GridData.FILL;
+    gridData.horizontalAlignment = GridData.FILL;
+    rightContent.setLayoutData(gridData);
+
+    gridLayout = new GridLayout();
+    gridLayout.marginTop = 0;
+    gridLayout.marginLeft = 0;
+    gridLayout.marginRight = 0;
+    gridLayout.marginBottom = 0;
+    gridLayout.marginHeight = 3;
+    gridLayout.marginWidth = 3;
+    gridLayout.numColumns = 1;
+    testComp.setLayout(gridLayout);
+
+    gridData = new GridData();
+    gridData.grabExcessHorizontalSpace = true;
+    gridData.grabExcessVerticalSpace = true;
+    gridData.verticalAlignment = GridData.FILL;
+    gridData.horizontalAlignment = GridData.FILL;
+    testComp.setLayoutData(gridData);
+
+    createElementContentWidget(testComp);
+
+    int[] weights = { 30, 70 };
+    sashForm.setWeights(weights);
+
+    Composite buttonComposite = getWidgetFactory().createComposite(pageBook2, SWT.FLAT);
+    gridLayout = new GridLayout();
+    gridLayout.marginTop = 0;
+    gridLayout.marginBottom = 0;
+    gridLayout.numColumns = 2;
+    gridLayout.makeColumnsEqualWidth = true;
+    buttonComposite.setLayout(gridLayout);
+    addButton = getWidgetFactory().createButton(buttonComposite, "Add...", SWT.FLAT);
+    addButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+    addButton.addSelectionListener(this);
+    addButton.setToolTipText("Add Extension Component");
+    removeButton = getWidgetFactory().createButton(buttonComposite, "Remove", SWT.FLAT);
+    removeButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+    removeButton.addSelectionListener(this);
+    removeButton.setToolTipText("Remove Extension Component");
+
+    pageBook.showPage(pageBook2);
+  }
+
+  protected void createElementContentWidget(Composite parent)
+  {
+    tableTree = new ApplicationInformationTableTreeViewer(parent);
+    GridData gridData = new GridData();
+    gridData.grabExcessHorizontalSpace = true;
+    gridData.grabExcessVerticalSpace = true;
+    gridData.verticalAlignment = GridData.FILL;
+    gridData.horizontalAlignment = GridData.FILL;
+
+    tableTree.getControl().setLayoutData(gridData);
+  }
+
+  /*
+   * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh()
+   */
+  public void refresh()
+  {
+    setListenerEnabled(false);
+    if (input != null)
+    {
+      tableTree.setInput(null);
+      tableTree.getTree().removeAll();
+      extensibleElementsTable.getTable().removeAll();
+      
+      extensibleElementsTable.setInput(input);
+
+      if (extensibleElementsTable.getTable().getSelectionCount() == 0)
+      {
+        Object o = extensibleElementsTable.getElementAt(0);
+        if (o != null)
+        {
+          extensibleElementsTable.setSelection(new StructuredSelection(o));
+          if (o instanceof Element)
+          {
+            tableTree.setInput(((Element) o).getParentNode());
+          }
+        }
+        tableTree.refresh();
+      }
+
+    }
+    setListenerEnabled(true);
+
+  }
+
+  public Composite getPage()
+  {
+    return page;
+  }
+
+  public void widgetSelected(SelectionEvent event)
+  {
+    if (event.widget == addButton)
+    {
+        ApplicationInformationPropertiesRegistry registry = XSDEditorPlugin.getDefault().getApplicationInformationPropertiesRegistry();
+      AddApplicationInfoDialog dialog = new AddApplicationInfoDialog(composite.getShell(), registry);
+
+      List properties = registry.getAllApplicationSpecificSchemaProperties();
+
+      dialog.setInput(properties);
+      dialog.setBlockOnOpen(true);
+
+      if (dialog.open() == Window.OK)
+      {
+        Object[] result = dialog.getResult();
+        if (result != null)
+        {
+          SpecificationForAppinfoSchema appInfoSchemaSpec = (SpecificationForAppinfoSchema) result[1];
+          if (input instanceof XSDConcreteComponent)
+          {
+            AddAppInfoCommand addAppInfo = null;
+            if (result[0] instanceof XSDElementDeclaration)
+            {
+              XSDElementDeclaration element = (XSDElementDeclaration) result[0];
+              addAppInfo = new AddAppInfoElementCommand("Add AppInfo Element", (XSDConcreteComponent) input, element);
+            }
+            else if (result[0] instanceof XSDAttributeDeclaration)
+            {
+              XSDAttributeDeclaration attribute = (XSDAttributeDeclaration) result[0];
+              addAppInfo = new AddAppInfoAttributeCommand("Add AppInfo Attribute", (XSDConcreteComponent) input, attribute);
+            }
+            else
+              return;
+
+            addAppInfo.setSchemaProperties(appInfoSchemaSpec);
+            if (getCommandStack() != null)
+            {
+              getCommandStack().execute(addAppInfo);
+            }
+          }
+        }
+        extensibleElementsTable.refresh();
+        refresh();
+      }
+
+    }
+    else if (event.widget == removeButton)
+    {
+      ISelection selection = extensibleElementsTable.getSelection();
+      
+      if (selection instanceof StructuredSelection)
+      {
+    	Command command = null;
+        Object o = ((StructuredSelection) selection).getFirstElement();
+        if (o instanceof Element)
+        {
+            XSDAnnotation xsdAnnotation = (XSDAnnotation) extensibleElementsTable.getInput();
+        	Node appInfoElement = ((Element) o).getParentNode();
+        	command = new RemoveAppInfoElementCommand("Remove AppInfo Element",
+        			xsdAnnotation, appInfoElement);
+        }
+        else if (o instanceof Attr){
+        	Element hostElement = ((Attr) o).getOwnerElement();
+        	command = new RemoveAppInfoAttrCommand("Remove AppInfo Attribute",
+        			hostElement, (Attr) o);
+        }
+        else 
+        	return;
+        if (getCommandStack() != null)
+        {
+        	getCommandStack().execute(command);
+        	extensibleElementsTable.setInput(input);
+        	extensibleElementsTable.refresh();
+        	
+        	if (extensibleElementsTable.getTable().getItemCount() > 0)
+        	{
+        		Object object = extensibleElementsTable.getElementAt(0);
+        		if (object != null)
+        		{
+        			extensibleElementsTable.setSelection(new StructuredSelection(object));
+        		}
+        	}
+        	else
+        	{
+        		tableTree.setInput(null);
+        	}
+        }
+      }
+    }
+    else if (event.widget == extensibleElementsTable.getTable())
+    {
+
+    }
+  }
+
+  public void widgetDefaultSelected(SelectionEvent event)
+  {
+
+  }
+
+  public boolean shouldUseExtraSpace()
+  {
+    return true;
+  }
+
+  public void dispose()
+  {
+
+  }
+
+  static class ElementTableContentProvider implements IStructuredContentProvider
+  {
+    protected String facet;
+
+    public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
+    {
+    }
+
+    public java.lang.Object[] getElements(java.lang.Object inputElement)
+    {
+      if (inputElement instanceof XSDConcreteComponent)
+      {
+        XSDConcreteComponent component = (XSDConcreteComponent) inputElement;
+        List elementsAndAttributes = new ArrayList();
+        
+        /** Construct elements list */
+        XSDAnnotation xsdAnnotation = XSDCommonUIUtils.getInputXSDAnnotation(component, false);
+        if (xsdAnnotation != null)
+        {
+          List appInfoList = xsdAnnotation.getApplicationInformation();
+          Element appInfoElement = null;
+          if (appInfoList.size() > 0)
+          {
+            appInfoElement = (Element) appInfoList.get(0);
+          }
+          if (appInfoElement != null)
+          {            
+            for (Iterator it = appInfoList.iterator(); it.hasNext();)
+            {
+              Object obj = it.next();
+              if (obj instanceof Element)
+              {
+                Element appInfo = (Element) obj;
+                NodeList nodeList = appInfo.getChildNodes();
+                int length = nodeList.getLength();
+                for (int i = 0; i < length; i++)
+                {
+                  Node node = nodeList.item(i);
+                  if (node instanceof Element)
+                  {
+                    elementsAndAttributes.add(node);
+                  }
+                }
+              }
+            }
+          }
+        }
+        
+        /** Construct attributes list */
+        NamedNodeMap attributes = component.getElement().getAttributes();
+        if ( attributes != null ){
+          //String defaultNamespace = (String)component.getSchema().getQNamePrefixToNamespaceMap().get("");          
+          int length = attributes.getLength();
+          for (int i = 0; i < length; i++){
+            Node oneAttribute = attributes.item(i);
+            if (!isXmlnsAttribute(oneAttribute))
+            {  
+              String namespace = oneAttribute.getNamespaceURI();        
+              boolean isExtension = true;
+              if (namespace == null && oneAttribute.getPrefix() == null) 
+              {
+                isExtension = false;
+              }  
+              else if (!XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001.equals(namespace))
+              {
+                isExtension = true;
+              }           
+              if (isExtension)
+              {  
+                elementsAndAttributes.add(oneAttribute);
+              }    
+            }
+          }
+        }
+        return elementsAndAttributes.toArray();
+      }
+      return Collections.EMPTY_LIST.toArray();
+    }
+    
+    private static boolean isXmlnsAttribute(Node attribute)
+    {
+      String prefix = attribute.getPrefix();
+      if (prefix != null)
+      {
+        // this handle the xmlns:foo="blah" case
+        return "xmlns".equals(prefix);
+      }
+      else
+      {
+        // this handles the xmlns="blah" case
+        return "xmlns".equals(attribute.getNodeName());
+      }  
+    }
+
+    public void dispose()
+    {
+
+    }
+  }
+
+  static class ElementTableLabelProvider extends LabelProvider implements ITableLabelProvider
+  {
+    public Image getColumnImage(Object element, int columnIndex)
+    {
+      ApplicationInformationPropertiesRegistry registry = XSDEditorPlugin.getDefault().getApplicationInformationPropertiesRegistry();
+      if (element instanceof Element)
+      {
+        Element domElement = (Element) element;
+        ILabelProvider lp = registry.getLabelProvider(domElement);
+        if (lp != null)
+        {
+          Image img = lp.getImage(domElement);
+          if (img != null)
+            return img;
+        }
+        return DEFAULT_ELEMENT_ICON;
+      }
+      if (element instanceof Attr)
+    	return DEFAULT_ATTR_ICON;
+      return null;
+    }
+
+    public String getColumnText(Object input, int columnIndex)
+    {
+      ApplicationInformationPropertiesRegistry registry = XSDEditorPlugin.getDefault().getApplicationInformationPropertiesRegistry();
+
+      if (input instanceof Element)
+      {
+        Element domElement = (Element) input;
+        return domElement.getLocalName();
+      }
+      if ( input instanceof Attr){
+        return ((Attr) input).getLocalName();
+      }
+      return "";
+    }
+  }
+
+  Element selectedElement;
+
+  class ElementSelectionChangedListener implements ISelectionChangedListener
+  {
+    public void selectionChanged(SelectionChangedEvent event)
+    {
+      ISelection selection = event.getSelection();
+      if (selection instanceof StructuredSelection)
+      {
+        Object obj = ((StructuredSelection) selection).getFirstElement();
+        if (obj instanceof Element)
+        {
+          selectedElement = (Element) obj;
+          tableTree.setInput(selectedElement.getParentNode());
+          tableTree.setASIElement(selectedElement);
+          tableTree.setCommandStack(getCommandStack());
+          contentLabel.setText("Structure of " + selectedElement.getLocalName());
+          contentLabel.getParent().layout();
+        }
+      }
+    }
+
+  }
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/CommonDirectivesSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/CommonDirectivesSection.java
new file mode 100644
index 0000000..f77f0ae
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/CommonDirectivesSection.java
@@ -0,0 +1,157 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.properties.sections;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyleRange;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.wst.common.uriresolver.internal.util.URIHelper;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+import org.eclipse.xsd.XSDInclude;
+import org.eclipse.xsd.XSDRedefine;
+import org.eclipse.xsd.XSDSchema;
+import org.eclipse.xsd.util.XSDParser;
+
+public abstract class CommonDirectivesSection extends AbstractSection
+{
+  Text schemaLocationText;
+  Button wizardButton;
+  StyledText errorText;
+  Color red;
+
+  // TODO: common up code with XSDSelectIncludeFileWizard
+  public void doHandleEvent(Event event)
+  {
+    errorText.setText("");
+    if (event.type == SWT.Modify)
+    {
+      if (event.widget == schemaLocationText)
+      {
+        String errorMessage = "";
+        boolean isValidSchemaLocation = true;
+        String xsdModelFile = schemaLocationText.getText();
+        String namespace = "";
+        XSDSchema externalSchema = null;
+        
+        if (xsdModelFile.length() == 0)
+        {
+          handleSchemaLocationChange(xsdModelFile, "", null);
+          return;
+        }
+
+        try
+        {
+          IFile currentIFile = ((IFileEditorInput)getActiveEditor().getEditorInput()).getFile();
+
+          URI newURI = URI.createURI(xsdModelFile);
+          String xsdFile = URIHelper.getRelativeURI(newURI.toString(), currentIFile.getFullPath().toString());
+          final String normalizedXSDFile = URIHelper.normalize(xsdFile, currentIFile.getLocation().toString(), "");
+          
+          XSDParser parser = new XSDParser();
+          parser.parse(normalizedXSDFile);
+          
+          externalSchema = parser.getSchema();
+
+          if (externalSchema != null)
+          {
+            String extNamespace = externalSchema.getTargetNamespace();
+            if (extNamespace == null) extNamespace = "";
+            namespace = extNamespace;
+            
+            if (externalSchema.getDiagnostics() != null &&
+                externalSchema.getDiagnostics().size() > 0)
+            {
+              isValidSchemaLocation = false;
+              errorMessage = XSDEditorPlugin.getResourceString("_UI_INCORRECT_XML_SCHEMA", xsdModelFile);
+            }  
+            else
+            {
+              String currentNameSpace = xsdSchema.getTargetNamespace();
+              if (input instanceof XSDInclude || input instanceof XSDRedefine)
+              {  
+                // Check the namespace to make sure they are the same as current file
+                if (extNamespace != null)
+                {
+                  if (currentNameSpace != null && !extNamespace.equals(currentNameSpace))
+                  {
+                    errorMessage = XSDEditorPlugin.getResourceString("_UI_DIFFERENT_NAME_SPACE", xsdModelFile);
+                    isValidSchemaLocation = false;
+                  }
+                }
+              }
+              else
+              {  
+                // Check the namespace to make sure they are different from the current file
+                if (extNamespace != null)
+                {
+                  if (currentNameSpace != null && extNamespace.equals(currentNameSpace))
+                  {
+                    errorMessage = XSDEditorPlugin.getResourceString("_UI_SAME_NAME_SPACE", xsdModelFile);
+                    isValidSchemaLocation = false;
+                  }
+                }
+              }
+            }
+          }
+          else
+          {
+            errorMessage = "Invalid file";
+            isValidSchemaLocation = false;
+          }
+        }
+        catch(Exception e)
+        {
+          errorMessage = "Invalid file";
+          isValidSchemaLocation = false;
+        }
+        finally
+        {
+          if (!isValidSchemaLocation)
+          {
+            errorText.setText(errorMessage);
+            int length = errorText.getText().length();
+            red = new Color(null, 255, 0, 0);
+            StyleRange style = new StyleRange(0, length, red, schemaLocationText.getBackground());
+            errorText.setStyleRange(style);
+          }
+          else
+          {
+            handleSchemaLocationChange(xsdModelFile, namespace, externalSchema);          
+          }
+        }
+      }
+    }
+  }
+  
+  protected void handleSchemaLocationChange(String schemaFileString, String namespace, XSDSchema externalSchema)
+  {
+    
+  }
+
+  
+  public void dispose()
+  {
+    super.dispose();
+    if (red != null)
+    {
+      red.dispose();
+      red = null;
+    }
+  }
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/EnumerationsSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/EnumerationsSection.java
new file mode 100644
index 0000000..7f2723f
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/EnumerationsSection.java
@@ -0,0 +1,404 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.properties.sections;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.ColumnWeightData;
+import org.eclipse.jface.viewers.ICellModifier;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TableLayout;
+import org.eclipse.jface.viewers.TextCellEditor;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
+import org.eclipse.wst.common.ui.internal.viewers.NavigableTableViewer;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+import org.eclipse.wst.xsd.ui.common.commands.AddEnumerationsCommand;
+import org.eclipse.wst.xsd.ui.common.commands.DeleteCommand;
+import org.eclipse.wst.xsd.ui.common.commands.SetXSDFacetValueCommand;
+import org.eclipse.wst.xsd.ui.internal.widgets.EnumerationsDialog;
+import org.eclipse.xsd.XSDEnumerationFacet;
+import org.eclipse.xsd.XSDSimpleTypeDefinition;
+import org.eclipse.xsd.util.XSDConstants;
+
+public class EnumerationsSection extends AbstractSection
+{
+  private EnumerationsTableViewer enumerationsTable;
+  private Button addButton;
+  private Button addManyButton;
+  private Button deleteButton;
+
+  /**
+   * 
+   */
+  public EnumerationsSection()
+  {
+    super();
+  }
+
+  public void widgetSelected(SelectionEvent e)
+  {
+    XSDSimpleTypeDefinition st = (XSDSimpleTypeDefinition) input;
+
+    if (e.widget == addButton)
+    {
+      List enumList = st.getEnumerationFacets();
+      StringBuffer newName = new StringBuffer("value1"); //$NON-NLS-1$
+      int suffix = 1;
+      for (Iterator i = enumList.iterator(); i.hasNext();)
+      {
+        XSDEnumerationFacet enumFacet = (XSDEnumerationFacet) i.next();
+        String value = enumFacet.getLexicalValue();
+        if (value != null)
+        {
+          if (value.equals(newName.toString()))
+          {
+            suffix++;
+            newName = new StringBuffer("value" + String.valueOf(suffix)); //$NON-NLS-1$
+          }
+        }
+      }
+
+      AddEnumerationsCommand command = new AddEnumerationsCommand("Add Enumeration", (XSDSimpleTypeDefinition) input);
+      command.setValue(newName.toString());
+      getCommandStack().execute(command);
+
+      enumerationsTable.refresh();
+      int newItemIndex = enumerationsTable.getTable().getItemCount() - 1;
+      enumerationsTable.editElement(enumerationsTable.getElementAt(newItemIndex), 0);
+    }
+    else if (e.widget == addManyButton)
+    {
+      Display display = Display.getCurrent();
+      // if it is null, get the default one
+      display = display == null ? Display.getDefault() : display;
+      Shell parentShell = display.getActiveShell();
+      EnumerationsDialog dialog = new EnumerationsDialog(parentShell);
+      dialog.setBlockOnOpen(true);
+      int result = dialog.open();
+
+      if (result == Window.OK)
+      {
+        String text = dialog.getText();
+        String delimiter = dialog.getDelimiter();
+        StringTokenizer tokenizer = new StringTokenizer(text, delimiter);
+        CompoundCommand compoundCommand = new CompoundCommand("Add Enumerations");
+        while (tokenizer.hasMoreTokens())
+        {
+          String token = tokenizer.nextToken();
+          if (dialog.isPreserveWhitespace() == false)
+          {
+            token = token.trim();
+          }
+          AddEnumerationsCommand command = new AddEnumerationsCommand("Add Enumerations", (XSDSimpleTypeDefinition) input);
+          command.setValue(token);
+          compoundCommand.add(command);
+        }
+        getCommandStack().execute(compoundCommand);
+      }
+      enumerationsTable.refresh();
+    }
+    else if (e.widget == deleteButton)
+    {
+      StructuredSelection selection = (StructuredSelection) enumerationsTable.getSelection();
+      if (selection != null)
+      {
+        Iterator i = selection.iterator();
+        CompoundCommand compoundCommand = new CompoundCommand("Delete Enumeration");
+        while (i.hasNext())
+        {
+          Object obj = i.next();
+          if (obj != null)
+          {
+            if (obj instanceof XSDEnumerationFacet)
+            {
+              XSDEnumerationFacet enumFacet = (XSDEnumerationFacet) obj;
+
+              DeleteCommand deleteCommand = new DeleteCommand("Delete Enumeration", enumFacet);
+              compoundCommand.add(deleteCommand);
+            }
+          }
+        }
+        getCommandStack().execute(compoundCommand);
+        enumerationsTable.refresh();
+      }
+    }
+    else if (e.widget == enumerationsTable.getTable())
+    {
+      StructuredSelection selection = (StructuredSelection) enumerationsTable.getSelection();
+      if (selection.getFirstElement() != null)
+      {
+        deleteButton.setEnabled(true);
+      }
+      else
+      {
+        deleteButton.setEnabled(false);
+      }
+    }
+
+  }
+
+  public void widgetDefaultSelected(SelectionEvent e)
+  {
+
+  }
+
+  public void createContents(Composite parent)
+  {
+    TabbedPropertySheetWidgetFactory factory = getWidgetFactory();
+    composite = factory.createFlatFormComposite(parent);
+
+    enumerationsTable = new EnumerationsTableViewer(getWidgetFactory().createTable(composite, SWT.MULTI | SWT.FULL_SELECTION));
+    enumerationsTable.setInput(input);
+    Table table = enumerationsTable.getTable();
+    table.addSelectionListener(this);
+
+    addButton = getWidgetFactory().createButton(composite, XSDEditorPlugin.getXSDString("_UI_REGEX_WIZARD_ADD_BUTTON_LABEL"), SWT.PUSH); //$NON-NLS-1$
+    addManyButton = getWidgetFactory().createButton(composite, XSDEditorPlugin.getXSDString("_UI_REGEX_WIZARD_ADD_BUTTON_LABEL") + "...", SWT.PUSH); //$NON-NLS-1$
+    deleteButton = getWidgetFactory().createButton(composite, XSDEditorPlugin.getXSDString("_UI_ACTION_DELETE_INCLUDE"), SWT.PUSH); //$NON-NLS-1$
+
+    FormData data2 = new FormData();
+    data2.top = new FormAttachment(0, 0);
+    data2.left = new FormAttachment(100, -100);
+    data2.right = new FormAttachment(100, 0);
+    // data2.width = 50;
+    addButton.setLayoutData(data2);
+    addButton.addSelectionListener(this);
+
+    FormData data = new FormData();
+    data.left = new FormAttachment(addButton, 0, SWT.LEFT);
+    data.right = new FormAttachment(100, 0);
+    data.top = new FormAttachment(addButton, 0);
+    addManyButton.setLayoutData(data);
+    addManyButton.addSelectionListener(this);
+
+    data = new FormData();
+    data.left = new FormAttachment(addButton, 0, SWT.LEFT);
+    data.right = new FormAttachment(100, 0);
+    data.top = new FormAttachment(addManyButton, 0);
+    deleteButton.setLayoutData(data);
+    deleteButton.setEnabled(false);
+    deleteButton.addSelectionListener(this);
+
+    data = new FormData();
+    data.top = new FormAttachment(0, 0);
+    data.left = new FormAttachment(0, 0);
+    data.right = new FormAttachment(addButton, 0);
+    data.bottom = new FormAttachment(100, 0);
+    data.width = 50;
+    table.setLayoutData(data);
+    table.addListener(SWT.Resize, this);
+  }
+
+  /*
+   * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh()
+   */
+  public void refresh()
+  {
+    if (isReadOnly)
+    {
+      composite.setEnabled(false);
+    }
+    else
+    {
+      composite.setEnabled(true);
+    }
+    XSDSimpleTypeDefinition st = (XSDSimpleTypeDefinition) input;
+
+    Iterator validFacets = st.getValidFacets().iterator();
+
+    boolean isApplicable = false;
+    while (validFacets.hasNext())
+    {
+      String aValidFacet = (String) validFacets.next();
+      if (aValidFacet.equals(XSDConstants.ENUMERATION_ELEMENT_TAG))
+      {
+        isApplicable = true;
+      }
+    }
+
+    if (isApplicable)
+    {
+      addButton.setEnabled(true);
+      addManyButton.setEnabled(true);
+    }
+    else
+    {
+      addButton.setEnabled(false);
+      addManyButton.setEnabled(false);
+    }
+    enumerationsTable.setInput(input);
+  }
+
+  public void handleEvent(Event event)
+  {
+    Table table = enumerationsTable.getTable();
+    if (event.type == SWT.Resize && event.widget == table)
+    {
+      TableColumn tableColumn = table.getColumn(0);
+      tableColumn.setWidth(table.getSize().x);
+    }
+  }
+
+  public void dispose()
+  {
+  }
+
+  public boolean shouldUseExtraSpace()
+  {
+    return true;
+  }
+
+  class EnumerationsTableViewer extends NavigableTableViewer implements ICellModifier
+  {
+    protected String[] columnProperties = { XSDConstants.ENUMERATION_ELEMENT_TAG };
+
+    protected CellEditor[] cellEditors;
+
+    Table table;
+
+    public EnumerationsTableViewer(Table table)
+    {
+      super(table);
+      table = getTable();
+
+      table.setLinesVisible(true);
+
+      setContentProvider(new EnumerationsTableContentProvider());
+      setLabelProvider(new EnumerationsTableLabelProvider());
+      setColumnProperties(columnProperties);
+
+      setCellModifier(this);
+
+      TableColumn column = new TableColumn(table, SWT.NONE, 0);
+      column.setText(columnProperties[0]);
+      column.setAlignment(SWT.LEFT);
+      column.setResizable(true);
+
+      cellEditors = new CellEditor[1];
+
+      TableLayout layout = new TableLayout();
+      ColumnWeightData data = new ColumnWeightData(100);
+
+      layout.addColumnData(data);
+      cellEditors[0] = new TextCellEditor(table);
+
+      getTable().setLayout(layout);
+      setCellEditors(cellEditors);
+    }
+
+    public boolean canModify(Object element, String property)
+    {
+      return true;
+    }
+
+    public void modify(Object element, String property, Object value)
+    {
+      if (element instanceof TableItem && (value != null))
+      {
+        TableItem item = (TableItem) element;
+
+        XSDEnumerationFacet enumFacet = (XSDEnumerationFacet) item.getData();
+        SetXSDFacetValueCommand command = new SetXSDFacetValueCommand("Set Enumeration Value", enumFacet);
+        command.setValue((String) value);
+        getCommandStack().execute(command);
+        item.setData(enumFacet);
+        item.setText((String) value);
+      }
+    }
+
+    public Object getValue(Object element, String property)
+    {
+      if (element instanceof XSDEnumerationFacet)
+      {
+        XSDEnumerationFacet enumFacet = (XSDEnumerationFacet) element;
+        String value = enumFacet.getLexicalValue();
+        if (value == null)
+          value = ""; //$NON-NLS-1$
+        return value;
+      }
+      return ""; //$NON-NLS-1$
+    }
+
+  }
+
+  class EnumerationsTableContentProvider implements IStructuredContentProvider
+  {
+    public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
+    {
+    }
+
+    public java.lang.Object[] getElements(java.lang.Object inputElement)
+    {
+      java.util.List list = new ArrayList();
+      if (inputElement instanceof XSDSimpleTypeDefinition)
+      {
+        XSDSimpleTypeDefinition st = (XSDSimpleTypeDefinition) inputElement;
+        return st.getEnumerationFacets().toArray();
+      }
+      return list.toArray();
+    }
+
+    public void dispose()
+    {
+    }
+  }
+
+  class EnumerationsTableLabelProvider extends LabelProvider implements ITableLabelProvider
+  {
+    public EnumerationsTableLabelProvider()
+    {
+
+    }
+
+    public Image getColumnImage(Object element, int columnIndex)
+    {
+      return XSDEditorPlugin.getXSDImage("icons/XSDSimpleEnum.gif");
+    }
+
+    public String getColumnText(Object element, int columnIndex)
+    {
+      if (element instanceof XSDEnumerationFacet)
+      {
+        XSDEnumerationFacet enumFacet = (XSDEnumerationFacet) element;
+        String value = enumFacet.getLexicalValue();
+        if (value == null)
+          value = "";
+        return value;
+      }
+      return "";
+    }
+
+  }
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/FacetViewer.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/FacetViewer.java
new file mode 100644
index 0000000..3ae9947
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/FacetViewer.java
@@ -0,0 +1,559 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.properties.sections;
+
+//import java.util.ArrayList;
+//import java.util.Iterator;
+//import java.util.List;
+//
+//import org.eclipse.jface.viewers.CellEditor;
+//import org.eclipse.jface.viewers.ColumnWeightData;
+//import org.eclipse.jface.viewers.ICellModifier;
+//import org.eclipse.jface.viewers.ISelectionChangedListener;
+//import org.eclipse.jface.viewers.IStructuredContentProvider;
+//import org.eclipse.jface.viewers.ITableLabelProvider;
+//import org.eclipse.jface.viewers.LabelProvider;
+//import org.eclipse.jface.viewers.SelectionChangedEvent;
+//import org.eclipse.jface.viewers.StructuredSelection;
+//import org.eclipse.jface.viewers.TableLayout;
+//import org.eclipse.jface.viewers.TextCellEditor;
+//import org.eclipse.jface.viewers.Viewer;
+//import org.eclipse.swt.SWT;
+//import org.eclipse.swt.events.MouseEvent;
+//import org.eclipse.swt.events.MouseTrackAdapter;
+//import org.eclipse.swt.graphics.Image;
+//import org.eclipse.swt.graphics.Point;
+//import org.eclipse.swt.widgets.Composite;
+//import org.eclipse.swt.widgets.Table;
+//import org.eclipse.swt.widgets.TableColumn;
+//import org.eclipse.swt.widgets.TableItem;
+//import org.eclipse.wst.common.ui.internal.viewers.NavigableTableViewer;
+//import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+//import org.eclipse.wst.xsd.ui.internal.actions.DOMAttribute;
+//import org.eclipse.wst.xsd.ui.internal.properties.XSDComboBoxPropertyDescriptor;
+//import org.eclipse.wst.xsd.ui.internal.util.XSDDOMHelper;
+//import org.eclipse.xsd.XSDConstrainingFacet;
+//import org.eclipse.xsd.XSDFactory;
+//import org.eclipse.xsd.XSDMaxExclusiveFacet;
+//import org.eclipse.xsd.XSDMaxFacet;
+//import org.eclipse.xsd.XSDMaxInclusiveFacet;
+//import org.eclipse.xsd.XSDMinExclusiveFacet;
+//import org.eclipse.xsd.XSDMinFacet;
+//import org.eclipse.xsd.XSDMinInclusiveFacet;
+//import org.eclipse.xsd.XSDSimpleTypeDefinition;
+//import org.eclipse.xsd.util.XSDConstants;
+//import org.eclipse.xsd.util.XSDSchemaBuildingTools;
+//import org.w3c.dom.Element;
+
+public class FacetViewer //extends NavigableTableViewer implements ICellModifier
+{
+//  public static final String FACET_NAME = XSDEditorPlugin.getXSDString("_UI_FACET_NAME"); // "Name";
+//  public static final String FACET_VALUE = XSDEditorPlugin.getXSDString("_UI_FACET_VALUE"); // "Value";
+//  public static final String FACET_OTHER = XSDEditorPlugin.getXSDString("_UI_FACET_FIXED"); // "Fixed";
+//
+//  protected FacetsTableLabelProvider facetsTableLabelProvider = new FacetsTableLabelProvider();
+//  protected FacetsTableContentProvider facetsTableContentProvider = new FacetsTableContentProvider();
+//  protected String[] columnProperties = { FACET_NAME, FACET_VALUE, FACET_OTHER };
+//  protected CellEditor[] cellEditors; // these cellEditors are used when
+//                                      // non-whitespace facet is selected
+//  protected CellEditor[] altCellEditors; // these cellEditors are used when
+//                                          // whitespace facet is selected
+//
+//  protected String[] whiteSpaceValues = new String[] { "", "preserve", "replace", "collapse" };
+//  protected String[] trueFalseValues = new String[] { "", "false", "true" };
+//
+//  /**
+//   * @param parent
+//   */
+//  public FacetViewer(Composite parent)
+//  {
+//    super(new Table(parent, SWT.FULL_SELECTION | SWT.SINGLE));
+//
+//    getTable().setLinesVisible(true);
+//    getTable().setHeaderVisible(true);
+//
+//    addSelectionChangedListener(new SelectionChangedListener());
+//    getTable().addMouseTrackListener(new MyMouseTrackListener());
+//
+//    setContentProvider(facetsTableContentProvider);
+//    setLabelProvider(facetsTableLabelProvider);
+//    setColumnProperties(columnProperties);
+//
+//    setCellModifier(this);
+//
+//    for (int i = 0; i < 3; i++)
+//    {
+//      TableColumn column = new TableColumn(getTable(), SWT.NONE, i);
+//      column.setText(columnProperties[i]);
+//      column.setAlignment(SWT.LEFT);
+//      column.setResizable(true);
+//    }
+//
+//    cellEditors = new CellEditor[3];
+//    altCellEditors = new CellEditor[3];
+//
+//    TableLayout layout = new TableLayout();
+//    ColumnWeightData data = new ColumnWeightData(60, 80, true);
+//    layout.addColumnData(data);
+//    cellEditors[0] = null;
+//
+//    ColumnWeightData data2 = new ColumnWeightData(120, 80, true);
+//    layout.addColumnData(data2);
+//
+//    cellEditors[1] = new TextCellEditor(getTable());
+//    XSDComboBoxPropertyDescriptor pd = new XSDComboBoxPropertyDescriptor("combo", "whitespace", whiteSpaceValues);
+//    altCellEditors[1] = pd.createPropertyEditor(getTable());
+//
+//    ColumnWeightData data3 = new ColumnWeightData(60, 60, true);
+//    layout.addColumnData(data3);
+//
+//    XSDComboBoxPropertyDescriptor pd2 = new XSDComboBoxPropertyDescriptor("combo", "other", trueFalseValues);
+//    cellEditors[2] = pd2.createPropertyEditor(getTable());
+//    altCellEditors[2] = pd2.createPropertyEditor(getTable());
+//
+//    getTable().setLayout(layout);
+//    setCellEditors(cellEditors);
+//
+//  }
+//
+//  /*
+//   * (non-Javadoc)
+//   * 
+//   * @see org.eclipse.jface.viewers.ICellModifier#canModify(java.lang.Object,
+//   *      java.lang.String)
+//   */
+//  public boolean canModify(Object element, String property)
+//  {
+//    return property.equals(FACET_VALUE) || property.equals(FACET_OTHER);
+//  }
+//
+//  /*
+//   * (non-Javadoc)
+//   * 
+//   * @see org.eclipse.jface.viewers.ICellModifier#getValue(java.lang.Object,
+//   *      java.lang.String)
+//   */
+//  public Object getValue(Object element, String property)
+//  {
+//    int column = 0;
+//    if (property.equals(columnProperties[0]))
+//    {
+//      column = 0;
+//    }
+//    else if (property.equals(columnProperties[1]))
+//    {
+//      column = 1;
+//    }
+//    else if (property.equals(columnProperties[2]))
+//    {
+//      column = 2;
+//    }
+//
+//    return facetsTableLabelProvider.getColumnText(element, column);
+//  }
+//
+//  /*
+//   * (non-Javadoc)
+//   * 
+//   * @see org.eclipse.jface.viewers.ICellModifier#modify(java.lang.Object,
+//   *      java.lang.String, java.lang.Object)
+//   */
+//  public void modify(Object element, String property, Object value)
+//  {
+//    XSDSimpleTypeDefinition xsdSimpleType = (XSDSimpleTypeDefinition) getInput();
+//    TableItem item = (TableItem) element;
+//    if (item != null)
+//    {
+//      Object o = item.getData();
+//      if (o != null)
+//      {
+//        if (o instanceof String)
+//        {
+//          String facet = (String) o;
+//
+//          Element simpleTypeElement = xsdSimpleType.getElement();
+//          XSDDOMHelper xsdDOMHelper = new XSDDOMHelper();
+//          Element derivedByElement = xsdDOMHelper.getDerivedByElement(simpleTypeElement);
+//
+//          String prefix = simpleTypeElement.getPrefix();
+//          prefix = (prefix == null) ? "" : (prefix + ":");
+//
+//          Element childNodeElement = null;
+//          DOMAttribute valueAttr = null;
+//
+//          XSDConstrainingFacet targetFacet = getXSDConstrainingFacet(facet);
+//
+//          String newValue = "";
+//          if (value != null && value instanceof String)
+//          {
+//            newValue = (String) value;
+//          }
+//
+//          if (property.equals(columnProperties[1]))
+//          {
+//            if (targetFacet == null && newValue.length() > 0)
+//            {
+//              targetFacet = createFacet(facet);
+//              childNodeElement = (derivedByElement.getOwnerDocument()).createElementNS(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, prefix + facet);
+//              valueAttr = new DOMAttribute(XSDConstants.VALUE_ATTRIBUTE, newValue);
+//              childNodeElement.setAttribute(valueAttr.getName(), valueAttr.getValue());
+//              // add and format child
+//              derivedByElement.appendChild(childNodeElement);
+//              targetFacet.setElement(childNodeElement);
+//              XSDDOMHelper.formatChild(childNodeElement);
+//
+//              // XSDSchemaHelper.updateElement(xsdSimpleType);
+//            }
+//            if (targetFacet == null)
+//            {
+//              return;
+//            }
+//
+//            if (newValue.length() > 0)
+//            {
+//              targetFacet.setLexicalValue(newValue);
+//
+//              if (targetFacet instanceof XSDMaxFacet || targetFacet instanceof XSDMinFacet)
+//              {
+//                if (targetFacet instanceof XSDMaxFacet)
+//                {
+//                  if (targetFacet instanceof XSDMaxExclusiveFacet)
+//                  {
+//                    XSDMaxInclusiveFacet xsdMaxInclusiveFacet = xsdSimpleType.getMaxInclusiveFacet();
+//                    if (xsdMaxInclusiveFacet != null)
+//                    {
+//                      Element xsdMaxInclusiveFacetElement = xsdMaxInclusiveFacet.getElement();
+//                      XSDDOMHelper.removeNodeAndWhitespace(xsdMaxInclusiveFacetElement);
+//                    }
+//                  }
+//                  else if (targetFacet instanceof XSDMaxInclusiveFacet)
+//                  {
+//                    XSDMaxExclusiveFacet xsdMaxExclusiveFacet = xsdSimpleType.getMaxExclusiveFacet();
+//                    if (xsdMaxExclusiveFacet != null)
+//                    {
+//                      Element xsdMaxExclusiveFacetElement = xsdMaxExclusiveFacet.getElement();
+//                      XSDDOMHelper.removeNodeAndWhitespace(xsdMaxExclusiveFacetElement);
+//                    }
+//                  }
+//                }
+//                else if (targetFacet instanceof XSDMinFacet)
+//                {
+//                  if (targetFacet instanceof XSDMinExclusiveFacet)
+//                  {
+//                    XSDMinInclusiveFacet xsdMinInclusiveFacet = xsdSimpleType.getMinInclusiveFacet();
+//                    if (xsdMinInclusiveFacet != null)
+//                    {
+//                      Element xsdMinInclusiveFacetElement = xsdMinInclusiveFacet.getElement();
+//                      XSDDOMHelper.removeNodeAndWhitespace(xsdMinInclusiveFacetElement);
+//                    }
+//                  }
+//                  else if (targetFacet instanceof XSDMinInclusiveFacet)
+//                  {
+//                    XSDMinExclusiveFacet xsdMinExclusiveFacet = xsdSimpleType.getMinExclusiveFacet();
+//                    if (xsdMinExclusiveFacet != null)
+//                    {
+//                      Element xsdMinExclusiveFacetElement = xsdMinExclusiveFacet.getElement();
+//                      XSDDOMHelper.removeNodeAndWhitespace(xsdMinExclusiveFacetElement);
+//                    }
+//                  }
+//                }
+//              }
+//            }
+//            else
+//            // newValue.length == 0
+//            {
+//              Element targetFacetElement = targetFacet.getElement();
+//              XSDDOMHelper.removeNodeAndWhitespace(targetFacetElement);
+//            }
+//          }
+//          else if (property.equals(columnProperties[2]))
+//          {
+//            if (targetFacet != null)
+//            {
+//              if (newValue.length() > 0)
+//              {
+//                targetFacet.getElement().setAttribute(XSDConstants.FIXED_ATTRIBUTE, newValue);
+//              }
+//              else
+//              {
+//                targetFacet.getElement().removeAttribute(XSDConstants.FIXED_ATTRIBUTE);
+//              }
+//            }
+//          }
+//          xsdSimpleType.setElement(simpleTypeElement);
+//          // xsdSimpleType.updateElement();
+//          refresh();
+//        }
+//      }
+//    }
+//  }
+//
+//  private XSDConstrainingFacet getXSDConstrainingFacet(String facetString)
+//  {
+//    XSDSimpleTypeDefinition xsdSimpleType = (XSDSimpleTypeDefinition) getInput();
+//    List list = xsdSimpleType.getFacetContents();
+//    if (list == null)
+//    {
+//      return null;
+//    }
+//    Iterator iter = list.iterator();
+//    XSDConstrainingFacet targetFacet = null;
+//
+//    while (iter.hasNext())
+//    {
+//      XSDConstrainingFacet xsdConstrainingFacet = (XSDConstrainingFacet) iter.next();
+//      if (xsdConstrainingFacet.getFacetName().equals(facetString))
+//      {
+//        targetFacet = xsdConstrainingFacet;
+//        break;
+//      }
+//    }
+//    return targetFacet;
+//  }
+//
+//  private XSDConstrainingFacet createFacet(String facet)
+//  {
+//    XSDFactory factory = XSDSchemaBuildingTools.getXSDFactory();
+//    XSDConstrainingFacet xsdFacet = null;
+//    if (facet.equals("length"))
+//    {
+//      xsdFacet = factory.createXSDLengthFacet();
+//    }
+//    else if (facet.equals("minLength"))
+//    {
+//      xsdFacet = factory.createXSDMinLengthFacet();
+//    }
+//    else if (facet.equals("maxLength"))
+//    {
+//      xsdFacet = factory.createXSDMaxLengthFacet();
+//    }
+//    else if (facet.equals("minInclusive"))
+//    {
+//      xsdFacet = factory.createXSDMinInclusiveFacet();
+//    }
+//    else if (facet.equals("minExclusive"))
+//    {
+//      xsdFacet = factory.createXSDMinExclusiveFacet();
+//    }
+//    else if (facet.equals("maxInclusive"))
+//    {
+//      xsdFacet = factory.createXSDMaxInclusiveFacet();
+//    }
+//    else if (facet.equals("maxExclusive"))
+//    {
+//      xsdFacet = factory.createXSDMaxExclusiveFacet();
+//    }
+//
+//    else if (facet.equals("totalDigits"))
+//    {
+//      xsdFacet = factory.createXSDTotalDigitsFacet();
+//    }
+//    else if (facet.equals("fractionDigits"))
+//    {
+//      xsdFacet = factory.createXSDFractionDigitsFacet();
+//    }
+//    else if (facet.equals("whiteSpace"))
+//    {
+//      xsdFacet = factory.createXSDWhiteSpaceFacet();
+//    }
+//    return xsdFacet;
+//  }
+//
+//  /**
+//   * Get the tooltip for the facet
+//   */
+//  public String getToolTip(String facet)
+//  {
+//    String key = "";
+//    if (facet.equals("length"))
+//    {
+//      key = "_UI_TOOLTIP_LENGTH";
+//    }
+//    else if (facet.equals("minLength"))
+//    {
+//      key = "_UI_TOOLTIP_MIN_LEN";
+//    }
+//    else if (facet.equals("maxLength"))
+//    {
+//      key = "_UI_TOOLTIP_MAX_LEN";
+//    }
+//
+//    else if (facet.equals("minInclusive"))
+//    {
+//      key = "_UI_TOOLTIP_MIN_INCLUSIVE";
+//    }
+//    else if (facet.equals("minExclusive"))
+//    {
+//      key = "_UI_TOOLTIP_MIN_EXCLUSIVE";
+//    }
+//
+//    else if (facet.equals("maxInclusive"))
+//    {
+//      key = "_UI_TOOLTIP_MAX_INCLUSIVE";
+//    }
+//    else if (facet.equals("maxExclusive"))
+//    {
+//      key = "_UI_TOOLTIP_MAX_EXCLUSIVE";
+//    }
+//
+//    else if (facet.equals("totalDigits"))
+//    {
+//      key = "_UI_TOOLTIP_TOTAL_DIGITS";
+//    }
+//    else if (facet.equals("fractionDigits"))
+//    {
+//      key = "_UI_TOOLTIP_FRACTION_DIGITS";
+//    }
+//
+//    else if (facet.equals("whiteSpace"))
+//    {
+//      key = "_UI_TOOLTIP_WHITE_SPACE";
+//    }
+//
+//    return (key != null) ? XSDEditorPlugin.getXSDString(key) : "";
+//  }
+//
+//  /**
+//   * This listener detects which row is selected and add a tool tip for that row
+//   */
+//  public class MyMouseTrackListener extends MouseTrackAdapter
+//  {
+//    public void mouseHover(MouseEvent e)
+//    {
+//      TableItem item = getTable().getItem(new Point(e.x, e.y));
+//      if (item != null)
+//      {
+//        Object o = item.getData();
+//        if (o != null)
+//        {
+//          String facetName = (String) o;
+//          getTable().setToolTipText(getToolTip(facetName));
+//        }
+//      }
+//    }
+//  }
+//
+//  /**
+//   * Based on the selection, detects if it is a white space or not, and add the
+//   * corresponding cell editors
+//   */
+//  public class SelectionChangedListener implements ISelectionChangedListener
+//  {
+//    public void selectionChanged(SelectionChangedEvent event)
+//    {
+//      Object selection = event.getSelection();
+//      if (selection instanceof StructuredSelection)
+//      {
+//        Object o = ((StructuredSelection) selection).getFirstElement();
+//        if (o != null)
+//        {
+//          String facet = (String) o;
+//          if (facet.equals("whiteSpace"))
+//          {
+//            setCellEditors(altCellEditors);
+//          }
+//          else
+//          {
+//            setCellEditors(cellEditors);
+//          }
+//        }
+//      }
+//    }
+//  }
+//
+//  class FacetsTableContentProvider implements IStructuredContentProvider
+//  {
+//    protected String facet;
+//
+//    public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
+//    {
+//    }
+//
+//    public java.lang.Object[] getElements(java.lang.Object inputElement)
+//    {
+//      List v = new ArrayList();
+//      XSDSimpleTypeDefinition inputXSDSimpleType = (XSDSimpleTypeDefinition) inputElement;
+//      XSDSimpleTypeDefinition base = inputXSDSimpleType.getPrimitiveTypeDefinition();
+//
+//      if (base != null)
+//      {
+//        Iterator validFacets = inputXSDSimpleType.getValidFacets().iterator();
+//        while (validFacets.hasNext())
+//        {
+//          String aValidFacet = (String) validFacets.next();
+//          if (!(aValidFacet.equals("pattern") || aValidFacet.equals("enumeration")))
+//          {
+//            v.add(aValidFacet);
+//          }
+//        }
+//      }
+//      return v.toArray();
+//    }
+//
+//    public void dispose()
+//    {
+//    }
+//  }
+//
+//  class FacetsTableLabelProvider extends LabelProvider implements ITableLabelProvider
+//  {
+//    public Image getColumnImage(Object element, int columnIndex)
+//    {
+//      return null;
+//    }
+//
+//    public String getColumnText(Object element, int columnIndex)
+//    {
+//      if (element instanceof String)
+//      {
+//        String value = null;
+//        XSDConstrainingFacet targetFacet = getXSDConstrainingFacet((String) element);
+//        switch (columnIndex)
+//        {
+//        case 0:
+//        {
+//          value = (String) element;
+//          break;
+//        }
+//        case 1:
+//        {
+//          if (targetFacet == null)
+//          {
+//            value = "";
+//          }
+//          else
+//          {
+//            value = targetFacet.getLexicalValue();
+//          }
+//
+//          break;
+//        }
+//        case 2:
+//        {
+//          if (targetFacet == null)
+//          {
+//            value = "";
+//          }
+//          else
+//          {
+//            Element elem = targetFacet.getElement();
+//            value = elem.getAttribute(XSDConstants.FIXED_ATTRIBUTE);
+//            if (value == null)
+//              value = "";
+//          }
+//        }
+//        }
+//        return value;
+//      }
+//      return "";
+//    }
+//  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/MultiplicitySection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/MultiplicitySection.java
new file mode 100644
index 0000000..128991f
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/MultiplicitySection.java
@@ -0,0 +1,211 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.properties.sections;
+
+import org.eclipse.swt.custom.CCombo;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.wst.xsd.ui.common.commands.UpdateMaxOccursCommand;
+import org.eclipse.wst.xsd.ui.common.commands.UpdateMinOccursCommand;
+import org.eclipse.xsd.XSDConcreteComponent;
+import org.eclipse.xsd.XSDParticle;
+import org.eclipse.xsd.XSDParticleContent;
+import org.eclipse.xsd.util.XSDConstants;
+import org.w3c.dom.Element;
+
+
+public class MultiplicitySection extends AbstractSection
+{
+  protected CCombo minCombo, maxCombo;
+  protected Button listButton;
+  protected Button requiredButton;
+  protected boolean isRequired;
+ 
+  public MultiplicitySection()
+  {
+    super();
+  }
+
+  protected void createContents(Composite parent)
+  {
+  }
+
+  
+  public void doHandleEvent(Event event)
+  {
+    if (event.widget == minCombo)
+    {
+      updateMinAttribute();
+    }
+    else if (event.widget == maxCombo)
+    {
+      updateMaxAttribute();
+    }
+  }
+
+  public void doWidgetSelected(SelectionEvent e)
+  {
+    if (e.widget == minCombo)
+    {
+      updateMinAttribute();
+    }
+    else if (e.widget == maxCombo)
+    {
+      updateMaxAttribute();
+    }
+  }
+
+  protected void updateMaxAttribute()
+  {
+    setErrorMessage(null);
+    XSDParticle particle = null;
+
+    if (input instanceof XSDParticleContent)
+    {
+      particle = getAssociatedParticle((XSDParticleContent) input);
+    }
+    if (particle != null)
+    {
+      String newValue = maxCombo.getText().trim();
+      
+      if (newValue.length() == 0)
+      {
+        particle.unsetMaxOccurs();
+        return;
+      }
+      try
+      {
+        int newMax = 1;
+        if (newValue.equals("unbounded") || newValue.equals("*")) //$NON-NLS-1$
+        {
+          newMax = XSDParticle.UNBOUNDED;
+        }
+        else
+        {
+          if (newValue.length() > 0)
+          {
+            newMax = Integer.parseInt(newValue);
+          }
+        }
+        setListenerEnabled(false);
+        UpdateMaxOccursCommand command = new UpdateMaxOccursCommand("Maximum Occurrence Change", particle, newMax);
+        getCommandStack().execute(command);
+        setListenerEnabled(true);
+
+      }
+      catch (NumberFormatException e)
+      {
+        setErrorMessage("Invalid value for maximum occurrence");
+      }
+    }
+  }
+
+  protected void updateMinAttribute()
+  {
+    setErrorMessage(null);
+    XSDParticle particle = null;
+
+    if (input instanceof XSDParticleContent)
+    {
+      particle = getAssociatedParticle((XSDParticleContent) input);
+    }
+    if (particle != null)
+    {
+      String newValue = minCombo.getText();
+      isRequired = false;
+      if (newValue.length() == 0)
+      {
+        particle.unsetMinOccurs();
+      }
+      try
+      {
+        int newMin = 1;
+        if (newValue.equals("unbounded") || newValue.equals("*")) //$NON-NLS-1$
+        {
+          newMin = XSDParticle.UNBOUNDED;
+          isRequired = true;
+        }
+        else
+        {
+          newMin = Integer.parseInt(newValue);
+          isRequired = newMin > 0;
+        }
+        UpdateMinOccursCommand command = new UpdateMinOccursCommand("Minimum Occurrence Change", particle, newMin);
+        getCommandStack().execute(command);
+      }
+      catch (NumberFormatException e)
+      {
+
+      }
+    }
+  }
+  
+  protected void refreshMinMax()
+  {
+    boolean refreshMinText = true;
+    boolean refreshMaxText = true;
+    if (minCombo.isFocusControl())
+    {
+      refreshMinText = false;
+    }
+    if (maxCombo.isFocusControl())
+    {
+      refreshMaxText = false;
+    }
+    if (refreshMinText)
+    {
+      minCombo.setText(""); //$NON-NLS-1$
+    }
+    if (refreshMaxText)
+    {
+      maxCombo.setText(""); //$NON-NLS-1$
+    }
+
+    if (input != null)
+    {
+      if (input instanceof XSDParticleContent)
+      {
+        XSDParticle particle = getAssociatedParticle((XSDParticleContent) input);
+        if (particle != null)
+        {
+          // minText.setText(String.valueOf(particle.getMinOccurs()));
+          // maxText.setText(String.valueOf(particle.getMaxOccurs()));
+          Element element = particle.getElement();
+          if (element != null)
+          {
+            String min = element.getAttribute(XSDConstants.MINOCCURS_ATTRIBUTE);
+            String max = element.getAttribute(XSDConstants.MAXOCCURS_ATTRIBUTE);
+            if (min != null && refreshMinText)
+            {
+              minCombo.setText(min);
+            }
+            if (max != null && refreshMaxText)
+            {
+              maxCombo.setText(max);
+            }
+          }
+        }
+      }
+    }
+  }
+
+  protected XSDParticle getAssociatedParticle(XSDParticleContent particleContent)
+  {
+    XSDConcreteComponent xsdComp = particleContent.getContainer();
+    if (xsdComp instanceof XSDParticle)
+    {
+      return (XSDParticle) xsdComp;
+    }
+    return null;
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/SchemaLocationSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/SchemaLocationSection.java
new file mode 100644
index 0000000..4b2f160
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/SchemaLocationSection.java
@@ -0,0 +1,202 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.properties.sections;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.jface.window.Window;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.wst.common.ui.internal.viewers.ResourceFilter;
+import org.eclipse.wst.common.uriresolver.internal.util.URIHelper;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+import org.eclipse.wst.xsd.ui.internal.wizards.XSDSelectIncludeFileWizard;
+import org.eclipse.xsd.XSDInclude;
+import org.eclipse.xsd.XSDRedefine;
+import org.eclipse.xsd.XSDSchema;
+import org.eclipse.xsd.impl.XSDIncludeImpl;
+import org.eclipse.xsd.impl.XSDRedefineImpl;
+import org.w3c.dom.Element;
+
+public class SchemaLocationSection extends CommonDirectivesSection
+{
+	  IWorkbenchPart part;
+	  
+	  /**
+	   * 
+	   */
+	  public SchemaLocationSection()
+	  {
+	    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 = 3;
+      composite.setLayout(gridLayout);
+      
+      GridData data = new GridData();
+
+			// Create Schema Location Label
+			CLabel schemaLocationLabel = getWidgetFactory().createCLabel(composite, XSDEditorPlugin.getXSDString("_UI_LABEL_SCHEMA_LOCATION")); //$NON-NLS-1$
+      data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
+      data.grabExcessHorizontalSpace = false;
+      schemaLocationLabel.setLayoutData(data);
+			
+      // Create Schema Location Text
+      schemaLocationText = getWidgetFactory().createText(composite, "", SWT.NONE); //$NON-NLS-1$
+      schemaLocationText.setEditable(true);
+      applyAllListeners(schemaLocationText);       
+
+      data = new GridData();
+      data.grabExcessHorizontalSpace = true;
+      data.horizontalAlignment = GridData.FILL;
+      schemaLocationText.setLayoutData(data);
+      
+			// Create Wizard Button
+			wizardButton = getWidgetFactory().createButton(composite, "", SWT.NONE); //$NON-NLS-1$
+      wizardButton.setImage(XSDEditorPlugin.getXSDImage("icons/browsebutton.gif")); //$NON-NLS-1$
+      data = new GridData();
+      data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
+      data.grabExcessHorizontalSpace = false;
+			wizardButton.setLayoutData(data);
+			wizardButton.addSelectionListener(this);
+			
+      // error text
+      errorText = new StyledText(composite, SWT.FLAT);
+      errorText.setEditable(false);
+      errorText.setEnabled(false);
+      errorText.setText("");
+      
+      data = new GridData();
+      data.horizontalAlignment = GridData.FILL;
+      data.horizontalSpan = 3;
+      data.grabExcessHorizontalSpace = true;
+      errorText.setLayoutData(data);
+
+		}
+		
+		public void widgetSelected(SelectionEvent event)
+    {
+			if (event.widget == wizardButton)
+      {
+				Shell shell = Display.getCurrent().getActiveShell();
+			    
+				IFile currentIFile = ((IFileEditorInput)getActiveEditor().getEditorInput()).getFile();
+				ViewerFilter filter = new ResourceFilter(new String[] { ".xsd" },  //$NON-NLS-1$
+			            new IFile[] { currentIFile },
+			            null);
+			      
+			  XSDSelectIncludeFileWizard fileSelectWizard = 
+			      new XSDSelectIncludeFileWizard(xsdSchema, true,
+			          XSDEditorPlugin.getXSDString("_UI_FILEDIALOG_SELECT_XML_SCHEMA"), //$NON-NLS-1$
+			          XSDEditorPlugin.getXSDString("_UI_FILEDIALOG_SELECT_XML_DESC"), //$NON-NLS-1$
+			          filter,
+			          (IStructuredSelection) getSelection());
+
+			  WizardDialog wizardDialog = new WizardDialog(shell, fileSelectWizard);
+			  wizardDialog.create();
+			  wizardDialog.setBlockOnOpen(true);
+			  int result = wizardDialog.open();
+				  
+	      String value = schemaLocationText.getText();
+	      if (result == Window.OK)
+	      {
+          errorText.setText("");
+	        IFile selectedIFile = fileSelectWizard.getResultFile();
+	        String schemaFileString = value;
+	        if (selectedIFile != null) 
+	        {
+	          schemaFileString = URIHelper.getRelativeURI(selectedIFile.getLocation(), currentIFile.getLocation());
+	        }
+	        else
+	        {
+	          schemaFileString = fileSelectWizard.getURL();
+	        }
+
+          handleSchemaLocationChange(schemaFileString, fileSelectWizard.getNamespace(), null);
+	        refresh();
+			  } 
+			}
+		}
+
+		/*
+		 * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh()
+		 */
+		public void refresh()
+		{
+				setListenerEnabled(false);
+
+				Element element = null;
+				if (input instanceof XSDInclude)
+        { 
+					element = ((XSDIncludeImpl) input).getElement();
+				}
+				else if (input instanceof XSDRedefine)
+        {
+					element = ((XSDRedefineImpl) input).getElement();
+				}
+				
+				if (element != null)
+        {
+					String location = ""; //$NON-NLS-1$
+					location = element.getAttribute("schemaLocation"); //$NON-NLS-1$
+          if (location == null)
+          {
+            location = "";
+          }
+					schemaLocationText.setText(location);
+				}
+
+        setListenerEnabled(true);
+		}
+
+	  /* (non-Javadoc)
+	   * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISection#shouldUseExtraSpace()
+	   */
+	  public boolean shouldUseExtraSpace()
+	  {
+	    return true;
+	  }
+    
+    protected void handleSchemaLocationChange(String schemaFileString, String namespace, XSDSchema externalSchema)
+    {
+      if (input instanceof XSDInclude)
+      {
+        Element element = ((XSDIncludeImpl) input).getElement();
+        element.setAttribute("schemaLocation", schemaFileString); //$NON-NLS-1$
+      }
+      else if (input instanceof XSDRedefine)
+      {
+        Element element = ((XSDRedefineImpl) input).getElement();
+        element.setAttribute("schemaLocation", schemaFileString); //$NON-NLS-1$
+      }
+    }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/SimpleContentUnionMemberTypesDialog.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/SimpleContentUnionMemberTypesDialog.java
new file mode 100644
index 0000000..1f921f9
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/SimpleContentUnionMemberTypesDialog.java
@@ -0,0 +1,311 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 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.common.properties.sections;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+import org.eclipse.wst.xsd.ui.internal.util.TypesHelper;
+import org.eclipse.wst.xsd.ui.internal.util.ViewUtility;
+import org.eclipse.wst.xsd.ui.internal.widgets.TypeSection;
+import org.eclipse.xsd.XSDSchema;
+import org.eclipse.xsd.XSDSimpleTypeDefinition;
+import org.eclipse.xsd.util.XSDConstants;
+
+
+public class SimpleContentUnionMemberTypesDialog extends Dialog implements SelectionListener
+{
+  XSDSimpleTypeDefinition simpleType;
+  /**
+   * @param parentShell
+   */
+  public SimpleContentUnionMemberTypesDialog(Shell parentShell, XSDSimpleTypeDefinition simpleType)
+  {
+    super(parentShell);
+    this.simpleType = simpleType;
+  }
+  
+  Table table;
+  TypeSection typeSection;
+  Button addButton, removeButton;
+  org.eclipse.swt.widgets.List memberTypesList;
+  
+  private String result;
+
+  protected void configureShell(Shell shell)
+  {
+    super.configureShell(shell);
+  }
+
+  protected void buttonPressed(int buttonId)
+  {
+    if (buttonId == Dialog.OK)
+    {
+      StringBuffer sb = new StringBuffer();
+      int length = memberTypesList.getItemCount();
+      for (int i=0 ; i < length; i++)
+      {
+        sb.append(memberTypesList.getItem(i));
+        if (i < length - 1)
+        {
+          sb.append(" ");
+        }
+      }
+      result = sb.toString();
+    }
+    super.buttonPressed(buttonId);
+  }
+
+  public String getResult() { return result; }
+
+  //
+  // Create the controls
+  //
+  public Control createDialogArea(Composite parent)
+  {
+    Composite client = (Composite)super.createDialogArea(parent);
+    getShell().setText("Union " + XSDConstants.MEMBERTYPES_ATTRIBUTE); 
+    
+    Label instructions = new Label(client, SWT.LEFT | SWT.WRAP);
+    instructions.setText(XSDEditorPlugin.getXSDString("_UI_LABEL_SELECT_MEMBERTYPES"));
+    
+    Composite columnsComposite = new Composite(client, SWT.NONE);
+    GridLayout ccGL = new GridLayout();
+    ccGL.verticalSpacing = 0;
+    ccGL.horizontalSpacing = 0;
+    ccGL.marginHeight = 0;
+    ccGL.marginWidth = 0;
+    ccGL.makeColumnsEqualWidth = true;
+    ccGL.numColumns = 3;
+    columnsComposite.setLayout(ccGL);
+    
+    GridData ccGD = new GridData();
+    ccGD.grabExcessHorizontalSpace = true;
+    ccGD.horizontalAlignment = GridData.FILL;
+    columnsComposite.setLayoutData(ccGD);     
+                           
+    typeSection = new TypeSection(columnsComposite);
+    typeSection.setShowUserComplexType(false);
+
+    typeSection.createClient(columnsComposite);
+    typeSection.getSimpleType().setSelection(false);
+    typeSection.getSimpleType().addSelectionListener(this);
+    typeSection.getUserSimpleType().addSelectionListener(this);
+    
+    ViewUtility.createHorizontalFiller(columnsComposite, 1);
+    
+    Label memberListLabel = new Label(columnsComposite, SWT.LEFT);
+    memberListLabel.setText(XSDEditorPlugin.getXSDString("_UI_LABEL_MEMBERTYPES_VALUE"));
+    
+    Composite dataComposite = new Composite(client, SWT.NONE);
+    GridLayout dcGL = new GridLayout();
+    dcGL.verticalSpacing = 0;
+    dcGL.marginHeight = 0;
+    dcGL.marginWidth = 0;
+    dcGL.numColumns = 3;
+    dataComposite.setLayout(dcGL);
+    
+    GridData dcGD = new GridData();
+    dcGD.grabExcessHorizontalSpace = true;
+    dcGD.grabExcessVerticalSpace = true;
+    dataComposite.setLayoutData(dcGD);
+    
+    table = new Table(dataComposite,
+        SWT.SINGLE | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); 
+    table.setHeaderVisible(false);
+    table.setLinesVisible(true);
+    GridData gd2 = new GridData();
+    gd2.grabExcessHorizontalSpace = true;
+    gd2.grabExcessVerticalSpace = true;
+    gd2.horizontalAlignment = GridData.FILL;
+    gd2.verticalAlignment = GridData.FILL;
+    gd2.heightHint = 200;
+    gd2.widthHint = 200;
+    table.setLayoutData(gd2);
+
+    // Fill table
+    handleSetInput();
+    table.getItemCount();
+
+    TableColumn tc = new TableColumn(table, SWT.LEFT);
+    tc.setWidth(200);
+    tc.setResizable(true);
+    
+    Composite buttonComposite = new Composite(dataComposite, SWT.NONE);
+    GridLayout bcGL = new GridLayout();
+    bcGL.numColumns = 1;
+    buttonComposite.setLayout(bcGL);
+    addButton = new Button(buttonComposite, SWT.PUSH);
+    addButton.setText(">");
+    addButton.addSelectionListener(this);
+    removeButton = new Button(buttonComposite, SWT.PUSH);
+    removeButton.setText("<");
+    removeButton.addSelectionListener(this);
+    
+    Composite listComposite = new Composite(dataComposite, SWT.NONE);
+    GridLayout mtGL = new GridLayout();
+    mtGL.numColumns = 1;
+    mtGL.marginHeight = 0;
+    mtGL.marginWidth = 0;
+    mtGL.horizontalSpacing = 0;
+    mtGL.verticalSpacing = 0;
+    listComposite.setLayout(mtGL);
+
+    GridData mtGD = new GridData();
+    mtGD.grabExcessHorizontalSpace = true;
+    mtGD.grabExcessVerticalSpace = true;
+    mtGD.verticalAlignment = GridData.FILL;
+    mtGD.horizontalAlignment = GridData.FILL;
+    listComposite.setLayoutData(mtGD);
+    
+    memberTypesList = new org.eclipse.swt.widgets.List(listComposite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
+    GridData mtlGD = new GridData();
+    mtlGD.grabExcessHorizontalSpace = true;
+    mtlGD.grabExcessVerticalSpace = true;
+    mtlGD.verticalAlignment = GridData.FILL;
+    mtlGD.horizontalAlignment = GridData.FILL;
+    mtlGD.heightHint = 200;
+    mtlGD.widthHint = 200;
+    memberTypesList.setLayoutData(mtlGD);
+    
+    initializeMemberListContent();
+    return client;
+  }
+
+  private void initializeMemberListContent()
+  {
+//    String result = element.getAttribute(XSDConstants.MEMBERTYPES_ATTRIBUTE);
+//    if (result == null)
+//    {
+//      return;
+//    }
+//    StringTokenizer token = new StringTokenizer(result);
+//    while (token.hasMoreTokens())
+//    {
+//      memberTypesList.add(token.nextToken());
+//    }
+    XSDSchema schema = simpleType.getSchema();
+    for (Iterator i = simpleType.getMemberTypeDefinitions().iterator(); i.hasNext(); )
+    {
+      String name = ((XSDSimpleTypeDefinition)i.next()).getQName(schema);
+      if (name != null)
+      memberTypesList.add(name);
+    }
+  }
+
+  /* (non-Javadoc)
+   * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+   */
+  public void widgetSelected(SelectionEvent e)
+  {
+    if (e.widget == typeSection.getSimpleType() && typeSection.getSimpleType().getSelection())
+     {
+      populateBuiltInType();
+    }
+    else if (e.widget == typeSection.getUserSimpleType() && typeSection.getUserSimpleType().getSelection())
+     {
+      populateUserSimpleType(false);
+    }
+    else if (e.widget == addButton)
+    {
+      TableItem[] items = table.getItems();
+      int selection = table.getSelectionIndex();
+      if (items != null && items.length > 0 && selection >= 0)
+      {
+        String typeToAdd = items[selection].getData().toString();
+        if (memberTypesList.indexOf(typeToAdd) < 0)
+        {
+          memberTypesList.add(items[selection].getData().toString());
+        }
+      }
+    }
+    else if (e.widget == removeButton)
+    {
+      String[] typesToRemove = memberTypesList.getSelection();
+      for (int i=0; i < typesToRemove.length; i++)
+      {
+        memberTypesList.remove(typesToRemove[i]);
+      }
+    }
+  }
+
+  /* (non-Javadoc)
+   * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent)
+   */
+  public void widgetDefaultSelected(SelectionEvent e)
+  {
+  }
+  
+  public void handleSetInput()
+  {
+    populateBuiltInType();
+  }
+  
+  public void populateBuiltInType()
+  {
+    table.removeAll();
+    List items = getBuiltInTypeNamesList();
+    for (int i = 0; i < items.size(); i++)
+     {
+      TableItem item = new TableItem(table, SWT.NONE);
+      item.setText(items.get(i).toString());
+      item.setImage(XSDEditorPlugin.getXSDImage("icons/XSDSimpleType.gif"));
+      item.setData(items.get(i));
+    }
+  }
+
+  public void populateUserSimpleType(boolean showAnonymous)
+  {
+    table.removeAll();
+    if (showAnonymous)
+     {
+      TableItem anonymousItem = new TableItem(table, SWT.NONE);
+      anonymousItem.setText("**anonymous**");
+      anonymousItem.setData("**anonymous**");
+    }
+    List items = getUserSimpleTypeNamesList();
+    for (int i = 0; i < items.size(); i++)
+     {
+      TableItem item = new TableItem(table, SWT.NONE);
+      item.setText(items.get(i).toString());
+      item.setImage(XSDEditorPlugin.getXSDImage("icons/XSDSimpleType.gif"));
+      item.setData(items.get(i));
+    }
+  }
+  
+  public java.util.List getBuiltInTypeNamesList()
+  {
+    TypesHelper helper = new TypesHelper(simpleType.getSchema());
+    return helper.getBuiltInTypeNamesList();
+  }
+
+  public java.util.List getUserSimpleTypeNamesList()
+  {
+    TypesHelper helper = new TypesHelper(simpleType.getSchema());
+    return helper.getUserSimpleTypeNamesList();
+  }
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/SpecificConstraintsWidget.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/SpecificConstraintsWidget.java
new file mode 100644
index 0000000..40b7dab
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/SpecificConstraintsWidget.java
@@ -0,0 +1,667 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.properties.sections;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import org.eclipse.gef.commands.CommandStack;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.ColumnWeightData;
+import org.eclipse.jface.viewers.ICellModifier;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TableLayout;
+import org.eclipse.jface.viewers.TextCellEditor;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.window.Window;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
+import org.eclipse.wst.common.ui.internal.viewers.NavigableTableViewer;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+import org.eclipse.wst.xsd.ui.common.commands.AddEnumerationsCommand;
+import org.eclipse.wst.xsd.ui.common.commands.ChangeToLocalSimpleTypeCommand;
+import org.eclipse.wst.xsd.ui.common.commands.DeleteCommand;
+import org.eclipse.wst.xsd.ui.common.commands.SetXSDFacetValueCommand;
+import org.eclipse.wst.xsd.ui.common.commands.UpdateXSDPatternFacetCommand;
+import org.eclipse.wst.xsd.ui.common.util.XSDCommonUIUtils;
+import org.eclipse.wst.xsd.ui.internal.widgets.EnumerationsDialog;
+import org.eclipse.wst.xsd.ui.internal.wizards.RegexWizard;
+import org.eclipse.xsd.XSDEnumerationFacet;
+import org.eclipse.xsd.XSDFactory;
+import org.eclipse.xsd.XSDFeature;
+import org.eclipse.xsd.XSDPatternFacet;
+import org.eclipse.xsd.XSDSimpleTypeDefinition;
+import org.eclipse.xsd.util.XSDConstants;
+import org.w3c.dom.Element;
+
+public class SpecificConstraintsWidget implements SelectionListener, Listener
+{
+  public static int ENUMERATION = 0;
+  public static int PATTERN = 1;
+  
+  int kind;
+  ConstraintsTableViewer constraintsTableViewer;
+  Button addButton;
+  Button addUsingDialogButton;
+  Button deleteButton;
+  Button editButton;
+  Composite composite;
+  boolean isEnabled;
+  TabbedPropertySheetWidgetFactory factory;
+  XSDSimpleTypeDefinition input;
+  XSDFeature feature;
+  boolean isReadOnly;
+  CommandStack commandStack;
+  XSDFacetSection facetSection;
+
+  public SpecificConstraintsWidget(Composite composite, TabbedPropertySheetWidgetFactory factory, XSDFeature feature, XSDSimpleTypeDefinition input, XSDFacetSection facetSection)
+  {
+    this.factory = factory;
+    this.input = input;
+    this.composite = composite;
+    this.feature = feature;
+    this.facetSection = facetSection;
+    createControl(composite);
+  }
+
+  public void setCommandStack(CommandStack commandStack)
+  {
+    this.commandStack = commandStack; 
+  }
+
+  public void setIsReadOnly(boolean isReadOnly)
+  {
+    this.isReadOnly = isReadOnly;
+  }
+
+  public TabbedPropertySheetWidgetFactory getWidgetFactory()
+  {
+    return factory;
+  }
+  
+  public Control getControl()
+  {
+    return composite;
+  }
+  
+  public void setEnabled(boolean isEnabled)
+  {
+    this.isEnabled = isEnabled;
+    addButton.setEnabled(isEnabled);
+    addUsingDialogButton.setEnabled(isEnabled);
+    editButton.setEnabled(isEnabled);
+    constraintsTableViewer.getTable().setEnabled(isEnabled);
+    composite.setEnabled(isEnabled);
+  }
+
+  public Control createControl(Composite parent)
+  {
+    composite = factory.createFlatFormComposite(parent);
+    GridData data = new GridData();
+
+    GridLayout gridLayout = new GridLayout();
+    gridLayout.marginTop = 0;
+    gridLayout.marginBottom = 0;
+    gridLayout.numColumns = 2;
+    composite.setLayout(gridLayout);
+
+    constraintsTableViewer = new ConstraintsTableViewer(getWidgetFactory().createTable(composite, SWT.MULTI | SWT.FULL_SELECTION));
+    constraintsTableViewer.setInput(input);
+    Table table = constraintsTableViewer.getTable();
+    table.addSelectionListener(this);
+    data.horizontalAlignment = GridData.FILL;
+    data.verticalAlignment = GridData.FILL;
+    data.grabExcessHorizontalSpace = true;
+    data.widthHint = 150;
+    data.grabExcessVerticalSpace = true;
+    table.setLayoutData(data);
+    table.addListener(SWT.Resize, this);
+    
+    Composite buttonComposite = getWidgetFactory().createComposite(composite, SWT.FLAT);
+    GridLayout buttonCompositeLayout = new GridLayout();
+    buttonCompositeLayout.marginTop = 0;
+    buttonCompositeLayout.marginBottom = 0;
+    buttonCompositeLayout.numColumns = 1;
+    buttonComposite.setLayout(buttonCompositeLayout);
+    data = new GridData();
+    data.horizontalAlignment = GridData.FILL;
+    data.grabExcessHorizontalSpace = false;
+    buttonComposite.setLayoutData(data);
+
+    
+    addButton = getWidgetFactory().createButton(buttonComposite, "Add", SWT.PUSH);
+    data = new GridData();
+    data.grabExcessHorizontalSpace = true;
+    data.horizontalAlignment = GridData.FILL;
+    data.verticalAlignment = GridData.BEGINNING;
+    addButton.setLayoutData(data);
+    addButton.addSelectionListener(this);
+    
+    addUsingDialogButton = getWidgetFactory().createButton(buttonComposite, "Add...", SWT.PUSH);
+    data = new GridData();
+    data.grabExcessHorizontalSpace = true;
+    data.horizontalAlignment = GridData.FILL;
+    data.verticalAlignment = GridData.BEGINNING;
+    addUsingDialogButton.setLayoutData(data);
+    addUsingDialogButton.addSelectionListener(this);
+
+    editButton = getWidgetFactory().createButton(buttonComposite, "Edit...", SWT.PUSH);
+    data = new GridData();
+    data.grabExcessHorizontalSpace = true;
+    data.horizontalAlignment = GridData.FILL;
+    editButton.setLayoutData(data);
+    editButton.setEnabled(false);
+    editButton.addSelectionListener(this);
+    
+    
+    deleteButton = getWidgetFactory().createButton(buttonComposite, "Delete", SWT.PUSH);
+
+    data = new GridData();
+    data.grabExcessHorizontalSpace = true;
+    data.horizontalAlignment = GridData.FILL;
+    deleteButton.setLayoutData(data);
+    deleteButton.setEnabled(false);
+    deleteButton.addSelectionListener(this);
+
+
+    return composite;
+  }
+
+  public void handleEvent(Event event)
+  {
+    Table table = constraintsTableViewer.getTable();
+    if (event.type == SWT.Resize && event.widget == table)
+    {
+      TableColumn tableColumn = table.getColumn(0);
+      tableColumn.setWidth(table.getSize().x);
+    }
+  }
+
+  public void setInput(Object input)
+  {
+    constraintsTableViewer.setInput(input);
+    if (isReadOnly)
+    {
+      composite.setEnabled(false);
+    }
+    else
+    {
+      composite.setEnabled(true);
+    }
+//    constraintsTableViewer.refresh();
+  }
+
+  public void widgetSelected(SelectionEvent e)
+  {
+    XSDSimpleTypeDefinition st = (XSDSimpleTypeDefinition) input;
+    Element element = st.getElement();
+
+    if (e.widget == addButton)
+    {
+      List enumList = st.getEnumerationFacets();
+      StringBuffer newName = new StringBuffer("value1"); //$NON-NLS-1$
+      int suffix = 1;
+      for (Iterator i = enumList.iterator(); i.hasNext();)
+      {
+        XSDEnumerationFacet enumFacet = (XSDEnumerationFacet) i.next();
+        String value = enumFacet.getLexicalValue();
+        if (value != null)
+        {
+          if (value.equals(newName.toString()))
+          {
+            suffix++;
+            newName = new StringBuffer("value" + String.valueOf(suffix)); //$NON-NLS-1$
+          }
+        }
+      }
+
+      if (kind == ENUMERATION)
+      {
+        CompoundCommand compoundCommand = new CompoundCommand();
+        XSDSimpleTypeDefinition targetSimpleType = null;
+        if (feature != null)
+        {
+          XSDSimpleTypeDefinition anonymousSimpleType = XSDCommonUIUtils.getAnonymousSimpleType(feature, input);
+          if (anonymousSimpleType == null)
+          {
+            anonymousSimpleType = XSDFactory.eINSTANCE.createXSDSimpleTypeDefinition();
+            anonymousSimpleType.setBaseTypeDefinition(input);
+
+            ChangeToLocalSimpleTypeCommand changeToAnonymousCommand = new ChangeToLocalSimpleTypeCommand("Change pattern", (XSDFeature) feature);
+            changeToAnonymousCommand.setAnonymousSimpleType(anonymousSimpleType);
+            compoundCommand.add(changeToAnonymousCommand);
+            input = anonymousSimpleType;
+          }
+          targetSimpleType = anonymousSimpleType;
+        }
+        else
+        {
+          targetSimpleType = input;
+        }
+
+        AddEnumerationsCommand command = new AddEnumerationsCommand("Add Enumeration", targetSimpleType);
+        command.setValue(newName.toString());
+        compoundCommand.add(command);
+        commandStack.execute(compoundCommand);
+        setInput(input);
+        constraintsTableViewer.refresh();
+        int newItemIndex = constraintsTableViewer.getTable().getItemCount() - 1;
+        constraintsTableViewer.editElement(constraintsTableViewer.getElementAt(newItemIndex), 0);
+      }
+    }
+    else if (e.widget == addUsingDialogButton)
+    {
+      Display display = Display.getCurrent();
+      // if it is null, get the default one
+      display = display == null ? Display.getDefault() : display;
+      Shell shell = display.getActiveShell();
+
+      if (kind == PATTERN)
+      {
+        String initialValue = ""; //$NON-NLS-1$
+        RegexWizard wizard = new RegexWizard(initialValue);
+
+        WizardDialog wizardDialog = new WizardDialog(shell, wizard);
+        wizardDialog.setBlockOnOpen(true);
+        wizardDialog.create();
+
+        int result = wizardDialog.open();
+
+        if (result == Window.OK)
+        {
+          String newPattern = wizard.getPattern();
+          CompoundCommand compoundCommand = new CompoundCommand();
+          XSDSimpleTypeDefinition targetSimpleType = null;
+          if (feature != null)
+          {
+            XSDSimpleTypeDefinition anonymousSimpleType = XSDCommonUIUtils.getAnonymousSimpleType(feature, input);
+            if (anonymousSimpleType == null)
+            {
+              anonymousSimpleType = XSDFactory.eINSTANCE.createXSDSimpleTypeDefinition();
+              anonymousSimpleType.setBaseTypeDefinition(input);
+
+              ChangeToLocalSimpleTypeCommand changeToAnonymousCommand = new ChangeToLocalSimpleTypeCommand("Change pattern", (XSDFeature) feature);
+              changeToAnonymousCommand.setAnonymousSimpleType(anonymousSimpleType);
+              compoundCommand.add(changeToAnonymousCommand);
+              input = anonymousSimpleType;
+            }
+            targetSimpleType = anonymousSimpleType;
+          }
+          else
+          {
+            targetSimpleType = input;
+          }
+          
+          UpdateXSDPatternFacetCommand command = new UpdateXSDPatternFacetCommand("Add pattern", targetSimpleType, UpdateXSDPatternFacetCommand.ADD);
+          command.setValue(newPattern);
+          setInput(input);
+          compoundCommand.add(command);
+          commandStack.execute(compoundCommand);
+          facetSection.doSetInput();
+        }
+        constraintsTableViewer.refresh();
+      }
+      else
+      {
+        EnumerationsDialog dialog = new EnumerationsDialog(shell);
+        dialog.setBlockOnOpen(true);
+        int result = dialog.open();
+
+        if (result == Window.OK)
+        {
+          String text = dialog.getText();
+          String delimiter = dialog.getDelimiter();
+          StringTokenizer tokenizer = new StringTokenizer(text, delimiter);
+          CompoundCommand compoundCommand = new CompoundCommand("Add Enumerations");
+          
+          XSDSimpleTypeDefinition targetSimpleType = null;
+          if (feature != null)
+          {
+            XSDSimpleTypeDefinition anonymousSimpleType = XSDCommonUIUtils.getAnonymousSimpleType(feature, input);
+            if (anonymousSimpleType == null)
+            {
+              anonymousSimpleType = XSDFactory.eINSTANCE.createXSDSimpleTypeDefinition();
+              anonymousSimpleType.setBaseTypeDefinition(input);
+
+              ChangeToLocalSimpleTypeCommand changeToAnonymousCommand = new ChangeToLocalSimpleTypeCommand("", (XSDFeature) feature);
+              changeToAnonymousCommand.setAnonymousSimpleType(anonymousSimpleType);
+              compoundCommand.add(changeToAnonymousCommand);
+              input = anonymousSimpleType;
+            }
+            targetSimpleType = anonymousSimpleType;
+          }
+          else
+          {
+            targetSimpleType = input;
+          }
+
+          while (tokenizer.hasMoreTokens())
+          {
+            String token = tokenizer.nextToken();
+            if (dialog.isPreserveWhitespace() == false)
+            {
+              token = token.trim();
+            }
+            AddEnumerationsCommand command = new AddEnumerationsCommand("Add Enumerations", targetSimpleType);
+            command.setValue(token);
+            compoundCommand.add(command);
+          }
+          commandStack.execute(compoundCommand);
+        }
+        //setInput(input);
+        facetSection.doSetInput();
+        constraintsTableViewer.refresh();
+      }
+    }
+    else if (e.widget == deleteButton)
+    {
+      StructuredSelection selection = (StructuredSelection) constraintsTableViewer.getSelection();
+      CompoundCommand compoundCommand = new CompoundCommand();
+      if (selection != null)
+      {
+        Iterator i = selection.iterator();
+        if (selection.size() > 0)
+        {
+          compoundCommand.setLabel("Delete Constraints");
+        }
+        else
+        {
+          compoundCommand.setLabel("Delete Pattern");
+        }
+        while (i.hasNext())
+        {
+          Object obj = i.next();
+          if (obj != null)
+          {
+            if (obj instanceof XSDPatternFacet)
+            {
+              UpdateXSDPatternFacetCommand command = new UpdateXSDPatternFacetCommand("", input, UpdateXSDPatternFacetCommand.DELETE);
+              command.setPatternToEdit((XSDPatternFacet)obj);
+              compoundCommand.add(command);
+            }
+            else if (obj instanceof XSDEnumerationFacet)
+            {
+              XSDEnumerationFacet enumFacet = (XSDEnumerationFacet) obj;
+              DeleteCommand deleteCommand = new DeleteCommand("Delete Enumeration", enumFacet);
+              compoundCommand.add(deleteCommand);
+            }
+          }
+        }
+        commandStack.execute(compoundCommand);
+        constraintsTableViewer.refresh();
+
+        if (constraintsTableViewer.getTable().getItemCount() == 0)
+        {
+          editButton.setEnabled(false);
+          deleteButton.setEnabled(false);
+        }
+      }
+    }
+    else if (e.widget == editButton)
+    {
+      StructuredSelection selection = (StructuredSelection) constraintsTableViewer.getSelection();
+      if (selection != null)
+      {
+        Object obj = selection.getFirstElement();
+        if (obj instanceof XSDPatternFacet)
+        {
+          XSDPatternFacet pattern = (XSDPatternFacet) obj;
+          String initialValue = pattern.getLexicalValue();
+          if (initialValue == null)
+          {
+            initialValue = ""; //$NON-NLS-1$
+          }
+
+          Shell shell = Display.getCurrent().getActiveShell();
+
+          RegexWizard wizard = new RegexWizard(initialValue);
+
+          WizardDialog wizardDialog = new WizardDialog(shell, wizard);
+          wizardDialog.setBlockOnOpen(true);
+          wizardDialog.create();
+
+          int result = wizardDialog.open();
+
+          if (result == Window.OK)
+          {
+            String newPattern = wizard.getPattern();
+            element.setAttribute(XSDConstants.VALUE_ATTRIBUTE, newPattern);
+            pattern.setLexicalValue(newPattern);
+            constraintsTableViewer.refresh();
+          }
+        }
+      }
+    }
+    else if (e.widget == constraintsTableViewer.getTable())
+    {
+      StructuredSelection selection = (StructuredSelection) constraintsTableViewer.getSelection();
+      if (selection.getFirstElement() != null)
+      {
+        editButton.setEnabled(true);
+        deleteButton.setEnabled(true);
+      }
+      else
+      {
+        editButton.setEnabled(false);
+        deleteButton.setEnabled(false);
+      }
+    }
+  }
+  
+  public void widgetDefaultSelected(SelectionEvent e)
+  {
+
+  }
+
+  
+  public void setConstraintKind(int kind)
+  {
+    this.kind = kind;
+    constraintsTableViewer.setInput(input);
+    constraintsTableViewer.refresh();
+  }
+  
+  public void doModify(Object element, String property, Object value)
+  {
+    if (element instanceof TableItem && (value != null))
+    {
+      TableItem item = (TableItem) element;
+
+      if (item.getData() instanceof XSDPatternFacet)
+      {
+        XSDPatternFacet patternFacet = (XSDPatternFacet) item.getData();
+        patternFacet.setLexicalValue((String) value);
+
+        item.setData(patternFacet);
+        item.setText((String) value);
+      }
+      else if (item.getData() instanceof XSDEnumerationFacet)
+      {
+        XSDEnumerationFacet enumFacet = (XSDEnumerationFacet) item.getData();
+        SetXSDFacetValueCommand command = new SetXSDFacetValueCommand("Set Enumeration Value", enumFacet);
+        command.setValue((String) value);
+        commandStack.execute(command);
+        item.setData(enumFacet);
+        item.setText((String) value);
+      }
+    }
+  }
+  
+  public Object doGetValue(Object element, String property)
+  {
+    if (element instanceof XSDPatternFacet)
+    {
+      XSDPatternFacet patternFacet = (XSDPatternFacet) element;
+      String value = patternFacet.getLexicalValue();
+      if (value == null)
+        value = ""; //$NON-NLS-1$
+      return value;
+    }
+    else if (element instanceof XSDEnumerationFacet)
+    {
+      XSDEnumerationFacet enumFacet = (XSDEnumerationFacet) element;
+      String value = enumFacet.getLexicalValue();
+      if (value == null)
+        value = ""; //$NON-NLS-1$
+      return value;
+    }
+
+    return ""; //$NON-NLS-1$
+  }
+  
+  class ConstraintsTableViewer extends NavigableTableViewer implements ICellModifier
+  {
+    protected String[] columnProperties = { "Pattern" };
+
+    protected CellEditor[] cellEditors;
+
+    Table table;
+
+    public ConstraintsTableViewer(Table table)
+    {
+      super(table);
+      table = getTable();
+
+      table.setLinesVisible(true);
+
+      setContentProvider(new ConstraintsContentProvider());
+      setLabelProvider(new ConstraintsTableLabelProvider());
+      setColumnProperties(columnProperties);
+
+      setCellModifier(this);
+
+      TableColumn column = new TableColumn(table, SWT.NONE, 0);
+      column.setText(columnProperties[0]);
+      column.setAlignment(SWT.LEFT);
+      column.setResizable(true);
+
+      cellEditors = new CellEditor[1];
+
+      TableLayout layout = new TableLayout();
+      ColumnWeightData data = new ColumnWeightData(100);
+
+      layout.addColumnData(data);
+      cellEditors[0] = new TextCellEditor(table);
+
+      getTable().setLayout(layout);
+      setCellEditors(cellEditors);
+    }
+    
+    public boolean canModify(Object element, String property)
+    {
+      return true;
+    }
+
+    public void modify(Object element, String property, Object value)
+    {
+      doModify(element, property, value);
+    }
+
+    public Object getValue(Object element, String property)
+    {
+      return doGetValue(element, property);
+    }
+
+  }
+
+  class ConstraintsContentProvider implements IStructuredContentProvider
+  {
+    public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
+    {
+    }
+
+    public java.lang.Object[] getElements(java.lang.Object inputElement)
+    {
+      java.util.List list = new ArrayList();
+      if (inputElement instanceof XSDSimpleTypeDefinition)
+      {
+        XSDSimpleTypeDefinition st = (XSDSimpleTypeDefinition) inputElement;
+        if (kind == PATTERN)
+        {
+          return st.getPatternFacets().toArray();
+        }
+        else
+        {
+          return st.getEnumerationFacets().toArray();
+        }
+      }
+      return list.toArray();
+    }
+
+    public void dispose()
+    {
+    }
+  }
+
+  class ConstraintsTableLabelProvider extends LabelProvider implements ITableLabelProvider
+  {
+    public ConstraintsTableLabelProvider()
+    {
+
+    }
+
+    public Image getColumnImage(Object element, int columnIndex)
+    {
+      if (kind == PATTERN)
+      {
+        return XSDEditorPlugin.getXSDImage("icons/XSDSimplePattern.gif"); //$NON-NLS-1$
+      }
+      else
+      {
+        return XSDEditorPlugin.getXSDImage("icons/XSDSimpleEnum.gif");
+      }
+    }
+
+    public String getColumnText(Object element, int columnIndex)
+    {
+      if (element instanceof XSDPatternFacet)
+      {
+        XSDPatternFacet pattern = (XSDPatternFacet) element;
+        String value = pattern.getLexicalValue();
+        if (value == null)
+          value = ""; //$NON-NLS-1$
+        return value;
+      }
+      else if (element instanceof XSDEnumerationFacet)
+      {
+        XSDEnumerationFacet enumFacet = (XSDEnumerationFacet) element;
+        String value = enumFacet.getLexicalValue();
+        if (value == null)
+          value = "";
+        return value;
+      }
+      return ""; //$NON-NLS-1$
+    }
+  }
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/XSDActionManager.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/XSDActionManager.java
new file mode 100644
index 0000000..04f0a5e
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/XSDActionManager.java
@@ -0,0 +1,148 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.properties.sections;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CommandStack;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
+import org.eclipse.wst.xml.core.internal.contentmodel.CMAttributeDeclaration;
+import org.eclipse.wst.xml.core.internal.contentmodel.CMDataType;
+import org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.xml.ui.internal.XMLUIMessages;
+import org.eclipse.wst.xml.ui.internal.actions.EditAttributeAction;
+import org.eclipse.wst.xml.ui.internal.contentoutline.XMLNodeActionManager;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+public class XSDActionManager extends XMLNodeActionManager {
+
+  private CommandStack commandStack;
+  
+	public XSDActionManager(IStructuredModel model, Viewer viewer) {
+		super(model, viewer);
+	}
+  
+  public void setCommandStack(CommandStack commandStack) {
+    this.commandStack = commandStack;
+  }
+
+  protected Action createAddCDataSectionAction(Node parent, int index)
+  {
+    return null;
+  }
+  
+  protected Action createAddPCDataAction(Node parent, CMDataType dataType, int index) {
+    return null;
+  }
+  
+  
+	protected void contributeAddDocumentChildActions(IMenuManager menu, Document document, int ic, int vc) {
+	}
+  
+	protected void contributeEditGrammarInformationActions(IMenuManager menu, Node node) {
+	}
+	
+	protected void contributePIAndCommentActions(IMenuManager menu, Document document, int index) {
+	}
+	
+	protected void contributePIAndCommentActions(IMenuManager menu, Element parentElement, CMElementDeclaration parentEd, int index) {
+	}
+	
+	protected void contributeTextNodeActions(IMenuManager menu, Element parentElement, CMElementDeclaration parentEd, int index) {
+		super.contributeTextNodeActions(menu, parentElement, parentEd, index);
+	}
+  
+  protected Action createAddAttributeAction(Element parent, CMAttributeDeclaration ad) {
+    Action action = null;
+    if (ad == null) {
+      action = new EditAttributeAction(this, parent, null, XMLUIMessages._UI_MENU_NEW_ATTRIBUTE, XMLUIMessages._UI_MENU_NEW_ATTRIBUTE_TITLE); //$NON-NLS-1$ //$NON-NLS-2$
+    } else {
+      action = new AddNodeAction(ad, parent, -1);
+    }
+    
+    WrapperCommand command = new WrapperCommand(action, parent, ad);
+    WrapperAction wrapperAction = new WrapperAction(command);
+    return wrapperAction;
+  }
+  
+  class WrapperAction extends Action
+  {
+    WrapperCommand command;
+    
+    public WrapperAction(WrapperCommand command)
+    {
+      super();
+      this.command = command;
+    }
+    
+    public String getText()
+    {
+      return command.getAction().getText();
+    }
+
+    public void run()
+    {
+      // Some editors may not use a command stack
+      if (commandStack != null)
+      {
+        commandStack.execute(command);
+      }
+      else
+      {
+        command.execute();
+      }
+    }
+  }
+
+  class WrapperCommand extends Command
+  {
+    Action action;
+    Element parent;
+    CMAttributeDeclaration ad;
+    public WrapperCommand(Action action, Element parent, CMAttributeDeclaration ad)
+    {
+      super();
+      this.action = action;
+      this.parent = parent;
+      this.ad = ad;
+    }
+    
+    public String getLabel()
+    {
+      return action.getText();
+    }
+    
+    public Action getAction()
+    {
+      return action;
+    }
+    
+    public void execute()
+    {
+      action.run();
+    }
+    
+    public void undo() {
+      
+//      ((Element)parent).removeAttribute(ad.getAttrName());
+
+      getModel().getUndoManager().undo();
+
+    } 
+        
+
+  }
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/XSDAttributeDeclarationSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/XSDAttributeDeclarationSection.java
new file mode 100644
index 0000000..b3438f2
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/XSDAttributeDeclarationSection.java
@@ -0,0 +1,247 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.properties.sections;
+
+import org.apache.xerces.util.XMLChar;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.wst.xsd.editor.Messages;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+import org.eclipse.wst.xsd.ui.common.commands.UpdateNameCommand;
+import org.eclipse.xsd.XSDAttributeDeclaration;
+import org.eclipse.xsd.XSDTypeDefinition;
+import org.eclipse.xsd.util.XSDConstants;
+import org.w3c.dom.Element;
+
+public class XSDAttributeDeclarationSection extends AbstractSection
+{
+  protected Text nameText;
+  protected Text typeCombo;
+  protected Button button;
+  boolean isAttributeReference;
+  
+  public XSDAttributeDeclarationSection()
+  {
+    super();
+  }
+
+  protected void createContents(Composite parent)
+  {
+    composite = getWidgetFactory().createFlatFormComposite(parent);
+
+    String typeLabel = Messages.UI_LABEL_TYPE; //$NON-NLS-1$
+
+    GridLayout gridLayout = new GridLayout();
+    gridLayout.numColumns = 3;
+    composite.setLayout(gridLayout);
+
+    // ------------------------------------------------------------------
+    // NameLabel
+    // ------------------------------------------------------------------
+    GridData data = new GridData();
+    data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
+    data.grabExcessHorizontalSpace = false;
+    CLabel nameLabel = getWidgetFactory().createCLabel(composite, "Name:"); //$NON-NLS-1$
+    nameLabel.setLayoutData(data);
+
+    // ------------------------------------------------------------------
+    // NameText
+    // ------------------------------------------------------------------
+    data = new GridData();
+    data.grabExcessHorizontalSpace = true;
+    data.horizontalAlignment = GridData.FILL;
+    nameText = getWidgetFactory().createText(composite, ""); //$NON-NLS-1$
+    nameText.setLayoutData(data);
+    applyAllListeners(nameText);
+
+    // ------------------------------------------------------------------
+    // DummyLabel
+    // ------------------------------------------------------------------
+    data = new GridData();
+    data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
+    data.grabExcessHorizontalSpace = false;
+    getWidgetFactory().createCLabel(composite, ""); //$NON-NLS-1$
+
+    // ------------------------------------------------------------------
+    // typeLabel
+    // ------------------------------------------------------------------
+    getWidgetFactory().createCLabel(composite, typeLabel); //$NON-NLS-1$
+
+    // ------------------------------------------------------------------
+    // typeCombo
+    // ------------------------------------------------------------------
+    data = new GridData();
+    data.grabExcessHorizontalSpace = true;
+    data.horizontalAlignment = GridData.FILL;
+
+    typeCombo = getWidgetFactory().createText(composite, ""); //$NON-NLS-1$
+    typeCombo.setEditable(false);
+    // baseTypeCombo.addListener(SWT.Modify, this);
+    typeCombo.setLayoutData(data);
+
+    // ------------------------------------------------------------------
+    // BaseTypeButton
+    // ------------------------------------------------------------------
+    data = new GridData();
+    data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
+    data.grabExcessHorizontalSpace = false;
+
+    button = getWidgetFactory().createButton(composite, "", SWT.PUSH);
+    button.setImage(XSDEditorPlugin.getXSDImage("icons/browsebutton.gif"));
+    button.addSelectionListener(this);
+    button.setLayoutData(data);
+  }
+
+  /*
+   * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh()
+   */
+  public void refresh()
+  {
+    super.refresh();
+
+    setListenerEnabled(false);
+
+    // refresh name
+
+    nameText.setText("");
+    if (input instanceof XSDAttributeDeclaration)
+    {
+      XSDAttributeDeclaration namedComponent = ((XSDAttributeDeclaration) input).getResolvedAttributeDeclaration();
+
+      String name = namedComponent.getName();
+      if (name != null)
+      {
+        nameText.setText(name);
+      }
+    }
+
+    // refresh type
+
+    typeCombo.setText(""); //$NON-NLS-1$
+    if (input != null)
+    {
+      Element element = null;
+      if (input instanceof XSDAttributeDeclaration)
+      {
+        XSDAttributeDeclaration xsdAttribute = ((XSDAttributeDeclaration) input).getResolvedAttributeDeclaration();
+        isAttributeReference = ((XSDAttributeDeclaration)input).isAttributeDeclarationReference();
+        element = xsdAttribute.getElement();
+        XSDTypeDefinition typeDef = xsdAttribute.getTypeDefinition();
+        boolean isAnonymous = xsdAttribute.getAnonymousTypeDefinition() != null;
+
+        if (isAnonymous)
+        {
+          typeCombo.setText("**anonymous**"); //$NON-NLS-1$
+        }
+        else
+        {
+          String typeName = ""; //$NON-NLS-1$
+          if (typeDef != null)
+          {
+            typeName = typeDef.getQName(xsdSchema);
+            if (typeName == null)
+            {
+              typeName = ""; //$NON-NLS-1$
+            }
+            typeCombo.setText(typeName);
+          }
+          else
+          {
+            typeCombo.setText(Messages.UI_NO_TYPE); //$NON-NLS-1$
+          }
+        }
+      }
+    }
+
+    setListenerEnabled(true);
+  }
+
+  public boolean shouldUseExtraSpace()
+  {
+    return false;
+  }
+
+  protected void doHandleEvent(Event event)
+  {
+    super.doHandleEvent(event);
+    if (event.widget == nameText)
+    {
+      if (!nameText.getEditable())
+        return;
+
+      String newValue = nameText.getText().trim();
+      if (input instanceof XSDAttributeDeclaration)
+      {
+        XSDAttributeDeclaration namedComponent = ((XSDAttributeDeclaration) input).getResolvedAttributeDeclaration();
+
+        if (!validateSection())
+          return;
+
+        Command command = null;
+
+        // Make sure an actual name change has taken place
+        String oldName = namedComponent.getName();
+        if (!newValue.equals(oldName))
+        {
+          command = new UpdateNameCommand("Rename", namedComponent, newValue);
+        }
+
+        if (command != null && getCommandStack() != null)
+        {
+          getCommandStack().execute(command);
+        }
+        
+        if (isAttributeReference)
+        {
+          XSDAttributeDeclaration attrRef = (XSDAttributeDeclaration)input;
+          String qname = attrRef.getResolvedAttributeDeclaration().getQName();
+          attrRef.getElement().setAttribute(XSDConstants.REF_ATTRIBUTE, qname);
+          
+//          TypesHelper helper = new TypesHelper(xsdSchema);
+//          List items = new ArrayList();
+//          items = helper.getGlobalElements();
+//          items.add(0, "");
+//          componentNameCombo.setItems((String [])items.toArray(new String[0]));
+//
+//          refreshRefCombo();
+        }
+
+      }
+    }
+  }
+  
+  protected boolean validateSection()
+  {
+    if (nameText == null || nameText.isDisposed())
+      return true;
+
+    setErrorMessage(null);
+
+    String name = nameText.getText().trim();
+
+    // validate against NCName
+    if (name.length() < 1 || !XMLChar.isValidNCName(name))
+    {
+      setErrorMessage("Error Invalid Name");
+      return false;
+    }
+
+    return true;
+  }
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/XSDAttributeGroupDefinitionSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/XSDAttributeGroupDefinitionSection.java
new file mode 100644
index 0000000..cee4335
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/XSDAttributeGroupDefinitionSection.java
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.properties.sections;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CCombo;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.xsd.XSDNamedComponent;
+import org.eclipse.xsd.util.XSDConstants;
+import org.w3c.dom.Element;
+
+public class XSDAttributeGroupDefinitionSection extends AbstractSection
+{
+  protected CCombo refCombo;
+
+  public XSDAttributeGroupDefinitionSection()
+  {
+    super();
+  }
+
+  protected void createContents(Composite parent)
+  {
+    composite = getWidgetFactory().createFlatFormComposite(parent);
+
+    GridLayout gridLayout = new GridLayout();
+    gridLayout.numColumns = 2;
+    composite.setLayout(gridLayout);
+
+    // ------------------------------------------------------------------
+    // Ref Label
+    // ------------------------------------------------------------------
+    GridData data = new GridData();
+    data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
+    data.grabExcessHorizontalSpace = false;
+    CLabel refLabel = getWidgetFactory().createCLabel(composite, XSDConstants.REF_ATTRIBUTE + ":");  //$NON-NLS-1$
+    refLabel.setLayoutData(data);
+
+    // ------------------------------------------------------------------
+    // Ref Combo
+    // ------------------------------------------------------------------
+
+    data = new GridData();
+    data.grabExcessHorizontalSpace = true;
+    data.horizontalAlignment = GridData.FILL;
+
+    refCombo = getWidgetFactory().createCCombo(composite, SWT.FLAT);
+    refCombo.addSelectionListener(this);
+    refCombo.setLayoutData(data);
+  }
+
+  public void refresh()
+  {
+    super.refresh();
+
+    if (isReadOnly)
+    {
+      composite.setEnabled(false);
+    }
+    else
+    {
+      composite.setEnabled(true);
+    }
+
+    setListenerEnabled(false);
+
+    if (input instanceof XSDNamedComponent)
+    {
+      XSDNamedComponent namedComponent = (XSDNamedComponent)input;
+      Element element = namedComponent.getElement();
+      if (element != null)
+      {
+        String attrValue = element.getAttribute(XSDConstants.REF_ATTRIBUTE);
+        if (attrValue == null)
+        {
+          attrValue = "";
+        }
+        refCombo.setText(attrValue);
+      }
+    }
+
+    setListenerEnabled(true);
+  }
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/XSDComplexTypeSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/XSDComplexTypeSection.java
new file mode 100644
index 0000000..326419d
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/XSDComplexTypeSection.java
@@ -0,0 +1,365 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.properties.sections;
+
+import org.apache.xerces.util.XMLChar;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CCombo;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.wst.xsd.editor.Messages;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+import org.eclipse.wst.xsd.ui.common.commands.UpdateNameCommand;
+import org.eclipse.xsd.XSDComplexTypeDefinition;
+import org.eclipse.xsd.XSDDerivationMethod;
+import org.eclipse.xsd.XSDNamedComponent;
+import org.eclipse.xsd.XSDSchema;
+import org.eclipse.xsd.XSDTypeDefinition;
+import org.eclipse.xsd.util.XSDConstants;
+import org.w3c.dom.Element;
+
+public class XSDComplexTypeSection extends AbstractSection implements SelectionListener
+{
+  protected Text nameText;
+  protected Text baseTypeCombo;
+  protected CCombo derivedByCombo;
+  protected Button button;
+  private String derivedByChoicesComboValues[] = { "", XSDConstants.RESTRICTION_ELEMENT_TAG, XSDConstants.EXTENSION_ELEMENT_TAG };
+
+  public XSDComplexTypeSection()
+  {
+    super();
+  }
+
+  /**
+   * Contents of the property tab
+   * 
+   * NameLabel NameText DummyLabel BaseTypeLabel BaseTypeCombo BaseTypeButton
+   * DerivedByLabel DerivedByCombo
+   */
+  public void createContents(Composite parent)
+  {
+    composite = getWidgetFactory().createFlatFormComposite(parent);
+
+    GridLayout gridLayout = new GridLayout();
+    gridLayout.numColumns = 3;
+    composite.setLayout(gridLayout);
+
+    // ------------------------------------------------------------------
+    // NameLabel
+    // ------------------------------------------------------------------
+    GridData data = new GridData();
+    data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
+    data.grabExcessHorizontalSpace = false;
+    CLabel nameLabel = getWidgetFactory().createCLabel(composite, "Name:"); //$NON-NLS-1$
+    nameLabel.setLayoutData(data);
+
+    // ------------------------------------------------------------------
+    // NameText
+    // ------------------------------------------------------------------
+    data = new GridData();
+    data.grabExcessHorizontalSpace = true;
+    data.horizontalAlignment = GridData.FILL;
+    nameText = getWidgetFactory().createText(composite, ""); //$NON-NLS-1$
+    nameText.setLayoutData(data);
+    applyAllListeners(nameText);
+
+    // ------------------------------------------------------------------
+    // DummyLabel
+    // ------------------------------------------------------------------
+    data = new GridData();
+    data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
+    data.grabExcessHorizontalSpace = false;
+    getWidgetFactory().createCLabel(composite, ""); //$NON-NLS-1$
+
+    // ------------------------------------------------------------------
+    // BaseTypeLabel
+    // ------------------------------------------------------------------
+
+    getWidgetFactory().createCLabel(composite, Messages.UI_LABEL_INHERIT_FROM); //$NON-NLS-1$
+
+    // ------------------------------------------------------------------
+    // BaseTypeCombo
+    // ------------------------------------------------------------------
+    data = new GridData();
+    data.grabExcessHorizontalSpace = true;
+    data.horizontalAlignment = GridData.FILL;
+
+    baseTypeCombo = getWidgetFactory().createText(composite, ""); //$NON-NLS-1$
+    baseTypeCombo.setEditable(false);
+    // baseTypeCombo.addListener(SWT.Modify, this);
+    baseTypeCombo.setLayoutData(data);
+
+    // ------------------------------------------------------------------
+    // BaseTypeButton
+    // ------------------------------------------------------------------
+    data = new GridData();
+    data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
+    data.grabExcessHorizontalSpace = false;
+
+    button = getWidgetFactory().createButton(composite, "", SWT.PUSH);
+    button.setImage(XSDEditorPlugin.getXSDImage("icons/browsebutton.gif"));
+    button.addSelectionListener(this);
+    button.setLayoutData(data);
+
+    // ------------------------------------------------------------------
+    // DerivedByLabel
+    // ------------------------------------------------------------------
+    data = new GridData();
+    data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
+    data.grabExcessHorizontalSpace = false;
+
+    CLabel derivedByLabel = getWidgetFactory().createCLabel(composite, Messages.UI_LABEL_INHERIT_BY); //$NON-NLS-1$
+    derivedByLabel.setLayoutData(data);
+
+    // ------------------------------------------------------------------
+    // DerivedByCombo
+    // ------------------------------------------------------------------
+    data = new GridData();
+    data.grabExcessHorizontalSpace = true;
+    data.horizontalAlignment = GridData.FILL;
+
+    derivedByCombo = getWidgetFactory().createCCombo(composite, SWT.FLAT);
+    derivedByCombo.setLayoutData(data);
+    derivedByCombo.setItems(derivedByChoicesComboValues);
+    // derivedByCombo.addSelectionListener(this);
+
+  }
+
+  /*
+   * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh()
+   */
+  public void refresh()
+  {
+    super.refresh();
+    if (Display.getCurrent() == null)
+      return;
+
+    setListenerEnabled(false);
+
+    try
+    {
+      nameText.setText("");
+      baseTypeCombo.setText(""); //$NON-NLS-1$
+
+      if (input instanceof XSDComplexTypeDefinition)
+      {
+        XSDComplexTypeDefinition complexType = (XSDComplexTypeDefinition) input;
+        String name = complexType.getName();
+        if (name == null)
+          name = "";
+
+        boolean isAnonymousType = name.equals("") ? true : false;
+        if (isAnonymousType)
+        {
+          nameText.setText("**anonymous**"); //$NON-NLS-1$
+          nameText.setEditable(false);
+        }
+        else
+        {
+          nameText.setText(name);
+          nameText.setEditable(true);
+        }
+
+        XSDTypeDefinition baseTypeDefinition = complexType.getBaseTypeDefinition();
+        String baseType = ""; //$NON-NLS-1$
+        if (baseTypeDefinition != null)
+        {
+          baseType = baseTypeDefinition.getName();
+          if (baseType == null)
+          {
+            baseType = "";
+          }
+        }
+        baseTypeCombo.setText(baseType);
+
+        derivedByCombo.setText(""); //$NON-NLS-1$
+        int derivationMethod = complexType.getDerivationMethod().getValue();
+        if (derivationMethod == XSDDerivationMethod.EXTENSION)
+        {
+          derivedByCombo.setText(XSDConstants.EXTENSION_ELEMENT_TAG);
+        }
+        else if (derivationMethod == XSDDerivationMethod.RESTRICTION)
+        {
+          derivedByCombo.setText(XSDConstants.RESTRICTION_ELEMENT_TAG);
+        }
+      }
+
+    }
+    finally
+    {
+      setListenerEnabled(true);
+    }
+  }
+
+  /**
+   * @see org.eclipse.swt.events.SelectionListener#widgetSelected(SelectionEvent)
+   */
+  public void widgetSelected(SelectionEvent e)
+  {
+    XSDComplexTypeDefinition xsdComplexType = (XSDComplexTypeDefinition) input;
+    Element ctElement = xsdComplexType.getElement();
+    if (e.widget == button)
+    {
+      Shell shell = Display.getCurrent().getActiveShell();
+      Element element = null;
+      if (xsdComplexType.getContent() != null)
+      {
+        element = xsdComplexType.getContent().getElement();
+      }
+
+      // SimpleContentBaseTypeOptionsDialog dialog = new
+      // SimpleContentBaseTypeOptionsDialog(shell, element, BASE_TYPE_ID,
+      // xsdComplexType.getSchema());
+      // dialog.setBlockOnOpen(true);
+      // dialog.create();
+      // int result = dialog.open();
+
+      IFile currentIFile = ((IFileEditorInput) getActiveEditor().getEditorInput()).getFile();
+
+      XSDSchema schema = xsdComplexType.getSchema();
+      
+      // issuec (cs) need to move the common.ui's selection dialog
+      /*
+      XSDComponentSelectionProvider provider = new XSDComponentSelectionProvider(currentIFile, schema);
+      XSDComponentSelectionDialog dialog = new XSDComponentSelectionDialog(shell, Messages.UI_LABEL_SET_TYPE, provider);
+      provider.setDialog(dialog);
+      dialog.setBlockOnOpen(true);
+      dialog.create();
+      int result = dialog.open();
+
+      if (result == Window.OK)
+      {
+        XMLComponentSpecification spec = dialog.getSelection();
+        XSDSetTypeHelper helper = new XSDSetTypeHelper(currentIFile, schema);
+        helper.addImportIfNecessary(element, spec);
+
+        String typeString = helper.getPrefixedTypeName(spec);
+
+        String derivedBy = "";
+        int derivationMethod = xsdComplexType.getDerivationMethod().getValue();
+        if (derivationMethod == XSDDerivationMethod.EXTENSION)
+        {
+          derivedBy = XSDConstants.EXTENSION_ELEMENT_TAG;
+        }
+        else if (derivationMethod == XSDDerivationMethod.RESTRICTION)
+        {
+          derivedBy = XSDConstants.RESTRICTION_ELEMENT_TAG;
+        }
+
+        SetBaseTypeAction setBaseTypeAction = new SetBaseTypeAction("_UI_LABEL_SET_BASE_TYPE"); //$NON-NLS-1$
+        setBaseTypeAction.setXSDSchema(xsdSchema);
+        setBaseTypeAction.setComplexTypeElement(ctElement);
+        setBaseTypeAction.setType(typeString);
+        setBaseTypeAction.setDerivedBy(derivedBy);
+        setBaseTypeAction.performAction();
+
+      }
+      refresh();
+      // }
+      // else if (e.widget == derivedByCombo)
+      // {
+      // Element contentModelElement =
+      // getDomHelper().getContentModelFromParent(ctElement);
+      // String baseType = getDomHelper().getBaseType(contentModelElement);
+      // beginRecording(XSDEditorPlugin.getXSDString("_UI_DERIVEDBY_CHANGE"),
+      // ctElement); //$NON-NLS-1$
+      // if (contentModelElement != null)
+      // {
+      // getDomHelper().changeDerivedByType(contentModelElement,
+      // derivedByCombo.getText(), baseType);
+      // }
+      // endRecording(ctElement);       
+       */
+    }
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISection#shouldUseExtraSpace()
+   */
+  public boolean shouldUseExtraSpace()
+  {
+    return false;
+  }
+
+  public void dispose()
+  {
+    super.dispose();
+  }
+
+  public void doHandleEvent(Event event)
+  {
+    super.doHandleEvent(event);
+    if (event.widget == nameText)
+    {
+      if (!nameText.getEditable())
+        return;
+
+      String newValue = nameText.getText().trim();
+      if (input instanceof XSDNamedComponent)
+      {
+        XSDNamedComponent namedComponent = (XSDNamedComponent) input;
+
+        if (!validateSection())
+          return;
+
+        Command command = null;
+
+        // Make sure an actual name change has taken place
+        String oldName = namedComponent.getName();
+        if (!newValue.equals(oldName))
+        {
+          command = new UpdateNameCommand("Rename", namedComponent, newValue);
+        }
+
+        if (command != null && getCommandStack() != null)
+        {
+          getCommandStack().execute(command);
+        }
+        // doReferentialIntegrityCheck(namedComponent, newValue);
+      }
+    }
+  }
+
+  protected boolean validateSection()
+  {
+    if (nameText == null || nameText.isDisposed())
+      return true;
+
+    setErrorMessage(null);
+
+    String name = nameText.getText().trim();
+
+    // validate against NCName
+    if (name.length() < 1 || !XMLChar.isValidNCName(name))
+    {
+      setErrorMessage("Error Invalid Name");
+      return false;
+    }
+
+    return true;
+  }
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/XSDElementDeclarationSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/XSDElementDeclarationSection.java
new file mode 100644
index 0000000..17bc839
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/XSDElementDeclarationSection.java
@@ -0,0 +1,581 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.properties.sections;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.xerces.util.XMLChar;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CCombo;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
+import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSearchListDialog;
+import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSearchListDialogConfiguration;
+import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification;
+import org.eclipse.wst.common.ui.internal.search.dialogs.ScopedComponentSearchListDialog;
+import org.eclipse.wst.xsd.editor.Messages;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+import org.eclipse.wst.xsd.editor.internal.dialogs.NewTypeButtonHandler;
+import org.eclipse.wst.xsd.editor.internal.search.XSDComponentDescriptionProvider;
+import org.eclipse.wst.xsd.editor.internal.search.XSDTypesSearchListProvider;
+import org.eclipse.wst.xsd.ui.common.commands.UpdateMaxOccursCommand;
+import org.eclipse.wst.xsd.ui.common.commands.UpdateMinOccursCommand;
+import org.eclipse.wst.xsd.ui.common.commands.UpdateNameCommand;
+import org.eclipse.wst.xsd.ui.common.commands.UpdateTypeReferenceCommand;
+import org.eclipse.wst.xsd.ui.internal.util.TypesHelper;
+import org.eclipse.xsd.XSDAttributeDeclaration;
+import org.eclipse.xsd.XSDElementDeclaration;
+import org.eclipse.xsd.XSDParticle;
+import org.eclipse.xsd.XSDSchema;
+import org.eclipse.xsd.XSDTypeDefinition;
+import org.eclipse.xsd.util.XSDConstants;
+import org.w3c.dom.Element;
+
+public class XSDElementDeclarationSection extends MultiplicitySection
+{
+  protected Text nameText;
+  protected Text typeCombo;
+  protected Button typesBrowseButton;
+  protected CCombo componentNameCombo;
+  boolean isElementReference;
+
+  private XSDTypeDefinition typeDefinition;
+
+  public XSDElementDeclarationSection()
+  {
+    super();
+  }
+
+  /**
+   * Contents of the property tab
+   */
+  public void createContents(Composite parent)
+  {
+    composite = getWidgetFactory().createFlatFormComposite(parent);
+    TabbedPropertySheetWidgetFactory factory = getWidgetFactory();
+
+    String typeLabel = Messages.UI_LABEL_TYPE; //$NON-NLS-1$
+
+    GridData data = new GridData();
+
+    GridLayout gridLayout = new GridLayout();
+    gridLayout.marginTop = 0;
+    gridLayout.marginBottom = 0;
+    gridLayout.numColumns = 3;
+    composite.setLayout(gridLayout);
+    
+      // ------------------------------------------------------------------
+      // NameLabel
+      // ------------------------------------------------------------------
+
+      data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
+      data.grabExcessHorizontalSpace = false;
+      CLabel nameLabel = factory.createCLabel(composite, "Name:");
+      nameLabel.setLayoutData(data);
+
+      // ------------------------------------------------------------------
+      // NameText
+      // ------------------------------------------------------------------
+      data = new GridData();
+      data.grabExcessHorizontalSpace = true;
+      data.horizontalAlignment = GridData.FILL;
+      nameText = getWidgetFactory().createText(composite, ""); //$NON-NLS-1$
+      nameText.setLayoutData(data);
+      applyAllListeners(nameText);   
+     
+      // ------------------------------------------------------------------
+      // DummyLabel
+      // ------------------------------------------------------------------
+      data = new GridData();
+      data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
+      data.grabExcessHorizontalSpace = false;
+      getWidgetFactory().createCLabel(composite, ""); //$NON-NLS-1$
+
+    // ------------------------------------------------------------------
+    // Ref Label
+    // ------------------------------------------------------------------
+    if (isElementReference)
+    {
+      data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
+      data.grabExcessHorizontalSpace = false;
+      CLabel refLabel = getWidgetFactory().createCLabel(composite, "Reference:");
+      refLabel.setLayoutData(data);
+
+      // ------------------------------------------------------------------
+      // Ref Combo
+      // ------------------------------------------------------------------
+
+      data = new GridData();
+      data.grabExcessHorizontalSpace = true;
+      data.horizontalAlignment = GridData.FILL;
+
+      componentNameCombo = getWidgetFactory().createCCombo(composite, SWT.FLAT);
+      componentNameCombo.addSelectionListener(this);
+      componentNameCombo.setLayoutData(data);
+
+      data = new GridData();
+      data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
+      data.grabExcessHorizontalSpace = false;
+
+      getWidgetFactory().createCLabel(composite, ""); //$NON-NLS-1$
+    }
+
+    // ------------------------------------------------------------------
+    // typeLabel
+    // ------------------------------------------------------------------
+    getWidgetFactory().createCLabel(composite, typeLabel);
+
+    // ------------------------------------------------------------------
+    // typeCombo
+    // ------------------------------------------------------------------
+    data = new GridData();
+    data.grabExcessHorizontalSpace = true;
+    data.horizontalAlignment = GridData.FILL;
+
+    typeCombo = getWidgetFactory().createText(composite, ""); //$NON-NLS-1$
+    typeCombo.setEditable(false);
+    typeCombo.setLayoutData(data);
+
+    // ------------------------------------------------------------------
+    // BaseTypeButton
+    // ------------------------------------------------------------------
+    data = new GridData();
+    data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
+    data.grabExcessHorizontalSpace = false;
+
+    typesBrowseButton = getWidgetFactory().createButton(composite, "", SWT.PUSH);
+    typesBrowseButton.setImage(XSDEditorPlugin.getXSDImage("icons/browsebutton.gif"));
+    typesBrowseButton.addSelectionListener(this);
+    typesBrowseButton.setLayoutData(data);
+
+    // ------------------------------------------------------------------
+    // min/max button modifiers
+    // ------------------------------------------------------------------
+
+    data = new GridData();
+    data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
+    data.grabExcessHorizontalSpace = false;
+
+    getWidgetFactory().createCLabel(composite, ""); //$NON-NLS-1$
+
+    Composite modifierComposite = getWidgetFactory().createComposite(composite, SWT.FLAT);
+    GridLayout gridLayout2 = new GridLayout();
+    gridLayout2.marginLeft = 0;
+    gridLayout2.marginRight = 0;
+    gridLayout2.marginTop = 0;
+    gridLayout2.marginBottom = 0;
+    gridLayout2.numColumns = 2;
+    modifierComposite.setLayout(gridLayout2);
+    modifierComposite.setLayoutData(data);
+    requiredButton = getWidgetFactory().createButton(modifierComposite, "Required", SWT.CHECK | SWT.FLAT); //$NON-NLS-1$
+    requiredButton.addSelectionListener(this);
+
+    listButton = getWidgetFactory().createButton(modifierComposite, "Array", SWT.CHECK | SWT.FLAT); //$NON-NLS-1$
+    listButton.addSelectionListener(this);
+
+    getWidgetFactory().createCLabel(composite, ""); //$NON-NLS-1$
+
+    // ------------------------------------------------------------------
+    // min property
+    // ------------------------------------------------------------------
+
+    getWidgetFactory().createCLabel(composite, Messages.UI_LABEL_MINOCCURS);
+
+    data = new GridData();
+    data.grabExcessHorizontalSpace = true;
+    data.horizontalAlignment = GridData.FILL;
+
+    minCombo = getWidgetFactory().createCCombo(composite, SWT.FLAT);
+    minCombo.setLayoutData(data);
+    minCombo.add("0"); //$NON-NLS-1$
+    minCombo.add("1"); //$NON-NLS-1$
+    applyModifyListeners(minCombo);
+    minCombo.addSelectionListener(this);
+
+    // ------------------------------------------------------------------
+    // DummyLabel
+    // ------------------------------------------------------------------
+    data = new GridData();
+    data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
+    data.grabExcessHorizontalSpace = false;
+    getWidgetFactory().createCLabel(composite, ""); //$NON-NLS-1$
+
+    // ------------------------------------------------------------------
+    // max property
+    // ------------------------------------------------------------------
+    getWidgetFactory().createCLabel(composite, Messages.UI_LABEL_MAXOCCURS);
+
+    data = new GridData();
+    data.grabExcessHorizontalSpace = true;
+    data.horizontalAlignment = GridData.FILL;
+
+    maxCombo = getWidgetFactory().createCCombo(composite, SWT.FLAT);
+    maxCombo.setLayoutData(data);
+    maxCombo.add("0"); //$NON-NLS-1$
+    maxCombo.add("1"); //$NON-NLS-1$
+    maxCombo.add("unbounded"); //$NON-NLS-1$
+    applyModifyListeners(maxCombo);
+    maxCombo.addSelectionListener(this);
+  }
+
+  public void setInput(IWorkbenchPart part, ISelection selection)
+  {
+    super.setInput(part, selection);
+    setListenerEnabled(false);
+    init();
+    relayout();
+    
+    if (isElementReference)
+    {
+      TypesHelper helper = new TypesHelper(xsdSchema);
+      List items = new ArrayList();
+      items = helper.getGlobalElements();
+      items.add(0, "");
+      componentNameCombo.setItems((String [])items.toArray(new String[0]));
+    }
+    setListenerEnabled(true);
+  }
+  
+  protected void init()
+  {
+    if (input instanceof XSDElementDeclaration)
+    {
+      XSDElementDeclaration xsdElementDeclaration = (XSDElementDeclaration) input;
+      isElementReference = xsdElementDeclaration.isElementDeclarationReference();
+
+      typeDefinition = xsdElementDeclaration.getResolvedElementDeclaration().getTypeDefinition();
+    }
+  }
+  
+  /*
+   * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh()
+   */
+  public void refresh()
+  {
+    super.refresh();
+
+    setListenerEnabled(false);
+
+    XSDElementDeclaration xsdElementDeclaration = ((XSDElementDeclaration) input).getResolvedElementDeclaration();
+
+      // refresh name
+      nameText.setText("");
+      typeCombo.setText(""); //$NON-NLS-1$
+      typesBrowseButton.setEnabled(true);
+//
+//      if (input instanceof XSDNamedComponent)
+//      {
+//        XSDNamedComponent namedComponent = (XSDNamedComponent) input;
+//
+        String name = xsdElementDeclaration.getName();
+        if (name != null)
+        {
+          nameText.setText(name);
+        }
+//      }
+    
+    if (isElementReference)
+    {
+      refreshRefCombo();
+    }
+
+    // refresh type
+    if (input != null)
+    {
+      Element element = null;
+      if (input instanceof XSDElementDeclaration)
+      {
+        element = xsdElementDeclaration.getElement();
+        boolean isAnonymous = xsdElementDeclaration.getAnonymousTypeDefinition() != null;
+        //XSDTypeDefinition typeDef = XSDUtils.getResolvedType(xsdElementDeclaration);
+        XSDTypeDefinition typeDef = xsdElementDeclaration.getResolvedElementDeclaration().getTypeDefinition();
+        XSDTypeDefinition typeValue = xsdElementDeclaration.getType();
+        boolean isPrimitive = false;
+        if (typeValue != null)
+        {
+          if (typeValue.getTargetNamespace() != null)
+          {
+            isPrimitive = typeValue.getTargetNamespace().equals(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001);
+          }
+        }
+        
+        String typeName = ""; //$NON-NLS-1$
+        if (typeDef != null)
+          typeName = typeDef.getQName(xsdSchema);
+
+        if (typeName == null)
+        {
+          typeName = ""; //$NON-NLS-1$
+        }
+
+        if (isAnonymous)
+        {
+          typeCombo.setText("**anonymous**"); //$NON-NLS-1$
+        }
+        else
+        {
+          if (typeDefinition != null)
+          {
+            typeCombo.setText(typeName);
+          }
+          else
+          {
+            typeCombo.setText(Messages.UI_NO_TYPE); //$NON-NLS-1$
+          }
+        }
+      }
+    }
+
+    // refresh min max
+    refreshMinMax();
+
+    setListenerEnabled(true);
+
+  }
+
+  public boolean shouldUseExtraSpace()
+  {
+    return false;
+  }
+
+  public void doWidgetSelected(SelectionEvent e)
+  {
+    if (e.widget == typesBrowseButton)
+    {
+      Shell shell = Display.getCurrent().getActiveShell();
+      IFile currentIFile = ((IFileEditorInput) getActiveEditor().getEditorInput()).getFile();
+
+      /** Initialize the Set types Dialog */
+      final XSDTypesSearchListProvider searchListProvider = 
+    	  new XSDTypesSearchListProvider(currentIFile, new XSDSchema[] {xsdSchema} );      
+      ComponentSearchListDialogConfiguration configuration = new ComponentSearchListDialogConfiguration();
+      configuration.setDescriptionProvider(new XSDComponentDescriptionProvider() );
+      configuration.setSearchListProvider(searchListProvider);      
+      configuration.setNewComponentHandler(new NewTypeButtonHandler());
+      ComponentSearchListDialog dialog = new ScopedComponentSearchListDialog(shell, XSDEditorPlugin.getXSDString("_UI_LABEL_SET_TYPE"), configuration);
+      //dialog.setFilterLabel("Text:");
+
+      if (input instanceof XSDAttributeDeclaration)
+      {
+        searchListProvider.showComplexTypes(false);
+      }
+
+      dialog.setBlockOnOpen(true);
+      dialog.create();
+
+      if (dialog.open() == Window.OK)
+      {
+        //String newType = (String) dialog.getSelection().getAttributeInfo("name");
+        //String nsType = (String) dialog.getSelection().getTargetNamespace();
+        
+        ComponentSpecification selection = dialog.getSelectedComponent();
+        String newType = selection.getName();
+        String namespace = selection.getQualifier();
+        
+        UpdateTypeReferenceCommand command = new UpdateTypeReferenceCommand((XSDElementDeclaration) input, xsdSchema.resolveTypeDefinition(namespace, newType));
+        getCommandStack().execute(command);
+
+        init();
+        relayout();
+      }
+    }
+    else if (e.widget == listButton)
+    {
+      int maxOccurs = (listButton.getSelection() ? XSDParticle.UNBOUNDED : 1);
+      if (input instanceof XSDElementDeclaration)
+      {
+        XSDParticle particle = (XSDParticle) ((XSDElementDeclaration) input).eContainer();
+        UpdateMaxOccursCommand command = new UpdateMaxOccursCommand("Update Maximum Occurence", particle, maxOccurs);
+        getCommandStack().execute(command);
+        if (maxOccurs == -1)
+          maxCombo.setText("*");
+        else
+          maxCombo.setText("");
+      }
+    }
+    else if (e.widget == requiredButton)
+    {
+      int minOccurs = requiredButton.getSelection() ? 1 : 0;
+      if (input instanceof XSDElementDeclaration)
+      {
+        XSDParticle particle = (XSDParticle) ((XSDElementDeclaration) input).eContainer();
+        UpdateMinOccursCommand command = new UpdateMinOccursCommand("Update Minimum Occurrence", particle, minOccurs);
+        getCommandStack().execute(command);
+      }
+      minCombo.setText("" + minOccurs);
+    }
+    else if (e.widget == componentNameCombo)
+    {
+      String newValue = componentNameCombo.getText();
+      if (input instanceof XSDElementDeclaration)
+      {
+        XSDElementDeclaration element = (XSDElementDeclaration)input;
+// TODO: We should set the ref using the model, and not the DOM.        
+        element.setResolvedElementDeclaration(element.resolveElementDeclaration(newValue));
+//        element.getElement().setAttribute(XSDConstants.REF_ATTRIBUTE, newValue);
+      }
+    }
+    else if (e.widget == maxCombo)
+    {
+      updateMaxAttribute();
+    }
+    else if (e.widget == minCombo)
+    {
+      updateMinAttribute();
+    }
+
+  }
+
+  protected void relayout()
+  {
+    Composite parentComposite = composite.getParent();
+    parentComposite.getParent().setRedraw(false);
+
+    if (parentComposite != null && !parentComposite.isDisposed())
+    {
+      Control[] children = parentComposite.getChildren();
+      for (int i = 0; i < children.length; i++)
+      {
+        children[i].dispose();
+      }
+    }
+
+    // Now initialize the new handler
+    createContents(parentComposite);
+    parentComposite.getParent().layout(true, true);
+
+    // Now turn painting back on
+    parentComposite.getParent().setRedraw(true);
+    refresh();
+  }
+
+  public void doHandleEvent(Event event)
+  {
+    super.doHandleEvent(event);
+    if (event.widget == nameText)
+    {
+      String newValue = nameText.getText().trim();
+      if (input instanceof XSDElementDeclaration)
+      {
+        XSDElementDeclaration namedComponent = ((XSDElementDeclaration) input).getResolvedElementDeclaration();
+        if (!validateSection())
+          return;
+
+        Command command = null;
+
+        // Make sure an actual name change has taken place
+        String oldName = namedComponent.getName();
+        if (!newValue.equals(oldName))
+        {
+          command = new UpdateNameCommand("Rename", namedComponent, newValue);
+        }
+
+        if (command != null && getCommandStack() != null)
+        {
+          getCommandStack().execute(command);
+        }
+        
+        if (isElementReference)
+        {
+          XSDElementDeclaration elementRef = (XSDElementDeclaration)input;
+          String qname = elementRef.getResolvedElementDeclaration().getQName();
+          elementRef.getElement().setAttribute(XSDConstants.REF_ATTRIBUTE, qname);
+          
+          TypesHelper helper = new TypesHelper(xsdSchema);
+          List items = new ArrayList();
+          items = helper.getGlobalElements();
+          items.add(0, "");
+          componentNameCombo.setItems((String [])items.toArray(new String[0]));
+
+          refreshRefCombo();
+        }
+
+        // doReferentialIntegrityCheck(namedComponent, newValue);
+      }
+    }
+    else if (event.widget == minCombo)
+    {
+      requiredButton.setSelection(isRequired);
+    }
+
+  }
+
+  protected boolean validateSection()
+  {
+    if (nameText == null || nameText.isDisposed())
+      return true;
+
+    setErrorMessage(null);
+
+    String name = nameText.getText().trim();
+
+    // validate against NCName
+    if (name.length() < 1 || !XMLChar.isValidNCName(name))
+    {
+      setErrorMessage("Invalid name");
+      return false;
+    }
+
+    return true;
+  }
+
+  public void dispose()
+  {
+    if (typesBrowseButton != null && !typesBrowseButton.isDisposed())
+      typesBrowseButton.removeSelectionListener(this);
+    if (componentNameCombo != null && !componentNameCombo.isDisposed())
+      componentNameCombo.removeSelectionListener(this);
+    if (minCombo != null && !minCombo.isDisposed())
+      minCombo.removeSelectionListener(this);
+    if (maxCombo != null && !maxCombo.isDisposed())
+      maxCombo.removeSelectionListener(this);
+    if (requiredButton != null && !requiredButton.isDisposed())
+      requiredButton.removeSelectionListener(this);
+    if (listButton != null && !listButton.isDisposed())
+      listButton.removeSelectionListener(this);
+    super.dispose();
+  }
+
+  protected void refreshRefCombo()
+  {
+    componentNameCombo.setText("");
+    typesBrowseButton.setEnabled(false);
+
+    XSDElementDeclaration namedComponent = (XSDElementDeclaration) input;
+    Element element = namedComponent.getElement();
+    if (element != null)
+    {
+      String attrValue = element.getAttribute(XSDConstants.REF_ATTRIBUTE);
+      if (attrValue == null)
+      {
+        attrValue = "";
+      }
+      componentNameCombo.setText(attrValue);
+    }
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/XSDFacetSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/XSDFacetSection.java
new file mode 100644
index 0000000..0a07f3c
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/XSDFacetSection.java
@@ -0,0 +1,912 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.properties.sections;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
+import org.eclipse.wst.xsd.ui.common.commands.ChangeToLocalSimpleTypeCommand;
+import org.eclipse.wst.xsd.ui.common.commands.UpdateNumericBoundsFacetCommand;
+import org.eclipse.wst.xsd.ui.common.commands.UpdateStringLengthFacetCommand;
+import org.eclipse.wst.xsd.ui.common.commands.UpdateXSDWhiteSpaceFacetCommand;
+import org.eclipse.wst.xsd.ui.common.util.XSDCommonUIUtils;
+import org.eclipse.xsd.XSDAttributeDeclaration;
+import org.eclipse.xsd.XSDElementDeclaration;
+import org.eclipse.xsd.XSDFactory;
+import org.eclipse.xsd.XSDFeature;
+import org.eclipse.xsd.XSDLengthFacet;
+import org.eclipse.xsd.XSDMaxExclusiveFacet;
+import org.eclipse.xsd.XSDMaxFacet;
+import org.eclipse.xsd.XSDMaxInclusiveFacet;
+import org.eclipse.xsd.XSDMaxLengthFacet;
+import org.eclipse.xsd.XSDMinExclusiveFacet;
+import org.eclipse.xsd.XSDMinFacet;
+import org.eclipse.xsd.XSDMinInclusiveFacet;
+import org.eclipse.xsd.XSDMinLengthFacet;
+import org.eclipse.xsd.XSDSchema;
+import org.eclipse.xsd.XSDSimpleTypeDefinition;
+import org.eclipse.xsd.XSDTypeDefinition;
+import org.eclipse.xsd.XSDWhiteSpace;
+import org.eclipse.xsd.XSDWhiteSpaceFacet;
+import org.eclipse.xsd.util.XSDConstants;
+
+public class XSDFacetSection extends AbstractSection
+{
+  private String minLengthString, maxLengthString, titleString;
+  Font titleFont;
+  CLabel title;
+  Label minLengthLabel;
+  Text minLengthText;
+  Label maxLengthLabel;
+  Text maxLengthText;
+  Group simpleTypeModifierGroup;
+  String simpleTypeModifierGroupTitle = "";
+  Button collapseWhitespaceButton;
+  Button useEnumerationsButton, usePatternsButton;
+  Button minimumInclusiveCheckbox;
+  Button maximumInclusiveCheckbox;
+  boolean isNumericBaseType;
+  private XSDTypeDefinition typeDefinition;
+  private XSDSimpleTypeDefinition xsdSimpleTypeDefinition;
+  private XSDElementDeclaration xsdElementDeclaration;
+  private XSDAttributeDeclaration xsdAttributeDeclaration;
+  private XSDFeature xsdFeature;
+  boolean hasMaxMinFacets;
+
+  SpecificConstraintsWidget constraintsWidget;
+
+  public XSDFacetSection()
+  {
+    super();
+  }
+
+  protected void createContents(Composite parent)
+  {
+    TabbedPropertySheetWidgetFactory factory = getWidgetFactory();
+    composite = factory.createFlatFormComposite(parent);
+
+    GridLayout gridLayout = new GridLayout();
+    gridLayout.marginTop = 0;
+    gridLayout.marginBottom = 0;
+    gridLayout.numColumns = 1;
+    composite.setLayout(gridLayout);
+
+    title = factory.createCLabel(composite, ""); //$NON-NLS-1$
+    FontData fontData = composite.getFont().getFontData()[0];
+    int height = fontData.getHeight();
+    fontData.setHeight(height + 2);
+    fontData.setStyle(SWT.BOLD);
+    titleFont = new Font(null, fontData);
+    title.setFont(titleFont);
+    title.setText(titleString + (isReadOnly ? " - ReadOnly" : ""));
+
+    Composite facetComposite = factory.createComposite(composite, SWT.FLAT);
+
+    GridData data = new GridData();
+    gridLayout = new GridLayout();
+    gridLayout.marginTop = 0;
+    gridLayout.marginBottom = 0;
+    gridLayout.numColumns = 2;
+    facetComposite.setLayout(gridLayout);
+    data.grabExcessVerticalSpace = true;
+    data.grabExcessHorizontalSpace = true;
+    data.verticalAlignment = GridData.FILL;
+    data.horizontalAlignment = GridData.FILL;
+    facetComposite.setLayoutData(data);
+
+    data = new GridData();
+    data.grabExcessVerticalSpace = true;
+    data.horizontalAlignment = GridData.FILL;
+    data.verticalAlignment = GridData.FILL;
+
+    simpleTypeModifierGroup = getWidgetFactory().createGroup(facetComposite, simpleTypeModifierGroupTitle);
+    GridLayout groupGrid = new GridLayout();
+    groupGrid.marginTop = 0;
+    groupGrid.marginBottom = 0;
+    groupGrid.numColumns = 1;
+    simpleTypeModifierGroup.setLayoutData(data);
+    simpleTypeModifierGroup.setLayout(groupGrid);
+
+    Composite simpleTypeModifierComposite = getWidgetFactory().createFlatFormComposite(simpleTypeModifierGroup);
+    data = new GridData();
+    data.grabExcessVerticalSpace = true;
+    data.verticalAlignment = GridData.FILL;
+    data.horizontalAlignment = GridData.FILL;
+
+    GridLayout grid = new GridLayout();
+    grid.marginTop = 0;
+    grid.marginBottom = 0;
+    grid.numColumns = 3;
+    simpleTypeModifierComposite.setLayout(grid);
+    simpleTypeModifierComposite.setLayoutData(data);
+    if (hasMaxMinFacets)
+    {
+      minLengthLabel = factory.createLabel(simpleTypeModifierComposite, minLengthString);
+      minLengthText = factory.createText(simpleTypeModifierComposite, "");
+      applyAllListeners(minLengthText);
+
+      GridData minGridData = new GridData();
+      minGridData.widthHint = 100;
+      minLengthText.setLayoutData(minGridData);
+      minimumInclusiveCheckbox = factory.createButton(simpleTypeModifierComposite, "Inclusive", SWT.CHECK);
+      minimumInclusiveCheckbox.addSelectionListener(this);
+
+      maxLengthLabel = factory.createLabel(simpleTypeModifierComposite, maxLengthString);
+      maxLengthText = factory.createText(simpleTypeModifierComposite, "");
+      applyAllListeners(maxLengthText);
+
+      GridData maxGridData = new GridData();
+      maxGridData.widthHint = 100;
+      maxLengthText.setLayoutData(maxGridData);
+
+      maximumInclusiveCheckbox = factory.createButton(simpleTypeModifierComposite, "Inclusive", SWT.CHECK);
+      maximumInclusiveCheckbox.addSelectionListener(this);
+
+      minimumInclusiveCheckbox.setVisible(isNumericBaseType);
+      maximumInclusiveCheckbox.setVisible(isNumericBaseType);
+    }
+    collapseWhitespaceButton = factory.createButton(simpleTypeModifierComposite, "Collapse whitespace", SWT.CHECK);
+    collapseWhitespaceButton.addSelectionListener(this);
+
+    Group specificValueConstraintsGroup = factory.createGroup(facetComposite, "Specific constraint values");
+    gridLayout = new GridLayout();
+    gridLayout.marginTop = 0;
+    gridLayout.marginBottom = 0;
+    gridLayout.numColumns = 2;
+    specificValueConstraintsGroup.setLayout(gridLayout);
+    data = new GridData();
+    data.grabExcessHorizontalSpace = true;
+    data.grabExcessVerticalSpace = true;
+    data.horizontalAlignment = GridData.FILL;
+    data.verticalAlignment = GridData.FILL;
+    specificValueConstraintsGroup.setLayoutData(data);
+
+    Composite compositeForButtons = factory.createFlatFormComposite(specificValueConstraintsGroup);
+    gridLayout = new GridLayout();
+    gridLayout.marginTop = 0;
+    gridLayout.verticalSpacing = 1;
+    gridLayout.marginBottom = 0;
+    gridLayout.numColumns = 1;
+    compositeForButtons.setLayout(gridLayout);
+    data = new GridData();
+    data.verticalAlignment = GridData.BEGINNING;
+    compositeForButtons.setLayoutData(data);
+
+    factory.createCLabel(compositeForButtons, "Restrict values by:");
+//    useDefinedValuesButton = factory.createButton(compositeForButtons, "Only permit certain values", SWT.CHECK);
+//    useDefinedValuesButton.addSelectionListener(this);
+
+    Composite compositeForRadioButtons = factory.createFlatFormComposite(compositeForButtons);
+    gridLayout = new GridLayout();
+    gridLayout.marginTop = 0;
+    gridLayout.marginLeft = 0;
+    gridLayout.marginBottom = 0;
+    gridLayout.numColumns = 1;
+    compositeForRadioButtons.setLayout(gridLayout);
+    useEnumerationsButton = factory.createButton(compositeForRadioButtons, "Enumerations", SWT.RADIO);
+    useEnumerationsButton.addSelectionListener(this);
+    usePatternsButton = factory.createButton(compositeForRadioButtons, "Patterns", SWT.RADIO);
+    usePatternsButton.addSelectionListener(this);
+    
+    constraintsWidget = new SpecificConstraintsWidget(specificValueConstraintsGroup, factory, (input instanceof XSDFeature) ? (XSDFeature)input : null, xsdSimpleTypeDefinition, this);
+    data = new GridData();
+    data.grabExcessHorizontalSpace = true;
+    data.grabExcessVerticalSpace = true;
+    data.horizontalAlignment = GridData.FILL;
+    data.verticalAlignment = GridData.FILL;
+    constraintsWidget.getControl().setLayoutData(data);
+  }
+  
+  public void doSetInput()
+  {
+    setInput(getPart(), getSelection());
+  }
+
+  public void setInput(IWorkbenchPart part, ISelection selection)
+  {
+    super.setInput(part, selection);
+    init();
+    
+    XSDSchema schemaOfType = null;
+
+    if (!isReadOnly)
+    {
+      schemaOfType = xsdSimpleTypeDefinition.getSchema();
+    }
+    if (schemaOfType == owningEditor.getAdapter(XSDSchema.class))
+    {
+      isReadOnly = false;
+    }
+    else
+    {
+      if (!XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001.equals(xsdSimpleTypeDefinition.getTargetNamespace()))
+        isReadOnly = true;
+    }
+    if (hasMaxMinFacets)
+    {
+      title.setText(titleString + (isReadOnly ? " - ReadOnly" : ""));
+    }
+    relayout();
+    constraintsWidget.setCommandStack(getCommandStack());
+  }
+
+  protected void init()
+  {
+    hasMaxMinFacets = false;
+    try
+    {
+    updateInput();
+    
+    if (xsdSimpleTypeDefinition != null)
+    {
+      XSDSimpleTypeDefinition targetST = xsdSimpleTypeDefinition;
+      XSDSimpleTypeDefinition basePrimitive = xsdSimpleTypeDefinition.getPrimitiveTypeDefinition();
+      if (basePrimitive != null) 
+        targetST = basePrimitive;
+      else
+        targetST = xsdSimpleTypeDefinition.getBaseTypeDefinition();
+      
+      minLengthString = "";
+      maxLengthString = "";
+      if (targetST.getValidFacets().contains("length"))
+      {
+        minLengthString = "Minimum length:";
+        maxLengthString = "Maximum length:";
+        simpleTypeModifierGroupTitle = "Constraints on length of " + targetST.getName();
+        isNumericBaseType = false;
+        hasMaxMinFacets = true;
+      }
+      else if (targetST.getValidFacets().contains("maxInclusive"))
+      {
+        simpleTypeModifierGroupTitle = "Constraints on value of " + targetST.getName();
+        minLengthString = "Minimum value:";
+        maxLengthString = "Maximum value:";
+        isNumericBaseType = true;
+        hasMaxMinFacets = true;
+      }
+      else
+      {
+        simpleTypeModifierGroupTitle = "Constraints on " + (basePrimitive != null ? basePrimitive.getName() : "anyType");
+      }
+    }
+    }
+    catch(Exception e)
+    {
+    }
+  }
+  
+  private void updateInput()
+  {
+    if (input instanceof XSDFeature)
+    {
+      xsdFeature = (XSDFeature) input;
+      typeDefinition = xsdFeature.getResolvedFeature().getType();
+      XSDTypeDefinition anonymousTypeDefinition = null;
+      if (xsdFeature instanceof XSDElementDeclaration)
+      {
+        xsdElementDeclaration = (XSDElementDeclaration)xsdFeature;
+        anonymousTypeDefinition = xsdElementDeclaration.getResolvedElementDeclaration().getAnonymousTypeDefinition();
+      }
+      else if (xsdFeature instanceof XSDAttributeDeclaration)
+      {
+        xsdAttributeDeclaration = (XSDAttributeDeclaration)xsdFeature;
+        anonymousTypeDefinition = xsdAttributeDeclaration.getResolvedAttributeDeclaration().getAnonymousTypeDefinition();
+      }
+      
+      if (typeDefinition instanceof XSDSimpleTypeDefinition)
+      {
+        xsdSimpleTypeDefinition = (XSDSimpleTypeDefinition) typeDefinition;
+      }
+      
+      if (anonymousTypeDefinition instanceof XSDSimpleTypeDefinition)
+      {
+        xsdSimpleTypeDefinition = (XSDSimpleTypeDefinition)anonymousTypeDefinition;
+      }
+      
+      if (xsdSimpleTypeDefinition != null)
+        titleString = "Type: " + (anonymousTypeDefinition != null ? "(" + xsdElementDeclaration.getResolvedElementDeclaration().getName() + "Type)" : xsdSimpleTypeDefinition.getName())  + " , Base: " + xsdSimpleTypeDefinition.getPrimitiveTypeDefinition().getName();
+    }
+    else if (input instanceof XSDSimpleTypeDefinition)
+    {
+      xsdSimpleTypeDefinition = (XSDSimpleTypeDefinition) input;
+      titleString = "Type: " + xsdSimpleTypeDefinition.getName() + " , Base: " + xsdSimpleTypeDefinition.getPrimitiveTypeDefinition().getName();
+    }
+  }
+
+  public void refresh()
+  {
+    super.refresh();
+    init();
+    setListenerEnabled(false);
+    
+    collapseWhitespaceButton.setSelection(false);
+    XSDWhiteSpaceFacet whitespaceFacet = xsdSimpleTypeDefinition.getWhiteSpaceFacet();
+    if (whitespaceFacet != null)
+    {
+      if (xsdSimpleTypeDefinition.getFacetContents().contains(whitespaceFacet))
+      {
+        if (XSDWhiteSpace.COLLAPSE_LITERAL.equals(whitespaceFacet.getValue()))
+        {
+          if (!XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001.equals(xsdSimpleTypeDefinition.getTargetNamespace()))
+          {
+            collapseWhitespaceButton.setSelection(true);
+          }
+        }
+      }
+    }
+
+    if (hasMaxMinFacets)
+    {
+      minLengthLabel.setText(minLengthString);
+      maxLengthLabel.setText(maxLengthString);
+
+      if (!isNumericBaseType)
+        refreshStringLength();
+      else
+        refreshValueLengths();
+    }
+
+    if (xsdSimpleTypeDefinition.getEnumerationFacets().size() > 0) 
+    {
+      usePatternsButton.setSelection(false);
+      useEnumerationsButton.setSelection(true);
+      constraintsWidget.setConstraintKind(SpecificConstraintsWidget.ENUMERATION);
+      constraintsWidget.addButton.setEnabled(true);
+    }
+    else if (xsdSimpleTypeDefinition.getPatternFacets().size() > 0)
+    {
+      usePatternsButton.setSelection(true);
+      useEnumerationsButton.setSelection(false);
+      constraintsWidget.setConstraintKind(SpecificConstraintsWidget.PATTERN);
+      constraintsWidget.addButton.setEnabled(false);
+    }
+    else
+    {
+      usePatternsButton.setSelection(false);
+      useEnumerationsButton.setSelection(true);
+      constraintsWidget.setConstraintKind(SpecificConstraintsWidget.ENUMERATION);
+      constraintsWidget.addButton.setEnabled(true);
+    }
+    constraintsWidget.setInput(xsdSimpleTypeDefinition);
+
+    setListenerEnabled(true);
+  }
+
+  protected void relayout()
+  {
+    Composite parent = composite.getParent();
+    parent.getParent().setRedraw(false);
+
+    if (parent != null && !parent.isDisposed())
+    {
+      Control[] children = parent.getChildren();
+      for (int i = 0; i < children.length; i++)
+      {
+        children[i].dispose();
+      }
+    }
+    createContents(parent);
+    parent.getParent().layout(true, true);
+    parent.getParent().setRedraw(true);
+    refresh();
+  }
+
+  public void dispose()
+  {
+    if (titleFont != null && !titleFont.isDisposed())
+      titleFont.dispose();
+    titleFont = null;
+    
+    if (minimumInclusiveCheckbox != null && !minimumInclusiveCheckbox.isDisposed())
+      minimumInclusiveCheckbox.removeSelectionListener(this);
+    if (maximumInclusiveCheckbox != null && !maximumInclusiveCheckbox.isDisposed())
+      maximumInclusiveCheckbox.removeSelectionListener(this);
+    
+    if (collapseWhitespaceButton != null && !collapseWhitespaceButton.isDisposed())
+      collapseWhitespaceButton.removeSelectionListener(this);
+
+    if (maxLengthText != null && !maxLengthText.isDisposed())
+      removeListeners(maxLengthText);
+    if (minLengthText != null && !minLengthText.isDisposed())
+      removeListeners(minLengthText);
+    
+    super.dispose();
+  }
+
+  public void refreshStringLength()
+  {
+    XSDMinLengthFacet minLengthFacet = xsdSimpleTypeDefinition.getMinLengthFacet();
+    XSDMaxLengthFacet maxLengthFacet = xsdSimpleTypeDefinition.getMaxLengthFacet();
+    XSDLengthFacet lengthFacet = xsdSimpleTypeDefinition.getLengthFacet();
+
+    try
+    {
+      if (minLengthFacet != null)
+      {
+        int minLengthValue = minLengthFacet.getValue();
+        if (minLengthValue >= 0)
+        {
+          minLengthText.setText(Integer.toString(minLengthValue));
+        }
+        else
+        {
+          minLengthText.setText(""); //$NON-NLS-1$
+        }
+      }
+      if (maxLengthFacet != null)
+      {
+        int maxLength = maxLengthFacet.getValue();
+        if (maxLength >= 0)
+        {
+          maxLengthText.setText(Integer.toString(maxLength));
+        }
+        else
+        {
+          maxLengthText.setText(""); //$NON-NLS-1$
+        }
+      }
+      if (lengthFacet != null)
+      {
+        int length = lengthFacet.getValue();
+        if (length >= 0)
+        {
+          minLengthText.setText(Integer.toString(length));
+          maxLengthText.setText(Integer.toString(length));
+        }
+      }
+    }
+    catch (Exception e)
+    {
+
+    }
+
+  }
+
+  public void refreshValueLengths()
+  {
+    XSDSimpleTypeDefinition type = xsdSimpleTypeDefinition;
+    XSDMinFacet minFacet = type.getMinFacet();
+    XSDMaxFacet maxFacet = type.getMaxFacet();
+
+    minimumInclusiveCheckbox.removeSelectionListener(this);
+    maximumInclusiveCheckbox.removeSelectionListener(this);
+    try
+    {
+      minLengthText.setText(""); //$NON-NLS-1$
+      maxLengthText.setText(""); //$NON-NLS-1$
+
+      minimumInclusiveCheckbox.setSelection(false);
+      minimumInclusiveCheckbox.setEnabled(false);
+      if (minFacet != null)
+      {
+        if (minFacet.getElement().getNodeName().equals(XSDConstants.MINEXCLUSIVE_ELEMENT_TAG) ||
+            minFacet.getElement().getNodeName().equals(XSDConstants.MININCLUSIVE_ELEMENT_TAG))
+        {
+          minLengthText.setText(minFacet.getLexicalValue());
+          minimumInclusiveCheckbox.setSelection(minFacet.isInclusive());
+          minimumInclusiveCheckbox.setEnabled(true);
+        }
+      }
+
+      maximumInclusiveCheckbox.setSelection(false);
+      maximumInclusiveCheckbox.setEnabled(false);
+      if (maxFacet != null)
+      {
+        if (maxFacet.getElement().getNodeName().equals(XSDConstants.MAXEXCLUSIVE_ELEMENT_TAG) ||
+            maxFacet.getElement().getNodeName().equals(XSDConstants.MAXINCLUSIVE_ELEMENT_TAG))
+        {
+          maxLengthText.setText(maxFacet.getLexicalValue());
+          maximumInclusiveCheckbox.setSelection(maxFacet.isInclusive());
+          maximumInclusiveCheckbox.setEnabled(true);
+        }
+      }
+    }
+    finally
+    {
+      minimumInclusiveCheckbox.addSelectionListener(this);
+      maximumInclusiveCheckbox.addSelectionListener(this);
+    }
+  }
+
+  protected void doHandleEvent(Event event)
+  {
+    super.doHandleEvent(event);
+    Command command = null;
+    boolean doUpdateMax = false, doUpdateMin = false;
+    
+    String minValue = minLengthText.getText().trim();
+    String maxValue = maxLengthText.getText().trim();
+
+    XSDLengthFacet lengthFacet = xsdSimpleTypeDefinition.getLengthFacet();
+    XSDMinLengthFacet minLengthFacet = xsdSimpleTypeDefinition.getMinLengthFacet();
+    XSDMaxLengthFacet maxLengthFacet = xsdSimpleTypeDefinition.getMaxLengthFacet();
+    
+    XSDMinInclusiveFacet minInclusiveFacet = xsdSimpleTypeDefinition.getMinInclusiveFacet();
+    XSDMinExclusiveFacet minExclusiveFacet = xsdSimpleTypeDefinition.getMinExclusiveFacet();
+    XSDMaxInclusiveFacet maxInclusiveFacet = xsdSimpleTypeDefinition.getMaxInclusiveFacet();
+    XSDMaxExclusiveFacet maxExclusiveFacet = xsdSimpleTypeDefinition.getMaxExclusiveFacet();
+
+    String currentMinInclusive = null, currentMinExclusive = null, currentMaxInclusive = null, currentMaxExclusive = null;
+    if (minInclusiveFacet != null)
+    {
+      currentMinInclusive = minInclusiveFacet.getLexicalValue();
+    }
+    if (minExclusiveFacet != null)
+    {
+      currentMinExclusive = minExclusiveFacet.getLexicalValue();
+    }
+    if (maxInclusiveFacet != null)
+    {
+      currentMaxInclusive = maxInclusiveFacet.getLexicalValue();
+    }
+    if (maxExclusiveFacet != null)
+    {
+      currentMaxExclusive = maxExclusiveFacet.getLexicalValue();
+    }
+    
+    
+    String currentLength = null, currentMin = null, currentMax = null;
+    if (lengthFacet != null)
+    {
+      currentLength = lengthFacet.getLexicalValue();
+    }
+    if (minLengthFacet != null)
+    {
+      currentMin = minLengthFacet.getLexicalValue();
+    }
+    if (maxLengthFacet != null)
+    {
+      currentMax = maxLengthFacet.getLexicalValue();
+    }
+    
+    if (event.widget == minLengthText)
+    {
+      try
+      {
+        if (minValue.length() > 0)
+        {
+          if (!isNumericBaseType)
+          {
+            Number big = new BigInteger(minValue);
+            big.toString();
+            if (minLengthFacet != null)
+            {
+              if (minValue.equals(currentMin) || minValue.equals(currentLength))
+                return;
+            }
+            else
+            {
+              if (maxValue != null && minValue.equals(maxValue) && lengthFacet != null)
+              {
+                return;
+              }
+            }
+          }
+          else
+          {
+            if (xsdSchema.getSchemaForSchema().resolveSimpleTypeDefinition("double").equals(xsdSimpleTypeDefinition) ||
+                xsdSchema.getSchemaForSchema().resolveSimpleTypeDefinition("float").equals(xsdSimpleTypeDefinition) ||
+                xsdSchema.getSchemaForSchema().resolveSimpleTypeDefinition("decimal").equals(xsdSimpleTypeDefinition))
+            {
+              BigDecimal bigDecimal = new BigDecimal(minValue);
+              bigDecimal.toString();
+              if ( (currentMinInclusive != null && minValue.equals(currentMinInclusive)) ||
+                   (currentMinExclusive != null && minValue.equals(currentMinExclusive)) )
+              {
+                return;
+              }
+            }
+            else
+            {
+              Number big = new BigInteger(minValue);
+              big.toString();
+            }
+            minimumInclusiveCheckbox.setEnabled(true);
+          }
+        }
+        else
+        {
+          if (!isNumericBaseType)
+          {
+            if (currentMin == null && currentLength == null)
+              return;
+          }
+          else
+          {
+            if (currentMinInclusive == null && minimumInclusiveCheckbox.getSelection())
+            {
+              return;
+            }
+            else if (currentMinExclusive == null && !minimumInclusiveCheckbox.getSelection())
+            {
+              return;
+            }
+          }
+          minimumInclusiveCheckbox.setEnabled(false);
+          minValue = null;
+        }
+        doUpdateMin = true;
+      }
+      catch (NumberFormatException e)
+      {
+        // TODO show error message
+        doUpdateMin = false;
+      }
+    }
+    if (event.widget == maxLengthText)
+    {
+      try
+      {
+        if (maxValue.length() > 0)
+        {
+          if (!isNumericBaseType)
+          {
+            Number big = new BigInteger(maxValue);
+            big.toString();
+            if (maxLengthFacet != null)
+            {
+              if (maxValue.equals(currentMax) || maxValue.equals(currentLength))
+                return;
+            }
+            else
+            {
+              if (minValue != null && maxValue.equals(minValue) && lengthFacet != null)
+              {
+                return;
+              }
+            }
+          }
+          else
+          {
+            if (xsdSchema.getSchemaForSchema().resolveSimpleTypeDefinition("double").equals(xsdSimpleTypeDefinition) ||
+                xsdSchema.getSchemaForSchema().resolveSimpleTypeDefinition("float").equals(xsdSimpleTypeDefinition) ||
+                xsdSchema.getSchemaForSchema().resolveSimpleTypeDefinition("decimal").equals(xsdSimpleTypeDefinition))
+            {
+              BigDecimal bigDecimal = new BigDecimal(maxValue);
+              bigDecimal.toString();
+            }
+            else
+            {
+              Number big = new BigInteger(maxValue);
+              big.toString();
+            }
+            maximumInclusiveCheckbox.setEnabled(true);
+          }
+        }
+        else
+        {
+          if (!isNumericBaseType)
+          {
+            if (currentMax == null && currentLength == null)
+              return;
+          }
+          else
+          {
+            if (currentMaxInclusive == null && maximumInclusiveCheckbox.getSelection())
+            {
+              return;
+            }
+            else if (currentMaxExclusive == null && !maximumInclusiveCheckbox.getSelection())
+            {
+              return;
+            }
+            maximumInclusiveCheckbox.setEnabled(false);
+          }
+          maxValue = null;
+        }
+
+        doUpdateMax = true;
+      }
+      catch (NumberFormatException e)
+      {
+        doUpdateMax = false;
+        // TODO show error message
+      }
+    }
+    
+    if (XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001.equals(xsdSimpleTypeDefinition.getTargetNamespace()) && (doUpdateMax || doUpdateMin))
+    {
+      XSDSimpleTypeDefinition anonymousSimpleType = null;
+      CompoundCommand compoundCommand = new CompoundCommand();
+      ChangeToLocalSimpleTypeCommand changeToAnonymousCommand = null;
+      if (input instanceof XSDFeature)
+      {
+        anonymousSimpleType = XSDCommonUIUtils.getAnonymousSimpleType((XSDFeature)input, xsdSimpleTypeDefinition);
+        if (anonymousSimpleType == null)
+        {
+          anonymousSimpleType = XSDFactory.eINSTANCE.createXSDSimpleTypeDefinition();
+          anonymousSimpleType.setBaseTypeDefinition(xsdSimpleTypeDefinition);
+       
+          changeToAnonymousCommand = new ChangeToLocalSimpleTypeCommand("Constrain length", (XSDFeature)input);
+          changeToAnonymousCommand.setAnonymousSimpleType(anonymousSimpleType);
+          compoundCommand.add(changeToAnonymousCommand);
+        }
+
+        if (!isNumericBaseType)
+        {
+          UpdateStringLengthFacetCommand updateCommand = new UpdateStringLengthFacetCommand("", anonymousSimpleType);
+          if (doUpdateMax)
+          {
+            updateCommand.setMax(maxValue);
+          }
+          if (doUpdateMin)
+          {
+            updateCommand.setMin(minValue);
+          }
+          compoundCommand.add(updateCommand);
+        }
+        else
+        {
+          UpdateNumericBoundsFacetCommand updateCommand = new UpdateNumericBoundsFacetCommand("Update bounds", anonymousSimpleType, minimumInclusiveCheckbox.getSelection(), maximumInclusiveCheckbox.getSelection());
+          if (doUpdateMax)
+          {
+            updateCommand.setMax(maxValue);
+          }
+          if (doUpdateMin)
+          {
+            updateCommand.setMin(minValue);
+          }
+          compoundCommand.add(updateCommand);
+        }
+        command = compoundCommand;
+        getCommandStack().execute(command);
+      }
+      else if (input instanceof XSDSimpleTypeDefinition)
+      {
+        if (!isNumericBaseType)
+        {
+          UpdateStringLengthFacetCommand updateCommand = new UpdateStringLengthFacetCommand("", xsdSimpleTypeDefinition);
+          if (doUpdateMax)
+          {
+            updateCommand.setMax(maxValue);
+          }
+          if (doUpdateMin)
+          {
+            updateCommand.setMin(minValue);
+          }
+          command = updateCommand;
+        }
+        else
+        {
+          UpdateNumericBoundsFacetCommand updateCommand = new UpdateNumericBoundsFacetCommand("Update bounds", xsdSimpleTypeDefinition, minimumInclusiveCheckbox.getSelection(), maximumInclusiveCheckbox.getSelection());
+          if (doUpdateMax)
+          {
+            updateCommand.setMax(maxValue);
+          }
+          if (doUpdateMin)
+          {
+            updateCommand.setMin(minValue);
+          }
+          command = updateCommand;
+        }
+        getCommandStack().execute(command);
+      }
+    }
+    else
+    {
+      if (!isNumericBaseType)
+      {
+        UpdateStringLengthFacetCommand updateCommand = new UpdateStringLengthFacetCommand("", xsdSimpleTypeDefinition);
+        if (doUpdateMax)
+        {
+          updateCommand.setMax(maxValue);
+        }
+        if (doUpdateMin)
+        {
+          updateCommand.setMin(minValue);
+        }
+        getCommandStack().execute(updateCommand);
+      }
+      else
+      {
+        UpdateNumericBoundsFacetCommand updateCommand = new UpdateNumericBoundsFacetCommand("Update bounds", xsdSimpleTypeDefinition, minimumInclusiveCheckbox.getSelection(), maximumInclusiveCheckbox.getSelection());
+        if (doUpdateMax)
+        {
+          updateCommand.setMax(maxValue);
+        }
+        if (doUpdateMin)
+        {
+          updateCommand.setMin(minValue);
+        }
+        getCommandStack().execute(updateCommand);
+      }
+      
+    }
+    setInput(getPart(), getSelection());
+  }
+  
+  public void widgetSelected(SelectionEvent e)
+  {
+    if (e.widget == collapseWhitespaceButton)
+    {
+       CompoundCommand compoundCommand = new CompoundCommand();
+       XSDSimpleTypeDefinition anonymousSimpleType = null;
+       if (XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001.equals(xsdSimpleTypeDefinition.getTargetNamespace()))
+       {
+         if (input instanceof XSDFeature)
+         {
+           anonymousSimpleType = XSDCommonUIUtils.getAnonymousSimpleType((XSDFeature)input, xsdSimpleTypeDefinition);
+           if (anonymousSimpleType == null)
+           {
+             anonymousSimpleType = XSDFactory.eINSTANCE.createXSDSimpleTypeDefinition();
+             anonymousSimpleType.setBaseTypeDefinition(xsdSimpleTypeDefinition);
+           
+             ChangeToLocalSimpleTypeCommand changeToAnonymousCommand = new ChangeToLocalSimpleTypeCommand("Constrain length", (XSDFeature)input);
+             changeToAnonymousCommand.setAnonymousSimpleType(anonymousSimpleType);
+             compoundCommand.add(changeToAnonymousCommand);
+           }
+  
+           UpdateXSDWhiteSpaceFacetCommand whiteSpaceCommand = new UpdateXSDWhiteSpaceFacetCommand("Collapse whitespace", anonymousSimpleType, collapseWhitespaceButton.getSelection());
+           compoundCommand.add(whiteSpaceCommand);
+            
+           getCommandStack().execute(compoundCommand);
+        }
+         setInput(getPart(), getSelection());
+      }
+      else
+      {
+        UpdateXSDWhiteSpaceFacetCommand whiteSpaceCommand = new UpdateXSDWhiteSpaceFacetCommand("Collapse whitespace", xsdSimpleTypeDefinition, collapseWhitespaceButton.getSelection());
+        getCommandStack().execute(whiteSpaceCommand);
+      }
+    }
+    else if (e.widget == minimumInclusiveCheckbox)
+    {
+      String minValue = minLengthText.getText().trim();
+      if (minValue.length() == 0) minValue = null;
+
+      UpdateNumericBoundsFacetCommand updateCommand = new UpdateNumericBoundsFacetCommand("Update bounds", xsdSimpleTypeDefinition, minimumInclusiveCheckbox.getSelection(), maximumInclusiveCheckbox.getSelection());
+      updateCommand.setMin(minValue);
+      
+      if (minValue != null)
+        getCommandStack().execute(updateCommand);
+    }
+    else if (e.widget == maximumInclusiveCheckbox)
+    {
+      String maxValue = maxLengthText.getText().trim();
+      if (maxValue.length() == 0) maxValue = null;
+      UpdateNumericBoundsFacetCommand updateCommand = new UpdateNumericBoundsFacetCommand("Update bounds", xsdSimpleTypeDefinition, minimumInclusiveCheckbox.getSelection(), maximumInclusiveCheckbox.getSelection());
+      updateCommand.setMax(maxValue);
+      if (maxValue != null)
+        getCommandStack().execute(updateCommand);
+    }
+    else if (e.widget == useEnumerationsButton)
+    {
+      constraintsWidget.addButton.setEnabled(true);
+      if (isListenerEnabled())
+        constraintsWidget.setConstraintKind(SpecificConstraintsWidget.ENUMERATION);
+    }
+    else if (e.widget == usePatternsButton)
+    {
+      constraintsWidget.addButton.setEnabled(false);
+      if (isListenerEnabled())
+        constraintsWidget.setConstraintKind(SpecificConstraintsWidget.PATTERN);
+    }
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/XSDFacetSectionFilter.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/XSDFacetSectionFilter.java
new file mode 100644
index 0000000..294189c
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/XSDFacetSectionFilter.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.properties.sections;
+
+import org.eclipse.jface.viewers.IFilter;
+import org.eclipse.xsd.XSDFeature;
+import org.eclipse.xsd.XSDSchema;
+import org.eclipse.xsd.XSDSimpleTypeDefinition;
+import org.eclipse.xsd.XSDTypeDefinition;
+
+public class XSDFacetSectionFilter implements IFilter
+{
+  public boolean select(Object toTest)
+  {
+    if (toTest instanceof XSDFeature)
+    {
+      XSDTypeDefinition type = ((XSDFeature)toTest).getResolvedFeature().getType();
+      if (type instanceof XSDSimpleTypeDefinition)
+      {
+        return true;
+      }
+    }
+    else if (toTest instanceof XSDSimpleTypeDefinition)
+    {
+      XSDSimpleTypeDefinition st = (XSDSimpleTypeDefinition)toTest;
+      if (st.eContainer() instanceof XSDSchema ||
+          st.eContainer() instanceof XSDFeature)
+      {
+        return true;
+      }
+    }
+    return false;
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/XSDModelGroupDefinitionSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/XSDModelGroupDefinitionSection.java
new file mode 100644
index 0000000..f499498
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/XSDModelGroupDefinitionSection.java
@@ -0,0 +1,261 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.properties.sections;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.xerces.util.XMLChar;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CCombo;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.wst.xsd.ui.common.commands.UpdateNameCommand;
+import org.eclipse.wst.xsd.ui.internal.util.TypesHelper;
+import org.eclipse.xsd.XSDModelGroupDefinition;
+import org.eclipse.xsd.XSDNamedComponent;
+import org.eclipse.xsd.util.XSDConstants;
+import org.w3c.dom.Element;
+
+public class XSDModelGroupDefinitionSection extends AbstractSection
+{
+  protected Text nameText;
+  protected CCombo componentNameCombo;
+  boolean isReference;
+
+  public XSDModelGroupDefinitionSection()
+  {
+    super();
+  }
+
+  protected void createContents(Composite parent)
+  {
+    composite = getWidgetFactory().createFlatFormComposite(parent);
+
+    GridLayout gridLayout = new GridLayout();
+    gridLayout.numColumns = 2;
+    composite.setLayout(gridLayout);
+
+    if (isReference)
+    {
+      // ------------------------------------------------------------------
+      // Ref Label
+      // ------------------------------------------------------------------
+      GridData data = new GridData();
+      data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
+      data.grabExcessHorizontalSpace = false;
+      CLabel refLabel = getWidgetFactory().createCLabel(composite, XSDConstants.REF_ATTRIBUTE + ":"); //$NON-NLS-1$
+      refLabel.setLayoutData(data);
+
+      // ------------------------------------------------------------------
+      // Ref Combo
+      // ------------------------------------------------------------------
+
+      data = new GridData();
+      data.grabExcessHorizontalSpace = true;
+      data.horizontalAlignment = GridData.FILL;
+
+      componentNameCombo = getWidgetFactory().createCCombo(composite, SWT.FLAT);
+      componentNameCombo.addSelectionListener(this);
+      componentNameCombo.setLayoutData(data);
+    }
+    else
+    {
+      // ------------------------------------------------------------------
+      // NameLabel
+      // ------------------------------------------------------------------
+      GridData data = new GridData();
+      data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
+      data.grabExcessHorizontalSpace = false;
+      CLabel nameLabel = getWidgetFactory().createCLabel(composite, "Name:");
+      nameLabel.setLayoutData(data);
+
+      // ------------------------------------------------------------------
+      // NameText
+      // ------------------------------------------------------------------
+      data = new GridData();
+      data.grabExcessHorizontalSpace = true;
+      data.horizontalAlignment = GridData.FILL;
+      nameText = getWidgetFactory().createText(composite, ""); //$NON-NLS-1$
+      nameText.setLayoutData(data);
+      nameText.addListener(SWT.Modify, this);
+    }
+  }
+
+  public void refresh()
+  {
+    super.refresh();
+
+    if (isReadOnly)
+    {
+      composite.setEnabled(false);
+    }
+    else
+    {
+      composite.setEnabled(true);
+    }
+
+    setListenerEnabled(false);
+
+    XSDNamedComponent namedComponent = (XSDNamedComponent) input;
+
+    if (isReference)
+    {
+      Element element = namedComponent.getElement();
+      if (element != null)
+      {
+        String attrValue = element.getAttribute(XSDConstants.REF_ATTRIBUTE);
+        if (attrValue == null)
+        {
+          attrValue = "";
+        }
+        componentNameCombo.setText(attrValue);
+      }
+    }
+    else
+    {
+      // refresh name
+      nameText.setText("");
+
+      String name = namedComponent.getName();
+      if (name != null)
+      {
+        nameText.setText(name);
+      }
+    }
+
+    setListenerEnabled(true);
+  }
+
+  public void setInput(IWorkbenchPart part, ISelection selection)
+  {
+    super.setInput(part, selection);
+    init();
+    relayout();
+    
+    if (isReference)
+    {
+      TypesHelper helper = new TypesHelper(xsdSchema);
+      List items = new ArrayList();
+      items = helper.getModelGroups();
+      items.add(0, "");
+      componentNameCombo.setItems((String [])items.toArray(new String[0]));
+    }
+  }
+
+  protected void init()
+  {
+    if (input instanceof XSDModelGroupDefinition)
+    {
+      XSDModelGroupDefinition group = (XSDModelGroupDefinition) input;
+      isReference = group.isModelGroupDefinitionReference();
+    }
+  }
+
+  protected void relayout()
+  {
+    Composite parentComposite = composite.getParent();
+    parentComposite.getParent().setRedraw(false);
+
+    if (parentComposite != null && !parentComposite.isDisposed())
+    {
+      Control[] children = parentComposite.getChildren();
+      for (int i = 0; i < children.length; i++)
+      {
+        children[i].dispose();
+      }
+    }
+
+    // Now initialize the new handler
+    createContents(parentComposite);
+    parentComposite.getParent().layout(true, true);
+
+    // Now turn painting back on
+    parentComposite.getParent().setRedraw(true);
+    refresh();
+  }
+
+  public void doHandleEvent(Event event)
+  {
+    super.doHandleEvent(event);
+    if (event.widget == nameText)
+    {
+      String newValue = nameText.getText().trim();
+      if (input instanceof XSDNamedComponent)
+      {
+        XSDNamedComponent namedComponent = (XSDNamedComponent) input;
+        if (!validateSection())
+          return;
+
+        Command command = null;
+
+        // Make sure an actual name change has taken place
+        String oldName = namedComponent.getName();
+        if (!newValue.equals(oldName))
+        {
+          command = new UpdateNameCommand("Rename", namedComponent, newValue);
+        }
+
+        if (command != null && getCommandStack() != null)
+        {
+          getCommandStack().execute(command);
+        }
+        // doReferentialIntegrityCheck(namedComponent, newValue);
+      }
+    }
+  }
+
+  protected boolean validateSection()
+  {
+    if (nameText == null || nameText.isDisposed())
+      return true;
+
+    setErrorMessage(null);
+
+    String name = nameText.getText().trim();
+
+    // validate against NCName
+    if (name.length() < 1 || !XMLChar.isValidNCName(name))
+    {
+      setErrorMessage("Invalid name");
+      return false;
+    }
+
+    return true;
+  }
+  
+  public void widgetSelected(SelectionEvent e)
+  {
+    if (e.widget == componentNameCombo)
+    {
+      String newValue = componentNameCombo.getText();
+      if (input instanceof XSDNamedComponent)
+      {
+        XSDNamedComponent namedComponent = (XSDNamedComponent)input;
+        Element element = namedComponent.getElement();
+
+        if (namedComponent instanceof XSDModelGroupDefinition)
+        {
+          element.setAttribute(XSDConstants.REF_ATTRIBUTE, newValue);
+        }
+      }
+    }
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/XSDModelGroupSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/XSDModelGroupSection.java
new file mode 100644
index 0000000..d9a653d
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/XSDModelGroupSection.java
@@ -0,0 +1,140 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.properties.sections;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CCombo;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.wst.xsd.editor.Messages;
+import org.eclipse.wst.xsd.ui.common.commands.UpdateContentModelCommand;
+import org.eclipse.xsd.XSDCompositor;
+import org.eclipse.xsd.XSDModelGroup;
+
+public class XSDModelGroupSection extends MultiplicitySection
+{
+  protected CCombo modelGroupCombo;
+  private String[] modelGroupComboValues = { "sequence", "choice", "all" }; //$NON-NLS-1$
+
+  public XSDModelGroupSection()
+  {
+    super();
+  }
+
+  public void createContents(Composite parent)
+  {
+    composite = getWidgetFactory().createFlatFormComposite(parent);
+
+    String typeLabel = Messages.UI_LABEL_TYPE; //$NON-NLS-1$
+
+    GridLayout gridLayout = new GridLayout();
+    gridLayout.numColumns = 2;
+    composite.setLayout(gridLayout);
+
+    // ------------------------------------------------------------------
+    // NameLabel
+    // ------------------------------------------------------------------
+    GridData data = new GridData();
+    data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
+    data.grabExcessHorizontalSpace = false;
+    CLabel nameLabel = getWidgetFactory().createCLabel(composite, "Kind:"); //$NON-NLS-1$
+    nameLabel.setLayoutData(data);
+
+    // ------------------------------------------------------------------
+    // NameText
+    // ------------------------------------------------------------------
+    data = new GridData();
+    data.grabExcessHorizontalSpace = true;
+    data.horizontalAlignment = GridData.FILL;
+    modelGroupCombo = getWidgetFactory().createCCombo(composite, SWT.FLAT);
+    modelGroupCombo.setLayoutData(data);
+    modelGroupCombo.addSelectionListener(this);
+    modelGroupCombo.setItems(modelGroupComboValues);
+
+    // ------------------------------------------------------------------
+    // min property
+    // ------------------------------------------------------------------
+    getWidgetFactory().createCLabel(composite, Messages.UI_LABEL_MINOCCURS);
+    
+    data = new GridData();
+    data.grabExcessHorizontalSpace = true;
+    data.horizontalAlignment = GridData.FILL;
+
+    minCombo = getWidgetFactory().createCCombo(composite, SWT.FLAT);
+    minCombo.setLayoutData(data);
+    minCombo.add("0"); //$NON-NLS-1$
+    minCombo.add("1"); //$NON-NLS-1$
+    minCombo.addListener(SWT.Modify, this);
+    minCombo.addSelectionListener(this);
+
+    // ------------------------------------------------------------------
+    // max property
+    // ------------------------------------------------------------------
+    getWidgetFactory().createCLabel(composite, Messages.UI_LABEL_MAXOCCURS);
+
+    data = new GridData();
+    data.grabExcessHorizontalSpace = true;
+    data.horizontalAlignment = GridData.FILL;
+
+    maxCombo = getWidgetFactory().createCCombo(composite, SWT.FLAT);
+    maxCombo.setLayoutData(data);
+    maxCombo.add("0"); //$NON-NLS-1$
+    maxCombo.add("1"); //$NON-NLS-1$
+    maxCombo.add("unbounded"); //$NON-NLS-1$
+    maxCombo.addListener(SWT.Modify, this);
+    maxCombo.addSelectionListener(this);
+  }
+
+  
+  public void refresh()
+  {
+    super.refresh();
+
+    if (isReadOnly)
+    {
+      composite.setEnabled(false);
+    }
+    else
+    {
+      composite.setEnabled(true);
+    }
+
+    setListenerEnabled(false);
+
+    if (input != null)
+    {
+      if (input instanceof XSDModelGroup)
+      {
+        XSDModelGroup particle = (XSDModelGroup)input;
+        String modelType = particle.getCompositor().getName();
+        modelGroupCombo.setText(modelType);
+      }
+    }
+    
+    refreshMinMax();
+
+    setListenerEnabled(true);
+  }
+  
+  public void doWidgetSelected(SelectionEvent e)
+  {
+    XSDModelGroup particle = (XSDModelGroup)input;
+    if (e.widget == modelGroupCombo)
+    {
+      XSDCompositor newValue = XSDCompositor.get(modelGroupCombo.getText());
+      UpdateContentModelCommand command = new UpdateContentModelCommand("Content Model Change", particle, newValue);
+      getCommandStack().execute(command);
+    }
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/XSDSchemaSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/XSDSchemaSection.java
new file mode 100644
index 0000000..7100bc9
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/XSDSchemaSection.java
@@ -0,0 +1,468 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.properties.sections;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.custom.StyleRange;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.wst.xml.core.internal.document.DocumentImpl;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+import org.eclipse.wst.xsd.ui.internal.actions.XSDEditNamespacesAction;
+import org.eclipse.wst.xsd.ui.internal.nsedit.TargetNamespaceChangeHandler;
+import org.eclipse.wst.xsd.ui.internal.util.TypesHelper;
+import org.eclipse.xsd.XSDConcreteComponent;
+import org.eclipse.xsd.util.XSDConstants;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+public class XSDSchemaSection extends AbstractSection
+{
+  IWorkbenchPart part;
+  Text prefixText;
+  Text targetNamespaceText;
+  Button editButton;
+  StyledText errorText;
+  Color red;
+
+  /**
+   * 
+   */
+  public XSDSchemaSection()
+  {
+    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);
+
+    GridData data = new GridData();
+
+    // Create Prefix Label
+    CLabel prefixLabel = getWidgetFactory().createCLabel(composite, XSDEditorPlugin.getXSDString("_UI_LABEL_SCHEMA_PREFIX")); //$NON-NLS-1$
+    data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
+    data.grabExcessHorizontalSpace = false;
+    prefixLabel.setLayoutData(data);
+
+    // Create Prefix Text
+    prefixText = getWidgetFactory().createText(composite, "", SWT.NONE); //$NON-NLS-1$
+    data = new GridData();
+    data.grabExcessHorizontalSpace = true;
+    data.horizontalAlignment = GridData.FILL;
+    prefixText.setLayoutData(data);
+    prefixText.addListener(SWT.Modify, this);
+
+    // Create TargetNamespace Label
+    CLabel targetNamespaceLabel = getWidgetFactory().createCLabel(composite, XSDEditorPlugin.getXSDString("_UI_LABEL_TARGET_NAME_SPACE")); //$NON-NLS-1$
+    data = new GridData();
+    data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
+    data.grabExcessHorizontalSpace = false;
+    targetNamespaceLabel.setLayoutData(data);
+
+    // Create TargetNamespace Text
+    targetNamespaceText = getWidgetFactory().createText(composite, "", SWT.NONE); //$NON-NLS-1$
+    data = new GridData();
+    data.grabExcessHorizontalSpace = true;
+    data.horizontalAlignment = GridData.FILL;
+    targetNamespaceText.setLayoutData(data);
+    targetNamespaceText.addListener(SWT.Modify, this);
+
+    // Advanced Button
+    editButton = getWidgetFactory().createButton(composite, XSDEditorPlugin.getXSDString("_UI_SECTION_ADVANCED_ATTRIBUTES") + "...", SWT.PUSH);
+    data = new GridData(SWT.END, SWT.CENTER, true, false);
+    data.horizontalSpan = 2;
+    editButton.setLayoutData(data);
+    editButton.addSelectionListener(this);
+
+    // error text
+    errorText = new StyledText(composite, SWT.FLAT);
+    errorText.setEditable(false);
+    errorText.setEnabled(false);
+    errorText.setText("");
+    data = new GridData();
+    data.horizontalAlignment = GridData.FILL;
+    data.horizontalSpan = 2;
+    data.grabExcessHorizontalSpace = true;
+    errorText.setLayoutData(data);
+
+  }
+
+  /*
+   * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh()
+   */
+  public void refresh()
+  {
+    setListenerEnabled(false);
+
+    Element element = xsdSchema.getElement();
+
+    if (element != null)
+    {
+      // Handle prefixText
+      TypesHelper helper = new TypesHelper(xsdSchema);
+      String aPrefix = helper.getPrefix(element.getAttribute(XSDConstants.TARGETNAMESPACE_ATTRIBUTE), false);
+
+      if (aPrefix != null && aPrefix.length() > 0)
+      {
+        prefixText.setText(aPrefix);
+      }
+      else
+      {
+        prefixText.setText(""); //$NON-NLS-1$
+      }
+
+      // Handle TargetNamespaceText
+      String tns = element.getAttribute(XSDConstants.TARGETNAMESPACE_ATTRIBUTE);
+      if (tns != null && tns.length() > 0)
+      {
+        targetNamespaceText.setText(tns);
+      }
+      else
+      {
+        targetNamespaceText.setText(""); //$NON-NLS-1$
+      }
+      errorText.setText("");
+    }
+    setListenerEnabled(true);
+  }
+
+  public void doHandleEvent(Event event)
+  {
+    errorText.setText("");
+    String prefixValue = prefixText.getText();
+    String tnsValue = targetNamespaceText.getText();
+    if (tnsValue.trim().length() == 0)
+    {
+      if (prefixValue.trim().length() > 0)
+      {
+        errorText.setText(XSDEditorPlugin.getXSDString("_ERROR_TARGET_NAMESPACE_AND_PREFIX"));
+        int length = errorText.getText().length();
+        red = new Color(null, 255, 0, 0);
+        StyleRange style = new StyleRange(0, length, red, targetNamespaceText.getBackground());
+        errorText.setStyleRange(style);
+        return;
+      }
+    }
+
+    if (event.widget == prefixText)
+    {
+      updateNamespaceInfo(prefixValue, tnsValue);
+    }
+    else if (event.widget == targetNamespaceText)
+    {
+      updateNamespaceInfo(prefixValue, tnsValue);
+    }
+  }
+
+  public void doWidgetSelected(SelectionEvent e)
+  {
+    if (e.widget == editButton)
+    {
+      XSDEditNamespacesAction nsAction = new XSDEditNamespacesAction(XSDEditorPlugin.getXSDString("_UI_ACTION_EDIT_NAMESPACES"), xsdSchema.getElement(), null, xsdSchema); //$NON-NLS-1$ 
+      nsAction.run();
+      refresh();
+    }
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISection#shouldUseExtraSpace()
+   */
+  public boolean shouldUseExtraSpace()
+  {
+    return true;
+  }
+
+  private void updateNamespaceInfo(String newPrefix, String newTargetNamespace)
+  {
+    Element element = xsdSchema.getElement();
+    DocumentImpl doc = (DocumentImpl) element.getOwnerDocument();
+
+    String modelTargetNamespace = xsdSchema.getTargetNamespace();
+    String oldNamespace = xsdSchema.getTargetNamespace();
+
+    TypesHelper helper = new TypesHelper(xsdSchema);
+    String oldPrefix = helper.getPrefix(element.getAttribute(XSDConstants.TARGETNAMESPACE_ATTRIBUTE), false);
+
+    if (modelTargetNamespace == null)
+    {
+      modelTargetNamespace = ""; //$NON-NLS-1$
+    }
+
+    String targetNamespace = newTargetNamespace.trim();
+    String prefix = newPrefix.trim();
+
+    if (!validatePrefix(prefix) || !validateTargetNamespace(targetNamespace))
+    {
+      return;
+    }
+
+    if (prefix.length() > 0 && targetNamespace.length() == 0)
+    {
+      // can't have blank targetnamespace and yet specify a prefix
+      return;
+    }
+
+    doc.getModel().beginRecording(this, XSDEditorPlugin.getXSDString("_UI_TARGETNAMESPACE_CHANGE")); //$NON-NLS-1$
+    String xsdForXSDPrefix = xsdSchema.getSchemaForSchemaQNamePrefix();
+    Map map = xsdSchema.getQNamePrefixToNamespaceMap();
+
+    // For debugging
+    // System.out.println("1. SW Map is " + map.values());
+    // System.out.println("1. SW Map keys are " + map.keySet());
+
+    // Check if prefix is blank
+    // if it is, then make sure we have a prefix
+    // for schema for schema
+    if (prefix.length() == 0)
+    {
+      // if prefix for schema for schema is blank
+      // then set it to value specified in preference
+      // and update ALL nodes with this prefix
+      if (xsdForXSDPrefix == null || (xsdForXSDPrefix != null && xsdForXSDPrefix.trim().length() == 0))
+      {
+        // get preference prefix
+        xsdForXSDPrefix = XSDEditorPlugin.getPlugin().getXMLSchemaPrefix();
+        // get a unique prefix by checking what's in the map
+
+        xsdForXSDPrefix = getUniqueSchemaForSchemaPrefix(xsdForXSDPrefix, map);
+        element.setAttribute("xmlns:" + xsdForXSDPrefix, XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001); //$NON-NLS-1$
+
+        updateAllNodes(element, xsdForXSDPrefix);
+
+        // remove the old xmlns attribute for the schema for schema
+        if (element.getAttribute("xmlns") != null && //$NON-NLS-1$
+            element.getAttribute("xmlns").equals(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001)) //$NON-NLS-1$
+        {
+          element.removeAttribute("xmlns"); //$NON-NLS-1$
+        }
+      }
+    }
+
+    if (targetNamespace.length() > 0 || (targetNamespace.length() == 0 && prefix.length() == 0))
+    {
+      // clean up the old prefix for this schema
+      if (oldPrefix != null && oldPrefix.length() > 0)
+      {
+        element.removeAttribute("xmlns:" + oldPrefix); //$NON-NLS-1$
+        // element.setAttribute("xmlns:" + prefix, targetNamespace);
+        // java.util.Map prefixToNameSpaceMap =
+        // xsdSchema.getQNamePrefixToNamespaceMap();
+        // prefixToNameSpaceMap.remove(oldPrefix);
+      }
+      else
+      // if no prefix
+      {
+        if (element.getAttribute("xmlns") != null) //$NON-NLS-1$
+        {
+          if (!element.getAttribute("xmlns").equals(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001)) //$NON-NLS-1$
+          {
+            element.removeAttribute("xmlns"); //$NON-NLS-1$
+          }
+        }
+      }
+    }
+
+    if (targetNamespace.length() > 0)
+    {
+      if (!modelTargetNamespace.equals(targetNamespace))
+      {
+        element.setAttribute(XSDConstants.TARGETNAMESPACE_ATTRIBUTE, targetNamespace);
+      }
+      // now set the new xmlns:prefix attribute
+      if (prefix.length() > 0)
+      {
+        element.setAttribute("xmlns:" + prefix, targetNamespace); //$NON-NLS-1$
+      }
+      else
+      {
+        element.setAttribute("xmlns", targetNamespace); //$NON-NLS-1$
+      }
+      // set the targetNamespace attribute
+    }
+    else
+    // else targetNamespace is blank
+    {
+      if (prefix.length() == 0)
+      {
+        element.removeAttribute(XSDConstants.TARGETNAMESPACE_ATTRIBUTE);
+      }
+    }
+
+    // System.out.println("1.5 SW Map is " + map.values());
+    // System.out.println("1.5 SW Map keys are " + map.keySet());
+
+    // do our own referential integrity
+    TargetNamespaceChangeHandler targetNamespaceChangeHandler = new TargetNamespaceChangeHandler(xsdSchema, oldNamespace, targetNamespace);
+    targetNamespaceChangeHandler.resolve();
+
+    updateElement(xsdSchema);
+
+    
+    doc.getModel().endRecording(this);
+
+    // For debugging
+    // map = xsdSchema.getQNamePrefixToNamespaceMap();
+    // System.out.println("2. SW Map is " + map.values());
+    // System.out.println("2. SW Map keys are " + map.keySet());
+  }
+
+  // issue (cs) I don't have a clue why we need to call this method
+  //
+  private static void updateElement(XSDConcreteComponent concreteComp)
+  {
+    try
+    {
+      concreteComp.updateElement();
+    }
+    catch (Exception e)
+    {
+      for (Iterator containments = concreteComp.eClass().getEAllReferences().iterator(); containments.hasNext(); )
+      {
+        EReference eReference = (EReference)containments.next();
+        if (eReference.isContainment())
+        {
+          if (eReference.isMany())
+          {
+            for (Iterator objects = ((Collection)concreteComp.eGet(eReference)).iterator(); objects.hasNext(); )
+            {
+              XSDConcreteComponent xsdConcreteComponent = (XSDConcreteComponent)objects.next();
+              try
+              {
+                xsdConcreteComponent.updateElement();
+              }
+              catch (Exception ex) {}
+            }
+          }
+          else
+          {
+            XSDConcreteComponent xsdConcreteComponent = (XSDConcreteComponent)concreteComp.eGet(eReference);
+            if (xsdConcreteComponent != null)
+            {
+              try
+              {
+                xsdConcreteComponent.updateElement();
+              }
+              catch (Exception ex) {}
+            }
+          }
+        }
+      }
+    }
+  }      
+  private String getUniqueSchemaForSchemaPrefix(String xsdForXSDPrefix, Map map)
+  {
+    if (xsdForXSDPrefix == null || (xsdForXSDPrefix != null && xsdForXSDPrefix.trim().length() == 0))
+    {
+      xsdForXSDPrefix = "xsd"; //$NON-NLS-1$
+    }
+    // ensure prefix is unique
+    int prefixExtension = 1;
+    while (map.containsKey(xsdForXSDPrefix) && prefixExtension < 100)
+    {
+      xsdForXSDPrefix = xsdForXSDPrefix + String.valueOf(prefixExtension);
+      prefixExtension++;
+    }
+    return xsdForXSDPrefix;
+  }
+
+  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);
+          }
+        }
+      }
+    }
+  }
+
+  private boolean validateTargetNamespace(String ns)
+  {
+    // will allow blank namespace !!
+    if (ns.equals(""))
+    {
+      return true;
+    }
+
+    String errorMessage = null;
+    try
+    {
+      URI testURI = new URI(ns);
+      testURI.isAbsolute();
+    }
+    catch (URISyntaxException e)
+    {
+      errorMessage = XSDEditorPlugin.getXSDString("_WARN_INVALID_TARGET_NAMESPACE"); //$NON-NLS-1$
+    }
+
+    if (errorMessage == null || errorMessage.length() == 0)
+    {
+      return true;
+    }
+    return false;
+  }
+
+  public void dispose()
+  {
+    super.dispose();
+    if (red != null)
+    {
+      red.dispose();
+      red = null;
+    }
+  }
+
+  protected boolean validatePrefix(String prefix)
+  {
+    // TODO
+    return true;
+  }
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/XSDSimpleTypeSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/XSDSimpleTypeSection.java
new file mode 100644
index 0000000..2f95ce6
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/XSDSimpleTypeSection.java
@@ -0,0 +1,653 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.properties.sections;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.StringTokenizer;
+import org.apache.xerces.util.XMLChar;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CCombo;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+import org.eclipse.wst.xsd.ui.common.commands.UpdateNameCommand;
+import org.eclipse.wst.xsd.ui.internal.actions.CreateElementAction;
+import org.eclipse.wst.xsd.ui.internal.actions.DOMAttribute;
+import org.eclipse.wst.xsd.ui.internal.util.XSDDOMHelper;
+import org.eclipse.xsd.XSDConcreteComponent;
+import org.eclipse.xsd.XSDNamedComponent;
+import org.eclipse.xsd.XSDSimpleTypeDefinition;
+import org.eclipse.xsd.XSDVariety;
+import org.eclipse.xsd.util.XSDConstants;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+public class XSDSimpleTypeSection extends AbstractSection
+{
+  protected Text nameText;
+  CCombo varietyCombo;
+  Text typesText;
+  CLabel typesLabel;
+  Button button;
+  XSDSimpleTypeDefinition memberTypeDefinition, itemTypeDefinition, baseTypeDefinition;
+
+  public XSDSimpleTypeSection()
+  {
+    super();
+  }
+
+  protected void createContents(Composite parent)
+  {
+    TabbedPropertySheetWidgetFactory factory = getWidgetFactory();
+    composite = factory.createFlatFormComposite(parent);
+
+    GridData data = new GridData();
+
+    GridLayout gridLayout = new GridLayout();
+    gridLayout.marginTop = 0;
+    gridLayout.marginBottom = 0;
+    gridLayout.numColumns = 3;
+    composite.setLayout(gridLayout);
+
+    // ------------------------------------------------------------------
+    // NameLabel
+    // ------------------------------------------------------------------
+
+    data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
+    data.grabExcessHorizontalSpace = false;
+    CLabel nameLabel = factory.createCLabel(composite, "Name:");
+    nameLabel.setLayoutData(data);
+
+    // ------------------------------------------------------------------
+    // NameText
+    // ------------------------------------------------------------------
+    data = new GridData();
+    data.grabExcessHorizontalSpace = true;
+    data.horizontalAlignment = GridData.FILL;
+    nameText = getWidgetFactory().createText(composite, ""); //$NON-NLS-1$
+    nameText.setLayoutData(data);
+    applyAllListeners(nameText);
+
+    // ------------------------------------------------------------------
+    // DummyLabel
+    // ------------------------------------------------------------------
+    getWidgetFactory().createCLabel(composite, ""); //$NON-NLS-1$
+
+    // Variety Label
+    CLabel label = getWidgetFactory().createCLabel(composite, XSDEditorPlugin.getXSDString("_UI_LABEL_VARIETY")); //$NON-NLS-1$
+
+    // Variety Combo
+    data = new GridData();
+    data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
+    data.grabExcessHorizontalSpace = false;
+    label.setLayoutData(data);
+
+    varietyCombo = getWidgetFactory().createCCombo(composite, SWT.FLAT);
+    data = new GridData();
+    data.grabExcessHorizontalSpace = true;
+    data.horizontalAlignment = GridData.FILL;
+
+    List list = XSDVariety.VALUES;
+    Iterator iter = list.iterator();
+    while (iter.hasNext())
+    {
+      varietyCombo.add(((XSDVariety) iter.next()).getName());
+    }
+    varietyCombo.addSelectionListener(this);
+    varietyCombo.setLayoutData(data);
+
+    // ------------------------------------------------------------------
+    // DummyLabel
+    // ------------------------------------------------------------------
+    getWidgetFactory().createCLabel(composite, ""); //$NON-NLS-1$
+
+    // ------------------------------------------------------------------
+    // Types Label
+    // ------------------------------------------------------------------
+    typesLabel = getWidgetFactory().createCLabel(composite, XSDEditorPlugin.getXSDString("_UI_LABEL_MEMBERTYPES")); //$NON-NLS-1$
+
+    // ------------------------------------------------------------------
+    // Types Text
+    // ------------------------------------------------------------------
+    typesText = getWidgetFactory().createText(composite, ""); //$NON-NLS-1$
+    typesText.addListener(SWT.Modify, this);
+    data = new GridData();
+    data.grabExcessHorizontalSpace = true;
+    data.horizontalAlignment = GridData.FILL;
+    typesText.setLayoutData(data);
+
+    button = getWidgetFactory().createButton(composite, "", SWT.PUSH); //$NON-NLS-1$
+    button.setImage(XSDEditorPlugin.getXSDImage("icons/browsebutton.gif")); //$NON-NLS-1$
+    button.addSelectionListener(this);
+  }
+  
+  public void setInput(IWorkbenchPart part, ISelection selection)
+  {
+    super.setInput(part, selection);
+    relayout();
+  }
+
+  protected void relayout()
+  {
+    Composite parentComposite = composite.getParent();
+    parentComposite.getParent().setRedraw(false);
+
+    if (parentComposite != null && !parentComposite.isDisposed())
+    {
+      Control[] children = parentComposite.getChildren();
+      for (int i = 0; i < children.length; i++)
+      {
+        children[i].dispose();
+      }
+    }
+
+    // Now initialize the new handler
+    createContents(parentComposite);
+    parentComposite.getParent().layout(true, true);
+
+    // Now turn painting back on
+    parentComposite.getParent().setRedraw(true);
+    refresh();
+  }
+
+  public void refresh()
+  {
+    super.refresh();
+
+    setListenerEnabled(false);
+    if (isReadOnly)
+    {
+      composite.setEnabled(false);
+    }
+    else
+    {
+      composite.setEnabled(true);
+    }
+
+    nameText.setText("");
+    varietyCombo.setText(""); //$NON-NLS-1$
+    typesText.setText(""); //$NON-NLS-1$
+    typesLabel.setText(XSDEditorPlugin.getXSDString("_UI_LABEL_BASE_TYPE_WITH_COLON")); //$NON-NLS-1$
+
+    if (input instanceof XSDSimpleTypeDefinition)
+    {
+      XSDSimpleTypeDefinition st = (XSDSimpleTypeDefinition) input;
+      String simpleTypeName = st.getName();
+      if (simpleTypeName != null)
+      {
+        nameText.setText(simpleTypeName);
+      }
+      else
+      {
+        nameText.setText("**anonymous**");
+      }
+      
+      Element simpleTypeElement = st.getElement();
+      Element element = null;
+      String variety = st.getVariety().getName();
+      int intVariety = st.getVariety().getValue();
+
+      if (variety != null)
+      {
+        varietyCombo.setText(variety);
+        if (intVariety == XSDVariety.ATOMIC)
+        {
+          baseTypeDefinition = st.getBaseTypeDefinition();
+          String name = "";
+          if (baseTypeDefinition != null)
+          {
+            name = baseTypeDefinition.getName();
+          }
+          typesText.setText(name);
+          typesLabel.setText(XSDEditorPlugin.getXSDString("_UI_LABEL_BASE_TYPE_WITH_COLON")); //$NON-NLS-1$
+        }
+        else if (intVariety == XSDVariety.LIST)
+        {
+          itemTypeDefinition = st.getItemTypeDefinition();
+          String name = "";
+          if (itemTypeDefinition != null)
+          {
+            name = itemTypeDefinition.getName();
+          }
+          typesText.setText(name);
+          typesLabel.setText(XSDEditorPlugin.getXSDString("_UI_LABEL_ITEM_TYPE")); //$NON-NLS-1$
+        }
+        else if (intVariety == XSDVariety.UNION)
+        {
+          List memberTypesList = st.getMemberTypeDefinitions();
+          StringBuffer sb = new StringBuffer();
+          for (Iterator i = memberTypesList.iterator(); i.hasNext();)
+          {
+            XSDSimpleTypeDefinition typeObject = (XSDSimpleTypeDefinition) i.next();
+            String name = typeObject.getQName();
+            if (name != null)
+            {
+              sb.append(name);
+              if (i.hasNext())
+              {
+                sb.append(" "); //$NON-NLS-1$
+              }
+            }
+          }
+          String memberTypes = sb.toString();
+          typesText.setText(memberTypes);
+          typesLabel.setText(XSDEditorPlugin.getXSDString("_UI_LABEL_MEMBERTYPES")); //$NON-NLS-1$
+        }
+      }
+    }
+    setListenerEnabled(true);
+
+  }
+
+  public void widgetSelected(SelectionEvent e)
+  {
+    if (e.widget == varietyCombo)
+    {
+      if (input != null)
+      {
+        if (input instanceof XSDSimpleTypeDefinition)
+        {
+          XSDSimpleTypeDefinition st = (XSDSimpleTypeDefinition) input;
+          Element parent = st.getElement();
+
+          String variety = varietyCombo.getText();
+          if (variety.equals(XSDVariety.ATOMIC_LITERAL.getName()))
+          {
+            typesLabel.setText(XSDEditorPlugin.getXSDString("_UI_LABEL_BASE_TYPE_WITH_COLON")); //$NON-NLS-1$
+            st.setVariety(XSDVariety.ATOMIC_LITERAL);
+            addCreateElementActionIfNotExist(XSDConstants.RESTRICTION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_RESTRICTION"), parent, null); //$NON-NLS-1$
+          }
+          else if (variety.equals(XSDVariety.UNION_LITERAL.getName()))
+          {
+            typesLabel.setText(XSDEditorPlugin.getXSDString("_UI_LABEL_MEMBERTYPES")); //$NON-NLS-1$
+            st.setVariety(XSDVariety.UNION_LITERAL);
+            addCreateElementActionIfNotExist(XSDConstants.UNION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_UNION"), parent, null); //$NON-NLS-1$
+          }
+          else if (variety.equals(XSDVariety.LIST_LITERAL.getName()))
+          {
+            typesLabel.setText(XSDEditorPlugin.getXSDString("_UI_LABEL_ITEM_TYPE")); //$NON-NLS-1$
+            st.setVariety(XSDVariety.LIST_LITERAL);
+            addCreateElementActionIfNotExist(XSDConstants.LIST_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_LIST"), parent, null); //$NON-NLS-1$
+          }
+        }
+      }
+    }
+    else if (e.widget == button)
+    {
+      Shell shell = Display.getCurrent().getActiveShell();
+      Element element = ((XSDConcreteComponent) input).getElement();
+      Dialog dialog = null;
+      String property = "";
+      Element secondaryElement = null;
+
+      IFile currentIFile = ((IFileEditorInput) getActiveEditor().getEditorInput()).getFile();
+      
+      // issue (cs) need to move to common.ui's selection dialog
+      /*
+      XSDComponentSelectionProvider provider = new XSDComponentSelectionProvider(currentIFile, xsdSchema);
+      dialog = new XSDComponentSelectionDialog(shell, XSDEditorPlugin.getXSDString("_UI_LABEL_SET_TYPE"), provider);
+      provider.setDialog((XSDComponentSelectionDialog) dialog);
+
+      if (input instanceof XSDSimpleTypeDefinition)
+      {
+        XSDSimpleTypeDefinition st = (XSDSimpleTypeDefinition) input;
+        Element simpleTypeElement = st.getElement();
+        if (st.getVariety() == XSDVariety.LIST_LITERAL)
+        {
+          Element listElement = (Element) itemTypeDefinition.getElement();
+          // dialog = new TypesDialog(shell, listElement,
+          // XSDConstants.ITEMTYPE_ATTRIBUTE, xsdSchema);
+          // dialog.showComplexTypes = false;
+          provider.showComplexTypes(false);
+
+          secondaryElement = listElement;
+          property = XSDConstants.ITEMTYPE_ATTRIBUTE;
+        }
+        else if (st.getVariety() == XSDVariety.ATOMIC_LITERAL)
+        {
+          Element derivedByElement = (Element) baseTypeDefinition.getElement();
+          if (derivedByElement != null)
+          {
+            // dialog = new TypesDialog(shell, derivedByElement,
+            // XSDConstants.BASE_ATTRIBUTE, xsdSchema);
+            // dialog.showComplexTypes = false;
+            provider.showComplexTypes(false);
+
+            secondaryElement = derivedByElement;
+            property = XSDConstants.BASE_ATTRIBUTE;
+          }
+          else
+          {
+            return;
+          }
+        }
+        else if (st.getVariety() == XSDVariety.UNION_LITERAL)
+        {
+          SimpleContentUnionMemberTypesDialog unionDialog = new SimpleContentUnionMemberTypesDialog(shell, st);
+          unionDialog.setBlockOnOpen(true);
+          unionDialog.create();
+
+          int result = unionDialog.open();
+          if (result == Window.OK)
+          {
+            String newValue = unionDialog.getResult();
+            // beginRecording(XSDEditorPlugin.getXSDString("_UI_LABEL_MEMBERTYPES_CHANGE"),
+            // element); //$NON-NLS-1$
+            Element unionElement = (Element) memberTypeDefinition.getElement();
+            unionElement.setAttribute(XSDConstants.MEMBERTYPES_ATTRIBUTE, newValue);
+
+            if (newValue.length() > 0)
+            {
+              unionElement.setAttribute(XSDConstants.MEMBERTYPES_ATTRIBUTE, newValue);
+            }
+            else
+            {
+              unionElement.removeAttribute(XSDConstants.MEMBERTYPES_ATTRIBUTE);
+            }
+            // endRecording(unionElement);
+            refresh();
+          }
+          return;
+        }
+        else
+        {
+          property = "type";
+        }
+      }
+      else
+      {
+        property = "type";
+      }
+      // beginRecording(XSDEditorPlugin.getXSDString("_UI_TYPE_CHANGE"),
+      // element); //$NON-NLS-1$
+      dialog.setBlockOnOpen(true);
+      dialog.create();
+      int result = dialog.open();
+
+      if (result == Window.OK)
+      {
+        if (secondaryElement == null)
+        {
+          secondaryElement = element;
+        }
+        XSDSetTypeHelper helper = new XSDSetTypeHelper(currentIFile, xsdSchema);
+        helper.setType(secondaryElement, property, ((XSDComponentSelectionDialog) dialog).getSelection());
+
+        XSDSimpleTypeDefinition st = (XSDSimpleTypeDefinition) input;
+        st.setElement(element);
+        updateSimpleTypeFacets();*/
+      }
+      // endRecording(element);
+    
+    refresh();
+  }
+
+  public boolean shouldUseExtraSpace()
+  {
+    return false;
+  }
+
+  // issue (cs) this method seems to be utilizing 'old' classes, can we reimplement?
+  // (e.g. ChangeElementAction, XSDDOMHelper, etc)
+  protected boolean addCreateElementActionIfNotExist(String elementTag, String label, Element parent, Node relativeNode)
+  {
+    XSDSimpleTypeDefinition st = (XSDSimpleTypeDefinition) input;
+    List attributes = new ArrayList();
+    String reuseType = null;
+
+    // beginRecording(XSDEditorPlugin.getXSDString("_UI_LABEL_VARIETY_CHANGE"),
+    // parent); //$NON-NLS-1$
+    if (elementTag.equals(XSDConstants.RESTRICTION_ELEMENT_TAG))
+    {
+      Element listNode = getFirstChildNodeIfExists(parent, XSDConstants.LIST_ELEMENT_TAG, false);
+      if (listNode != null)
+      {
+        reuseType = listNode.getAttribute(XSDConstants.ITEMTYPE_ATTRIBUTE);
+        XSDDOMHelper.removeNodeAndWhitespace(listNode);
+      }
+
+      Element unionNode = getFirstChildNodeIfExists(parent, XSDConstants.UNION_ELEMENT_TAG, false);
+      if (unionNode != null)
+      {
+        String memberAttr = unionNode.getAttribute(XSDConstants.MEMBERTYPES_ATTRIBUTE);
+        if (memberAttr != null)
+        {
+          StringTokenizer stringTokenizer = new StringTokenizer(memberAttr);
+          reuseType = stringTokenizer.nextToken();
+        }
+        XSDDOMHelper.removeNodeAndWhitespace(unionNode);
+      }
+
+      if (reuseType == null)
+      {
+        reuseType = getBuiltInStringQName();
+      }
+      attributes.add(new DOMAttribute(XSDConstants.BASE_ATTRIBUTE, reuseType));
+      st.setItemTypeDefinition(null);
+    }
+    else if (elementTag.equals(XSDConstants.LIST_ELEMENT_TAG))
+    {
+      Element restrictionNode = getFirstChildNodeIfExists(parent, XSDConstants.RESTRICTION_ELEMENT_TAG, false);
+      if (restrictionNode != null)
+      {
+        reuseType = restrictionNode.getAttribute(XSDConstants.BASE_ATTRIBUTE);
+        XSDDOMHelper.removeNodeAndWhitespace(restrictionNode);
+      }
+      Element unionNode = getFirstChildNodeIfExists(parent, XSDConstants.UNION_ELEMENT_TAG, false);
+      if (unionNode != null)
+      {
+        String memberAttr = unionNode.getAttribute(XSDConstants.MEMBERTYPES_ATTRIBUTE);
+        if (memberAttr != null)
+        {
+          StringTokenizer stringTokenizer = new StringTokenizer(memberAttr);
+          reuseType = stringTokenizer.nextToken();
+        }
+        XSDDOMHelper.removeNodeAndWhitespace(unionNode);
+      }
+      attributes.add(new DOMAttribute(XSDConstants.ITEMTYPE_ATTRIBUTE, reuseType));
+    }
+    else if (elementTag.equals(XSDConstants.UNION_ELEMENT_TAG))
+    {
+      Element listNode = getFirstChildNodeIfExists(parent, XSDConstants.LIST_ELEMENT_TAG, false);
+      if (listNode != null)
+      {
+        reuseType = listNode.getAttribute(XSDConstants.ITEMTYPE_ATTRIBUTE);
+        XSDDOMHelper.removeNodeAndWhitespace(listNode);
+      }
+      Element restrictionNode = getFirstChildNodeIfExists(parent, XSDConstants.RESTRICTION_ELEMENT_TAG, false);
+      if (restrictionNode != null)
+      {
+        reuseType = restrictionNode.getAttribute(XSDConstants.BASE_ATTRIBUTE);
+        XSDDOMHelper.removeNodeAndWhitespace(restrictionNode);
+      }
+      attributes.add(new DOMAttribute(XSDConstants.MEMBERTYPES_ATTRIBUTE, reuseType));
+      st.setItemTypeDefinition(null);
+    }
+
+    if (getFirstChildNodeIfExists(parent, elementTag, false) == null)
+    {
+      Action action = addCreateElementAction(elementTag, label, attributes, parent, relativeNode);
+      action.run();
+    }
+
+    st.setElement(parent);
+    st.updateElement();
+    // endRecording(parent);
+    return true;
+  }
+
+  protected Action addCreateElementAction(String elementTag, String label, List attributes, Element parent, Node relativeNode)
+  {
+    CreateElementAction action = new CreateElementAction(label);
+    action.setElementTag(elementTag);
+    action.setAttributes(attributes);
+    action.setParentNode(parent);
+    action.setRelativeNode(relativeNode);
+    return action;
+  }
+
+  protected Element getFirstChildNodeIfExists(Node parent, String elementTag, boolean isRef)
+  {
+    NodeList children = parent.getChildNodes();
+    Element targetNode = null;
+    for (int i = 0; i < children.getLength(); i++)
+    {
+      Node child = children.item(i);
+      if (child != null && child instanceof Element)
+      {
+        if (XSDDOMHelper.inputEquals((Element) child, elementTag, isRef))
+        {
+          targetNode = (Element) child;
+          break;
+        }
+      }
+    }
+    return targetNode;
+  }
+
+  protected String getBuiltInStringQName()
+  {
+    String stringName = "string"; //$NON-NLS-1$
+
+    if (xsdSchema != null)
+    {
+      String schemaForSchemaPrefix = xsdSchema.getSchemaForSchemaQNamePrefix();
+      if (schemaForSchemaPrefix != null && schemaForSchemaPrefix.length() > 0)
+      {
+        String prefix = xsdSchema.getSchemaForSchemaQNamePrefix();
+        if (prefix != null && prefix.length() > 0)
+        {
+          stringName = prefix + ":" + stringName; //$NON-NLS-1$
+        }
+      }
+    }
+    return stringName;
+  }
+
+  private void updateSimpleTypeFacets()
+  {
+    XSDSimpleTypeDefinition st = (XSDSimpleTypeDefinition) input;
+    Element simpleTypeElement = st.getElement();
+    Element derivedByElement = baseTypeDefinition.getElement();
+    if (derivedByElement != null)
+    {
+      List nodesToRemove = new ArrayList();
+      NodeList childList = derivedByElement.getChildNodes();
+      int length = childList.getLength();
+      for (int i = 0; i < length; i++)
+      {
+        Node child = childList.item(i);
+        if (child instanceof Element)
+        {
+          Element elementChild = (Element) child;
+          if (!(elementChild.getLocalName().equals("pattern") || elementChild.getLocalName().equals("enumeration") || //$NON-NLS-1$
+              XSDDOMHelper.inputEquals(elementChild, XSDConstants.SIMPLETYPE_ELEMENT_TAG, false) || XSDDOMHelper.inputEquals(elementChild, XSDConstants.ANNOTATION_ELEMENT_TAG, false)
+              || XSDDOMHelper.inputEquals(elementChild, XSDConstants.ATTRIBUTE_ELEMENT_TAG, false) || XSDDOMHelper.inputEquals(elementChild, XSDConstants.ATTRIBUTE_ELEMENT_TAG, true)
+              || XSDDOMHelper.inputEquals(elementChild, XSDConstants.ATTRIBUTEGROUP_ELEMENT_TAG, false) || XSDDOMHelper.inputEquals(elementChild, XSDConstants.ATTRIBUTEGROUP_ELEMENT_TAG, true) || XSDDOMHelper.inputEquals(elementChild,
+              XSDConstants.ANYATTRIBUTE_ELEMENT_TAG, false)))
+          {
+            nodesToRemove.add(child);
+          }
+        }
+      }
+      Iterator iter = nodesToRemove.iterator();
+      while (iter.hasNext())
+      {
+        Element facetToRemove = (Element) iter.next();
+        String facetName = facetToRemove.getLocalName();
+        Iterator it = st.getValidFacets().iterator();
+        boolean doRemove = true;
+        while (it.hasNext())
+        {
+          String aValidFacet = (String) it.next();
+          if (aValidFacet.equals(facetName))
+          {
+            doRemove = false;
+            break;
+          }
+        }
+        if (doRemove)
+        {
+          XSDDOMHelper.removeNodeAndWhitespace(facetToRemove);
+        }
+      }
+    }
+  }
+ // TODO: Common this up with element declaration
+  public void doHandleEvent(Event event) 
+  {
+    if (event.widget == nameText)
+    {
+      String newValue = nameText.getText().trim();
+      if (input instanceof XSDNamedComponent)
+      {
+        XSDNamedComponent namedComponent = (XSDNamedComponent)input;
+        if (!validateSection())
+          return;
+
+        Command command = null;
+
+        // Make sure an actual name change has taken place
+        String oldName = namedComponent.getName();
+        if (!newValue.equals(oldName))
+        {
+          command = new UpdateNameCommand("Rename", namedComponent, newValue);
+        }
+
+        if (command != null && getCommandStack() != null)
+        {
+          getCommandStack().execute(command);
+        }
+
+      }
+    }
+  }
+  
+  protected boolean validateSection()
+  {
+    if (nameText == null || nameText.isDisposed())
+      return true;
+
+    setErrorMessage(null);
+
+    String name = nameText.getText().trim();
+
+    // validate against NCName
+    if (name.length() < 1 || !XMLChar.isValidNCName(name))
+    {
+      setErrorMessage("Invalid name");
+      return false;
+    }
+
+    return true;
+  }
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/XSDTableTreeViewer.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/XSDTableTreeViewer.java
new file mode 100644
index 0000000..2738861
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/XSDTableTreeViewer.java
@@ -0,0 +1,127 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 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.common.properties.sections;
+
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
+import org.eclipse.wst.xml.ui.internal.tabletree.XMLTableTreeContentProvider;
+import org.eclipse.wst.xml.ui.internal.tabletree.XMLTableTreeViewer;
+import org.w3c.dom.Element;
+
+public class XSDTableTreeViewer extends XMLTableTreeViewer
+{
+
+  String filter = "";
+
+  class XSDActionMenuListener implements IMenuListener
+  {
+    public void menuAboutToShow(IMenuManager menuManager)
+    {
+      // used to disable NodeSelection listening while running NodeAction
+      // XSDActionManager nodeActionManager = new XSDActionManager(fModel,
+      // XSDTableTreeViewer.this);
+      // nodeActionManager.setCommandStack(commandStack);
+      // nodeActionManager.fillContextMenu(menuManager, getSelection());
+
+      // used to disable NodeSelection listening while running NodeAction
+      // XMLNodeActionManager nodeActionManager = new
+      // XMLNodeActionManager(((IDOMDocument) getInput()).getModel(),
+      // XMLTableTreeViewer.this) {
+      if (getInput() != null)
+      {
+        XSDActionManager nodeActionManager = new XSDActionManager(((IDOMDocument) (((Element) getInput()).getOwnerDocument())).getModel(), XSDTableTreeViewer.this);
+        // nodeActionManager.setCommandStack(commandStack);
+        nodeActionManager.fillContextMenu(menuManager, getSelection());
+      }
+
+    }
+  }
+
+  public XSDTableTreeViewer(Composite parent)
+  {
+    super(parent);
+    // treeExtension.setCellModifier(null);
+    getTree().setLinesVisible(true);
+
+    // treeExtension = new XMLTreeExtension(getTree());
+
+    // Reassign the content provider
+    XMLTableTreeContentProvider provider = new MyContentProvider();
+    // provider.addViewer(this);
+
+    setContentProvider(provider);
+    setLabelProvider(provider);
+
+    // setViewerSelectionManager(new ViewerSelectionManagerImpl(null));
+  }
+
+  protected Object getRoot()
+  {
+    return super.getRoot();
+  }
+
+  public void setFilter(String filter)
+  {
+    this.filter = filter;
+  }
+
+  protected void createContextMenu()
+  {
+    // TODO Verify if this is okay to override the MenuManager
+    MenuManager contextMenu = new MenuManager("#PopUp"); //$NON-NLS-1$
+    contextMenu.add(new Separator("additions")); //$NON-NLS-1$
+    contextMenu.setRemoveAllWhenShown(true);
+
+    // This is the line we have to modify
+    contextMenu.addMenuListener(new XSDActionMenuListener());
+    Menu menu = contextMenu.createContextMenu(getControl());
+    getControl().setMenu(menu);
+  }
+
+  boolean added = false;
+
+  class MyContentProvider extends XMLTableTreeContentProvider
+  {
+
+    // public Object[] getChildren(Object element) {
+    //			
+    // if (!added) {
+    // if (element instanceof Element) {
+    // added = true;
+    // Element elem = (Element)element;
+    // System.out.println("getChildren " + elem.getLocalName());
+    // if (elem instanceof INodeNotifier) {
+    // viewerNotifyingAdapterFactory.adapt((INodeNotifier) elem);
+    // }
+    // // return new Object[] {elem};
+    // }
+    // }
+    // return super.getChildren(element);
+    // }
+
+    public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
+    {
+      added = false;
+      if (oldInput instanceof Element)
+        oldInput = ((Element) oldInput).getOwnerDocument();
+
+      if (newInput instanceof Element)
+        newInput = ((Element) newInput).getOwnerDocument();
+      super.inputChanged(viewer, oldInput, newInput);
+    }
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/appinfo/AddApplicationInfoDialog.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/appinfo/AddApplicationInfoDialog.java
new file mode 100644
index 0000000..1596ee7
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/appinfo/AddApplicationInfoDialog.java
@@ -0,0 +1,524 @@
+/*******************************************************************************
+ * Copyright (c) 2006 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.common.properties.sections.appinfo;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.xerces.dom.DocumentImpl;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Cursor;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.ui.dialogs.SelectionDialog;
+import org.eclipse.wst.xsd.contentmodel.internal.XSDImpl;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+import org.eclipse.xsd.XSDAttributeDeclaration;
+import org.eclipse.xsd.XSDElementDeclaration;
+import org.eclipse.xsd.XSDSchema;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+public class AddApplicationInfoDialog extends SelectionDialog implements ISelectionChangedListener, SelectionListener
+{
+  // when this dialog is created it needs to know which registry it is going to use,the WSDL or the XSD,
+  // hence we need this field
+  ApplicationInformationPropertiesRegistry registry;
+  
+  protected static final Image DEFAULT_ELEMENT_ICON = XSDEditorPlugin.getXSDImage("icons/XSDElement.gif");
+  protected static final Image DEFAULT_ATTRIBUTE_ICON = XSDEditorPlugin.getXSDImage("icons/XSDAttribute.gif");
+
+  /** A temporary Document in which we create temporary DOM element for each element in the
+   * Element view. (required by LabelProvider)  */ 
+  protected static Document tempDoc = new DocumentImpl();
+  
+  Button addButton, removeButton;
+
+  public AddApplicationInfoDialog(Shell parent, ApplicationInformationPropertiesRegistry registry)
+  {
+    super(parent);
+    setTitle("Add Extension Components");
+    setShellStyle(SWT.APPLICATION_MODAL | SWT.RESIZE | SWT.CLOSE);
+    
+    this.registry = registry;
+  }
+
+  private IStructuredContentProvider categoryContentProvider, elementContentProvider;
+  private ILabelProvider categoryLabelProvider, elementLabelProvider;
+  private List fInput;
+
+  private TableViewer categoryTableViewer, elementTableViewer;
+  private ArrayList existingNames;
+
+  public void setInput(List input)
+  {
+    this.fInput = input;
+  }
+
+  protected Control createDialogArea(Composite container)
+  {
+    Composite parent = (Composite) super.createDialogArea(container);
+
+    Composite categoryComposite = new Composite(parent, SWT.NONE);
+    GridLayout gl = new GridLayout();
+    gl.numColumns = 2;
+    gl.marginHeight = 0;
+    gl.marginWidth = 0;
+    GridData data = new GridData(GridData.FILL_BOTH);
+    categoryComposite.setLayoutData(data);
+    categoryComposite.setLayout(gl);
+
+    Label label = new Label(categoryComposite, SWT.LEFT);
+    label.setText("Extension Categories:");
+
+    new Label(categoryComposite, SWT.NONE);
+
+    categoryTableViewer = new TableViewer(categoryComposite, getTableStyle());
+    categoryTableViewer.setContentProvider(new CategoryContentProvider());
+    categoryTableViewer.setLabelProvider(new CategoryLabelProvider());
+    categoryTableViewer.setInput(fInput);
+    categoryTableViewer.addSelectionChangedListener(this);
+
+    GridData gd = new GridData(GridData.FILL_BOTH);
+    Table table = categoryTableViewer.getTable();
+    table.setLayoutData(gd);
+    table.setFont(container.getFont());
+
+    Composite buttonComposite = new Composite(categoryComposite, SWT.NONE);
+    gl = new GridLayout();
+    gl.makeColumnsEqualWidth = true;
+    gl.numColumns = 1;
+    data = new GridData();
+    data.horizontalAlignment = SWT.FILL;
+    buttonComposite.setLayoutData(data);
+    buttonComposite.setLayout(gl);
+
+    addButton = new Button(buttonComposite, SWT.PUSH);
+    addButton.setText("Add...");
+    addButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+    addButton.addSelectionListener(this);
+
+    removeButton = new Button(buttonComposite, SWT.PUSH);
+    removeButton.setText("Remove");
+    removeButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+    removeButton.addSelectionListener(this);
+
+    List initialSelection = getInitialElementSelections();
+    if (initialSelection != null)
+      categoryTableViewer.setSelection(new StructuredSelection(initialSelection));
+
+    Label elementLabel = new Label(categoryComposite, SWT.LEFT);
+    elementLabel.setText("Available components to Add:");
+
+    new Label(categoryComposite, SWT.NONE);
+
+    elementTableViewer = new TableViewer(categoryComposite, getTableStyle());
+    elementTableViewer.setContentProvider(new ElementContentProvider());
+    elementTableViewer.setLabelProvider(new ElementLabelProvider());
+    elementTableViewer.setInput(null);
+    elementTableViewer.addDoubleClickListener(new IDoubleClickListener()
+    {
+      public void doubleClick(DoubleClickEvent event)
+      {
+        okPressed();
+      }
+    });
+    
+    gd = new GridData(GridData.FILL_BOTH);
+    table = elementTableViewer.getTable();
+    table.setLayoutData(gd);
+    table.setFont(container.getFont());
+
+    elementTableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+		public void selectionChanged(SelectionChangedEvent event) {
+	          getButton(IDialogConstants.OK_ID).setEnabled(true);			
+	    }        	  
+      });
+    
+    return parent;
+  }
+
+  public void create()
+  {
+    super.create();
+    if (categoryTableViewer.getTable().getItemCount() > 0)
+    {
+      categoryTableViewer.getTable().select(0);
+      categoryTableViewer.setSelection(new StructuredSelection(categoryTableViewer.getElementAt(0)));
+    }
+    
+    // Setup the list of category names that already exist
+	existingNames = new ArrayList();
+	TableItem[] categoryNames = categoryTableViewer.getTable().getItems();
+	for (int i = 0; i < categoryNames.length; i++ ){
+		existingNames.add(categoryNames[i].getText());
+	}
+	
+	getButton(IDialogConstants.OK_ID).setEnabled(false);
+  }
+
+  protected Point getInitialSize()
+  {
+    return getShell().computeSize(400, 300);
+  }
+
+  /**
+   * Return the style flags for the table viewer.
+   * 
+   * @return int
+   */
+  protected int getTableStyle()
+  {
+    return SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER;
+  }
+
+  /*
+   * Overrides method from Dialog
+   */
+  protected void okPressed()
+  {
+    // Build a list of selected children.
+    getShell().setCursor(new Cursor(getShell().getDisplay(), SWT.CURSOR_WAIT));
+    IStructuredSelection elementSelection = (IStructuredSelection) elementTableViewer.getSelection();
+    IStructuredSelection categorySelection = (IStructuredSelection) categoryTableViewer.getSelection();
+    List result = new ArrayList();
+    result.add(elementSelection.getFirstElement());
+    result.add(categorySelection.getFirstElement());
+    if (elementSelection.getFirstElement() != null)
+    {
+      setResult(result);
+    }
+    else
+    {
+      setResult(null);
+    }
+    super.okPressed();
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+   */
+  public void widgetSelected(SelectionEvent e)
+  {
+    if (e.widget == addButton)
+    {
+    	AddNewCategoryDialog addNewCategoryDialog
+    		= new AddNewCategoryDialog(getShell());
+    	
+    	addNewCategoryDialog.setUnavailableCategoryNames(existingNames);
+    	
+    	if ( addNewCategoryDialog.open() == Window.OK ){
+    		String location = addNewCategoryDialog.getAppInfoSchemaLocation();
+    		
+    		SpecificationForAppinfoSchema schemaSpec = new SpecificationForAppinfoSchema();
+    		schemaSpec.setDisplayName(addNewCategoryDialog.getNewCategoryName());
+    		schemaSpec.setLocation(location);
+    		
+    		fInput.add(schemaSpec);
+    		existingNames.add(schemaSpec.getDisplayName());
+    		
+    		// refresh without updating labels of existing TableItems    		
+    		categoryTableViewer.refresh(false);
+    		
+    		categoryTableViewer.setSelection(new StructuredSelection(schemaSpec));
+    		getButton(IDialogConstants.OK_ID).setEnabled(false);
+    	}
+    }
+    else if (e.widget == removeButton)
+    {
+    	TableItem[] selections = categoryTableViewer.getTable().getSelection();
+    	for (int i =0; i < selections.length; i++){
+    		fInput.remove(selections[i].getData() );
+    	}
+    	categoryTableViewer.refresh(false);
+
+    	elementTableViewer.setInput(null);
+    	elementTableViewer.refresh();
+    	
+        // TODO auto select either the prev category, the next category or the first category in the Table
+    	getButton(IDialogConstants.OK_ID).setEnabled(false);
+    }
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent)
+   */
+  public void widgetDefaultSelected(SelectionEvent event)
+  {
+
+  }
+
+  public void selectionChanged(SelectionChangedEvent event)
+  {
+    if (event.getSource() == categoryTableViewer)
+    {
+      ISelection selection = event.getSelection();
+      if (selection instanceof StructuredSelection)
+      {
+        Object obj = ((StructuredSelection) selection).getFirstElement();
+        if (obj instanceof SpecificationForAppinfoSchema)
+        {
+          SpecificationForAppinfoSchema properties = (SpecificationForAppinfoSchema) obj;
+
+          XSDSchema xsdSchema = getASISchemaModel(properties);
+
+          if (xsdSchema == null){
+        	  // TODO display an error Dialog telling the user that
+        	  // her selected schema file is invalid. 
+        	  return;
+          }
+          
+          List allItems = buildInput(xsdSchema);
+          elementTableViewer.setInput(allItems);
+          getButton(IDialogConstants.OK_ID).setEnabled(false);
+        }
+      }
+    }
+  }
+  private List buildInput(XSDSchema xsdSchema)
+  {
+    List elements = xsdSchema.getElementDeclarations();
+    List attributes = xsdSchema.getAttributeDeclarations();
+    String targetNamespace = xsdSchema.getTargetNamespace();
+
+    // For safety purpose: We don't append 'attributes' to 'elements'
+    // ArrayStoreException(or similar one) may occur
+    List allItems = new ArrayList(attributes.size() + elements.size());
+    {
+      // getElementDeclarations returns a lot of elements from import
+      // statement, we
+      // only add non-imported elements here. (trung)
+      for (int i = 0; i < elements.size(); i++)
+      {
+        XSDElementDeclaration currentElement = (XSDElementDeclaration) elements.get(i);
+        if (currentElement.getTargetNamespace().equals(targetNamespace))
+          allItems.add(currentElement);
+      }
+      // getAttributeDeclarations also returns a lot of elements from
+      // import statement, we
+      // only add non-imported elements here. (trung)
+      for (int i = 0; i < attributes.size(); i++)
+      {
+        XSDAttributeDeclaration currentAttribute = (XSDAttributeDeclaration) attributes.get(i);
+        if (currentAttribute.isGlobal() && currentAttribute.getTargetNamespace().equals(targetNamespace))
+          allItems.add(currentAttribute);
+      }
+    }
+    return allItems;
+  }
+
+  
+  private XSDSchema getASISchemaModel(SpecificationForAppinfoSchema appInfoSchemaSpec)
+  {
+    XSDSchema xsdSchema = XSDImpl.buildXSDModel(appInfoSchemaSpec.getLocation());
+    
+    // now that the .xsd file is read, we can retrieve the namespace of this xsd file
+    // and set the namespace for 'properties'
+    if ( appInfoSchemaSpec.getNamespaceURI() == null){
+    	appInfoSchemaSpec.setNamespaceURI( xsdSchema.getTargetNamespace());
+    }
+    
+    return xsdSchema;
+  }
+
+  static class CategoryContentProvider implements IStructuredContentProvider
+  {
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
+     */
+    public Object[] getElements(Object inputElement)
+    {    
+      SpecificationForAppinfoSchema[] appInfoSchemaSpecs = null;
+      try
+      {
+        List inputList = (List) inputElement;
+        appInfoSchemaSpecs = (SpecificationForAppinfoSchema[]) inputList.toArray(new SpecificationForAppinfoSchema[0]);
+      }
+      catch (Exception e)
+      {
+        e.printStackTrace();
+      }
+      return appInfoSchemaSpecs;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+     */
+    public void dispose()
+    {
+      // Do nothing
+
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer,
+     *      java.lang.Object, java.lang.Object)
+     */
+    public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
+    {
+      // Do nothing
+
+    }
+  }
+
+  static class CategoryLabelProvider extends LabelProvider
+  {
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
+     */
+    public Image getImage(Object element)
+    {
+      return XSDEditorPlugin.getXSDImage("icons/appinfo_category.gif");
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
+     */
+    public String getText(Object element)
+    {
+      if (element instanceof SpecificationForAppinfoSchema)
+        return ((SpecificationForAppinfoSchema) element).getDisplayName();
+
+      return super.getText(element);
+    }
+  }
+
+  static class ElementContentProvider implements IStructuredContentProvider
+  {
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
+     */
+    public Object[] getElements(Object inputElement)
+    {
+      if (inputElement instanceof List)
+      {
+        return ((List) inputElement).toArray();
+      }
+      return null;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+     */
+    public void dispose()
+    {
+      // Do nothing
+
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer,
+     *      java.lang.Object, java.lang.Object)
+     */
+    public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
+    {
+      // Do nothing
+
+    }
+  }
+
+  class ElementLabelProvider extends LabelProvider
+  {
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
+     */
+    public Image getImage(Object element)
+    {
+      if ( element instanceof XSDElementDeclaration){
+    	  
+    	  // Workaround trick: (trung) we create a temporary Dom element and put it in the label provider
+    	  // to get the image.
+    	  String namespace = ((XSDElementDeclaration) element).getSchema().getTargetNamespace();
+    	  String name = ((XSDElementDeclaration) element).getName();
+    	  Element tempElement = tempDoc.createElementNS(namespace, name);
+    	  ILabelProvider lp = registry.getLabelProvider(tempElement);
+    	  if (lp != null){
+    		  Image img = lp.getImage(tempElement);
+    		  
+    		  if (img != null){
+    			  return img;
+    		  }
+    	  }
+    	  return DEFAULT_ELEMENT_ICON;
+      }
+      else if ( element instanceof XSDAttributeDeclaration){
+    	  return DEFAULT_ATTRIBUTE_ICON;
+      }
+      return null;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
+     */
+    public String getText(Object element)
+    {
+      if (element instanceof XSDElementDeclaration)
+        return ((XSDElementDeclaration) element).getName();
+      if (element instanceof XSDAttributeDeclaration )
+        return ((XSDAttributeDeclaration) element).getName();
+      return super.getText(element);
+    }
+  }
+
+  public boolean close()
+  {
+    return super.close();
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/appinfo/AddNewCategoryDialog.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/appinfo/AddNewCategoryDialog.java
new file mode 100644
index 0000000..4b7787e
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/appinfo/AddNewCategoryDialog.java
@@ -0,0 +1,304 @@
+/*******************************************************************************
+ * Copyright (c) 2006 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.common.properties.sections.appinfo;
+
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.ToolItem;
+import org.eclipse.wst.common.ui.internal.dialogs.SelectSingleFileDialog;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+
+public class AddNewCategoryDialog extends Dialog
+{
+
+  private static final String SCHEMA_LABEL = "Schema:";
+  private static final String DIALOG_TITLE = "Add Category";
+  private static final String NAME_LABEL = "Name:";
+  private MenuManager browseMenu;
+  private Label name;
+  private Text nameText;
+  private Label schema;
+  private CLabel schemaDisplayer;
+  private ToolBar browseToolBar;
+  private ToolItem browseItem;
+
+  private List invalidNames;
+  private String appInfoSchemaLocation;
+  private String categoryName;
+  private CLabel errDisplayer;
+
+  private boolean isCategoryNameValid;
+
+  public AddNewCategoryDialog(Shell parentShell)
+  {
+    super(parentShell);
+  }
+
+  /**
+   * receive a List of names which have already been added to the category list
+   * 
+   * @param unavailNames
+   *          Array of unvailable names
+   */
+  public void setUnavailableCategoryNames(List unavailNames)
+  {
+    invalidNames = unavailNames;
+  }
+
+  // we initially disable the Ok button
+  protected Control createButtonBar(Composite parent)
+  {
+    Control result = super.createButtonBar(parent);
+    getButton(IDialogConstants.OK_ID).setEnabled(false);
+    return result;
+  }
+
+  protected Control createDialogArea(Composite parent)
+  {
+    getShell().setText(DIALOG_TITLE);
+
+    Composite mainComposite = (Composite) super.createDialogArea(parent);
+    GridLayout layout = new GridLayout(3, false);
+    layout.marginTop = 10;
+    mainComposite.setLayout(layout);
+    mainComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
+    GridData data = new GridData();
+    data.widthHint = 400;
+
+    mainComposite.setLayoutData(data);
+
+    // Line 1, name
+    name = new Label(mainComposite, SWT.NONE);
+    name.setText(NAME_LABEL);
+
+    nameText = new Text(mainComposite, SWT.BORDER | SWT.SINGLE);
+    nameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+    Button hidden = new Button(mainComposite, SWT.NONE);
+    hidden.setVisible(false);
+
+    // Line 2, schema
+    schema = new Label(mainComposite, SWT.NONE);
+    schema.setText(SCHEMA_LABEL);
+
+    schemaDisplayer = new CLabel(mainComposite, SWT.BORDER | SWT.SINGLE);
+    schemaDisplayer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+    browseToolBar = new ToolBar(mainComposite, SWT.FLAT);
+    browseItem = new ToolItem(browseToolBar, SWT.NONE);
+    // TODO: Should be able to get the image from the XML plugin. Don't need
+    // to copy to XSDEditor icons folder like this.
+    browseItem.setImage(XSDEditorPlugin.getXSDImage("icons/appinfo_browse.gif"));
+
+    browseMenu = new MenuManager();
+
+    BrowseInWorkspaceAction browseInWorkspace = new BrowseInWorkspaceAction();
+    browseMenu.add(browseInWorkspace);
+
+    BrowseCatalogAction browseCatalog = new BrowseCatalogAction();
+    browseMenu.add(browseCatalog);
+
+    browseItem.addSelectionListener(new SelectionAdapter()
+    {
+      public void widgetSelected(SelectionEvent e)
+      {
+        Menu menu = browseMenu.createContextMenu(getShell());
+        Rectangle bounds = browseItem.getBounds();
+        Point topLeft = new Point(bounds.x, bounds.y + bounds.height);
+        topLeft = browseToolBar.toDisplay(topLeft);
+        menu.setLocation(topLeft.x, topLeft.y);
+        menu.setVisible(true);
+      }
+    });
+
+    // Composite errComp = new Composite(mainComposite, SWT.NONE);
+    // errComp.setBackground(org.eclipse.draw2d.ColorConstants.white);
+    // errComp.setLayout(new GridLayout());
+    errDisplayer = new CLabel(mainComposite, SWT.FLAT);
+    // errDisplayer.setText("abd");
+    GridData gd = new GridData(GridData.FILL_BOTH);
+    gd.grabExcessHorizontalSpace = true;
+    gd.horizontalSpan = 3;
+    errDisplayer.setLayoutData(gd);
+
+    // errComp.setLayoutData(gd);
+    // errDisplayer.setLayoutData(gd);
+    // errMsgContainer.setContent(errDisplayer);
+
+    nameText.addModifyListener(new ModifyListener()
+    {
+      // track the nameText and enable/disable the OK button accordingly
+      public void modifyText(ModifyEvent e)
+      {
+        categoryName = nameText.getText();
+
+        // name is in the invalid List
+        if (invalidNames != null)
+        {
+          if (invalidNames.contains(categoryName.trim()))
+          {
+            isCategoryNameValid = false;
+
+            getButton(IDialogConstants.OK_ID).setEnabled(false);
+            errDisplayer.setText("The name is already being used.");
+            errDisplayer.setImage(XSDEditorPlugin.getXSDImage("icons/error_st_obj.gif"));
+            return;
+          }
+        }
+        // name is empty string
+        if (categoryName.equals(""))
+        {
+          isCategoryNameValid = false;
+
+          getButton(IDialogConstants.OK_ID).setEnabled(false);
+          errDisplayer.setText("");
+          errDisplayer.setImage(null);
+          return;
+        }
+
+        /*
+         * Enable the Ok button if the location field AND the name field are not
+         * empty
+         */
+        if (!categoryName.equals(""))
+        {
+          isCategoryNameValid = true;
+          errDisplayer.setText("");
+          errDisplayer.setImage(null);
+        }
+        if (!appInfoSchemaLocation.equals(""))
+        {
+          getButton(IDialogConstants.OK_ID).setEnabled(true);
+        }
+      }
+    });
+
+    return parent;
+  }
+
+  protected void okPressed()
+  {
+    super.okPressed();
+  }
+
+  protected class BrowseInWorkspaceAction extends Action
+  {
+    private static final String XSD_FILE_EXTENSION = ".xsd";
+
+    public BrowseInWorkspaceAction()
+    {
+      super("Workspace");
+    }
+
+    public void run()
+    {
+      SelectSingleFileDialog dialog = new SelectSingleFileDialog(getShell(), null, true);
+      dialog.addFilterExtensions(new String[] { XSD_FILE_EXTENSION });
+      dialog.create();
+      dialog.setTitle("Select XSD file");
+      dialog.setMessage("Choose an XSD file containing schema for your extensible components");
+
+      if (dialog.open() == Window.OK)
+      {
+        IFile appInfoSchemaFile = dialog.getFile();
+        if (appInfoSchemaFile != null)
+        {
+          // remove leading slash from the value to avoid the
+          // whole leading slash ambiguity problem
+          String uri = appInfoSchemaFile.getFullPath().toString();
+          while (uri.startsWith("/") || uri.startsWith("\\")) { //$NON-NLS-1$ //$NON-NLS-2$
+            uri = uri.substring(1);
+          }
+          appInfoSchemaLocation = uri.toString();
+
+          appInfoSchemaLocation = "file://" + Platform.getLocation().toString() + "/" + appInfoSchemaLocation;
+          // TODO... be careful how we construct the location
+          // UNIX related issues here
+
+          schemaDisplayer.setImage(XSDEditorPlugin.getXSDImage("icons/XSDFile.gif"));
+          schemaDisplayer.setText(uri);
+
+          // Enable the OK button if we should..
+          if (isCategoryNameValid)
+          {
+            getButton(IDialogConstants.OK_ID).setEnabled(true);
+            errDisplayer.setText("");
+            errDisplayer.setImage(null);
+          }
+        }
+      }
+    }
+  }
+
+  protected class BrowseCatalogAction extends Action
+  {
+    public BrowseCatalogAction()
+    {
+      super("Catalog");
+    }
+
+    public void run()
+    {
+      SelectFromCatalogDialog dialog = new SelectFromCatalogDialog(getShell());
+      // dialog.open();
+      if (dialog.open() == Window.OK)
+      {
+        appInfoSchemaLocation = dialog.getCurrentSelectionLocation();
+
+        schemaDisplayer.setImage(XSDEditorPlugin.getXSDImage("icons/xmlcatalog_obj.gif"));
+        schemaDisplayer.setText(dialog.getCurrentSelectionNamespace());
+
+        // Enable the OK button if we should..
+        if (isCategoryNameValid && !appInfoSchemaLocation.equals(""))
+        {
+          getButton(IDialogConstants.OK_ID).setEnabled(true);
+          errDisplayer.setText("");
+          errDisplayer.setImage(null);
+        }
+      }
+    }
+  }
+
+  public String getNewCategoryName()
+  {
+    return categoryName.trim();
+  }
+
+  public String getAppInfoSchemaLocation()
+  {
+    return appInfoSchemaLocation;
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/appinfo/ApplicationInformationPropertiesRegistry.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/appinfo/ApplicationInformationPropertiesRegistry.java
new file mode 100644
index 0000000..49682f2
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/appinfo/ApplicationInformationPropertiesRegistry.java
@@ -0,0 +1,193 @@
+/*******************************************************************************
+ * Copyright (c) 2006 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.common.properties.sections.appinfo;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.wst.xml.core.internal.XMLCorePlugin;
+import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalog;
+import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalogEntry;
+import org.eclipse.wst.xml.core.internal.catalog.provisional.INextCatalog;
+import org.w3c.dom.Element;
+
+public class ApplicationInformationPropertiesRegistry
+{
+  private static final String LOCATION_PREFIX = "platform:/plugin/";
+  public static final String DESCRIPTION = "description";
+  public static final String DISPLAYNAME = "displayName";
+  public static final String NAMESPACEURI = "namespaceURI";
+  public static final String XSDFILEURL = "xsdFileURL";
+  public static final String LABELPROVIDER = "labelProviderClass";
+
+  protected String extensionId;
+
+  HashMap propertyMap;
+  ArrayList nsURIProperties;
+  private ICatalog systemCatalog;
+
+  public ApplicationInformationPropertiesRegistry(String appinfo_extensionid)
+  {
+    extensionId = appinfo_extensionid;
+  }
+
+  public List getAllApplicationSpecificSchemaProperties()
+  {
+    // If we read the registry, then let's not do it again.
+    if (nsURIProperties != null)
+    {
+      return nsURIProperties;
+    }
+    IConfigurationElement[] asiPropertiesList = Platform.getExtensionRegistry().getConfigurationElementsFor(extensionId);
+
+    nsURIProperties = new ArrayList();
+    propertyMap = new HashMap();
+
+    boolean hasASIProperties = (asiPropertiesList != null) && (asiPropertiesList.length > 0);
+
+    if (hasASIProperties)
+    {
+      for (int i = 0; i < asiPropertiesList.length; i++)
+      {
+        IConfigurationElement asiPropertiesElement = asiPropertiesList[i];
+        String description = asiPropertiesElement.getAttribute(DESCRIPTION);
+        String displayName = asiPropertiesElement.getAttribute(DISPLAYNAME);
+        String namespaceURI = asiPropertiesElement.getAttribute(NAMESPACEURI);
+        String xsdFileURL = asiPropertiesElement.getAttribute(XSDFILEURL);
+        String labelProviderClass = asiPropertiesElement.getAttribute(LABELPROVIDER);
+
+        if (displayName == null)
+        {
+          // If there is no display name, force the user
+          // to manually create a name. Therefore, we ignore entry without
+          // a display name.
+          // TODO (trung) still in testing phase,
+          // remove the comment for "continue;" when needed
+          continue;
+        }
+
+        if (xsdFileURL == null)
+        {
+          xsdFileURL = locateFileUsingCatalog(namespaceURI);
+        }
+
+        SpecificationForAppinfoSchema asiAppinfoSpec = createEntry();
+        if (displayName == null)
+          displayName = namespaceURI;
+        asiAppinfoSpec.setDescription(description);
+        asiAppinfoSpec.setDisplayName(displayName);
+        asiAppinfoSpec.setNamespaceURI(namespaceURI);
+
+        if (labelProviderClass != null)
+        {
+          String pluginId = asiPropertiesElement.getDeclaringExtension().getContributor().getName();
+          ILabelProvider labelProvider = null;
+          try
+          {
+            Class theClass = Platform.getBundle(pluginId).loadClass(labelProviderClass);
+            if (theClass != null)
+            {
+              labelProvider = (ILabelProvider) theClass.newInstance();
+              if (labelProvider != null)
+              {
+                propertyMap.put(namespaceURI, labelProvider);
+                asiAppinfoSpec.setLabelProvider(labelProvider);
+              }
+            }
+          }
+          catch (Exception e)
+          {
+
+          }
+        }
+        String plugin = asiPropertiesElement.getDeclaringExtension().getContributor().getName();
+        asiAppinfoSpec.setLocation(LOCATION_PREFIX + plugin + "/" + xsdFileURL);
+
+        nsURIProperties.add(asiAppinfoSpec);
+      }
+
+    }
+    return nsURIProperties;
+  }
+
+  public ILabelProvider getLabelProvider(Element element)
+  {
+    String uri = element.getNamespaceURI();
+    if (uri == null)
+      uri = "";
+
+    // Didn't retrieve the config elements yet.
+    if (propertyMap == null)
+    {
+      getAllApplicationSpecificSchemaProperties();
+    }
+
+    Object object = propertyMap.get(uri);
+    if (object instanceof ILabelProvider)
+    {
+      return (ILabelProvider) object;
+    }
+    return null;
+  }
+
+  public SpecificationForAppinfoSchema createEntry()
+  {
+    return new SpecificationForAppinfoSchema();
+  }
+
+  /**
+   * Returns the String location for the schema with the given namespaceURI by
+   * looking at the XML catalog. We look only in the plugin specified entries of
+   * the catalog.
+   * 
+   * @param namespaceURI
+   * @return String representing the location of the schema.
+   */
+  private String locateFileUsingCatalog(String namespaceURI)
+  {
+    retrieveCatalog();
+
+    ICatalogEntry[] entries = systemCatalog.getCatalogEntries();
+    for (int i = 0; i < entries.length; i++)
+    {
+      if (entries[i].getKey().equals(namespaceURI))
+        return entries[i].getURI();
+    }
+
+    return null;
+  }
+
+  private void retrieveCatalog()
+  {
+    if (systemCatalog != null)
+      return;
+
+    ICatalog defaultCatalog = XMLCorePlugin.getDefault().getDefaultXMLCatalog();
+    INextCatalog[] nextCatalogs = defaultCatalog.getNextCatalogs();
+    for (int i = 0; i < nextCatalogs.length; i++)
+    {
+      INextCatalog catalog = nextCatalogs[i];
+      ICatalog referencedCatalog = catalog.getReferencedCatalog();
+      if (referencedCatalog != null)
+      {
+        if (XMLCorePlugin.SYSTEM_CATALOG_ID.equals(referencedCatalog.getId()))
+        {
+          systemCatalog = referencedCatalog;
+        }
+      }
+    }
+  }
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/appinfo/ApplicationInformationTableTreeViewer.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/appinfo/ApplicationInformationTableTreeViewer.java
new file mode 100644
index 0000000..6d4fbfb
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/appinfo/ApplicationInformationTableTreeViewer.java
@@ -0,0 +1,336 @@
+/*******************************************************************************
+ * Copyright (c) 2006 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.common.properties.sections.appinfo;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Vector;
+
+import org.eclipse.gef.commands.CommandStack;
+import org.eclipse.gef.ui.actions.ActionRegistry;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.wst.xml.core.internal.document.ElementImpl;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
+import org.eclipse.wst.xml.ui.internal.tabletree.TreeContentHelper;
+import org.eclipse.wst.xml.ui.internal.tabletree.XMLTableTreeContentProvider;
+import org.eclipse.wst.xml.ui.internal.tabletree.XMLTableTreeViewer;
+import org.eclipse.wst.xml.ui.internal.tabletree.XMLTreeExtension;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+import org.eclipse.wst.xsd.ui.common.properties.sections.XSDActionManager;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.Text;
+
+public class ApplicationInformationTableTreeViewer extends XMLTableTreeViewer
+{
+  private CommandStack commandStack;
+  
+  public ApplicationInformationTableTreeViewer(Composite parent)
+  {
+    super(parent);
+
+    getTree().setLinesVisible(true);
+    
+    treeExtension.setCellModifier(null);
+    getTree().removePaintListener(treeExtension);
+    treeExtension = new MyXMLTreeExtension(getTree());
+    
+    AppInfoContentProvider provider = new AppInfoContentProvider();
+    setContentProvider(provider);
+    setLabelProvider(provider);
+  }
+  
+  public void setCommandStack(CommandStack commandStack) {
+    this.commandStack = commandStack;
+  }
+  
+  Element asiElement;
+  
+  public void setASIElement(Element asiElement)
+  {
+    this.asiElement = asiElement;
+  }
+
+  class AppInfoContentProvider extends XMLTableTreeContentProvider
+  {
+    MyTreeContentHelper treeContentHelper;
+    public AppInfoContentProvider()
+    {
+      treeContentHelper = new MyTreeContentHelper();
+    }
+
+    public Object[] getChildren(Object element)
+    {
+      if (element instanceof List)
+      {
+        return ((List) element).toArray();
+      }
+      else if (element instanceof Element)
+      {
+
+      }
+      return treeContentHelper.getChildren(element);
+      
+      //return super.getChildren(element);
+    }
+
+    public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
+    {
+      if (oldInput instanceof Element)
+        oldInput = ((Element) oldInput).getOwnerDocument();
+
+      if (newInput instanceof Element)
+        newInput = ((Element) newInput).getOwnerDocument();
+
+      super.inputChanged(viewer, oldInput, newInput);
+
+    }
+  }
+
+  class ASIActionMenuListener implements IMenuListener
+  {
+    public void menuAboutToShow(IMenuManager menuManager)
+    {
+      // used to disable NodeSelection listening while running NodeAction
+      // ASIActionManager nodeActionManager = new ASIActionManager(fModel,
+      // ASITableTreeViewer.this);
+      // nodeActionManager.setCommandStack(commandStack);
+      IDOMModel model = null;
+      try
+      {
+        if (asiElement instanceof ElementImpl)
+        {
+          model = ((ElementImpl)asiElement).getModel();
+        }
+      }
+      catch (Exception e)
+      {
+        e.printStackTrace();
+      }
+      
+      // if the model is not the XML model, then we can't support the table viewer.
+      if (model != null)
+      {
+        XSDActionManager actionManager = new XSDActionManager(model, ApplicationInformationTableTreeViewer.this);
+        actionManager.setCommandStack(commandStack);
+        
+        // add general actions
+        ActionRegistry registry = (ActionRegistry) XSDEditorPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor().getAdapter(ActionRegistry.class);
+
+        if (registry != null) // an editor may not use the registry
+        {
+          // add undo, redo, revert
+          IAction undo = registry.getAction(ActionFactory.UNDO.getId());
+          if (undo != null)
+          {
+            menuManager.add(new Separator());
+            menuManager.add(undo);
+          }
+          IAction redo = registry.getAction(ActionFactory.REDO.getId());
+          if (redo != null)
+          {
+            menuManager.add(redo);
+          }
+          menuManager.add(new Separator());
+        }
+        actionManager.fillContextMenu(menuManager, getSelection());
+      }
+    }
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see com.ibm.xmleditor.internal.tabletree.XMLTableTreeViewer#createContextMenu()
+   */
+  protected void createContextMenu()
+  {
+    MenuManager contextMenu = new MenuManager("#PopUp"); //$NON-NLS-1$
+    contextMenu.add(new Separator("additions")); //$NON-NLS-1$
+    contextMenu.setRemoveAllWhenShown(true);
+
+    // This is the line we have to modify
+    contextMenu.addMenuListener(new ASIActionMenuListener());
+    Menu menu = contextMenu.createContextMenu(getControl());
+    getControl().setMenu(menu);
+  }
+
+  
+  
+  
+  
+  static String EMPTY_STRING = "";  //$NON-NLS-1$
+  static String XML_NS_STRING = "xmlns";  //$NON-NLS-1$
+  static String APPINFO = "appinfo"; //$NON-NLS-1$
+  
+  public class MyTreeContentHelper extends TreeContentHelper {
+    public void setNodeValue(Node node, String value) {
+      String oldValue = getNodeValue(node);
+      // The command stack was being populated with changes like an empty string to a null value
+      // So we weed those out as well
+//      if (value != null && !value.equals(oldValue) && (!(value.equals(EMPTY_STRING) && oldValue ==null))) {
+//          ModifyNodeCommand command = new ModifyNodeCommand(node, value, this);
+//          commandStack.execute(command);
+//      }
+    }
+    
+    // TODO - Remove this method when Bugzilla 6738 is fixed
+    public List getElementTextContent(Element element) {
+          List result = null;
+          if (!element.hasAttributes()) {
+             Node node = element.getFirstChild();
+
+             // TODO - Hack to workaround problem that a text cell editor appears on the first
+             // click and not the enumerated cell editor
+             if (node == null) {
+                result = new Vector();
+                Text txt = element.getOwnerDocument().createTextNode("");
+                element.appendChild(txt);
+                result.add(txt);
+             }
+             // end of workaround
+
+             for (; node != null; node = node.getNextSibling()) {
+                if (node.getNodeType() == Node.TEXT_NODE || node.getNodeType() == Node.ENTITY_REFERENCE_NODE) {
+                   if (result == null) {
+                      result = new Vector();
+                   }
+                   result.add(node);
+                } else {
+                   result = null;
+                   break;
+                }
+             }
+          }
+          return result;
+       }    
+    
+    public void executeSetNodeValue(Node node, String value) {
+      super.setNodeValue(node, value);
+    }
+    
+    public boolean isEditable(Node node) {
+      int nodeType = node.getNodeType();
+      boolean result = false;
+      switch (nodeType) {
+        case Node.ATTRIBUTE_NODE :
+        {
+          // Prevent the editing of the namespace attribute
+          Attr attr = (Attr)node;
+          result = !attr.getName().startsWith(XML_NS_STRING);
+          break;
+        }
+        default:
+        {
+          result = super.isEditable(node);
+        }
+      }
+      return result;
+    } 
+    
+    // Need to override since I don't want to see the source attribute
+    public Object[] getChildren(Object element) {
+      Object[] result = null;
+
+      if (element instanceof List) {
+        result = ((List)element).toArray();
+      } else if (element instanceof Node) {
+        Node node = (Node) element;
+        List list = new ArrayList();
+        boolean textContentOnly = true;
+
+        // Don't want to see any attributes for the input element
+        if (!(element instanceof Element && (element == getInput()))) {
+          NamedNodeMap map = node.getAttributes();
+          if (map != null) {
+            int length = map.getLength();
+            for (int i = 0; i < length; i++) {
+              list.add(map.item(i));
+              textContentOnly = false;
+            }
+          }
+        }
+
+        Node prevIncludedNode = null;
+        for (Node childNode = node.getFirstChild(); childNode != null; childNode = childNode.getNextSibling()) {
+          int childNodeType = childNode.getNodeType();
+          boolean includeNode = true;
+
+          if (includeNode && hasStyleFlag(HIDE_WHITE_SPACE_TEXT_NODES)) {
+            if (isIgnorableText(childNode)) {
+              // filter out the ignorable text node
+              includeNode = false;
+            }
+          }
+
+          if (includeNode && hasStyleFlag(COMBINE_ADJACENT_TEXT_AND_ENTITY_REFERENCES)) {
+            if (isTextOrEntityReferenceNode(childNode) && prevIncludedNode != null && isTextOrEntityReferenceNode(prevIncludedNode)) {
+              // we only show the first of a list of adjacent text or entity reference node in the tree
+              // so we filter out this subsequent one
+              includeNode = false;
+            }
+          }
+
+          if (hasStyleFlag(HIDE_ELEMENT_CHILD_TEXT_NODES)) {
+            if (childNodeType != Node.TEXT_NODE && childNodeType != Node.ENTITY_REFERENCE_NODE) {
+              textContentOnly = false;
+            }
+          }
+
+          if (includeNode) {
+            list.add(childNode);
+            prevIncludedNode = childNode;
+          }
+        }
+
+        if (hasStyleFlag(HIDE_ELEMENT_CHILD_TEXT_NODES) && textContentOnly) {
+          result = new Object[0];
+        }
+        else {
+          result = list.toArray();
+        }
+      }
+      return result;
+    }
+    
+  } 
+  
+  class MyXMLTreeExtension extends XMLTreeExtension {
+    
+    public MyXMLTreeExtension(Tree tree) {
+      super(tree);
+      this.treeContentHelper = new MyTreeContentHelper();
+      this.columnPosition = 200;
+//      this.setRefreshAll(true);
+    }
+    
+    
+    // Do not wish to display any of the helper text
+    public String getElementValueHelper(Element element) {
+      return EMPTY_STRING; 
+    } 
+        
+      
+  }
+  
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/appinfo/SelectFromCatalogDialog.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/appinfo/SelectFromCatalogDialog.java
new file mode 100644
index 0000000..2baa780
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/appinfo/SelectFromCatalogDialog.java
@@ -0,0 +1,212 @@
+/*******************************************************************************
+ * Copyright (c) 2006 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.common.properties.sections.appinfo;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.wst.xml.core.internal.XMLCorePlugin;
+import org.eclipse.wst.xml.core.internal.catalog.CatalogSet;
+import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalog;
+import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalogEntry;
+import org.eclipse.wst.xml.core.internal.catalog.provisional.INextCatalog;
+import org.eclipse.wst.xml.ui.internal.catalog.XMLCatalogEntriesView;
+import org.eclipse.wst.xml.ui.internal.catalog.XMLCatalogEntryDetailsView;
+import org.eclipse.wst.xml.ui.internal.catalog.XMLCatalogMessages;
+import org.eclipse.wst.xml.ui.internal.catalog.XMLCatalogTreeViewer;
+
+public class SelectFromCatalogDialog extends Dialog
+{
+
+  private ICatalog workingUserCatalog;
+  private ICatalog userCatalog;
+  private ICatalog defaultCatalog;
+  private XMLCatalogEntriesView catalogEntriesView;
+  private ICatalog systemCatalog;
+
+  private String currentSelectionLocation;
+  private String currentSelectionNamespace;
+
+  public SelectFromCatalogDialog(Shell parentShell)
+  {
+    super(parentShell);
+
+    defaultCatalog = XMLCorePlugin.getDefault().getDefaultXMLCatalog();
+    INextCatalog[] nextCatalogs = defaultCatalog.getNextCatalogs();
+    for (int i = 0; i < nextCatalogs.length; i++)
+    {
+      INextCatalog catalog = nextCatalogs[i];
+      ICatalog referencedCatalog = catalog.getReferencedCatalog();
+      if (referencedCatalog != null)
+      {
+        if (XMLCorePlugin.SYSTEM_CATALOG_ID.equals(referencedCatalog.getId()))
+        {
+          systemCatalog = referencedCatalog;
+        }
+        else if (XMLCorePlugin.USER_CATALOG_ID.equals(referencedCatalog.getId()))
+        {
+          userCatalog = referencedCatalog;
+        }
+      }
+    }
+  }
+
+  protected Control createDialogArea(Composite parent)
+  {
+    // we create a working copy of the 'User Settings' for the Catalog
+    // that we can modify
+    CatalogSet tempCatalogSet = new CatalogSet();
+    workingUserCatalog = tempCatalogSet.lookupOrCreateCatalog("working", ""); //$NON-NLS-1$ //$NON-NLS-2$
+
+    // TODO: add entries from the nested catalogs as well
+    workingUserCatalog.addEntriesFromCatalog(userCatalog);
+
+    Composite composite = new Composite(parent, SWT.NULL);
+    composite.setLayout(new GridLayout());
+    GridData gridData = new GridData(GridData.FILL_BOTH);
+    gridData.heightHint = 500;
+    composite.setLayoutData(gridData);
+    createCatalogEntriesView(composite);
+    createCatalogDetailsView(composite);
+
+    return composite;
+  }
+
+  protected void createCatalogEntriesView(Composite parent)
+  {
+    Group group = new Group(parent, SWT.NONE);
+    group.setLayout(new GridLayout());
+    GridData gridData = new GridData(GridData.FILL_BOTH);
+    gridData.widthHint = 370;
+    group.setLayoutData(gridData);
+    group.setText(XMLCatalogMessages.UI_LABEL_USER_ENTRIES);
+    group.setToolTipText(XMLCatalogMessages.UI_LABEL_USER_ENTRIES_TOOL_TIP);
+
+    /*
+     * create a subclass of XMLCatalogEntriesView which suppresses - the
+     * creation of 'Add', 'Edit', 'Delete' buttons - any method involving the
+     * above buttons
+     */
+    catalogEntriesView = new XMLCatalogEntriesView(group, workingUserCatalog, systemCatalog)
+    {
+      protected void createButtons(Composite parent)
+      {
+      }
+
+      protected void updateWidgetEnabledState()
+      {
+      }
+
+    };
+
+    // Only XML Schema entry is selectable
+    catalogEntriesView.setLayoutData(gridData);
+    XMLCatalogTreeViewer catalogTreeViewer = ((XMLCatalogTreeViewer) catalogEntriesView.getViewer());
+    catalogTreeViewer.resetFilters();
+
+    catalogTreeViewer.addFilter(new XMLCatalogTableViewerFilter(new String[] { ".xsd" }));
+  }
+
+  // Bug in the filter of the XML plugin, have to give a correct version here
+  // TODO: Waiting for the fix to be commited to XML plugin and
+  // be used by constellation
+  private class XMLCatalogTableViewerFilter extends ViewerFilter
+  {
+    private static final String W3_XMLSCHEMA_NAMESPACE = "http://www.w3.org/2001/";
+    protected String[] extensions;
+
+    public XMLCatalogTableViewerFilter(String[] extensions1)
+    {
+      this.extensions = extensions1;
+    }
+
+    public boolean isFilterProperty(Object element, Object property)
+    {
+      return false;
+    }
+
+    public boolean select(Viewer viewer, Object parent, Object element)
+    {
+      boolean result = false;
+      if (element instanceof ICatalogEntry)
+      {
+        ICatalogEntry catalogEntry = (ICatalogEntry) element;
+        for (int i = 0; i < extensions.length; i++)
+        {
+          // if the extension is correct and the namespace indicates
+          // that this entry is not the W3 XML Schema
+          if (catalogEntry.getURI().endsWith(extensions[i]) && !catalogEntry.getKey().startsWith(W3_XMLSCHEMA_NAMESPACE))
+          {
+            result = true;
+            break;
+          }
+        }
+      }
+      else if (element.equals(XMLCatalogTreeViewer.PLUGIN_SPECIFIED_ENTRIES_OBJECT) || element.equals(XMLCatalogTreeViewer.USER_SPECIFIED_ENTRIES_OBJECT))
+      {
+        return true;
+      }
+      return result;
+    }
+  }
+
+  protected void createCatalogDetailsView(Composite parent)
+  {
+    Group detailsGroup = new Group(parent, SWT.NONE);
+    detailsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+    detailsGroup.setLayout(new GridLayout());
+    detailsGroup.setText(XMLCatalogMessages.UI_LABEL_DETAILS);
+    final XMLCatalogEntryDetailsView detailsView = new XMLCatalogEntryDetailsView(detailsGroup);
+    ISelectionChangedListener listener = new ISelectionChangedListener()
+    {
+      public void selectionChanged(SelectionChangedEvent event)
+      {
+        ISelection selection = event.getSelection();
+        Object selectedObject = (selection instanceof IStructuredSelection) ? ((IStructuredSelection) selection).getFirstElement() : null;
+        if (selectedObject instanceof ICatalogEntry)
+        {
+          ICatalogEntry entry = (ICatalogEntry) selectedObject;
+          detailsView.setCatalogElement(entry);
+          currentSelectionLocation = entry.getURI();
+          currentSelectionNamespace = entry.getKey();
+        }
+        else
+        {
+          detailsView.setCatalogElement((ICatalogEntry) null);
+          currentSelectionLocation = "";
+          currentSelectionNamespace = "";
+        }
+      }
+    };
+    catalogEntriesView.getViewer().addSelectionChangedListener(listener);
+  }
+
+  public String getCurrentSelectionLocation()
+  {
+    return currentSelectionLocation;
+  }
+
+  public String getCurrentSelectionNamespace()
+  {
+    return currentSelectionNamespace;
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/appinfo/SpecificationForAppinfoSchema.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/appinfo/SpecificationForAppinfoSchema.java
new file mode 100644
index 0000000..65d560d
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/properties/sections/appinfo/SpecificationForAppinfoSchema.java
@@ -0,0 +1,105 @@
+/*******************************************************************************
+ * Copyright (c) 2006 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.common.properties.sections.appinfo;
+
+import org.eclipse.jface.viewers.ILabelProvider;
+
+public class SpecificationForAppinfoSchema
+{
+  private String description;
+  private String displayName;
+  private String namespaceURI;
+  private String location;
+  private ILabelProvider labelProvider;
+
+  public SpecificationForAppinfoSchema()
+  {
+    super();
+  }
+
+  /**
+   * @return Returns the description.
+   */
+  public String getDescription()
+  {
+    return description;
+  }
+
+  /**
+   * @param description
+   *          The description to set.
+   */
+  public void setDescription(String description)
+  {
+    this.description = description;
+  }
+
+  /**
+   * @return Returns the displayName.
+   */
+  public String getDisplayName()
+  {
+    return displayName;
+  }
+
+  /**
+   * @param name
+   *          The displayName to set.
+   */
+  public void setDisplayName(String displayName)
+  {
+    this.displayName = displayName;
+  }
+
+  /**
+   * @return Returns the namespaceURI.
+   */
+  public String getNamespaceURI()
+  {
+    return namespaceURI;
+  }
+
+  /**
+   * @param namespaceURI
+   *          The namespaceURI to set.
+   */
+  public void setNamespaceURI(String namespaceURI)
+  {
+    this.namespaceURI = namespaceURI;
+  }
+
+  /**
+   * @return Returns the location of the xsd file.
+   */
+  public String getLocation()
+  {
+    return location;
+  }
+
+  /**
+   * @param location
+   *          The location to be set
+   */
+  public void setLocation(String location)
+  {
+    this.location = location;
+  }
+
+  public ILabelProvider getLabelProvider()
+  {
+    return labelProvider;
+  }
+
+  public void setLabelProvider(ILabelProvider labelProvider)
+  {
+    this.labelProvider = labelProvider;
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/util/XSDCommonUIUtils.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/util/XSDCommonUIUtils.java
new file mode 100644
index 0000000..088923d
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/common/util/XSDCommonUIUtils.java
@@ -0,0 +1,470 @@
+package org.eclipse.wst.xsd.ui.common.util;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EObject;
+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.xsd.XSDAnnotation;
+import org.eclipse.xsd.XSDAttributeDeclaration;
+import org.eclipse.xsd.XSDAttributeGroupDefinition;
+import org.eclipse.xsd.XSDAttributeUse;
+import org.eclipse.xsd.XSDComplexTypeContent;
+import org.eclipse.xsd.XSDComplexTypeDefinition;
+import org.eclipse.xsd.XSDConcreteComponent;
+import org.eclipse.xsd.XSDElementDeclaration;
+import org.eclipse.xsd.XSDFacet;
+import org.eclipse.xsd.XSDFactory;
+import org.eclipse.xsd.XSDFeature;
+import org.eclipse.xsd.XSDIdentityConstraintDefinition;
+import org.eclipse.xsd.XSDImport;
+import org.eclipse.xsd.XSDInclude;
+import org.eclipse.xsd.XSDModelGroup;
+import org.eclipse.xsd.XSDModelGroupDefinition;
+import org.eclipse.xsd.XSDNamedComponent;
+import org.eclipse.xsd.XSDNotationDeclaration;
+import org.eclipse.xsd.XSDParticle;
+import org.eclipse.xsd.XSDRedefine;
+import org.eclipse.xsd.XSDSchema;
+import org.eclipse.xsd.XSDSimpleTypeDefinition;
+import org.eclipse.xsd.XSDTypeDefinition;
+import org.eclipse.xsd.XSDWildcard;
+import org.eclipse.xsd.XSDXPathDefinition;
+import org.eclipse.xsd.util.XSDConstants;
+import org.eclipse.xsd.util.XSDUtil;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+public class XSDCommonUIUtils
+{
+  public XSDCommonUIUtils()
+  {
+    super();
+  }
+
+  public static XSDAnnotation getInputXSDAnnotation(XSDConcreteComponent input, boolean createIfNotExist)
+  {
+    XSDAnnotation xsdAnnotation = null;
+    XSDFactory factory = XSDFactory.eINSTANCE;
+    if (input instanceof XSDAttributeDeclaration)
+    {
+      XSDAttributeDeclaration xsdComp = (XSDAttributeDeclaration) input;
+      xsdAnnotation = xsdComp.getAnnotation();
+      if (createIfNotExist && xsdAnnotation == null)
+      {
+        xsdAnnotation = factory.createXSDAnnotation();
+        xsdComp.setAnnotation(xsdAnnotation);
+      }
+    }
+    else if (input instanceof XSDAttributeGroupDefinition)
+    {
+      XSDAttributeGroupDefinition xsdComp = (XSDAttributeGroupDefinition) input;
+      xsdAnnotation = xsdComp.getAnnotation();
+      if (createIfNotExist && xsdAnnotation == null)
+      {
+        xsdAnnotation = factory.createXSDAnnotation();
+        xsdComp.setAnnotation(xsdAnnotation);
+      }
+    }
+    else if (input instanceof XSDElementDeclaration)
+    {
+      XSDElementDeclaration xsdComp = (XSDElementDeclaration) input;
+      xsdAnnotation = xsdComp.getAnnotation();
+      if (createIfNotExist && xsdAnnotation == null)
+      {
+        xsdAnnotation = factory.createXSDAnnotation();
+        xsdComp.setAnnotation(xsdAnnotation);
+      }
+    }
+    else if (input instanceof XSDNotationDeclaration)
+    {
+      XSDNotationDeclaration xsdComp = (XSDNotationDeclaration) input;
+      xsdAnnotation = xsdComp.getAnnotation();
+      if (createIfNotExist && xsdAnnotation == null)
+      {
+        xsdAnnotation = factory.createXSDAnnotation();
+        xsdComp.setAnnotation(xsdAnnotation);
+      }
+    }
+    else if (input instanceof XSDXPathDefinition)
+    {
+      XSDXPathDefinition xsdComp = (XSDXPathDefinition) input;
+      xsdAnnotation = xsdComp.getAnnotation();
+      if (createIfNotExist && xsdAnnotation == null)
+      {
+        xsdAnnotation = factory.createXSDAnnotation();
+        xsdComp.setAnnotation(xsdAnnotation);
+      }
+    }
+    else if (input instanceof XSDModelGroup)
+    {
+      XSDModelGroup xsdComp = (XSDModelGroup) input;
+      xsdAnnotation = xsdComp.getAnnotation();
+      if (createIfNotExist && xsdAnnotation == null)
+      {
+        xsdAnnotation = factory.createXSDAnnotation();
+        xsdComp.setAnnotation(xsdAnnotation);
+      }
+    }
+    else if (input instanceof XSDModelGroupDefinition)
+    {
+      XSDModelGroupDefinition xsdComp = (XSDModelGroupDefinition) input;
+      xsdAnnotation = xsdComp.getAnnotation();
+      if (createIfNotExist && xsdAnnotation == null)
+      {
+        xsdAnnotation = factory.createXSDAnnotation();
+        xsdComp.setAnnotation(xsdAnnotation);
+      }
+    }
+    else if (input instanceof XSDIdentityConstraintDefinition)
+    {
+      XSDIdentityConstraintDefinition xsdComp = (XSDIdentityConstraintDefinition) input;
+      xsdAnnotation = xsdComp.getAnnotation();
+      if (createIfNotExist && xsdAnnotation == null)
+      {
+        xsdAnnotation = factory.createXSDAnnotation();
+        xsdComp.setAnnotation(xsdAnnotation);
+      }
+    }
+    else if (input instanceof XSDWildcard)
+    {
+      XSDWildcard xsdComp = (XSDWildcard) input;
+      xsdAnnotation = xsdComp.getAnnotation();
+      if (createIfNotExist && xsdAnnotation == null)
+      {
+        xsdAnnotation = factory.createXSDAnnotation();
+        xsdComp.setAnnotation(xsdAnnotation);
+      }
+    }
+    else if (input instanceof XSDSchema)
+    {
+      XSDSchema xsdComp = (XSDSchema) input;
+      List list = xsdComp.getAnnotations();
+      if (list.size() > 0)
+      {
+        xsdAnnotation = (XSDAnnotation) list.get(0);
+      }
+      else
+      {
+        if (createIfNotExist && xsdAnnotation == null)
+        {
+          xsdAnnotation = factory.createXSDAnnotation();
+          if (xsdComp.getContents() != null)
+          {
+            xsdComp.getContents().add(0, xsdAnnotation);
+          }
+        }
+      }
+      return xsdAnnotation;
+    }
+    else if (input instanceof XSDFacet)
+    {
+      XSDFacet xsdComp = (XSDFacet) input;
+      xsdAnnotation = xsdComp.getAnnotation();
+      if (createIfNotExist && xsdAnnotation == null)
+      {
+        xsdAnnotation = factory.createXSDAnnotation();
+        xsdComp.setAnnotation(xsdAnnotation);
+      }
+    }
+    else if (input instanceof XSDTypeDefinition)
+    {
+      XSDTypeDefinition xsdComp = (XSDTypeDefinition) input;
+      xsdAnnotation = xsdComp.getAnnotation();
+      if (createIfNotExist && xsdAnnotation == null)
+      {
+        xsdAnnotation = factory.createXSDAnnotation();
+        xsdComp.setAnnotation(xsdAnnotation);
+      }
+    }
+    else if (input instanceof XSDInclude)
+    {
+      XSDInclude xsdComp = (XSDInclude) input;
+      xsdAnnotation = xsdComp.getAnnotation();
+      if (createIfNotExist && xsdAnnotation == null)
+      {
+        xsdAnnotation = factory.createXSDAnnotation();
+        xsdComp.setAnnotation(xsdAnnotation);
+      }
+    }
+    else if (input instanceof XSDImport)
+    {
+      XSDImport xsdComp = (XSDImport) input;
+      xsdAnnotation = xsdComp.getAnnotation();
+      if (createIfNotExist && xsdAnnotation == null)
+      {
+        xsdAnnotation = factory.createXSDAnnotation();
+        xsdComp.setAnnotation(xsdAnnotation);
+      }
+    }
+    else if (input instanceof XSDRedefine)
+    {
+      XSDRedefine xsdComp = (XSDRedefine) input;
+      List list = xsdComp.getAnnotations();
+      if (list.size() > 0)
+      {
+        xsdAnnotation = (XSDAnnotation) list.get(0);
+      }
+      else
+      {
+        if (createIfNotExist && xsdAnnotation == null)
+        {
+          // ?
+        }
+      }
+      return xsdAnnotation;
+    }
+    else if (input instanceof XSDAnnotation)
+    {
+      xsdAnnotation = (XSDAnnotation) input;
+    }
+
+    if (createIfNotExist)
+    {
+      formatAnnotation(xsdAnnotation);
+    }
+
+    return xsdAnnotation;
+  }
+
+  private static void formatAnnotation(XSDAnnotation annotation)
+  {
+    Element element = annotation.getElement();
+    formatChild(element);
+  }
+
+  public static void formatChild(Node child)
+  {
+    if (child instanceof IDOMNode)
+    {
+      IDOMModel model = ((IDOMNode) child).getModel();
+      try
+      {
+        // tell the model that we are about to make a big model change
+        model.aboutToChangeModel();
+
+        IStructuredFormatProcessor formatProcessor = new FormatProcessorXML();
+        formatProcessor.formatNode(child);
+      }
+      finally
+      {
+        // tell the model that we are done with the big model change
+        model.changedModel();
+      }
+    }
+  }
+
+  public static String createUniqueElementName(String prefix, List elements)
+  {
+    ArrayList usedNames = new ArrayList();
+    for (Iterator i = elements.iterator(); i.hasNext();)
+    {
+      usedNames.add(getDisplayName((XSDNamedComponent) i.next()));
+    }
+
+    int i = 1;
+    String testName = prefix + i++;
+    while (usedNames.contains(testName))
+    {
+      testName = prefix + i++;
+    }
+    return testName;
+  }
+
+  public static String getDisplayName(XSDNamedComponent component)
+  {
+    if (component instanceof XSDTypeDefinition)
+      return getDisplayNameFromXSDType((XSDTypeDefinition) component);
+
+    if (component instanceof XSDFeature)
+    {
+      XSDFeature feature = (XSDFeature) component;
+      if (feature.getName() != null)
+        return feature.getName();
+      else if (feature.getResolvedFeature() != null && feature.getResolvedFeature().getName() != null)
+        return feature.getResolvedFeature().getName();
+    }
+
+    return component.getName();
+
+  }
+
+  public static String getDisplayNameFromXSDType(XSDTypeDefinition type)
+  {
+    return getDisplayNameFromXSDType(type, true);
+  }
+
+  public static String getDisplayNameFromXSDType(XSDTypeDefinition type, boolean returnPrimitiveParents)
+  {
+    if (type == null)
+      return null;
+
+    if (type.getName() == null || type.getName().length() == 0)
+    {
+      if (returnPrimitiveParents && isPrimitiveType(type))
+      {
+        return getDisplayNameFromXSDType(type.getBaseType());
+      }
+
+      EObject container = type.eContainer();
+
+      while (container != null)
+      {
+        if (container instanceof XSDNamedComponent && ((XSDNamedComponent) container).getName() != null)
+        {
+          return ((XSDNamedComponent) container).getName();
+        }
+        container = container.eContainer();
+      }
+      return null;
+    }
+    else
+      return type.getName();
+  }
+
+  public static boolean isPrimitiveType(XSDTypeDefinition type)
+  {
+    if (type instanceof XSDComplexTypeDefinition)
+      return false;
+
+    XSDTypeDefinition baseType = null;
+    if (type != null)
+    {
+      baseType = type.getBaseType();
+      XSDTypeDefinition origType = baseType; // KC: although invalid, we need to
+                                            // prevent cycles and to avoid an
+                                            // infinite loop
+      while (baseType != null && !XSDUtil.isAnySimpleType(baseType) && !XSDUtil.isAnyType(baseType) && origType != baseType)
+      {
+        type = baseType;
+        baseType = type.getBaseType();
+      }
+      baseType = type;
+    }
+    else
+    {
+      return false;
+    }
+
+    return (XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001.equals(baseType.getTargetNamespace()));
+  }
+
+  public static XSDSimpleTypeDefinition getAnonymousSimpleType(XSDFeature input, XSDSimpleTypeDefinition xsdSimpleTypeDefinition)
+  {
+    XSDSimpleTypeDefinition anonymousSimpleType = null;
+    XSDTypeDefinition localType = null;
+
+    if (input instanceof XSDElementDeclaration)
+    {
+      localType = ((XSDElementDeclaration) input).getAnonymousTypeDefinition();
+    }
+    else if (input instanceof XSDAttributeDeclaration)
+    {
+      localType = ((XSDAttributeDeclaration) input).getAnonymousTypeDefinition();
+    }
+
+    if (localType instanceof XSDSimpleTypeDefinition)
+    {
+      anonymousSimpleType = (XSDSimpleTypeDefinition) localType;
+    }
+    return anonymousSimpleType;
+  }
+
+  public static List getChildElements(XSDModelGroup group)
+  {
+    List children = new ArrayList();
+    for (Iterator i = group.getContents().iterator(); i.hasNext();)
+    {
+      XSDParticle next = (XSDParticle) i.next();
+      if (next.getContent() instanceof XSDFeature)
+      {
+        children.add(next.getContent());
+      }
+      else if (next.getTerm() instanceof XSDModelGroup)
+      {
+        children.addAll(getChildElements((XSDModelGroup) next.getTerm()));
+      }
+    }
+    return children;
+  }
+
+  public static List getAllAttributes(XSDComplexTypeDefinition xsdComplexType)
+  {
+    List attributes = getChildElements(xsdComplexType);
+    attributes.addAll(getChildAttributes(xsdComplexType));
+
+    return attributes;
+  }
+
+  public static List getInheritedAttributes(XSDComplexTypeDefinition ct)
+  {
+    List attrs = new ArrayList();
+    XSDTypeDefinition parent = ct.getBaseTypeDefinition();
+    if (parent != null && parent instanceof XSDComplexTypeDefinition && ct.isSetDerivationMethod())
+    {
+      attrs.addAll(getAllAttributes((XSDComplexTypeDefinition) parent));
+      attrs.addAll(getInheritedAttributes((XSDComplexTypeDefinition) parent));
+    }
+
+    return attrs;
+  }
+
+  public static List getChildElements(XSDComplexTypeDefinition ct)
+  {
+    return getChildElements(getModelGroup(ct));
+  }
+
+  public static XSDModelGroup getModelGroup(XSDComplexTypeDefinition cType)
+  {
+    XSDParticle particle = cType.getComplexType();
+
+    if (particle == null || particle.eContainer() != cType)
+      return null;
+
+    Object particleContent = particle.getContent();
+    XSDModelGroup group = null;
+
+    if (particleContent instanceof XSDModelGroupDefinition)
+      group = ((XSDModelGroupDefinition) particleContent).getResolvedModelGroupDefinition().getModelGroup();
+    else if (particleContent instanceof XSDModelGroup)
+      group = (XSDModelGroup) particleContent;
+
+    if (group == null)
+      return null;
+
+    if (group.getContents().isEmpty() || group.eResource() != cType.eResource())
+    {
+      XSDComplexTypeContent content = cType.getContent();
+      if (content instanceof XSDParticle)
+        group = (XSDModelGroup) ((XSDParticle) content).getContent();
+    }
+
+    return group;
+  }
+
+  public static List getChildAttributes(XSDComplexTypeDefinition ct)
+  {
+    EList attrContents = ct.getAttributeContents();
+    List attrs = new ArrayList();
+    for (int i = 0; i < attrContents.size(); i++)
+    {
+      Object next = attrContents.get(i);
+
+      if (next instanceof XSDAttributeUse)
+      {
+        attrs.add(((XSDAttributeUse) next).getContent().getResolvedAttributeDeclaration());
+      }
+      else if (next instanceof XSDAttributeGroupDefinition)
+      {
+        XSDAttributeGroupDefinition attrGroup = (XSDAttributeGroupDefinition) next;
+      }
+    }
+    return attrs;
+  }
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/Checks.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/Checks.java
new file mode 100644
index 0000000..db67a13
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/Checks.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2006 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.refactor;
+
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.wst.xml.core.internal.provisional.NameValidator;
+
+public class Checks {
+	
+	public static RefactoringStatus checkName(String name) {
+		RefactoringStatus result= new RefactoringStatus();
+		if ("".equals(name)) //$NON-NLS-1$
+			return RefactoringStatus.createFatalErrorStatus("RefactoringMessages.Checks_Choose_name"); 
+		return result;
+	}
+	
+	public static boolean isAlreadyNamed(RefactoringComponent element, String name){
+		return name.equals(element.getName());
+	}
+	
+	public static RefactoringStatus checkComponentName(String name) {
+		RefactoringStatus result= new RefactoringStatus();
+		if (!NameValidator.isValid(name)) //$NON-NLS-1$
+			return RefactoringStatus.createFatalErrorStatus("RefactoringMessages.Checks_Choose_name"); 
+
+		return result;
+	}
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/INameUpdating.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/INameUpdating.java
new file mode 100644
index 0000000..af89666
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/INameUpdating.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2006 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.refactor;
+
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+
+/**
+ * @author ebelisar
+ */
+public interface INameUpdating {
+
+	public abstract void setNewElementName(String newName);
+	public abstract String getNewElementName();
+	public abstract String getCurrentElementName();
+    public abstract RefactoringStatus checkNewElementName(String newName);
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/IReferenceUpdating.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/IReferenceUpdating.java
new file mode 100644
index 0000000..1ff48fe
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/IReferenceUpdating.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2006 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.refactor;
+
+public interface IReferenceUpdating {
+
+	/**
+	 * Checks if this refactoring object is capable of updating references to the renamed element.
+	 */
+	public boolean canEnableUpdateReferences();
+
+	/**
+	 * If <code>canUpdateReferences</code> returns <code>true</code>, then this method is used to
+	 * inform the refactoring object whether references should be updated.
+	 * This call can be ignored if  <code>canUpdateReferences</code> returns <code>false</code>.
+	 */	
+	public void setUpdateReferences(boolean update);
+
+	/**
+	 * If <code>canUpdateReferences</code> returns <code>true</code>, then this method is used to
+	 * ask the refactoring object whether references should be updated.
+	 * This call can be ignored if  <code>canUpdateReferences</code> returns <code>false</code>.
+	 */		
+	public boolean getUpdateReferences();
+
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/RefactoringComponent.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/RefactoringComponent.java
new file mode 100644
index 0000000..554bc8a
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/RefactoringComponent.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2006 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.refactor;
+
+import org.eclipse.wst.common.core.search.pattern.QualifiedName;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
+
+
+public interface RefactoringComponent
+{
+	/**
+	 * @return the name of the component that is refactored.  E.g. "foo"
+	 */
+	public String getName();
+	
+	/**
+	 * @return the namespace of the component that is refactored.  E.g. "http://foo"
+	 */
+	public String getNamespaceURI();
+	
+	/**
+	 * The basic DOM element is used by the refactoring processor/participant to get 
+	 * access to the file location.
+	 * 
+	 * @return the Structured Source Editor XML DOM element object that underlines the 
+	 * combonent being refactore.
+	 * 
+	 * @see IDOMElement 
+	 */
+	public IDOMElement getElement();
+	
+	/** 
+	 * @return the qualified name of the type of the refactored component. 
+	 * 
+	 * <p>
+	 * A qualified name consists of a local name and a namespace.  
+	 * E.g. "complexType"-local name, "http://www.w3.org/2001/XMLSchema"-namespace
+	 * </p>
+	 * 
+	 * @see QualifiedName
+	 */
+	public QualifiedName getTypeQName();
+		
+	/** 
+	 * The model object may be required to be given to the refactored participants as is or 
+	 * other objects could be derived from it.
+	 * 
+	 * @return the principal object being refactored, such as an instance of WSDLElement or 
+	 * XSDNamedComponent
+	 */
+	public Object getModelObject();
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/RefactoringMessages.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/RefactoringMessages.java
new file mode 100644
index 0000000..7b56d8d
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/RefactoringMessages.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 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.refactor;
+
+import java.text.MessageFormat;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+public class RefactoringMessages {
+
+	private static final String RESOURCE_BUNDLE= "org.eclipse.wst.xsd.ui.internal.refactor.messages";//$NON-NLS-1$
+
+	private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE);
+
+	private RefactoringMessages() {
+	}
+
+	public static String getString(String key) {
+		try {
+			return fgResourceBundle.getString(key);
+		} catch (MissingResourceException e) {
+			return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
+		}
+	}
+	
+	public static String[] getStrings(String keys[]) {
+		String[] result= new String[keys.length];
+		for (int i= 0; i < keys.length; i++) {
+			result[i]= getString(keys[i]);
+		}
+		return result;
+	}
+	
+	public static String getFormattedString(String key, Object arg) {
+		return getFormattedString(key, new Object[] { arg });
+	}
+	
+	public static String getFormattedString(String key, Object[] args) {
+		return MessageFormat.format(getString(key), args);	
+	}	
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/TextChangeManager.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/TextChangeManager.java
new file mode 100644
index 0000000..5252362
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/TextChangeManager.java
@@ -0,0 +1,112 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2006 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.refactor;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.ltk.core.refactoring.TextChange;
+import org.eclipse.ltk.core.refactoring.TextFileChange;
+
+/**
+ * A <code>TextChangeManager</code> manages associations between <code>IFile</code> and <code>TextChange</code> objects.
+ */
+public class TextChangeManager {
+	
+	private Map fMap= new HashMap(10); // IFile -> TextChange
+	
+	private final boolean fKeepExecutedTextEdits;
+	
+	public TextChangeManager() {
+		this(false);
+	}
+
+	public TextChangeManager(boolean keepExecutedTextEdits) {
+		fKeepExecutedTextEdits= keepExecutedTextEdits;
+	}
+	
+	/**
+	 * Adds an association between the given file and the passed
+	 * change to this manager.
+	 * 
+	 * @param file the file (key)
+	 * @param change the change associated with the file
+	 */
+	public void manage(IFile file, TextChange change) {
+		fMap.put(file, change);
+	}
+	
+	/**
+	 * Returns the <code>TextChange</code> associated with the given file.
+	 * If the manager does not already manage an association it creates a one.
+	 * 
+	 * @param file the file for which the text buffer change is requested
+	 * @return the text change associated with the given file. 
+	 */
+	public TextChange get(IFile file) {
+		TextChange result= (TextChange)fMap.get(file);
+		if (result == null) {
+			result= new TextFileChange(file.toString(), file);
+			result.setKeepPreviewEdits(fKeepExecutedTextEdits);
+			fMap.put(file, result);
+		}
+		return result;
+	}
+	
+	/**
+	 * Removes the <tt>TextChange</tt> managed under the given key
+	 * <code>unit<code>.
+	 * 
+	 * @param unit the key determining the <tt>TextChange</tt> to be removed.
+	 * @return the removed <tt>TextChange</tt>.
+	 */
+	public TextChange remove(IFile unit) {
+		return (TextChange)fMap.remove(unit);
+	}
+	
+	/**
+	 * Returns all text changes managed by this instance.
+	 * 
+	 * @return all text changes managed by this instance
+	 */
+	public TextChange[] getAllChanges(){
+		return (TextChange[])fMap.values().toArray(new TextChange[fMap.values().size()]);
+	}
+
+	/**
+	 * Returns all files managed by this instance.
+	 * 
+	 * @return all files managed by this instance
+	 */	
+	public IFile[] getAllCompilationUnits(){
+		return (IFile[]) fMap.keySet().toArray(new IFile[fMap.keySet().size()]);
+	}
+	
+	/**
+	 * Clears all associations between resources and text changes.
+	 */
+	public void clear() {
+		fMap.clear();
+	}
+
+	/**
+	 * Returns if any text changes are managed for the specified file.
+	 * 
+	 * @param file the file
+	 * @return <code>true</code> if any text changes are managed for the specified file and <code>false</code> otherwise
+	 */		
+	public boolean containsChangesIn(IFile file){
+		return fMap.containsKey(file);
+	}
+}
+
+
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/XMLRefactoringComponent.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/XMLRefactoringComponent.java
new file mode 100644
index 0000000..ad779b1
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/XMLRefactoringComponent.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2006 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.refactor;
+
+import org.eclipse.wst.common.core.search.pattern.QualifiedName;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
+
+
+public class XMLRefactoringComponent implements RefactoringComponent
+{
+	// The name of the component being refactored
+	String name;
+	
+	// The namespace in which component is defined, e.g. XML or WSDL target namespace
+	String targetNamespace;
+	
+	// Optional model object that is refactored
+	Object model;
+	
+	// SED DOM object that underlines the component being refactored
+	IDOMElement domElement;
+
+	public XMLRefactoringComponent(Object modelObject, IDOMElement domElement, String name, String namespace)
+	{
+		super();
+		this.model = modelObject;
+		this.domElement = domElement;
+		this.name = name;
+		this.targetNamespace = namespace;
+		
+		
+	}
+	
+	public XMLRefactoringComponent(IDOMElement domElement, String name, String namespace)
+	{
+		super();
+		this.domElement = domElement;
+		this.name = name;
+		this.targetNamespace = namespace;
+	}
+
+	public Object getModelObject()
+	{
+		return model;
+	}
+
+	public IDOMElement getElement()
+	{
+		return domElement;
+	}
+
+	public String getName()
+	{
+		
+		return name;
+	}
+
+	public String getNamespaceURI()
+	{
+		return targetNamespace;
+	}
+
+	
+	public QualifiedName getTypeQName()
+	{
+		return new QualifiedName(domElement.getNamespaceURI(), domElement.getLocalName());
+	}
+	
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/MakeAnonymousTypeGlobalAction.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/MakeAnonymousTypeGlobalAction.java
new file mode 100644
index 0000000..dd5ffc4
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/MakeAnonymousTypeGlobalAction.java
@@ -0,0 +1,157 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials 
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.xsd.ui.internal.refactor.actions;
+
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ltk.core.refactoring.participants.RenameRefactoring;
+import org.eclipse.ltk.ui.refactoring.RefactoringWizard;
+import org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation;
+import org.eclipse.wst.xml.core.internal.document.DocumentImpl;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+import org.eclipse.wst.xsd.ui.internal.refactor.structure.MakeAnonymousTypeGlobalCommand;
+import org.eclipse.wst.xsd.ui.internal.refactor.structure.MakeTypeGlobalProcessor;
+import org.eclipse.wst.xsd.ui.internal.refactor.wizard.RefactoringWizardMessages;
+import org.eclipse.wst.xsd.ui.internal.refactor.wizard.RenameRefactoringWizard;
+import org.eclipse.xsd.XSDAttributeDeclaration;
+import org.eclipse.xsd.XSDComplexTypeDefinition;
+import org.eclipse.xsd.XSDConcreteComponent;
+import org.eclipse.xsd.XSDElementDeclaration;
+import org.eclipse.xsd.XSDSchema;
+import org.eclipse.xsd.XSDSimpleTypeDefinition;
+import org.eclipse.xsd.XSDTypeDefinition;
+import org.w3c.dom.Node;
+
+public class MakeAnonymousTypeGlobalAction extends XSDSelectionDispatchAction {
+
+	private String fParentName;
+	private boolean isComplexType = true;
+	private XSDTypeDefinition fSelectedComponent;
+	
+	public MakeAnonymousTypeGlobalAction(ISelection selection, XSDSchema schema) {
+		super(selection, schema);
+		setText(RefactoringWizardMessages.MakeAnonymousTypeGlobalAction_text); //$NON-NLS-1$
+	}
+	
+	public boolean canRun() {
+
+		return fSelectedComponent != null;
+	}
+	
+
+	private String getNewDefaultName(){
+		if(fParentName != null && !"".equals(fParentName)){
+			if(isComplexType){
+				return fParentName + "ComplexType";
+			}
+			else{
+				return fParentName + "SimpleType";
+			}
+		}
+		else{
+			if(isComplexType){
+				return "NewComplexType";
+			}
+			else{
+				return "NewSimpleType";
+			}
+		}
+		
+	}
+	private boolean canEnable(XSDConcreteComponent xsdComponent){
+		if (xsdComponent instanceof XSDComplexTypeDefinition) {
+			fSelectedComponent = (XSDComplexTypeDefinition)xsdComponent;
+			isComplexType = true;
+			XSDComplexTypeDefinition typeDef = (XSDComplexTypeDefinition) xsdComponent;
+			XSDConcreteComponent parent = typeDef.getContainer();
+			if(parent instanceof XSDElementDeclaration){
+				fParentName = ((XSDElementDeclaration)parent).getName();
+				return true;
+			}
+		} 
+		else if (xsdComponent instanceof XSDSimpleTypeDefinition){
+			fSelectedComponent = (XSDSimpleTypeDefinition)xsdComponent;
+			isComplexType = false;
+			XSDSimpleTypeDefinition typeDef = (XSDSimpleTypeDefinition) xsdComponent;
+			XSDConcreteComponent parent = typeDef.getContainer();
+			if(parent instanceof XSDElementDeclaration){
+				fParentName = ((XSDElementDeclaration)parent).getName();
+				return true;
+			}
+			else if(parent instanceof XSDAttributeDeclaration){
+				fParentName = ((XSDAttributeDeclaration)parent).getName();
+				return true;
+			}
+			
+		}
+		return false;
+	}
+
+	protected boolean canEnable(Object selectedObject) {
+		
+		if (selectedObject instanceof XSDConcreteComponent) {
+			return canEnable((XSDConcreteComponent)selectedObject);
+		}
+		else if (selectedObject instanceof Node) {
+			Node node = (Node) selectedObject;
+			XSDConcreteComponent concreteComponent = getSchema().getCorrespondingComponent(node);
+			return canEnable(concreteComponent);
+		
+		}
+		return false;
+		
+	}
+
+	public void run1() {
+		
+		if(fSelectedComponent == null){
+			return;
+		}
+		
+		if(fSelectedComponent.getSchema() == null){
+			getSchema().updateElement(true);
+		}
+		MakeTypeGlobalProcessor processor = new MakeTypeGlobalProcessor(fSelectedComponent, getNewDefaultName());
+		RenameRefactoring refactoring = new RenameRefactoring(processor);
+		try {
+			RefactoringWizard wizard = new RenameRefactoringWizard(
+					refactoring,
+					RefactoringWizardMessages.RenameComponentWizard_defaultPageTitle, // TODO: provide correct strings
+					RefactoringWizardMessages.RenameComponentWizard_inputPage_description, null);
+			RefactoringWizardOpenOperation op= new RefactoringWizardOpenOperation(wizard);
+			op.run(XSDEditorPlugin.getShell(), wizard.getDefaultPageTitle());
+			//triggerBuild();
+		} catch (InterruptedException e) {
+			// do nothing. User action got cancelled
+		}
+		
+	}
+	
+	public void run(){
+		if(fSelectedComponent == null){
+			return;
+		}
+		
+		if(fSelectedComponent.getSchema() == null){
+			getSchema().updateElement(true);
+		}
+		DocumentImpl doc = (DocumentImpl) fSelectedComponent.getElement().getOwnerDocument();
+		doc.getModel().beginRecording(
+						this,
+						RefactoringWizardMessages.MakeAnonymousTypeGlobalAction_text);
+		MakeAnonymousTypeGlobalCommand command = new MakeAnonymousTypeGlobalCommand(
+				fSelectedComponent, getNewDefaultName());
+		command.run();
+		doc.getModel().endRecording(this);
+	}
+	
+	
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/MakeLocalElementGlobalAction.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/MakeLocalElementGlobalAction.java
new file mode 100644
index 0000000..ea4de4e
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/MakeLocalElementGlobalAction.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials 
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.xsd.ui.internal.refactor.actions;
+
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.wst.xml.core.internal.document.DocumentImpl;
+import org.eclipse.wst.xsd.ui.internal.refactor.structure.MakeLocalElementGlobalCommand;
+import org.eclipse.xsd.XSDConcreteComponent;
+import org.eclipse.xsd.XSDElementDeclaration;
+import org.eclipse.xsd.XSDSchema;
+import org.w3c.dom.Node;
+
+public class MakeLocalElementGlobalAction extends XSDSelectionDispatchAction {
+
+	XSDElementDeclaration fSelectedComponent;
+
+	public MakeLocalElementGlobalAction(ISelection selection, XSDSchema schema) {
+		super(selection, schema);
+        //TODO cs : fix up translation
+        setText("Make Global");
+		//setText(RefactoringMessages.getString("MakeLocalElementGlobalAction.text")); //$NON-NLS-1$
+	}
+	
+	public boolean canRun() {
+
+		return fSelectedComponent != null;
+	}
+
+	protected boolean canEnable(XSDConcreteComponent selectedObject) {
+
+		fSelectedComponent = null;
+		if (selectedObject instanceof XSDElementDeclaration) {
+			XSDElementDeclaration element = (XSDElementDeclaration) selectedObject;
+			if (!element.isElementDeclarationReference() && !element.isGlobal()) {
+				fSelectedComponent = element;
+			}
+		} 
+		return canRun();
+	}
+	
+	
+	protected boolean canEnable(Object selectedObject) {
+		
+		if (selectedObject instanceof XSDConcreteComponent) {
+			return canEnable((XSDConcreteComponent)selectedObject);
+		}
+		else if (selectedObject instanceof Node) {
+			Node node = (Node) selectedObject;
+			XSDConcreteComponent concreteComponent = getSchema()
+					.getCorrespondingComponent(node);
+			return canEnable(concreteComponent);
+		}
+		return false;
+		
+	}
+
+
+	public void run() {
+		DocumentImpl doc = (DocumentImpl) fSelectedComponent.getElement()
+				.getOwnerDocument();
+		doc.getModel().beginRecording(this, getText());
+		MakeLocalElementGlobalCommand command = new MakeLocalElementGlobalCommand(
+				fSelectedComponent);
+		command.run();
+		doc.getModel().endRecording(this);
+	}
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/RenameAction.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/RenameAction.java
new file mode 100644
index 0000000..0874e57
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/RenameAction.java
@@ -0,0 +1,118 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2006 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.refactor.actions;
+
+
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+import org.eclipse.wst.xsd.ui.internal.refactor.wizard.RefactoringWizardMessages;
+
+
+
+/**
+* Renames a XML Schema element or workbench resource.
+* <p>
+* Action is applicable to selections containing elements of type
+* <code></code> or <code>IResource</code>.
+* 
+* <p>
+* This class may be instantiated; it is not intended to be subclassed.
+* </p>
+
+*/
+public class RenameAction extends SelectionDispatchAction  {
+
+	private SelectionDispatchAction renameComponentAction;
+	private SelectionDispatchAction renameResourceAction;
+	
+	
+	public RenameAction(ISelection selection) {
+		super(selection);
+		setText(RefactoringWizardMessages.RenameAction_text); 
+		renameResourceAction= new RenameResourceAction(selection);
+		renameResourceAction.setText(getText());
+		
+	}
+	public RenameAction(ISelection selection, Object model) {
+		super(selection);
+		setText(RefactoringWizardMessages.RenameAction_text);
+		renameComponentAction= new RenameComponentAction(selection, model);
+		renameComponentAction.setText(getText());
+		renameResourceAction= new RenameResourceAction(selection);
+		renameResourceAction.setText(getText());
+		
+	}
+	
+
+	
+	/*
+	 * @see ISelectionChangedListener#selectionChanged(SelectionChangedEvent)
+	 */
+	public void selectionChanged(SelectionChangedEvent event) {
+		renameComponentAction.selectionChanged(event);
+		if (renameResourceAction != null)
+			renameResourceAction.selectionChanged(event);
+		setEnabled(computeEnabledState());		
+	}
+
+	/*
+	 * @see SelectionDispatchAction#update(ISelection)
+	 */
+	public void update(ISelection selection) {
+		if(renameComponentAction != null){
+			renameComponentAction.update(selection);
+		}
+		if (renameResourceAction != null)
+			renameResourceAction.update(selection);
+		setEnabled(computeEnabledState());		
+	}
+	
+	private boolean computeEnabledState(){
+		if (renameResourceAction != null) {
+			return renameComponentAction.isEnabled() || renameResourceAction.isEnabled();
+		} else {
+			return renameComponentAction.isEnabled();
+		}
+	}
+	
+	public void run(IStructuredSelection selection) {
+		if (renameComponentAction != null && renameComponentAction.isEnabled())
+			renameComponentAction.run(selection);
+		if (renameResourceAction != null && renameResourceAction.isEnabled())
+			renameResourceAction.run(selection);
+	}
+
+	public void run(ITextSelection selection) {
+		if (renameComponentAction != null && renameComponentAction.canRun())
+			renameComponentAction.run(selection);
+		else
+			MessageDialog.openInformation(XSDEditorPlugin.getShell(), RefactoringWizardMessages.RenameAction_rename, RefactoringWizardMessages.RenameAction_unavailable);  
+	}
+	public void run(ISelection selection) {
+	    if(selection == null){
+	    	super.run();
+	    }
+	    else{
+	    	super.run(selection);
+	    }
+		
+	}
+	public final void setRenameComponentAction(
+			SelectionDispatchAction renameComponentAction)
+	{
+		this.renameComponentAction = renameComponentAction;
+	}
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/RenameComponentAction.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/RenameComponentAction.java
new file mode 100644
index 0000000..e433463
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/RenameComponentAction.java
@@ -0,0 +1,144 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials 
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.xsd.ui.internal.refactor.actions;
+
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ltk.core.refactoring.participants.RenameRefactoring;
+import org.eclipse.ltk.ui.refactoring.RefactoringWizard;
+import org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation;
+import org.eclipse.ui.actions.GlobalBuildAction;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+import org.eclipse.wst.xsd.ui.internal.refactor.RefactoringComponent;
+import org.eclipse.wst.xsd.ui.internal.refactor.XMLRefactoringComponent;
+import org.eclipse.wst.xsd.ui.internal.refactor.rename.RenameComponentProcessor;
+import org.eclipse.wst.xsd.ui.internal.refactor.wizard.RefactoringWizardMessages;
+import org.eclipse.wst.xsd.ui.internal.refactor.wizard.RenameRefactoringWizard;
+import org.eclipse.xsd.XSDAttributeDeclaration;
+import org.eclipse.xsd.XSDConcreteComponent;
+import org.eclipse.xsd.XSDElementDeclaration;
+import org.eclipse.xsd.XSDNamedComponent;
+import org.eclipse.xsd.XSDTypeDefinition;
+import org.w3c.dom.Node;
+
+public class RenameComponentAction extends XSDSelectionDispatchAction {
+
+	private XSDNamedComponent selectedComponent;
+
+	public RenameComponentAction(ISelection selection,
+			Object aModel) {
+		super(selection, aModel);
+	
+	}
+
+	protected boolean canEnable(XSDConcreteComponent selectedObject) {
+
+		selectedComponent = null;
+		if (selectedObject instanceof XSDNamedComponent) {
+			selectedComponent = (XSDNamedComponent) selectedObject;
+
+			// if it's element reference, then this action is not appropriate
+			if (selectedComponent instanceof XSDElementDeclaration) {
+				XSDElementDeclaration element = (XSDElementDeclaration) selectedComponent;
+				if (element.isElementDeclarationReference()) {
+					selectedComponent = null;
+				}
+			}
+			if(selectedComponent instanceof XSDTypeDefinition){
+				XSDTypeDefinition type = (XSDTypeDefinition) selectedComponent;
+				XSDConcreteComponent parent = type.getContainer();
+				if (parent instanceof XSDElementDeclaration) {
+					XSDElementDeclaration element = (XSDElementDeclaration) parent;
+					if(element.getAnonymousTypeDefinition().equals(type)){
+						selectedComponent = null;
+					}
+				}
+				else if(parent instanceof XSDAttributeDeclaration) {
+					XSDAttributeDeclaration element = (XSDAttributeDeclaration) parent;
+					if(element.getAnonymousTypeDefinition().equals(type)){
+						selectedComponent = null;
+					}
+				}
+			}
+		}
+
+		return canRun();
+	}
+
+	protected boolean canEnable(Object selectedObject) {
+
+		if (selectedObject instanceof XSDConcreteComponent) {
+			return canEnable((XSDConcreteComponent) selectedObject);
+		} else if (selectedObject instanceof Node) {
+			Node node = (Node) selectedObject;
+			if (getSchema() != null) {
+				XSDConcreteComponent concreteComponent = getSchema()
+						.getCorrespondingComponent(node);
+				return canEnable(concreteComponent);
+			}
+		}
+		return false;
+
+	}
+
+	public boolean canRun() {
+
+		return selectedComponent != null;
+	}
+
+	public void run(ISelection selection) {
+		if (selectedComponent.getName() == null) {
+			selectedComponent.setName(new String());
+		}
+		if (selectedComponent.getSchema() == null) {
+			if (getSchema() != null) {
+				getSchema().updateElement(true);
+			}
+
+		}
+		RefactoringComponent component = new XMLRefactoringComponent(
+				selectedComponent,
+				(IDOMElement)selectedComponent.getElement(), 
+				selectedComponent.getName(),
+				selectedComponent.getTargetNamespace());
+		
+		RenameComponentProcessor processor = new RenameComponentProcessor(
+				component, selectedComponent.getName());
+		RenameRefactoring refactoring = new RenameRefactoring(processor);
+		try {
+			RefactoringWizard wizard = new RenameRefactoringWizard(
+					refactoring,
+					RefactoringWizardMessages.RenameComponentWizard_defaultPageTitle, 
+					RefactoringWizardMessages
+							.RenameComponentWizard_inputPage_description, 
+					null);
+			RefactoringWizardOpenOperation op = new RefactoringWizardOpenOperation(
+					wizard);
+			op.run(XSDEditorPlugin.getShell(), wizard
+					.getDefaultPageTitle());
+			triggerBuild();
+		} catch (InterruptedException e) {
+			// do nothing. User action got cancelled
+		}
+
+	}
+
+	public static void triggerBuild() {
+		if (ResourcesPlugin.getWorkspace().getDescription().isAutoBuilding()) {
+			new GlobalBuildAction(XSDEditorPlugin.getPlugin().getWorkbench()
+					.getActiveWorkbenchWindow(),
+					IncrementalProjectBuilder.INCREMENTAL_BUILD).run();
+		}
+	}
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/RenameResourceAction.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/RenameResourceAction.java
new file mode 100644
index 0000000..5cda216
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/RenameResourceAction.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials 
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.xsd.ui.internal.refactor.actions;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ltk.core.refactoring.participants.RenameRefactoring;
+import org.eclipse.ltk.ui.refactoring.RefactoringWizard;
+import org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+import org.eclipse.wst.xsd.ui.internal.refactor.rename.RenameResourceProcessor;
+import org.eclipse.wst.xsd.ui.internal.refactor.wizard.RefactoringWizardMessages;
+import org.eclipse.wst.xsd.ui.internal.refactor.wizard.RenameRefactoringWizard;
+
+
+
+public class RenameResourceAction extends SelectionDispatchAction {
+
+
+
+	
+	public RenameResourceAction(ISelection selection)
+	{
+		super(selection);
+	}
+
+	public void selectionChanged(IStructuredSelection selection) {
+		IResource element= getResource(selection);
+		if (element == null) {
+			setEnabled(false);
+		} else {
+			RenameResourceProcessor processor= new RenameResourceProcessor(element);
+			setEnabled(processor.isApplicable());
+			
+		}
+	}
+
+	public void run(IStructuredSelection selection) {
+		IResource resource = getResource(selection);
+		RenameResourceProcessor processor= new RenameResourceProcessor(resource);
+
+			if(!processor.isApplicable())
+				return;
+			RenameRefactoring refactoring= new RenameRefactoring(processor);
+			try {
+				RefactoringWizard wizard = new RenameRefactoringWizard(
+						refactoring,
+						RefactoringWizardMessages.RenameComponentWizard_defaultPageTitle, //TODO: provide correct strings
+						RefactoringWizardMessages.RenameComponentWizard_inputPage_description, 
+						null);
+				RefactoringWizardOpenOperation op= new RefactoringWizardOpenOperation(wizard);
+				op.run(XSDEditorPlugin.getShell(), wizard.getDefaultPageTitle());
+			} catch (InterruptedException e) {
+				// do nothing. User action got cancelled
+			}
+			
+	}
+	
+	private static IResource getResource(IStructuredSelection selection) {
+		if (selection.size() != 1)
+			return null;
+		Object first= selection.getFirstElement();
+		if (! (first instanceof IResource))
+			return null;
+		return (IResource)first;
+	}
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/RenameResourceActionDelegate.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/RenameResourceActionDelegate.java
new file mode 100644
index 0000000..073f55d
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/RenameResourceActionDelegate.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials 
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.xsd.ui.internal.refactor.actions;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+
+/**
+ * @author ebelisar@ca.ibm.com
+ */
+public class RenameResourceActionDelegate implements IObjectActionDelegate {
+	
+	private ISelection fCurrentSelection;
+
+	private IWorkbenchPart fPart;
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction, org.eclipse.ui.IWorkbenchPart)
+	 */
+	public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+		fPart = targetPart;
+	}
+	/* (non-Javadoc)
+	 * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+	 */
+	public void run(IAction action) {
+		if (fCurrentSelection instanceof IStructuredSelection) {
+			IStructuredSelection structuredSelection= (IStructuredSelection) fCurrentSelection;
+			Object first= structuredSelection.getFirstElement();
+			if (first instanceof IFile) {
+				RenameResourceAction renameAction = new RenameResourceAction(structuredSelection);
+				renameAction.run(structuredSelection);
+			}
+		}
+
+	}
+	/* (non-Javadoc)
+	 * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+	 */
+	public void selectionChanged(IAction action, ISelection selection) {
+		fCurrentSelection= selection;
+
+	}
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/RenameTargetNamespaceAction.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/RenameTargetNamespaceAction.java
new file mode 100644
index 0000000..b6ac481
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/RenameTargetNamespaceAction.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials 
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.xsd.ui.internal.refactor.actions;
+
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ltk.core.refactoring.participants.RenameRefactoring;
+import org.eclipse.ltk.ui.refactoring.RefactoringWizard;
+import org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation;
+import org.eclipse.ui.actions.GlobalBuildAction;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+import org.eclipse.wst.xsd.ui.internal.refactor.rename.RenameTargetNamespaceProcessor;
+import org.eclipse.wst.xsd.ui.internal.refactor.wizard.RefactoringWizardMessages;
+import org.eclipse.wst.xsd.ui.internal.refactor.wizard.RenameRefactoringWizard;
+
+public class RenameTargetNamespaceAction extends XSDSelectionDispatchAction {
+
+	public RenameTargetNamespaceAction(ISelection selection,
+			Object aModel) {
+		super(selection, aModel);
+		setText(RefactoringWizardMessages.RenameTargetNamespace_text);
+
+	}
+
+
+	protected boolean canEnable(Object selectedObject) {
+
+		return getSchema() != null;
+
+	}
+	
+	public boolean canRun() {
+
+		return getSchema() != null;
+	}
+
+
+	public void run(ISelection selection) {
+
+		
+		RenameTargetNamespaceProcessor processor = new RenameTargetNamespaceProcessor(getSchema(), getSchema().getTargetNamespace());
+		RenameRefactoring refactoring = new RenameRefactoring(processor);
+		try {
+			RefactoringWizard wizard = new RenameRefactoringWizard(
+					refactoring,
+					RefactoringWizardMessages.RenameComponentWizard_defaultPageTitle,//TODO: provide correct strings
+					RefactoringWizardMessages.RenameComponentWizard_inputPage_description, 
+					null);
+			RefactoringWizardOpenOperation op = new RefactoringWizardOpenOperation(
+					wizard);
+			op.run(XSDEditorPlugin.getShell(), wizard
+					.getDefaultPageTitle());
+			triggerBuild();
+		} catch (InterruptedException e) {
+			// do nothing. User action got cancelled
+		}
+
+	}
+
+	public static void triggerBuild() {
+		if (ResourcesPlugin.getWorkspace().getDescription().isAutoBuilding()) {
+			new GlobalBuildAction(XSDEditorPlugin.getPlugin().getWorkbench()
+					.getActiveWorkbenchWindow(),
+					IncrementalProjectBuilder.INCREMENTAL_BUILD).run();
+		}
+	}
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/SelectionDispatchAction.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/SelectionDispatchAction.java
new file mode 100644
index 0000000..879eb31
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/SelectionDispatchAction.java
@@ -0,0 +1,194 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials 
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.xsd.ui.internal.refactor.actions;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.util.Assert;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+
+
+
+/**
+ * Action that dispatches the <code>IAction#run()</code> and the 
+ * <code>ISelectionChangedListener#selectionChanged</code> 
+ * according to the type of the selection. 
+ * 
+ * <ul>
+ * 	<li>if selection is of type <code>ITextSelection</code> then
+ * 	<code>run(ITextSelection)</code> and <code>selectionChanged(ITextSelection)</code>
+ * 	is called.</li> 
+ * 	<li>if selection is of type <code>IStructuredSelection</code> then
+ * 	<code>run(IStructuredSelection)</code> and <code>
+ * 	selectionChanged(IStructuredSelection)</code> is called.</li>
+ * 	<li>default is to call <code>run(ISelection)</code> and <code>
+ * 	selectionChanged(ISelection)</code>.</li>
+ * </ul>
+ * 
+ * <p>
+ * adapted from <code>org.eclipse.jdt.ui.actions.SelectionDispatchAction</code>
+ * </p>
+ *   
+ * 
+ */
+public abstract class SelectionDispatchAction extends Action implements ISelectionChangedListener {
+	
+	private ISelection selection;
+	
+	private Object model;
+	
+	protected SelectionDispatchAction(ISelection selection) {
+		Assert.isNotNull(selection);
+		this.selection = selection;
+		
+	}
+
+	/**
+	 * Returns the selection provided by the site owning this action.
+	 * 
+	 * @return the site's selection
+	 */	
+	public ISelection getSelection() {
+		return selection;
+	}
+	
+	/**
+	 * Updates the action's enablement state according to the given selection. This
+	 * default implementation calls one of the <code>selectionChanged</code>
+	 * methods depending on the type of the passed selection.
+	 * 
+	 * @param selection the selection this action is working on
+	 */
+	public void update(ISelection selection) {
+		dispatchSelectionChanged(selection);
+	}
+
+	/**
+	 * Notifies this action that the given structured selection has changed. This default
+	 * implementation calls <code>selectionChanged(ISelection selection)</code>.
+	 * 
+	 * @param selection the new selection
+ 	 */
+	public void selectionChanged(IStructuredSelection selection) {
+		if (selection.size() == 1) {
+			Object object = selection.getFirstElement();
+			setEnabled(canEnable(object));
+		}
+		else{
+			setEnabled(false);
+		}
+	}
+	
+	protected boolean canEnable(Object selectedObject){
+		return false;
+	}
+
+	/**
+	 * Executes this actions with the given structured selection. This default implementation
+	 * calls <code>run(ISelection selection)</code>.
+	 */
+	public void run(IStructuredSelection selection) {
+		run((ISelection)selection);
+	}
+
+	
+	/**
+	 * Notifies this action that the given text selection has changed.  This default
+	 * implementation calls <code>selectionChanged(ISelection selection)</code>.
+	 * 
+	 * @param selection the new selection
+ 	 */
+	public void selectionChanged(ITextSelection selection) {
+		selectionChanged((ISelection)selection);
+	}
+	
+	/**
+	 * Executes this actions with the given text selection. This default implementation
+	 * calls <code>run(ISelection selection)</code>.
+	 */
+	public void run(ITextSelection selection) {
+		run((ISelection)selection);
+	}
+	
+	/**
+	 * Notifies this action that the given selection has changed.  This default
+	 * implementation sets the action's enablement state to <code>false</code>.
+	 * 
+	 * @param selection the new selection
+ 	 */
+	public void selectionChanged(ISelection selection) {
+		setEnabled(false);
+	}
+	
+	/**
+	 * Executes this actions with the given selection. This default implementation
+	 * does nothing.
+	 */
+	public void run(ISelection selection) {
+		System.out.println("SelectionDispatchAction.run");
+	}
+
+	/* (non-Javadoc)
+	 * Method declared on IAction.
+	 */
+	public void run() {
+		dispatchRun(getSelection());
+		
+	}
+	
+	/* (non-Javadoc)
+	 * Method declared on ISelectionChangedListener.
+	 */
+	public void selectionChanged(SelectionChangedEvent event) {
+		dispatchSelectionChanged(event.getSelection());
+	}
+
+	private void dispatchSelectionChanged(ISelection selection) {
+		if (selection instanceof IStructuredSelection) {
+			selectionChanged((IStructuredSelection)selection);
+		} else if (selection instanceof ITextSelection) {
+			selectionChanged((ITextSelection)selection);
+		} else {
+			selectionChanged(selection);
+		}
+	}
+
+	protected void dispatchRun(ISelection selection) {
+		if (selection instanceof IStructuredSelection) {
+			run((IStructuredSelection)selection);
+		}  else if (selection instanceof ITextSelection) {
+			run((ITextSelection)selection);
+		} else {
+			run(selection);
+		}
+	}
+
+	public final Object getModel()
+	{
+		return model;
+	}
+
+	public final void setModel(Object model)
+	{
+		this.model = model;
+	}
+	
+	public boolean canRun() {
+
+		return true;
+	}
+
+	
+	
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/XSDRefactorActionGroup.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/XSDRefactorActionGroup.java
new file mode 100644
index 0000000..c8d8603
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/XSDRefactorActionGroup.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2006 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.refactor.actions;
+
+import java.util.ArrayList;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.wst.xsd.ui.internal.refactor.wizard.RefactorActionGroup;
+import org.eclipse.xsd.XSDSchema;
+
+public class XSDRefactorActionGroup extends RefactorActionGroup {
+
+	private static final String MAKE_ELEMENT_GLOBAL = "org.eclipse.wst.xsd.ui.refactor.makeElementGlobal"; //$NON-NLS-1$
+
+	private static final String MAKE_TYPE_GLOBAL = "org.eclipse.wst.xsd.ui.refactor.makeTypeGlobal"; //$NON-NLS-1$
+
+	private static final String RENAME_ELEMENT = "org.eclipse.wst.xsd.ui.refactor.rename.element"; //$NON-NLS-1$
+
+	private static final String RENAME_TARGET_NAMESPCE = "org.eclipse.wst.xsd.ui.refactor.renameTargetNamespace"; //$NON-NLS-1$
+
+	private SelectionDispatchAction fMakeLocalElementGlobal;
+
+	private SelectionDispatchAction fMakeLocalTypeGlobal;
+
+	public XSDRefactorActionGroup(ISelection selection,
+			XSDSchema schema) {
+		super(selection);
+		fEditorActions = new ArrayList();
+		fRenameAction = new RenameAction(selection, schema);
+		fRenameAction.setActionDefinitionId(RENAME_ELEMENT);
+		fEditorActions.add(fRenameAction);
+
+		fRenameTargetNamespace = new RenameTargetNamespaceAction(
+				selection, schema);
+		fRenameTargetNamespace.setActionDefinitionId(RENAME_TARGET_NAMESPCE);
+		fEditorActions.add(fRenameTargetNamespace);
+
+		fMakeLocalElementGlobal = new MakeLocalElementGlobalAction(
+				selection, schema);
+		fMakeLocalElementGlobal.setActionDefinitionId(MAKE_ELEMENT_GLOBAL);
+		fEditorActions.add(fMakeLocalElementGlobal);
+
+		fMakeLocalTypeGlobal = new MakeAnonymousTypeGlobalAction(
+				selection, schema);
+		fMakeLocalTypeGlobal.setActionDefinitionId(MAKE_TYPE_GLOBAL);
+		fEditorActions.add(fMakeLocalTypeGlobal);
+
+		initAction(fRenameAction, selection);
+		initAction(fRenameTargetNamespace, selection);
+		initAction(fMakeLocalElementGlobal, selection);
+		initAction(fMakeLocalTypeGlobal, selection);
+	}
+
+	public void dispose() {
+//		disposeAction(fRenameAction, selection);
+//		disposeAction(fMakeLocalElementGlobal, selection);
+//		disposeAction(fMakeLocalTypeGlobal, selection);
+//		disposeAction(fRenameTargetNamespace, selection);
+		super.dispose();
+	}
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/XSDRefactorGroupActionDelegate.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/XSDRefactorGroupActionDelegate.java
new file mode 100644
index 0000000..d46aa02
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/XSDRefactorGroupActionDelegate.java
@@ -0,0 +1,50 @@
+package org.eclipse.wst.xsd.ui.internal.refactor.actions;
+
+
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPartSite;
+import org.eclipse.wst.xsd.editor.ISelectionMapper;
+import org.eclipse.wst.xsd.ui.internal.refactor.actions.XSDRefactorActionGroup;
+import org.eclipse.wst.xsd.ui.internal.refactor.wizard.RefactorActionGroup;
+import org.eclipse.wst.xsd.ui.internal.refactor.wizard.RefactorGroupActionDelegate;
+import org.eclipse.wst.xsd.ui.internal.refactor.wizard.RefactorGroupSubMenu;
+import org.eclipse.xsd.XSDSchema;
+
+public class XSDRefactorGroupActionDelegate extends RefactorGroupActionDelegate {
+
+	public XSDRefactorGroupActionDelegate() {
+		super();
+	}
+
+	/**
+	 * Fills the menu with applicable refactor sub-menues
+	 * @param menu The menu to fill
+	 */
+	protected void fillMenu(Menu menu) {
+		if (fSelection == null) {
+			return;
+		}
+		if (workbenchPart != null) {
+			IWorkbenchPartSite site = workbenchPart.getSite();
+			if (site == null)
+				return;
+	
+			IEditorPart editor = site.getPage().getActiveEditor();
+			if (editor != null) {              
+                XSDSchema schema = (XSDSchema)editor.getAdapter(XSDSchema.class);
+                ISelectionMapper mapper = (ISelectionMapper)editor.getAdapter(ISelectionMapper.class);
+			    if (schema != null)
+                {                
+                    ISelection selection = mapper != null ? mapper.mapSelection(fSelection) : fSelection;                    
+					RefactorActionGroup refactorMenuGroup = new XSDRefactorActionGroup(selection, schema);
+					RefactorGroupSubMenu subMenu = new RefactorGroupSubMenu(refactorMenuGroup);
+					subMenu.fill(menu, -1);
+				}				
+			}
+		
+		}
+	
+	}
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/XSDSelectionDispatchAction.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/XSDSelectionDispatchAction.java
new file mode 100644
index 0000000..078f4c1
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/XSDSelectionDispatchAction.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2006 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.refactor.actions;
+
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.xsd.XSDSchema;
+
+public class XSDSelectionDispatchAction extends SelectionDispatchAction
+{
+
+	
+	
+	public XSDSelectionDispatchAction(ISelection selection, Object model)
+	{
+		super(selection);
+		setModel(model);
+	}
+
+	protected XSDSchema getSchema(){
+		Object model = getModel();
+		if(model instanceof XSDSchema)
+		{
+			return (XSDSchema) model;
+		}
+	
+		return null;
+	}
+
+	
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/messages.properties b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/messages.properties
new file mode 100644
index 0000000..48483a1
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/messages.properties
@@ -0,0 +1,41 @@
+RefactorMenu.label=Refactor
+RefactorActionGroup.no_refactoring_available=<no refactoring available>
+
+RenameAction.rename=Rename
+RenameAction.unavailable=Operation unavailable on the current selection.\nSelect a ....
+RenameAction.text=Re&name...
+
+RenameInputWizardPage.new_name= &New name:
+RenameRefactoringWizard.internal_error= Internal error during name checking: {0}
+
+
+RenameXSDElementAction.exception=Unexpected exception occurred. See log for details
+RenameXSDElementAction.not_available=Operation unavailable on the current selection.\nSelect a XSD project, folder, resource, file, attribute declarations,  attribute group definitions, complex type definitions, element declarations, identity constraint definitions, model groups definitions, notation declarations, or simple type definitions.
+RenameXSDElementAction.name=Rename
+
+
+RenameSupport.dialog.title=Rename
+RenameSupport.not_available=Rename support not available
+
+RenameComponentWizard.defaultPageTitle=Rename wizard
+RenameComponentWizard.inputPage.description=Rename XML Schema component
+
+RenameInputWizardPage.update_references=Update references
+XSDComponentRenameChange.name=XML Schema component renaming in {0}: {1} to {2}
+XSDComponentRenameChange.Renaming=Renaming...
+ResourceRenameParticipant.compositeChangeName=XSD file rename references updating changes
+RenameResourceChange.rename_resource_reference_change=Renaming resource name references
+XSDRenameResourceChange.name=Resource rename: {0} to {1}
+RenameResourceRefactoring.Internal_Error=Internal error
+RenameResourceRefactoring.alread_exists=Resource already exist
+RenameResourceRefactoring.invalidName=Invalid resource name
+RenameResourceProcessor.name=Resource renaming
+MakeLocalElementGlobalAction.text=Make Local Element Global
+XSDComponentRenameParticipant.Component_Refactoring_updates=XML Schema refactoring changes
+WSDLComponentRenameParticipant.Component_Refactoring_updates=WSDL refactoring changes
+RenameComponentProcessor.Component_Refactoring_updates=Component name refactoring changes
+RenameComponentProcessor.Component_Refactoring_update_declatation=Update component declaration/definition
+RenameComponentProcessor.Component_Refactoring_update_reference=Update component reference
+XSDComponentRenameParticipant.xsd_component_rename_participant=XSD component rename participant
+WSDLComponentRenameParticipant.wsdl_component_rename_participant=WSDL component rename participant
+ResourceRenameParticipant.File_Rename_update_reference=File rename refactoring changes
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/rename/ComponentRenameArguments.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/rename/ComponentRenameArguments.java
new file mode 100644
index 0000000..ebdf3d0
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/rename/ComponentRenameArguments.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2006 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.refactor.rename;
+
+import java.util.Map;
+import org.eclipse.ltk.core.refactoring.participants.RenameArguments;
+import org.eclipse.wst.xsd.ui.internal.refactor.TextChangeManager;
+
+public class ComponentRenameArguments extends RenameArguments {
+	
+	TextChangeManager changeManager;
+	Map matches;
+	String qualifier;
+
+	public ComponentRenameArguments(String newName, boolean updateReferences) {
+		super(newName, updateReferences);
+	}
+
+	public TextChangeManager getChangeManager() {
+		return changeManager;
+	}
+
+	public void setChangeManager(TextChangeManager changeManager) {
+		this.changeManager = changeManager;
+	}
+
+	public Map getMatches() {
+		return matches;
+	}
+
+	public void setMatches(Map matches) {
+		this.matches = matches;
+	}
+
+	public String getQualifier() {
+		return qualifier;
+	}
+
+	public void setQualifier(String qualifier) {
+		this.qualifier = qualifier;
+	}
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/rename/RenameComponentProcessor.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/rename/RenameComponentProcessor.java
new file mode 100644
index 0000000..62b6ac3
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/rename/RenameComponentProcessor.java
@@ -0,0 +1,484 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials 
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.xsd.ui.internal.refactor.rename;
+
+import com.ibm.icu.text.Collator;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.ltk.core.refactoring.Change;
+import org.eclipse.ltk.core.refactoring.CompositeChange;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.ltk.core.refactoring.TextChange;
+import org.eclipse.ltk.core.refactoring.TextFileChange;
+import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
+import org.eclipse.ltk.core.refactoring.participants.ParticipantManager;
+import org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant;
+import org.eclipse.ltk.core.refactoring.participants.RenameArguments;
+import org.eclipse.ltk.core.refactoring.participants.RenameParticipant;
+import org.eclipse.ltk.core.refactoring.participants.RenameProcessor;
+import org.eclipse.ltk.core.refactoring.participants.SharableParticipants;
+import org.eclipse.text.edits.ReplaceEdit;
+import org.eclipse.wst.common.core.search.SearchEngine;
+import org.eclipse.wst.common.core.search.SearchMatch;
+import org.eclipse.wst.common.core.search.pattern.QualifiedName;
+import org.eclipse.wst.common.core.search.pattern.SearchPattern;
+import org.eclipse.wst.common.core.search.scope.SearchScope;
+import org.eclipse.wst.common.core.search.scope.SelectionSearchScope;
+import org.eclipse.wst.common.core.search.scope.WorkspaceSearchScope;
+import org.eclipse.wst.common.core.search.util.CollectingSearchRequestor;
+import org.eclipse.wst.xml.core.internal.search.XMLComponentDeclarationPattern;
+import org.eclipse.wst.xml.core.internal.search.XMLComponentReferencePattern;
+import org.eclipse.wst.xsd.ui.internal.refactor.Checks;
+import org.eclipse.wst.xsd.ui.internal.refactor.INameUpdating;
+import org.eclipse.wst.xsd.ui.internal.refactor.IReferenceUpdating;
+import org.eclipse.wst.xsd.ui.internal.refactor.RefactoringComponent;
+import org.eclipse.wst.xsd.ui.internal.refactor.RefactoringMessages;
+import org.eclipse.wst.xsd.ui.internal.refactor.TextChangeManager;
+import org.eclipse.wst.xsd.ui.internal.refactor.util.TextChangeCompatibility;
+
+
+
+public class RenameComponentProcessor extends RenameProcessor implements INameUpdating, IReferenceUpdating {
+	public static final String IDENTIFIER = "org.eclipse.wst.xml.refactor.renameComponentProcessor"; //$NON-NLS-1$
+
+	public static String quoteString(String value) {
+		value = value == null ? "" : value;
+
+		StringBuffer sb = new StringBuffer();
+		if (!value.startsWith("\"")) {
+			sb.append("\"");
+		}
+		sb.append(value);
+		if (!value.endsWith("\"")) {
+			sb.append("\"");
+		}
+		return sb.toString();
+	}
+
+	private TextChangeManager changeManager;
+
+	private String newName;
+
+	private RefactoringComponent selectedComponent;
+
+	private boolean updateReferences = true;
+
+	private Map references = new HashMap();
+
+	public RenameComponentProcessor(RefactoringComponent selectedComponent) {
+		this.selectedComponent = selectedComponent;
+	}
+
+	public RenameComponentProcessor(RefactoringComponent selectedComponent, String newName) {
+		this.newName = newName;
+		this.selectedComponent = selectedComponent;
+	}
+
+	private void addDeclarationUpdate(TextChangeManager manager) throws CoreException {
+		String fileStr = selectedComponent.getElement().getModel().getBaseLocation();
+		IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(fileStr));
+		addDeclarationUpdate(manager, file);
+	}
+
+	final void addDeclarationUpdate(TextChangeManager manager, IFile file) throws CoreException {
+
+		String componentName = selectedComponent.getName();
+		String componentNamespace = selectedComponent.getNamespaceURI();
+		QualifiedName elementQName = new QualifiedName(componentNamespace, componentName);
+		QualifiedName typeQName = selectedComponent.getTypeQName();
+
+
+
+		SearchScope scope = new WorkspaceSearchScope();
+		if (file != null) {
+			scope = new SelectionSearchScope(new IResource[]{file});
+		}
+		CollectingSearchRequestor requestor = new CollectingSearchRequestor();
+		SearchPattern pattern = new XMLComponentDeclarationPattern(file, elementQName, typeQName);
+		SearchEngine searchEngine = new SearchEngine();
+		searchEngine.search(pattern, requestor, scope, null, new NullProgressMonitor());
+		List results = requestor.getResults();
+		for (Iterator iter = results.iterator(); iter.hasNext();) {
+			SearchMatch match = (SearchMatch) iter.next();
+			if (match != null) {
+				TextChange textChange = manager.get(match.getFile());
+				String newName = getNewElementName();
+				newName = quoteString(newName);
+
+				ReplaceEdit replaceEdit = new ReplaceEdit(match.getOffset(), match.getLength(), newName);
+				String editName = RefactoringMessages.getString("RenameComponentProcessor.Component_Refactoring_update_declatation");;
+				TextChangeCompatibility.addTextEdit(textChange, editName, replaceEdit);
+			}
+		}
+	}
+
+	void addOccurrences(TextChangeManager manager, IProgressMonitor pm, RefactoringStatus status) throws CoreException {
+
+		String fileStr = selectedComponent.getElement().getModel().getBaseLocation();
+		IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(fileStr));
+
+		String componentName = selectedComponent.getName();
+		String componentNamespace = selectedComponent.getNamespaceURI();
+		QualifiedName elementQName = new QualifiedName(componentNamespace, componentName);
+		QualifiedName typeQName = selectedComponent.getTypeQName();
+
+		SearchEngine searchEngine = new SearchEngine();
+
+		SortingSearchRequestor requestor = new SortingSearchRequestor();
+		SearchPattern pattern = new XMLComponentReferencePattern(file, elementQName, typeQName);
+		searchEngine.search(pattern, requestor, new WorkspaceSearchScope(), null, new NullProgressMonitor());
+		references = requestor.getResults();
+		// for (Iterator iter = references.iterator(); iter.hasNext();) {
+		// SearchMatch match = (SearchMatch) iter.next();
+
+		// TextChange textChange = manager.get(match.getFile());
+		// String newName = getNewElementName();
+		// if(match.getObject() instanceof Node){
+		// Node node = (Node)match.getObject();
+		// if(node instanceof IDOMAttr){
+		// IDOMAttr attr = (IDOMAttr)node;
+		// IDOMElement element = (IDOMElement)attr.getOwnerElement() ;
+		// newName = getNewQName(element, componentNamespace, newName);
+		// }
+		// newName = quoteString(newName);
+		// }
+		//				
+		// ReplaceEdit replaceEdit = new ReplaceEdit(match.getOffset(),
+		// match.getLength(), newName );
+		// String editName =
+		// RefactoringMessages.getString("RenameComponentProcessor.Component_Refactoring_update_reference");
+		// TextChangeCompatibility.addTextEdit(textChange, editName,
+		// replaceEdit);
+
+		// }
+	}
+
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jdt.internal.corext.refactoring.tagging.ITextUpdating#canEnableTextUpdating()
+	 */
+	public boolean canEnableTextUpdating() {
+		return true;
+	}
+
+	public boolean canEnableUpdateReferences() {
+		return true;
+	}
+
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor#checkFinalConditions(org.eclipse.core.runtime.IProgressMonitor,
+	 *      org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext)
+	 */
+	public RefactoringStatus checkFinalConditions(IProgressMonitor monitor, CheckConditionsContext context) throws CoreException, OperationCanceledException {
+		Assert.isNotNull(monitor);
+		Assert.isNotNull(context);
+		final RefactoringStatus status = new RefactoringStatus();
+		try {
+			monitor.beginTask("", 2); //$NON-NLS-1$
+			monitor.setTaskName("RefactoringMessages.RenameComponentRefactoring_checking");
+			status.merge(checkNewElementName(getNewElementName()));
+			monitor.worked(1);
+			monitor.setTaskName("RefactoringMessages.RenameComponentRefactoring_searching");
+			status.merge(createRenameChanges(new SubProgressMonitor(monitor, 1)));
+		}
+		finally {
+			monitor.done();
+		}
+		return status;
+	}
+
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor#checkInitialConditions(org.eclipse.core.runtime.IProgressMonitor)
+	 */
+	public RefactoringStatus checkInitialConditions(IProgressMonitor pm) throws CoreException, OperationCanceledException {
+		// TODO add code to check initial conditions for component rename
+		Assert.isNotNull(pm);
+		try {
+			return new RefactoringStatus();
+		}
+		finally {
+			pm.done();
+		}
+
+	}
+
+	public final RefactoringStatus checkNewElementName(final String name) {
+		Assert.isNotNull(name);
+		final RefactoringStatus result = Checks.checkName(name);
+		result.merge(Checks.checkComponentName(name));
+		if (Checks.isAlreadyNamed(selectedComponent, name))
+			result.addFatalError("RefactoringMessages.RenameComponentRefactoring_another_name");
+		return result;
+	}
+
+	private Object[] computeDerivedElements() {
+
+		Object[] elements = getElements();
+		// Object[] results = new Object[elements.length];
+		// for(int i=0; i< elements.length; i++){
+		// RefactoringComponent component = (RefactoringComponent)elements[i];
+		// results[i] = component.getAdaptee();
+		//			
+		// }
+		return elements;
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor#createChange(org.eclipse.core.runtime.IProgressMonitor)
+	 */
+	public Change createChange(IProgressMonitor pm) throws CoreException, OperationCanceledException {
+		// don't create any change now, all the changes are in changeManger
+		// variable and will be combined in postCreateChange method
+		return null;
+	}
+
+	private TextChangeManager updateChangeManager(IProgressMonitor pm, RefactoringStatus status) throws CoreException {
+		TextChangeManager manager = getChangeManager();
+		System.out.println("addDeclarationUpate-------------------");
+		// only one declaration gets updated
+		addDeclarationUpdate(manager);
+		if (getUpdateReferences()) {
+			System.out.println("addOccurences--------------------------");
+			addOccurrences(manager, pm, status);
+		}
+		return manager;
+	}
+
+	private RefactoringStatus createRenameChanges(final IProgressMonitor monitor) throws CoreException {
+		Assert.isNotNull(monitor);
+		final RefactoringStatus status = new RefactoringStatus();
+		try {
+			monitor.beginTask("RefactoringMessages.RenameComponentRefactoring_searching", 1);
+			updateChangeManager(new SubProgressMonitor(monitor, 1), status);
+		}
+		finally {
+			monitor.done();
+		}
+		return status;
+	}
+
+	public TextChangeManager getChangeManager() {
+
+		if (changeManager == null) {
+			changeManager = new TextChangeManager(false);
+		}
+		return changeManager;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.wst.xsd.internal.refactoring.rename.XSDRenameProcessor#getAffectedProjectNatures()
+	 */
+	protected String[] getAffectedProjectNatures() throws CoreException {
+		// TODO: find project natures of the files that are going to be
+		// refactored
+		return new String[]{"org.eclipse.jdt.core.javanature"};
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jdt.internal.corext.refactoring.tagging.ITextUpdating#getCurrentElementName()
+	 */
+	public String getCurrentElementName() {
+		//
+		return selectedComponent.getName();
+	}
+
+
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor#getElements()
+	 */
+	public Object[] getElements() {
+		Object model = selectedComponent.getModelObject();
+		if (model != null) {
+			return new Object[]{model};
+		}
+		return new Object[0];
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor#getIdentifier()
+	 */
+	public String getIdentifier() {
+		return IDENTIFIER;
+	}
+
+	public String getNewElementName() {
+		return newName;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor#getProcessorName()
+	 */
+	public String getProcessorName() {
+		return RefactoringMessages.getFormattedString("RenameComponentRefactoring.name", //$NON-NLS-1$
+					new String[]{selectedComponent.getNamespaceURI() + ":" + selectedComponent.getName(), newName});
+
+	}
+
+
+	public boolean getUpdateReferences() {
+		return updateReferences;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor#isApplicable()
+	 */
+	public boolean isApplicable() throws CoreException {
+		if (selectedComponent == null)
+			return false;
+		// TODO implement isApplicable logic for the named component,
+		// verify how it is different from other condition checks
+		// if (fNamedComponent.isAnonymous())
+		// return false;
+		// if (! Checks.isAvailable(fType))
+		// return false;
+		// if (isSpecialCase(fType))
+		// return false;
+		return true;
+	}
+
+	protected void loadDerivedParticipants(RefactoringStatus status, List result, Object[] derivedElements, ComponentRenameArguments arguments, String[] natures, SharableParticipants shared) throws CoreException {
+		if (derivedElements != null) {
+			for (int i = 0; i < derivedElements.length; i++) {
+				RenameParticipant[] participants = ParticipantManager.loadRenameParticipants(status, this, derivedElements[i], arguments, natures, shared);
+				result.addAll(Arrays.asList(participants));
+			}
+		}
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.wst.xsd.internal.refactoring.rename.XSDRenameProcessor#loadDerivedParticipants(org.eclipse.ltk.core.refactoring.RefactoringStatus,
+	 *      java.util.List, java.lang.String[],
+	 *      org.eclipse.ltk.core.refactoring.participants.SharableParticipants)
+	 */
+	protected void loadDerivedParticipants(RefactoringStatus status, List result, String[] natures, SharableParticipants shared) throws CoreException {
+		ComponentRenameArguments arguments = new ComponentRenameArguments(getNewElementName(), getUpdateReferences());
+		arguments.setMatches(references);
+		arguments.setQualifier(selectedComponent.getNamespaceURI());
+		// pass in changeManger to the participants so that it can collect all
+		// changes/per files
+		arguments.setChangeManager(getChangeManager());
+		loadDerivedParticipants(status, result, computeDerivedElements(), arguments, natures, shared);
+	}
+
+	protected void loadElementParticipants(RefactoringStatus status, List result, RenameArguments arguments, String[] natures, SharableParticipants shared) throws CoreException {
+		Object[] elements = new Object[0];// getElements();
+		for (int i = 0; i < elements.length; i++) {
+			result.addAll(Arrays.asList(ParticipantManager.loadRenameParticipants(status, this, elements[i], arguments, natures, shared)));
+		}
+	}
+
+
+	public final RefactoringParticipant[] loadParticipants(RefactoringStatus status, SharableParticipants sharedParticipants) throws CoreException {
+		RenameArguments arguments = new RenameArguments(getNewElementName(), getUpdateReferences());
+		String[] natures = getAffectedProjectNatures();
+		List result = new ArrayList();
+		loadElementParticipants(status, result, arguments, natures, sharedParticipants);
+		loadDerivedParticipants(status, result, natures, sharedParticipants);
+		for (Iterator i = result.iterator(); i.hasNext();) {
+			Object o = i.next();
+			if (o instanceof XMLComponentRenameParticipant) {
+				XMLComponentRenameParticipant p = (XMLComponentRenameParticipant) o;
+				// getChangeManager()
+				p.setChangeManager(getChangeManager());
+			}
+		}
+
+		return (RefactoringParticipant[]) result.toArray(new RefactoringParticipant[result.size()]);
+	}
+
+	public void setNewElementName(String newName) {
+		Assert.isNotNull(newName);
+		this.newName = newName;
+	}
+
+	public void setUpdateReferences(boolean update) {
+		updateReferences = update;
+
+	}
+
+	public Change postCreateChange(Change[] participantChanges, IProgressMonitor pm) throws CoreException, OperationCanceledException {
+		Assert.isNotNull(pm);
+		try {
+			String changeName = RefactoringMessages.getString("RenameComponentProcessor.Component_Refactoring_updates");
+			TextChange[] changes = changeManager.getAllChanges();
+			// System.out.println("all changes(" + getChangeManager() + ")" +
+			// changes.length);
+			// System.out.println("add cus " +
+			// changeManager.getAllCompilationUnits().length);
+			Comparator c = new Comparator() {
+				public int compare(Object o1, Object o2) {
+					TextFileChange c1 = (TextFileChange) o1;
+					TextFileChange c2 = (TextFileChange) o2;
+					return Collator.getInstance().compare(c1.getFile().getFullPath(), c2.getFile().getFullPath());
+				}
+			};
+			if (changes.length > 0) {
+				// Arrays.sort(changes, c);
+				CompositeChange compositeChange = new CompositeChange("!" + changeName, changes);
+				compositeChange.markAsSynthetic();
+				return compositeChange;
+			}
+			else {
+				return null;
+			}
+
+		}
+		finally {
+			pm.done();
+		}
+	}
+
+
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/rename/RenameResourceProcessor.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/rename/RenameResourceProcessor.java
new file mode 100644
index 0000000..f0a326e
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/rename/RenameResourceProcessor.java
@@ -0,0 +1,173 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials 
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package  org.eclipse.wst.xsd.ui.internal.refactor.rename;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.ltk.core.refactoring.Change;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
+import org.eclipse.ltk.core.refactoring.participants.ParticipantManager;
+import org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant;
+import org.eclipse.ltk.core.refactoring.participants.RenameArguments;
+import org.eclipse.ltk.core.refactoring.participants.RenameProcessor;
+import org.eclipse.ltk.core.refactoring.participants.SharableParticipants;
+import org.eclipse.wst.xsd.ui.internal.refactor.INameUpdating;
+import org.eclipse.wst.xsd.ui.internal.refactor.RefactoringMessages;
+
+public class RenameResourceProcessor extends RenameProcessor implements INameUpdating {
+
+	private IResource fResource;
+	private String fNewElementName;
+		
+	public static final String IDENTIFIER= "org.eclipse.wst.ui.xsd.renameResourceProcessor"; //$NON-NLS-1$
+	
+	public RenameResourceProcessor(IResource resource) {
+		fResource= resource;
+		if (fResource != null) {
+			setNewElementName(fResource.getName());
+		}
+	}
+
+	//---- INameUpdating ---------------------------------------------------
+	
+	public void setNewElementName(String newName) {
+		Assert.isNotNull(newName);
+		fNewElementName= newName;
+	}
+
+	public String getNewElementName() {
+		return fNewElementName;
+	}
+	
+	//---- IRenameProcessor methods ---------------------------------------
+		
+	public String getIdentifier() {
+		return IDENTIFIER;
+	}
+	
+	public boolean isApplicable()  {
+		if (fResource == null)
+			return false;
+		if (! fResource.exists())
+			return false;
+		if (! fResource.isAccessible())	
+			return false;
+		return true;			
+	}
+	
+	public String getProcessorName() {
+		String message= RefactoringMessages.getFormattedString("RenameResourceProcessor.name", //$NON-NLS-1$
+				new String[]{getCurrentElementName(), getNewElementName()});
+		return message;
+	}
+	
+	public Object[] getElements() {
+		return new Object[] {fResource};
+	}
+	
+	public String getCurrentElementName() {
+		return fResource.getName();
+	}
+	
+	public String[] getAffectedProjectNatures() throws CoreException {
+		return new String[0];
+	}
+
+	public Object getNewElement() {
+		
+			
+		return ResourcesPlugin.getWorkspace().getRoot().findMember(createNewPath(getNewElementName()));
+	}
+
+	public boolean getUpdateReferences() {
+		return true;
+	}
+	
+	public RefactoringParticipant[] loadParticipants(RefactoringStatus status, SharableParticipants shared) throws CoreException {
+		Object[] elements= getElements();
+		String[] natures= getAffectedProjectNatures();
+		List result= new ArrayList();
+		RenameArguments arguments= new RenameArguments(getNewElementName(), getUpdateReferences());
+		for (int i= 0; i < elements.length; i++) {
+			result.addAll(Arrays.asList(ParticipantManager.loadRenameParticipants(status, 
+				this, elements[i],
+				arguments, natures, shared)));
+		}
+		return (RefactoringParticipant[])result.toArray(new RefactoringParticipant[result.size()]);
+	}
+	
+	//--- Condition checking --------------------------------------------
+
+	public RefactoringStatus checkInitialConditions(IProgressMonitor pm) throws CoreException {
+		return new RefactoringStatus();
+	}
+	
+	/* non java-doc
+	 * @see IRenameRefactoring#checkNewName()
+	 */
+	public RefactoringStatus checkNewElementName(String newName)  {
+		Assert.isNotNull(newName, "new name"); //$NON-NLS-1$
+		IContainer c= fResource.getParent();
+		if (c == null)
+			return RefactoringStatus.createFatalErrorStatus(RefactoringMessages.getString("RenameResourceRefactoring.Internal_Error")); //$NON-NLS-1$
+						
+		if (c.findMember(newName) != null)
+			return RefactoringStatus.createFatalErrorStatus(RefactoringMessages.getString("RenameResourceRefactoring.alread_exists")); //$NON-NLS-1$
+			
+		if (!c.getFullPath().isValidSegment(newName))
+			return RefactoringStatus.createFatalErrorStatus(RefactoringMessages.getString("RenameResourceRefactoring.invalidName")); //$NON-NLS-1$
+	
+		RefactoringStatus result= RefactoringStatus.create(c.getWorkspace().validateName(newName, fResource.getType()));
+		if (! result.hasFatalError())
+			result.merge(RefactoringStatus.create(c.getWorkspace().validatePath(createNewPath(newName), fResource.getType())));		
+		return result;		
+	}
+	
+	/* non java-doc
+	 * @see Refactoring#checkInput(IProgressMonitor)
+	 */
+	public RefactoringStatus checkFinalConditions(IProgressMonitor pm, CheckConditionsContext context)  {
+		pm.beginTask("", 1); //$NON-NLS-1$
+		try{
+			return new RefactoringStatus();
+		} finally{
+			pm.done();
+		}	
+	}
+
+	private String createNewPath(String newName){
+		return fResource.getFullPath().removeLastSegments(1).append(newName).toString();
+	}
+		
+	//--- changes 
+	
+	/* non java-doc 
+	 * @see IRefactoring#createChange(IProgressMonitor)
+	 */
+	public Change createChange(IProgressMonitor pm) {
+		pm.beginTask("", 1); //$NON-NLS-1$
+		try{
+			return new ResourceRenameChange(fResource, getNewElementName());
+		} finally{
+			pm.done();
+		}	
+	}
+}
+
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/rename/RenameTargetNamespaceProcessor.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/rename/RenameTargetNamespaceProcessor.java
new file mode 100644
index 0000000..03fe81e
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/rename/RenameTargetNamespaceProcessor.java
@@ -0,0 +1,418 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials 
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.xsd.ui.internal.refactor.rename;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.ltk.core.refactoring.Change;
+import org.eclipse.ltk.core.refactoring.CompositeChange;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.ltk.core.refactoring.TextChange;
+import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
+import org.eclipse.ltk.core.refactoring.participants.ParticipantManager;
+import org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant;
+import org.eclipse.ltk.core.refactoring.participants.RenameArguments;
+import org.eclipse.ltk.core.refactoring.participants.RenameParticipant;
+import org.eclipse.ltk.core.refactoring.participants.RenameProcessor;
+import org.eclipse.ltk.core.refactoring.participants.SharableParticipants;
+import org.eclipse.wst.xsd.ui.internal.refactor.INameUpdating;
+import org.eclipse.wst.xsd.ui.internal.refactor.IReferenceUpdating;
+import org.eclipse.wst.xsd.ui.internal.refactor.RefactoringComponent;
+import org.eclipse.wst.xsd.ui.internal.refactor.RefactoringMessages;
+import org.eclipse.wst.xsd.ui.internal.refactor.TextChangeManager;
+import org.eclipse.xsd.XSDSchema;
+
+
+public class RenameTargetNamespaceProcessor extends RenameProcessor implements INameUpdating, IReferenceUpdating
+{
+	private String newNamespace;
+	private boolean updateReferences = true;
+	private TextChangeManager changeManager;
+	private XSDSchema model;
+
+
+	public static final String IDENTIFIER = "org.eclipse.wst.ui.xsd.renameComponentProcessor"; //$NON-NLS-1$
+
+	public RenameTargetNamespaceProcessor(XSDSchema model, String newName)
+	{
+		this.model = model;
+		this.newNamespace = newName;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jdt.internal.corext.refactoring.tagging.ITextUpdating#canEnableTextUpdating()
+	 */
+	public boolean canEnableTextUpdating()
+	{
+		return true;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jdt.internal.corext.refactoring.tagging.ITextUpdating#getCurrentElementName()
+	 */
+	public String getCurrentElementName()
+	{
+		//
+		return model.getTargetNamespace();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.wst.xsd.internal.refactoring.rename.XSDRenameProcessor#getAffectedProjectNatures()
+	 */
+	protected String[] getAffectedProjectNatures() throws CoreException
+	{
+		// TODO: find project natures of the files that are going to be
+		// refactored
+		return new String[]{"org.eclipse.jdt.core.javanature"};
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.wst.xsd.internal.refactoring.rename.XSDRenameProcessor#loadDerivedParticipants(org.eclipse.ltk.core.refactoring.RefactoringStatus,
+	 *      java.util.List, java.lang.String[],
+	 *      org.eclipse.ltk.core.refactoring.participants.SharableParticipants)
+	 */
+	protected void loadDerivedParticipants(RefactoringStatus status,
+			List result, String[] natures, SharableParticipants shared)
+			throws CoreException
+	{
+		String newCUName= getNewElementName(); //$NON-NLS-1$
+		RenameArguments arguments= new RenameArguments(newCUName, getUpdateReferences());
+		loadDerivedParticipants(status, result, 
+			computeDerivedElements(), arguments, 
+			 natures, shared);
+	}
+	
+	protected void loadDerivedParticipants(RefactoringStatus status, List result, Object[] derivedElements, 
+			RenameArguments arguments,  String[] natures, SharableParticipants shared) throws CoreException {
+		if (derivedElements != null) {
+			for (int i= 0; i < derivedElements.length; i++) {
+				RenameParticipant[] participants= ParticipantManager.loadRenameParticipants(status, 
+					this, derivedElements[i], 
+					arguments, natures, shared);
+				result.addAll(Arrays.asList(participants));
+			}
+		}
+		
+	}
+	
+	private Object[] computeDerivedElements() {
+
+		Object[] elements = getElements();
+		Object[] results = new Object[elements.length];
+		for(int i=0; i< elements.length; i++){
+			RefactoringComponent component = (RefactoringComponent)elements[i];
+			results[i] = component.getModelObject();
+			
+		}
+		return results;
+		
+	}
+	
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor#checkFinalConditions(org.eclipse.core.runtime.IProgressMonitor,
+	 *      org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext)
+	 */
+	public RefactoringStatus checkFinalConditions(IProgressMonitor pm,
+			CheckConditionsContext context) throws CoreException,
+			OperationCanceledException
+	{
+		try
+		{
+			RefactoringStatus result = new RefactoringStatus();
+			pm.beginTask("", 9); //$NON-NLS-1$
+			changeManager = createChangeManager(new SubProgressMonitor(pm, 1),
+					result);
+			return result;
+		} finally
+		{
+			pm.done();
+		}
+		
+
+	}
+
+	
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor#checkInitialConditions(org.eclipse.core.runtime.IProgressMonitor)
+	 */
+	public RefactoringStatus checkInitialConditions(IProgressMonitor pm)
+			throws CoreException, OperationCanceledException
+	{
+		// TODO add code to check initial conditions for component rename
+		return new RefactoringStatus();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor#createChange(org.eclipse.core.runtime.IProgressMonitor)
+	 */
+	public Change createChange(IProgressMonitor pm) throws CoreException,
+			OperationCanceledException
+	{
+		try
+		{
+			String changeName = RefactoringMessages.getString("RenameComponentProcessor.Component_Refactoring_updates");
+			return new CompositeChange(changeName, changeManager.getAllChanges());
+		} finally
+		{
+			pm.done();
+		}
+
+		// Change[] changes = ComponentRenameChange.createChangesFor(
+		// this.fNamedComponent, getNewElementName());
+		//
+		// if (changes.length > 0)
+		// {
+		// CompositeChange multiChange = null;
+		// multiChange = new CompositeChange(
+		// "XSD component rename participant changes", changes); //$NON-NLS-1$
+		// TODO: externalize string
+		// return multiChange;
+		// } else
+		// {
+		//
+		// return new ComponentRenameChange(
+		// fNamedComponent,
+		// fNamedComponent.getName(),
+		// getNewElementName(),
+		// fNamedComponent.getSchema());
+		// }
+		
+		
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor#getElements()
+	 */
+	public Object[] getElements()
+	{
+		return new Object[] { model };
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor#getIdentifier()
+	 */
+	public String getIdentifier()
+	{
+		return IDENTIFIER;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor#getProcessorName()
+	 */
+	public String getProcessorName()
+	{
+		return RefactoringMessages.getFormattedString(
+				"RenameComponentRefactoring.name", //$NON-NLS-1$
+				new String[]
+				{
+						getCurrentElementName(),
+						getNewElementName() });
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor#isApplicable()
+	 */
+	public boolean isApplicable() throws CoreException
+	{
+		if (getModel() == null)
+			return false;
+		// TODO implement isApplicable logic for the named component,
+		// verify how it is different from other condition checks
+		// if (fNamedComponent.isAnonymous())
+		// return false;
+		// if (! Checks.isAvailable(fType))
+		// return false;
+		// if (isSpecialCase(fType))
+		// return false;
+		return true;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jdt.internal.corext.refactoring.tagging.INameUpdating#checkNewElementName(java.lang.String)
+	 */
+	public RefactoringStatus checkNewElementName(String newName)
+	{
+		Assert.isNotNull(newName, "new name"); //$NON-NLS-1$
+		// TODO: implement new name checking
+		// RefactoringStatus result = Checks.checkTypeName(newName);
+		// if (Checks.isAlreadyNamed(fType, newName))
+		// result.addFatalError(RefactoringCoreMessages.getString("RenameTypeRefactoring.choose_another_name"));
+		// //$NON-NLS-1$
+		return new RefactoringStatus();
+	}
+
+	public final RefactoringParticipant[] loadParticipants(
+			RefactoringStatus status, SharableParticipants sharedParticipants)
+			throws CoreException
+	{
+		RenameArguments arguments = new RenameArguments(getNewElementName(),
+				true);
+		String[] natures = getAffectedProjectNatures();
+		List result = new ArrayList();
+		loadElementParticipants(status, result, arguments, natures,
+				sharedParticipants);
+		loadDerivedParticipants(status, result, natures, sharedParticipants);
+		return (RefactoringParticipant[]) result
+				.toArray(new RefactoringParticipant[result.size()]);
+	}
+
+	protected void loadElementParticipants(RefactoringStatus status,
+			List result, RenameArguments arguments, String[] natures,
+			SharableParticipants shared) throws CoreException
+	{
+		Object[] elements = getElements();
+		for (int i = 0; i < elements.length; i++)
+		{
+			result.addAll(Arrays.asList(ParticipantManager
+					.loadRenameParticipants(status, this, elements[i],
+							arguments, natures, shared)));
+		}
+	}
+	
+	private TextChangeManager createChangeManager(IProgressMonitor pm,
+			RefactoringStatus status) throws CoreException
+	{
+		TextChangeManager manager = new TextChangeManager(false);
+		// only one declaration gets updated
+		addDeclarationUpdate(manager);
+		return manager;
+	}
+
+	private void addDeclarationUpdate(TextChangeManager manager)
+
+	{
+		String fileStr = getModel().getSchemaLocation();
+		URI uri = URI.createPlatformResourceURI(fileStr);
+		try
+		{
+			URL url = new URL(uri.toString());
+			url = Platform.resolve(url);
+			if(url != null){
+				IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+				IFile file = root.getFileForLocation(new Path(url.getFile()));
+				if(file != null ){
+					TextChange change = manager.get(file);
+					addDeclarationUpdate(change);
+				}
+			}
+		} catch (MalformedURLException e)
+		{
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (IOException e)
+		{
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		
+		
+	}
+	
+	
+
+	final void addDeclarationUpdate(TextChange change) 
+	{
+//		String editName = RefactoringMessages.getString("RenameComponentProcessor.Component_Refactoring_update_declatation");;
+//	  
+//		NamedComponentRenamer renamer = new NamedComponentRenamer(
+//				selectedComponent.getElement(), newNamespace);
+//		renamer.renameComponent();
+//		List textEdits = renamer.getTextEdits();
+//		for (int j = 0; j < textEdits.size(); j++)
+//		{
+//			ReplaceEdit replaceEdit = (ReplaceEdit) textEdits
+//					.get(j);
+//			TextChangeCompatibility.addTextEdit(change,
+//					editName, replaceEdit);
+//		}
+	}
+
+	public void setNewElementName(String newName)
+	{
+		this.newNamespace = newName;
+	}
+
+	public String getNewElementName()
+	{
+		return newNamespace;
+	}
+
+	
+
+	public boolean canEnableUpdateReferences()
+	{
+		return true;
+	}
+
+	public boolean getUpdateReferences()
+	{
+		return updateReferences;
+	}
+
+	public void setUpdateReferences(boolean update)
+	{
+		updateReferences = update;
+		
+	}
+
+	public final TextChangeManager getChangeManager()
+	{
+		return changeManager;
+	}
+
+	public final XSDSchema getModel()
+	{
+		return model;
+	}
+	
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/rename/ResourceRenameChange.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/rename/ResourceRenameChange.java
new file mode 100644
index 0000000..ed6650c
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/rename/ResourceRenameChange.java
@@ -0,0 +1,107 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials 
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.xsd.ui.internal.refactor.rename;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.ltk.core.refactoring.Change;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.wst.xsd.ui.internal.refactor.RefactoringMessages;
+
+/**
+ * Represents a change that renames a given resource
+ */
+public class ResourceRenameChange extends Change {
+
+	/*
+	 * we cannot use handles because they became invalid when you rename the resource.
+	 * paths do not.
+	 */
+	private IPath fResourcePath;
+
+	private String fNewName;
+
+	/**
+	 * @param newName includes the extension
+	 */
+	public ResourceRenameChange(IResource resource, String newName) {
+		this(resource.getFullPath(), newName);
+	}
+
+	private ResourceRenameChange(IPath resourcePath, String newName) {
+		fResourcePath= resourcePath;
+		fNewName= newName;
+	}
+
+	private IResource getResource() {
+		return ResourcesPlugin.getWorkspace().getRoot().findMember(fResourcePath);
+	}
+
+	public RefactoringStatus isValid(IProgressMonitor pm) throws CoreException {
+		
+		// TODO: implement file validation, see JDTChange
+		return new RefactoringStatus();
+	}
+	
+	/*
+	 * to avoid the exception senders should check if a resource with the new name
+	 * already exists
+	 */
+	public Change perform(IProgressMonitor pm) throws CoreException {
+		try {
+			if (false)
+				throw new NullPointerException();
+			pm.beginTask(RefactoringMessages.getString("XSDRenameResourceChange.rename_resource"), 1); //$NON-NLS-1$
+
+			getResource().move(renamedResourcePath(fResourcePath, fNewName), getCoreRenameFlags(), pm);
+
+			String oldName= fResourcePath.lastSegment();
+			IPath newPath= renamedResourcePath(fResourcePath, fNewName);
+			return new ResourceRenameChange(newPath, oldName);
+		} finally {
+			pm.done();
+		}
+	}
+
+	private int getCoreRenameFlags() {
+		if (getResource().isLinked())
+			return IResource.SHALLOW;
+		else
+			return IResource.NONE;
+	}
+
+	/*
+	 * changes resource names /s/p/A.java renamed to B.java becomes /s/p/B.java
+	 */
+	public static IPath renamedResourcePath(IPath path, String newName) {
+		return path.removeLastSegments(1).append(newName);
+	}
+
+	public String getName() {
+		return RefactoringMessages.getFormattedString(
+			"XSDRenameResourceChange.name", new String[]{fResourcePath.toString(), //$NON-NLS-1$
+			renamedResourcePath(fResourcePath, fNewName).toString()});
+	}
+
+	public Object getModifiedElement() {
+		return getResource();
+	}
+	/* (non-Javadoc)
+	 * @see org.eclipse.ltk.core.refactoring.Change#initializeValidationData(org.eclipse.core.runtime.IProgressMonitor)
+	 */
+	public void initializeValidationData(IProgressMonitor pm) {
+		// TODO Auto-generated method stub
+
+	}
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/rename/ResourceRenameParticipant.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/rename/ResourceRenameParticipant.java
new file mode 100644
index 0000000..ecb772f
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/rename/ResourceRenameParticipant.java
@@ -0,0 +1,295 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials 
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.xsd.ui.internal.refactor.rename;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.core.runtime.content.IContentDescription;
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.ltk.core.refactoring.Change;
+import org.eclipse.ltk.core.refactoring.CompositeChange;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.ltk.core.refactoring.TextChange;
+import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
+import org.eclipse.ltk.core.refactoring.participants.RenameParticipant;
+import org.eclipse.wst.xsd.ui.internal.refactor.RefactoringMessages;
+import org.eclipse.wst.xsd.ui.internal.refactor.TextChangeManager;
+import org.eclipse.xsd.XSDNamedComponent;
+import org.eclipse.xsd.XSDSchema;
+
+/**
+ * This rename participant creates text changes for the references of the XSD and WSDL files
+ */
+public class ResourceRenameParticipant extends RenameParticipant {
+	
+	private IFile file = null;
+	private TextChangeManager changeManager;
+
+	
+	private static String XSD_CONTENT_TYPE_ID = "org.eclipse.wst.xsd.core.xsdsource";
+	private static String WSDL_CONTENT_TYPE_ID = "org.eclipse.wst.wsdl.wsdlsource";
+
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant#initialize(java.lang.Object)
+	 */
+	protected boolean initialize(Object element) {
+		if(element instanceof IFile) {
+			// check if file has XSD or WSDL content
+			IFile aFile = (IFile) element;
+			try {
+				IContentDescription description = aFile.getContentDescription();
+				if ( description == null )
+  				return false;
+				IContentType contentType = description.getContentType();
+				if(contentType != null){
+					if(XSD_CONTENT_TYPE_ID.equals(contentType.getId()) ||
+							WSDL_CONTENT_TYPE_ID.equals(contentType.getId())){
+						file = aFile;
+						return true;
+					}
+				}
+			} catch (CoreException e) {
+				return false;
+			}
+		}
+		return false;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant#getName()
+	 */
+	public String getName() {
+		return RefactoringMessages.getString("ResourceRenameParticipant.compositeChangeName");
+	}
+	
+	private IPath getNewFilePath() {
+		
+		IPath oldPath = file.getRawLocation();
+		IPath newPath = oldPath.removeLastSegments(1).append(getArguments().getNewName());
+		return newPath;
+	}
+
+	public RefactoringStatus checkConditions(IProgressMonitor pm,
+			CheckConditionsContext context) throws OperationCanceledException
+	{
+		RefactoringStatus result = new RefactoringStatus();
+		try
+		{
+			pm.beginTask("", 9); //$NON-NLS-1$
+			changeManager = createChangeManager(new SubProgressMonitor(pm, 1),
+					result);
+			
+		} catch(CoreException e){
+			result.addFatalError(e.toString());
+		}
+		finally
+		{
+			pm.done();
+		}
+		return result;
+
+	}
+	
+	
+
+	public Change createChange(IProgressMonitor pm) throws CoreException,
+			OperationCanceledException
+	{
+		try
+		{
+			String changeName = RefactoringMessages.getString("RenameResourceChange.rename_resource_reference_change");
+			TextChange[] changes =  changeManager.getAllChanges();
+			if(changes.length > 0){
+				return new CompositeChange(changeName, changes);
+			}
+			else{
+				return null;
+			}
+			
+		} finally
+		{
+			pm.done();
+		}
+
+	}
+	
+	
+	private TextChangeManager createChangeManager(IProgressMonitor pm,
+			RefactoringStatus status) throws CoreException
+	{
+		TextChangeManager manager = new TextChangeManager(false);
+		// only one declaration gets updated
+		//addDeclarationUpdate(manager);
+		if (getArguments().getUpdateReferences())
+			addOccurrences(manager, pm, status);
+		return manager;
+	}
+
+
+
+	void addOccurrences(TextChangeManager manager, IProgressMonitor pm,
+			RefactoringStatus status) throws CoreException
+	{
+//		
+//		Object[] occurrences = SearchTools.getFileDependencies(file);
+//		pm.beginTask("", occurrences.length); //$NON-NLS-1$
+//		
+//		for (int i = 0; i < occurrences.length; i++)
+//		{
+//			Object object = occurrences[i];
+//
+//			if (object instanceof SearchResultGroup)
+//			{
+//				SearchResultGroup searchResult = (SearchResultGroup) object;
+//				if (searchResult == null)
+//					continue;
+//				
+//				IFile referencingFile = (IFile)searchResult.getResource();
+//					
+//				resourceSet = new ResourceSetImpl();
+//				// for each result file create XSD model and get component from that model
+//				resourceSet.getAdapterFactories().add(
+//						new XSDSchemaLocationResolverAdapterFactory());
+//				URI uri = URI.createFileURI(referencingFile.getLocation().toPortableString());
+//				try
+//				{
+//					XSDSchema schema = XSDFactory.eINSTANCE.createXSDSchema();
+//					IStructuredModel structuredModel = StructuredModelManager.getModelManager().getModelForRead(referencingFile);
+//					IDOMModel domModel = (IDOMModel) structuredModel;
+//					Resource resource = new XSDResourceImpl();
+//					resource.setURI(uri);
+//					schema = XSDFactory.eINSTANCE.createXSDSchema();
+//					resource.getContents().add(schema);
+//					resourceSet.getResources().add(resource);
+//					schema.setElement(domModel.getDocument().getDocumentElement());
+//					// get target namespace 
+//					String stringPath = file.getLocation().toString();
+//					String targetNamespace = XMLQuickScan.getTargetNamespace(stringPath);
+//					targetNamespace = targetNamespace == null ? "" : targetNamespace;
+//
+//					List textEdits = new ArrayList();
+//					SearchMatch[] matches = searchResult.getSearchResults();
+//					
+//					for (int j = 0; j < matches.length; j++) {
+//						SearchMatch match = matches[j];
+//						
+//						FileReferenceRenamer renamer = new FileReferenceRenamer(
+//								match.getAttrValue(), targetNamespace, getNewFilePath().toString(), schema);
+//						renamer.visitSchema(schema);
+//					    textEdits.addAll(renamer.getTextEdits());
+//					}
+//					
+//					
+//					if(!textEdits.isEmpty()){
+//						TextChange textChange = manager.get(referencingFile);
+//						for (int j = 0; j < textEdits.size(); j++)
+//						{
+//							ReplaceEdit replaceEdit = (ReplaceEdit) textEdits
+//									.get(j);
+//							String editName = RefactoringMessages.getString("ResourceRenameParticipant.File_Rename_update_reference");
+//							TextChangeCompatibility.addTextEdit(textChange,
+//									editName, replaceEdit);
+//						}
+//					}
+//					
+//				} catch (Exception e)
+//				{
+//					e.printStackTrace();
+//				} finally
+//				{
+//
+//				}
+//			}
+//		}
+	}
+	
+	
+	public  class ReferenceLocationFinder
+	{
+		protected XSDNamedComponent component;
+		protected String name;
+		protected XSDSchema referencingSchema;
+		protected List results = new ArrayList();
+
+		public ReferenceLocationFinder(XSDNamedComponent component,
+				String name, XSDSchema referencingSchema)
+		{
+			this.component = component;
+			this.name = name;
+			this.referencingSchema = referencingSchema;
+		}
+
+		public void run()
+		{
+			
+			//XSDSwitch xsdSwitch = new XSDSwitch()
+//			{
+//				public Object caseXSDTypeDefinition(XSDTypeDefinition object)
+//				{
+//					GlobalTypeReferenceRenamer renamer = new GlobalTypeReferenceRenamer(
+//							object.getName(), object.getTargetNamespace(), name, referencingSchema);
+//					renamer.visitSchema(referencingSchema);
+//					results.addAll(renamer.getTextEdits());
+//					return null;
+//				}
+//
+//				public Object caseXSDElementDeclaration(
+//						XSDElementDeclaration object)
+//				{
+//					if (object.isGlobal())
+//					{
+//						GlobalElementRenamer renamer = new GlobalElementRenamer(
+//								object.getName(), object.getTargetNamespace(), name, referencingSchema);
+//						renamer.visitSchema(referencingSchema);
+//						results.addAll(renamer.getTextEdits());
+//					}
+//					return null;
+//				}
+//
+//				public Object caseXSDModelGroupDefinition(
+//						XSDModelGroupDefinition object)
+//				{
+//					GlobalGroupRenamer renamer = new GlobalGroupRenamer(
+//							object.getName(), object.getTargetNamespace(), name, referencingSchema);
+//					renamer.visitSchema(referencingSchema);
+//					return null;
+//				}
+//			};
+			//xsdSwitch.doSwitch(component);
+//			component.setName(name);
+//			try
+//			{
+//				referencingSchema.eResource().save(new HashMap());
+//			} catch (IOException e)
+//			{
+//				e.printStackTrace();
+//			}
+
+		}
+
+		public final List getResults()
+		{
+			return results;
+		}
+	}
+	
+	
+
+
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/rename/SortingSearchRequestor.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/rename/SortingSearchRequestor.java
new file mode 100644
index 0000000..d140a8c
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/rename/SortingSearchRequestor.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2006 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.refactor.rename;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.wst.common.core.search.SearchMatch;
+import org.eclipse.wst.common.core.search.SearchRequestor;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+public class SortingSearchRequestor extends SearchRequestor {
+	
+	public static String NONAMESPACE = "nonamespace";
+
+	
+		private Map fFound;
+
+		public SortingSearchRequestor() {
+			fFound= new HashMap();
+		}
+		
+
+		
+		/**
+		 * @return a List of {@link SearchMatch}es (sorted by namespace)
+		 */
+		public Map/* namespace - <SearchMatch>*/ getResults() {
+			return fFound;
+		}
+
+
+
+		/* (non-Javadoc)
+		 * @see org.eclipse.wst.common.core.search.internal.provisional.SearchRequestor#acceptSearchMatch(org.eclipse.wst.common.search.internal.provisional.SearchMatch)
+		 */
+		public void acceptSearchMatch(SearchMatch match) throws CoreException {
+
+			
+			if(match != null && match.getObject() instanceof Node){
+				Node node = (Node)match.getObject();
+				Element domElement = null;
+				switch (node.getNodeType()) {
+				case Node.ATTRIBUTE_NODE:
+					domElement = ((Attr)node).getOwnerElement();
+					break;
+				case Node.ELEMENT_NODE:
+					domElement = ((Element)node);
+					break;
+				default:
+					break;
+				}
+				String namespace = domElement.getNamespaceURI();
+				if(namespace == null || namespace.equals("")){
+					namespace = NONAMESPACE;
+				}
+				List matches = getMatches(namespace);
+				matches.add(match);			
+			}
+			
+		}
+		
+		private List getMatches(String namespace){
+			Object matches = fFound.get(namespace);
+			if(!(matches instanceof List)){
+				matches = new ArrayList();
+				fFound.put(namespace, matches);
+			}
+			return (List)matches;
+			
+		}
+		
+	
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/rename/XMLComponentRenameParticipant.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/rename/XMLComponentRenameParticipant.java
new file mode 100644
index 0000000..2b2904c
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/rename/XMLComponentRenameParticipant.java
@@ -0,0 +1,140 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2006 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.refactor.rename;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.ltk.core.refactoring.Change;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.ltk.core.refactoring.TextChange;
+import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
+import org.eclipse.ltk.core.refactoring.participants.RenameParticipant;
+import org.eclipse.text.edits.ReplaceEdit;
+import org.eclipse.wst.common.core.search.SearchMatch;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
+import org.eclipse.wst.xsd.ui.internal.refactor.RefactoringMessages;
+import org.eclipse.wst.xsd.ui.internal.refactor.TextChangeManager;
+import org.eclipse.wst.xsd.ui.internal.refactor.util.TextChangeCompatibility;
+import org.eclipse.xsd.util.XSDConstants;
+import org.w3c.dom.Node;
+
+public class XMLComponentRenameParticipant extends RenameParticipant {
+	
+	protected SearchMatch match;
+
+	protected TextChangeManager changeManager;
+	protected List matches;
+
+    
+    
+	protected boolean initialize(Object element) {
+		
+		if(getArguments() instanceof ComponentRenameArguments){
+			// changeManger is passed in from the RenameComponentProcessor to collect all the changes
+			changeManager = ((ComponentRenameArguments)getArguments()).getChangeManager();
+		}
+		
+		return false;
+	}
+	
+	public String getName() {
+		return "XML Component Rename Participant";
+	}
+
+	public RefactoringStatus checkConditions(IProgressMonitor monitor,
+			CheckConditionsContext context) throws OperationCanceledException {
+		return null;
+	}
+	
+	public TextChangeManager getChangeManager(){
+		
+		if(changeManager == null){
+				changeManager = new TextChangeManager(false);
+		}
+		return changeManager;
+		
+	}
+	
+	private RefactoringStatus createRenameChanges(final IProgressMonitor monitor) throws CoreException {
+		Assert.isNotNull(monitor);
+		final RefactoringStatus status= new RefactoringStatus();
+		try {
+			monitor.beginTask("RefactoringMessages.RenameComponentRefactoring_searching", 1); 
+			createRenameChanges(new SubProgressMonitor(monitor, 1));
+			//updateChangeManager(new SubProgressMonitor(monitor, 1), status);
+		} finally {
+			monitor.done();
+		}
+		return status;
+	}
+
+	public Change createChange(IProgressMonitor pm) throws CoreException,
+			OperationCanceledException {
+		//System.out.println("createChange("  + getChangeManager() + ")" + matches.size());
+		for (Iterator iter = matches.iterator(); iter.hasNext();) {
+			SearchMatch match = (SearchMatch) iter.next();
+			TextChange textChange = getChangeManager().get(match.getFile());
+			String newName = getArguments().getNewName();
+			String qualifier = "";
+			if(getArguments() instanceof ComponentRenameArguments){
+				qualifier = ((ComponentRenameArguments)getArguments()).getQualifier();
+			}
+			if(match.getObject() instanceof Node){
+				Node node = (Node)match.getObject();
+				if(node instanceof IDOMAttr){
+					IDOMAttr attr = (IDOMAttr)node;
+					IDOMElement element = (IDOMElement)attr.getOwnerElement() ;
+					newName = getNewQName(element, qualifier, newName);
+				}
+				newName = RenameComponentProcessor.quoteString(newName);
+			}
+			
+			ReplaceEdit replaceEdit = new ReplaceEdit(match.getOffset(), match.getLength(), newName );
+			String editName = RefactoringMessages.getString("RenameComponentProcessor.Component_Refactoring_update_reference");
+          //  System.out.println("textChange " + textChange + "/ replaceEdit " + replaceEdit);
+			TextChangeCompatibility.addTextEdit(textChange, editName, replaceEdit);
+   		}
+		// don't create any change now, all the changes are in changeManger variable and will be combined in RenameComponentProcessor.postCreateChange method
+		return null;
+	}
+	
+	private static String getNewQName(Node node, String targetNamespace, String newName) {
+		StringBuffer sb = new StringBuffer();
+		if (newName != null) {
+			String prefix = XSDConstants.lookupQualifier(node, targetNamespace);
+			if (prefix != null && prefix.length() > 0) {
+				sb.append(prefix);
+				sb.append(":");
+				sb.append(newName);
+			} else {
+				sb.append(newName);
+			}
+		} else {
+			sb.append(newName);
+		}
+
+		return sb.toString();
+	}
+
+  public void setChangeManager(TextChangeManager changeManager)
+  {
+    this.changeManager = changeManager;
+  }
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/rename/XSDComponentRenameParticipant.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/rename/XSDComponentRenameParticipant.java
new file mode 100644
index 0000000..3d169fd
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/rename/XSDComponentRenameParticipant.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2006 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.refactor.rename;
+
+import java.util.List;
+import org.eclipse.wst.xsd.ui.internal.search.IXSDSearchConstants;
+import org.eclipse.xsd.XSDNamedComponent;
+
+/**
+ * This participant takes case of renaming matches that are XSD components
+ */
+public class XSDComponentRenameParticipant extends XMLComponentRenameParticipant {
+
+protected boolean initialize(Object element) {
+		super.initialize(element);
+		if(element instanceof XSDNamedComponent){
+			if(getArguments() instanceof ComponentRenameArguments){
+				matches = (List)((ComponentRenameArguments)getArguments()).getMatches().get(IXSDSearchConstants.XMLSCHEMA_NAMESPACE);
+			}
+			if(matches != null){
+				return true;
+			}
+		}
+		return false;
+	}
+
+	public String getName() {
+		
+		return "XSD component rename participant";
+	}
+
+
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/structure/AbstractCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/structure/AbstractCommand.java
new file mode 100644
index 0000000..3972831
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/structure/AbstractCommand.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 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.refactor.structure;
+
+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.xsd.XSDConcreteComponent;
+import org.w3c.dom.Element;
+
+public abstract class AbstractCommand 
+{
+  private XSDConcreteComponent parent;
+  private XSDConcreteComponent model;
+
+  protected AbstractCommand(XSDConcreteComponent parent)
+  {
+    this.parent = parent;
+  }
+  
+  public abstract void run();
+
+  protected XSDConcreteComponent getParent()
+  {
+    return parent;
+  }
+  
+  public XSDConcreteComponent getModelObject()
+  {
+    return model;
+  }
+  
+  protected void setModelObject(XSDConcreteComponent model)
+  {
+    this.model = model;
+  }
+  
+  // Establish part-whole relationship
+  protected abstract boolean adopt(XSDConcreteComponent model);
+
+  protected void formatChild(Element child)
+  {
+    if (child instanceof IDOMNode)
+    {
+      IDOMModel model = ((IDOMNode)child).getModel();
+      try
+      {
+        // tell the model that we are about to make a big model change
+        model.aboutToChangeModel();
+        
+        IStructuredFormatProcessor formatProcessor = new FormatProcessorXML();
+        formatProcessor.formatNode(child);
+      }
+      finally
+      {
+        // tell the model that we are done with the big model change
+        model.changedModel(); 
+      }
+    }
+  }
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/structure/MakeAnonymousTypeGlobalCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/structure/MakeAnonymousTypeGlobalCommand.java
new file mode 100644
index 0000000..95f96a4
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/structure/MakeAnonymousTypeGlobalCommand.java
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 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.refactor.structure;
+
+import org.eclipse.xsd.XSDAttributeDeclaration;
+import org.eclipse.xsd.XSDComplexTypeDefinition;
+import org.eclipse.xsd.XSDConcreteComponent;
+import org.eclipse.xsd.XSDElementDeclaration;
+import org.eclipse.xsd.XSDSimpleTypeDefinition;
+import org.eclipse.xsd.XSDTypeDefinition;
+
+public final class MakeAnonymousTypeGlobalCommand extends AbstractCommand {
+
+	String fNewName;
+
+	public MakeAnonymousTypeGlobalCommand(XSDConcreteComponent element,
+			String newName) {
+		super(element.getContainer());
+		setModelObject(element);
+		fNewName = newName;
+	}
+
+	public void run() {
+		XSDConcreteComponent model = getModelObject();
+		XSDConcreteComponent parent = model.getContainer();
+		XSDTypeDefinition globalTypeDef = null;
+		if (model instanceof XSDComplexTypeDefinition) {
+			if (parent instanceof XSDElementDeclaration) {
+				// clone typedef with it's content and set it global
+				globalTypeDef = (XSDComplexTypeDefinition) model
+						.cloneConcreteComponent(true, false);
+				globalTypeDef.setName(fNewName);
+				parent.getSchema().getContents().add(globalTypeDef);
+				((XSDElementDeclaration) parent)
+						.setTypeDefinition(globalTypeDef);
+			}
+		} else if (model instanceof XSDSimpleTypeDefinition) {
+
+			XSDSimpleTypeDefinition typeDef = (XSDSimpleTypeDefinition) model;
+			if (parent instanceof XSDElementDeclaration) {
+				// clone typedef with it's content and set it global
+				globalTypeDef = (XSDSimpleTypeDefinition) typeDef
+						.cloneConcreteComponent(true, false);
+				globalTypeDef.setName(fNewName);
+				parent.getSchema().getContents().add(globalTypeDef);
+				((XSDElementDeclaration) parent)
+						.setTypeDefinition(globalTypeDef);
+				formatChild(globalTypeDef.getElement());
+
+			} else if (parent instanceof XSDAttributeDeclaration) {
+				// clone typedef with it's content and set it global
+				globalTypeDef = (XSDSimpleTypeDefinition) typeDef
+						.cloneConcreteComponent(true, false);
+				globalTypeDef.setName(fNewName);
+				parent.getSchema().getContents().add(globalTypeDef);
+				((XSDAttributeDeclaration) parent)
+						.setTypeDefinition((XSDSimpleTypeDefinition) globalTypeDef);
+
+			}
+
+		}
+
+		formatChild(globalTypeDef.getElement());
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.wst.xsd.ui.internal.commands.AbstractCommand#adopt(org.eclipse.xsd.XSDConcreteComponent)
+	 */
+	protected boolean adopt(XSDConcreteComponent model) {
+		// TODO Auto-generated method stub
+		return true;
+	}
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/structure/MakeLocalElementGlobalCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/structure/MakeLocalElementGlobalCommand.java
new file mode 100644
index 0000000..28bc4ac
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/structure/MakeLocalElementGlobalCommand.java
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 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.refactor.structure;
+
+import org.eclipse.xsd.XSDComplexTypeContent;
+import org.eclipse.xsd.XSDConcreteComponent;
+import org.eclipse.xsd.XSDElementDeclaration;
+import org.eclipse.xsd.XSDFactory;
+import org.eclipse.xsd.XSDModelGroup;
+import org.eclipse.xsd.XSDParticle;
+import org.eclipse.xsd.XSDTypeDefinition;
+
+public final class MakeLocalElementGlobalCommand extends AbstractCommand
+{
+	
+  public MakeLocalElementGlobalCommand
+    (XSDConcreteComponent element)
+  {
+    super(element.getContainer());
+    setModelObject(element);
+  }
+  
+  public void run()
+  {
+    
+   if(getModelObject() instanceof XSDElementDeclaration){
+   
+	   XSDElementDeclaration element = (XSDElementDeclaration)getModelObject();
+ 	XSDConcreteComponent parent = getParent();
+ 	XSDConcreteComponent container = parent.getContainer();
+ 	
+ 	// clone element with it's content and set it global
+	XSDConcreteComponent  elementDecl = ((XSDElementDeclaration)getModelObject()).cloneConcreteComponent(true, true);
+ 	container.getSchema().getContents().add(elementDecl);
+ 	
+ 	// create local element and set it's reference to the global one
+ 	XSDElementDeclaration elementRef = 
+	      XSDFactory.eINSTANCE.createXSDElementDeclaration();
+	elementRef.setValue(element.getValue());
+    elementRef.setResolvedElementDeclaration((XSDElementDeclaration)elementDecl); 
+    
+    // now set content models
+ 	if(parent instanceof XSDComplexTypeContent){
+ 		if(container instanceof XSDModelGroup){
+ 			XSDModelGroup modelGroup = (XSDModelGroup)container;
+ 			// disconnect parent from its container
+ 			int index = modelGroup.getContents().indexOf(parent);
+ 			 XSDParticle particle = 
+ 			      XSDFactory.eINSTANCE.createXSDParticle();
+ 		    particle.setContent(elementRef);
+ 		    modelGroup.getContents().add(index, particle); 
+ 		   
+ 			modelGroup.getContents().remove(parent);
+ 		    modelGroup.updateElement(true);
+  		    formatChild(modelGroup.getElement());
+ 		}
+ 	}
+ 	else if(parent instanceof XSDTypeDefinition){
+		System.out.println("MakeLocalElementGlobalCommand.run: parent instanceof XSDTypeDefinition");
+		 		
+ 	}
+ 	
+ 	container.getSchema().updateElement(true);
+    formatChild(elementDecl.getElement());
+  
+   }
+
+  }
+	/* (non-Javadoc)
+	 * @see org.eclipse.wst.xsd.ui.internal.commands.AbstractCommand#adopt(org.eclipse.xsd.XSDConcreteComponent)
+	 */
+	protected boolean adopt(XSDConcreteComponent model) {
+		// TODO Auto-generated method stub
+		return true;
+	}
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/structure/MakeTypeGlobalChange.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/structure/MakeTypeGlobalChange.java
new file mode 100644
index 0000000..b737c45
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/structure/MakeTypeGlobalChange.java
@@ -0,0 +1,168 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials 
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.wst.xsd.ui.internal.refactor.structure;
+
+import java.util.Map;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.jface.text.Assert;
+import org.eclipse.ltk.core.refactoring.Change;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.ltk.core.refactoring.TextChange;
+import org.eclipse.ltk.core.refactoring.TextFileChange;
+import org.eclipse.wst.xml.core.internal.document.DocumentImpl;
+import org.eclipse.wst.xsd.ui.internal.refactor.RefactoringMessages;
+import org.eclipse.xsd.XSDTypeDefinition;
+
+/**
+ * @author ebelisar
+ * 
+ */
+public class MakeTypeGlobalChange extends Change {
+
+	private Map fChanges;
+
+	private String fNewName;
+
+	private XSDTypeDefinition fTypeComponent;
+
+	public MakeTypeGlobalChange(XSDTypeDefinition component, 
+			String newName) {
+		Assert.isNotNull(newName, "new name"); //$NON-NLS-1$
+
+		fTypeComponent = component;
+		fNewName = newName;
+	}
+
+	// public static Change[] createChangesFor(XSDNamedComponent component,
+	// String newName) {
+	// // TODO: P1 implement search of XSD files
+	// XSDSearchSupport support = XSDSearchSupport.getInstance();
+	// RefactorSearchRequestor requestor = new
+	// RefactorSearchRequestor(component, newName);
+	// support.searchRunnable(component, IXSDSearchConstants.WORKSPACE_SCOPE,
+	// requestor);
+	//
+	// return requestor.getChanges();
+	//
+	// }
+
+	protected Change createUndoChange() {
+		return new MakeTypeGlobalChange(fTypeComponent, getNewName());
+	}
+
+	protected void doRename(IProgressMonitor pm) throws CoreException {
+		// TODO P1 change temporary rename of XSD model components
+		performModify(getNewName());
+	}
+
+	public void performModify(final String value) {
+			DelayedRenameRunnable runnable = new DelayedRenameRunnable(
+					fTypeComponent, value);
+			// TODO: remove Display
+			//Display.getCurrent().asyncExec(runnable);
+	}
+
+	protected static class DelayedRenameRunnable implements Runnable {
+		protected XSDTypeDefinition component;
+
+		protected String name;
+
+		public DelayedRenameRunnable(XSDTypeDefinition component, String name) {
+			this.component = component;
+			this.name = name;
+		}
+
+		public void run() {
+			DocumentImpl doc = (DocumentImpl) component.getElement().getOwnerDocument();
+			doc.getModel().beginRecording(
+							this,
+							RefactoringMessages
+									.getString("_UI_ACTION_MAKE_ANONYMOUS_TYPE_GLOBAL"));
+			MakeAnonymousTypeGlobalCommand command = new MakeAnonymousTypeGlobalCommand(
+					component, name);
+			command.run();
+			doc.getModel().endRecording(this);
+		}
+	}
+
+	public TextChange getChange(IFile file) {
+		TextChange result = (TextChange) fChanges.get(file);
+		if (result == null) {
+			result = new TextFileChange(file.getName(), file);
+			fChanges.put(file, result);
+		}
+		return result;
+	}
+
+	public String getName() {
+		return RefactoringMessages
+				.getFormattedString(
+						"MakeTypeGlobalChange.name", new String[] {getNewName() }); //$NON-NLS-1$
+	}
+
+	public final Change perform(IProgressMonitor pm) throws CoreException {
+		try {
+			pm.beginTask(RefactoringMessages
+					.getString("XSDComponentRenameChange.Renaming"), 1); //$NON-NLS-1$
+			Change result = createUndoChange();
+			doRename(new SubProgressMonitor(pm, 1));
+			return result;
+		} finally {
+			pm.done();
+		}
+	}
+
+	/**
+	 * Gets the newName.
+	 * 
+	 * @return Returns a String
+	 */
+	protected String getNewName() {
+		return fNewName;
+	}
+
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ltk.core.refactoring.Change#getModifiedElement()
+	 */
+	public Object getModifiedElement() {
+		// TODO Auto-generated method stub
+		return fTypeComponent;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ltk.core.refactoring.Change#initializeValidationData(org.eclipse.core.runtime.IProgressMonitor)
+	 */
+	public void initializeValidationData(IProgressMonitor pm) {
+		// TODO Auto-generated method stub
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ltk.core.refactoring.Change#isValid(org.eclipse.core.runtime.IProgressMonitor)
+	 */
+	public RefactoringStatus isValid(IProgressMonitor pm) throws CoreException,
+			OperationCanceledException {
+		// TODO implement change validation
+		return new RefactoringStatus();
+	}
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/structure/MakeTypeGlobalProcessor.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/structure/MakeTypeGlobalProcessor.java
new file mode 100644
index 0000000..28f09f2
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/structure/MakeTypeGlobalProcessor.java
@@ -0,0 +1,219 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials 
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.xsd.ui.internal.refactor.structure;
+
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.ltk.core.refactoring.Change;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
+import org.eclipse.ltk.core.refactoring.participants.ParticipantManager;
+import org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant;
+import org.eclipse.ltk.core.refactoring.participants.RenameArguments;
+import org.eclipse.ltk.core.refactoring.participants.RenameProcessor;
+import org.eclipse.ltk.core.refactoring.participants.SharableParticipants;
+import org.eclipse.wst.xsd.ui.internal.refactor.INameUpdating;
+import org.eclipse.wst.xsd.ui.internal.refactor.RefactoringMessages;
+import org.eclipse.xsd.XSDTypeDefinition;
+
+public class MakeTypeGlobalProcessor extends RenameProcessor implements INameUpdating{
+	
+	private XSDTypeDefinition fTypeComponent;
+	private String fNewElementName;
+
+	public static final String IDENTIFIER= "org.eclipse.wst.ui.xsd.makeTypeGlobalProcessor"; //$NON-NLS-1$
+
+	//private QualifiedNameSearchResult fNameSearchResult;
+	
+	public MakeTypeGlobalProcessor(XSDTypeDefinition element, String newName) {
+		fTypeComponent= element;
+		fNewElementName = newName;
+		
+	}
+	
+	public XSDTypeDefinition getTypeComponent() {
+		return fTypeComponent;
+	}
+
+	
+	
+	/* (non-Javadoc)
+	 * @see org.eclipse.jdt.internal.corext.refactoring.tagging.ITextUpdating#canEnableTextUpdating()
+	 */
+	public boolean canEnableTextUpdating() {
+		return true;
+	}
+
+	protected String[] getAffectedProjectNatures() throws CoreException {
+		//TODO: find project natures of the files that are going to be refactored
+		return new String[0];
+	}
+	
+	protected void loadDerivedParticipants(RefactoringStatus status,
+			List result, String[] natures, SharableParticipants shared)
+			throws CoreException {
+		// TODO: provide a way to load rename participants
+	}
+	/* (non-Javadoc)
+	 * @see org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor#checkFinalConditions(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext)
+	 */
+	public RefactoringStatus checkFinalConditions(IProgressMonitor pm,
+			CheckConditionsContext context) throws CoreException,
+			OperationCanceledException {
+		// TODO add code to check final conditions for component rename
+		return new RefactoringStatus();
+	}
+	/* (non-Javadoc)
+	 * @see org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor#checkInitialConditions(org.eclipse.core.runtime.IProgressMonitor)
+	 */
+	public RefactoringStatus checkInitialConditions(IProgressMonitor pm)
+			throws CoreException, OperationCanceledException {
+//		 TODO add code to check initial conditions for component rename
+		return new RefactoringStatus();
+	}
+	/* (non-Javadoc)
+	 * @see org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor#createChange(org.eclipse.core.runtime.IProgressMonitor)
+	 */
+	public Change createChange(IProgressMonitor pm) throws CoreException,
+			OperationCanceledException {
+		// TODO P1 add change creation
+//		Change[] changes = XSDComponentRenameChange.createChangesFor(this.fNamedComponent, getNewElementName());
+//		CompositeChange multiChange = null; 
+//			if(changes.length > 0)
+//				multiChange  = new CompositeChange("XSD component rename participant changes", changes); //$NON-NLS-1$ TODO: externalize string
+//		return multiChange;
+		
+//		computeNameMatches(pm);	
+//		Change[] changes = fNameSearchResult.getAllChanges();
+//		return new CompositeChange("XSD file rename participant changes", changes); //TODO: externalize string
+		pm.beginTask("", 1); //$NON-NLS-1$
+		try{
+			return new MakeTypeGlobalChange(fTypeComponent, getNewElementName());
+		} finally{
+			pm.done();
+		}	 
+	}
+	/* (non-Javadoc)
+	 * @see org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor#getElements()
+	 */
+	public Object[] getElements() {
+		
+		return new Object[] {fTypeComponent};
+	}
+	/* (non-Javadoc)
+	 * @see org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor#getIdentifier()
+	 */
+	public String getIdentifier() {
+		return IDENTIFIER;
+	}
+	/* (non-Javadoc)
+	 * @see org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor#getProcessorName()
+	 */
+	public String getProcessorName() {
+		return RefactoringMessages.getFormattedString(
+				"MakeLocalTypeGlobalRefactoring.name",  //$NON-NLS-1$
+				new String[]{getNewElementName()});
+
+	}
+	/* (non-Javadoc)
+	 * @see org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor#isApplicable()
+	 */
+	public boolean isApplicable() throws CoreException {
+		if (fTypeComponent == null)
+			return false;
+		// TODO implement isApplicable logic for the named component, 
+		// verify how it is different from other condition checks
+//		if (fNamedComponent.isAnonymous())
+//			return false;
+//		if (! Checks.isAvailable(fType))
+//			return false;
+//		if (isSpecialCase(fType))
+//			return false;
+		return true;
+	}
+	/* (non-Javadoc)
+	 * @see org.eclipse.jdt.internal.corext.refactoring.tagging.INameUpdating#checkNewElementName(java.lang.String)
+	 */
+	public RefactoringStatus checkNewElementName(String newName){
+		Assert.isNotNull(newName, "new name"); //$NON-NLS-1$
+		// TODO: implement new name checking
+//		RefactoringStatus result = Checks.checkTypeName(newName);
+//		if (Checks.isAlreadyNamed(fType, newName))
+//			result.addFatalError(RefactoringCoreMessages.getString("RenameTypeRefactoring.choose_another_name"));	 //$NON-NLS-1$
+		return new RefactoringStatus();
+	}
+	/* (non-Javadoc)
+	 * @see org.eclipse.jdt.internal.corext.refactoring.tagging.INameUpdating#getNewElement()
+	 */
+	public Object getNewElement() throws CoreException {
+		// TODO implement this method, it's used for updating selection on new element
+		return null;
+	}
+	
+//	private void computeNameMatches(IProgressMonitor pm) throws CoreException {
+//	
+//	    IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
+//	    try {
+//			URL fileURL = Platform.resolve(new URL(fNamedComponent.getSchema().getSchemaLocation()));
+//			IFile file = workspaceRoot.getFileForLocation(new Path(fileURL.getPath()));
+//			if (fNameSearchResult == null)
+//				fNameSearchResult= new QualifiedNameSearchResult();
+//			QualifiedNameFinder.process(fNameSearchResult, getNamedComponent().getName(),  
+//				getNewElementName(), 
+//				"*.xsd", file.getProject(), pm);
+//		} catch (IOException e) {
+//			// TODO Auto-generated catch block
+//			e.printStackTrace();
+//		}
+//	}
+	
+	public final RefactoringParticipant[] loadParticipants(RefactoringStatus status, SharableParticipants sharedParticipants) throws CoreException {
+		RenameArguments arguments= new RenameArguments(getNewElementName(), true);
+		String[] natures= getAffectedProjectNatures();
+		List result= new ArrayList();
+		loadElementParticipants(status, result, arguments, natures, sharedParticipants);
+		loadDerivedParticipants(status, result, natures, sharedParticipants);
+		return (RefactoringParticipant[])result.toArray(new RefactoringParticipant[result.size()]);
+	}
+	
+	protected void loadElementParticipants(RefactoringStatus status, List result, RenameArguments arguments, String[] natures, SharableParticipants shared) throws CoreException {
+		Object[] elements= getElements();
+		for (int i= 0; i < elements.length; i++) {
+			result.addAll(Arrays.asList(ParticipantManager.loadRenameParticipants(status, 
+				this,  elements[i],
+				arguments, natures, shared)));
+		}
+	}
+	
+	
+	public void setNewElementName(String newName) {
+		
+		fNewElementName= newName;
+	}
+
+	public String getNewElementName() {
+		return fNewElementName;
+	}
+
+	public String getCurrentElementName() {
+		// TODO Auto-generated method stub
+		return fNewElementName;
+	}
+	
+	
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/util/TextChangeCompatibility.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/util/TextChangeCompatibility.java
new file mode 100644
index 0000000..04a75e8
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/util/TextChangeCompatibility.java
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2006 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.refactor.util;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.ltk.core.refactoring.TextChange;
+import org.eclipse.text.edits.MultiTextEdit;
+import org.eclipse.text.edits.TextEdit;
+import org.eclipse.text.edits.TextEditGroup;
+
+/**
+ * A utility class to provide compatibility with the old
+ * text change API of adding text edits directly and auto
+ * inserting them into the tree.
+ */
+public class TextChangeCompatibility {
+
+	public static void addTextEdit(TextChange change, String name, TextEdit edit) {
+		Assert.isNotNull(change);
+		Assert.isNotNull(name);
+		Assert.isNotNull(edit);
+		TextEdit root= change.getEdit();
+		if (root == null) {
+			root= new MultiTextEdit();
+			change.setEdit(root);
+		}
+		insert(root, edit);
+		change.addTextEditGroup(new TextEditGroup(name, edit));
+	}
+	
+	public static void addTextEdit(TextChange change, String name, TextEdit[] edits) {
+		Assert.isNotNull(change);
+		Assert.isNotNull(name);
+		Assert.isNotNull(edits);
+		TextEdit root= change.getEdit();
+		if (root == null) {
+			root= new MultiTextEdit();
+			change.setEdit(root);
+		}
+		for (int i= 0; i < edits.length; i++) {
+			insert(root, edits[i]);
+		}
+		change.addTextEditGroup(new TextEditGroup(name, edits));
+	}
+	
+	public static void insert(TextEdit parent, TextEdit edit) {
+		if (!parent.hasChildren()) {
+			parent.addChild(edit);
+			return;
+		}
+		TextEdit[] children= parent.getChildren();
+		// First dive down to find the right parent.
+		for (int i= 0; i < children.length; i++) {
+			TextEdit child= children[i];
+			if (covers(child, edit)) {
+				insert(child, edit);
+				return;
+			}
+		}
+		// We have the right parent. Now check if some of the children have to
+		// be moved under the new edit since it is covering it.
+		for (int i= children.length - 1; i >= 0; i--) {
+			TextEdit child= children[i];
+			if (covers(edit, child)) {
+				parent.removeChild(i);
+				edit.addChild(child);
+			}
+		}
+		parent.addChild(edit);
+	}
+	
+	private static boolean covers(TextEdit thisEdit, TextEdit otherEdit) {
+		if (thisEdit.getLength() == 0)	// an insertion point can't cover anything
+			return false;
+		
+		int thisOffset= thisEdit.getOffset();
+		int thisEnd= thisEdit.getExclusiveEnd();	
+		if (otherEdit.getLength() == 0) {
+			int otherOffset= otherEdit.getOffset();
+			return thisOffset < otherOffset && otherOffset < thisEnd;
+		} else {
+			int otherOffset= otherEdit.getOffset();
+			int otherEnd= otherEdit.getExclusiveEnd();
+			return thisOffset <= otherOffset && otherEnd <= thisEnd;
+		}
+	}		
+	
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/RefactorActionGroup.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/RefactorActionGroup.java
new file mode 100644
index 0000000..303d1dc
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/RefactorActionGroup.java
@@ -0,0 +1,215 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 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.refactor.wizard;
+
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.util.Assert;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.swt.events.MenuAdapter;
+import org.eclipse.swt.events.MenuEvent;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.actions.ActionGroup;
+import org.eclipse.wst.xsd.ui.internal.refactor.actions.RenameAction;
+import org.eclipse.wst.xsd.ui.internal.refactor.actions.SelectionDispatchAction;
+
+/**
+ * Action group that adds refactor actions (for example 'Rename', 'Move') to a
+ * context menu and the global menu bar.
+ * 
+ */
+public abstract class RefactorActionGroup extends ActionGroup {
+	
+	private static class NoActionAvailable extends Action {
+		public NoActionAvailable() {
+			setEnabled(true);
+			setText(RefactoringWizardMessages.RefactorActionGroup_no_refactoring_available); 
+		}
+	}
+
+	/**
+	 * Pop-up menu: name of group for reorganize actions (value
+	 * <code>"group.reorganize"</code>).
+	 */
+	public static final String GROUP_REORGANIZE = IWorkbenchActionConstants.GROUP_REORGANIZE;
+
+	public static final String MENU_ID = "org.eclipse.wst.xsd.ui.refactoring.menu"; //$NON-NLS-1$
+
+	public static final String RENAME = "org.eclipse.wst.xsd.ui.refactoring.actions.Rename"; //$NON-NLS-1$
+
+
+	protected static void initAction(SelectionDispatchAction action,
+			ISelection selection) {
+
+		Assert.isNotNull(selection);
+		Assert.isNotNull(action);
+		action.update(selection);
+		//provider.addSelectionChangedListener(action);
+	}
+
+	protected List fEditorActions;
+
+	private String fGroupName = GROUP_REORGANIZE;
+	
+	private Action fNoActionAvailable = new NoActionAvailable();
+
+	protected RenameAction fRenameAction;
+
+	protected SelectionDispatchAction fRenameTargetNamespace;
+
+	protected ISelection selection;
+	
+	public RefactorActionGroup(ISelection selection) {
+			this.selection = selection;
+			
+	}
+
+	public int addAction(IAction action) {
+		if (action != null && action.isEnabled()) {
+			fEditorActions.add(action);
+			return 1;
+		}
+		return 0;
+	}
+
+	private void addRefactorSubmenu(IMenuManager menu) {
+
+		IMenuManager refactorSubmenu = new MenuManager(RefactoringWizardMessages.RefactorMenu_label, MENU_ID);
+		refactorSubmenu.addMenuListener(new IMenuListener() {
+				public void menuAboutToShow(IMenuManager manager) {
+					refactorMenuShown(manager);
+				}
+			});
+		refactorSubmenu.add(fNoActionAvailable);
+			if (menu.find(refactorSubmenu.getId()) == null) {
+				if (menu.find(fGroupName) == null) {
+					menu.add(refactorSubmenu);
+				} else {
+					menu.appendToGroup(fGroupName, refactorSubmenu);
+				}
+			}
+	}
+
+	protected void disposeAction(ISelectionChangedListener action,
+			ISelectionProvider provider) {
+		if (action != null)
+			provider.removeSelectionChangedListener(action);
+	}
+
+	/*
+	 * (non-Javadoc) Method declared in ActionGroup
+	 */
+	public void fillActionBars(IActionBars actionBars) {
+		super.fillActionBars(actionBars);
+		actionBars.setGlobalActionHandler(RENAME, fRenameAction);
+		retargetFileMenuActions(actionBars);
+	}
+
+	public void fillActions(List enabledActions) {
+		
+		if(selection != null && fEditorActions != null){
+			for (Iterator iter = fEditorActions.iterator(); iter.hasNext();) {
+				Action action = (Action) iter.next();
+				if (action instanceof SelectionDispatchAction) {
+					SelectionDispatchAction selectionAction = (SelectionDispatchAction) action;
+					selectionAction.update(selection);
+				}
+
+			}
+			for (Iterator iter = fEditorActions.iterator(); iter.hasNext();) {
+				Action action = (Action) iter.next();
+				if (action != null && action.isEnabled()) {
+					enabledActions.add(action);
+				}
+			}
+		}
+		
+	}
+
+	/*
+	 * (non-Javadoc) Method declared in ActionGroup
+	 */
+	public void fillContextMenu(IMenuManager menu) {
+		super.fillContextMenu(menu);
+		addRefactorSubmenu(menu);
+	}
+
+	private int fillRefactorMenu(IMenuManager refactorSubmenu) {
+		int added = 0;
+		refactorSubmenu.add(new Separator(GROUP_REORGANIZE));
+		for (Iterator iter = fEditorActions.iterator(); iter.hasNext();) {
+			Action action = (Action) iter.next();
+			if (action != null && action.isEnabled()) {
+				fEditorActions.add(action);
+				return 1;
+			}
+		}
+		return added;
+	}
+
+	private void refactorMenuHidden(IMenuManager manager) {
+
+		for (Iterator iter = fEditorActions.iterator(); iter.hasNext();) {
+			Action action = (Action) iter.next();
+			if (action instanceof SelectionDispatchAction) {
+				SelectionDispatchAction selectionAction = (SelectionDispatchAction) action;
+				selectionAction.update(selection);
+			}
+
+		}
+	}
+
+	private void refactorMenuShown(final IMenuManager refactorSubmenu) {
+		// we know that we have an MenuManager since we created it in
+		// addRefactorSubmenu.
+		Menu menu = ((MenuManager) refactorSubmenu).getMenu();
+		menu.addMenuListener(new MenuAdapter() {
+			public void menuHidden(MenuEvent e) {
+				refactorMenuHidden(refactorSubmenu);
+			}
+		});
+
+		for (Iterator iter = fEditorActions.iterator(); iter.hasNext();) {
+			Action action = (Action) iter.next();
+			if (action instanceof SelectionDispatchAction) {
+				SelectionDispatchAction selectionAction = (SelectionDispatchAction) action;
+				selectionAction.update(selection);
+			}
+		}
+		refactorSubmenu.removeAll();
+		if (fillRefactorMenu(refactorSubmenu) == 0)
+			refactorSubmenu.add(fNoActionAvailable);
+	}
+
+	/**
+	 * Retargets the File actions with the corresponding refactoring actions.
+	 * 
+	 * @param actionBars
+	 *            the action bar to register the move and rename action with
+	 */
+	public void retargetFileMenuActions(IActionBars actionBars) {
+		actionBars.setGlobalActionHandler(ActionFactory.RENAME.getId(),
+				fRenameAction);
+	}
+
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/RefactorGroupActionDelegate.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/RefactorGroupActionDelegate.java
new file mode 100644
index 0000000..29c5678
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/RefactorGroupActionDelegate.java
@@ -0,0 +1,146 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2006 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.refactor.wizard;
+
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IMenuCreator;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.events.MenuAdapter;
+import org.eclipse.swt.events.MenuEvent;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.ui.IEditorActionDelegate;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+
+public abstract class RefactorGroupActionDelegate implements IObjectActionDelegate, IEditorActionDelegate, IMenuCreator {
+
+	protected ISelection fSelection;
+	private IAction fDelegateAction;
+	// whether to re-fill the menu (reset on selection change)
+	private boolean fFillMenu = true;
+	protected IWorkbenchPart workbenchPart; 
+	protected ResourceSet resourceSet = new ResourceSetImpl();
+	
+
+	public RefactorGroupActionDelegate() {
+
+	}
+	
+	/*
+	 * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction, org.eclipse.ui.IWorkbenchPart)
+	 */
+	public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+		workbenchPart = targetPart;
+	}
+	/* (non-Javadoc)
+	 * @see org.eclipse.jface.action.IMenuCreator#dispose()
+	 */
+	public void dispose() {
+		// nothing to do
+	}
+	/* (non-Javadoc)
+	 * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Control)
+	 */
+	public Menu getMenu(Control parent) {
+		// never called
+		return null;
+	}
+	/* (non-Javadoc)
+	 * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Menu)
+	 */
+	public Menu getMenu(Menu parent) {
+		//Create the new menu. The menu will get filled when it is about to be shown. see fillMenu(Menu).
+		Menu menu = new Menu(parent);
+		/**
+		 * Add listener to repopulate the menu each time
+		 * it is shown because MenuManager.update(boolean, boolean) 
+		 * doesn't dispose pulldown ActionContribution items for each popup menu.
+		 */
+		menu.addMenuListener(new MenuAdapter() {
+			public void menuShown(MenuEvent e) {
+				if (fFillMenu) {
+					Menu m = (Menu)e.widget;
+					MenuItem[] items = m.getItems();
+					for (int i=0; i < items.length; i++) {
+						items[i].dispose();
+					}
+					fillMenu(m);
+					fFillMenu = false;
+				}
+			}
+		});
+		return menu;
+	}
+
+	/*
+	 * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+	 */
+	public void run(IAction action) {
+		// Never called because we become a menu.
+	}
+	
+	/*
+	 * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+	 */
+	public void selectionChanged(IAction action, ISelection selection) {
+		fDelegateAction = action;
+		updateWith(selection);
+		
+	}
+
+    public void setActiveEditor(IAction action, IEditorPart targetEditor) {
+		workbenchPart = targetEditor;
+		fDelegateAction = action;
+		if (targetEditor != null && targetEditor.getEditorSite() != null && targetEditor.getEditorSite().getSelectionProvider() != null) {
+			updateWith(targetEditor.getEditorSite().getSelectionProvider().getSelection());
+		}
+		
+	}
+    
+	public void updateWith(ISelection selection) {
+		fSelection = selection;
+		if (fDelegateAction != null) {
+			boolean enable = false;
+			if (selection != null) {
+				if (selection instanceof ITextSelection) {
+					//if (((ITextSelection) selection).getLength() > 0) {
+						enable = true;
+					//}
+				}
+				else if(selection instanceof IStructuredSelection ){
+					enable = !selection.isEmpty();
+				}
+			}
+			// enable action
+			fDelegateAction.setEnabled(enable);
+			
+			// fill submenu
+			fFillMenu = true;
+			fDelegateAction.setMenuCreator(this);
+			
+			
+		}
+		
+	}
+	
+	
+    protected abstract void fillMenu(Menu menu);
+	
+	
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/RefactorGroupSubMenu.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/RefactorGroupSubMenu.java
new file mode 100644
index 0000000..77780e1
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/RefactorGroupSubMenu.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2006 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.refactor.wizard;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.ActionContributionItem;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.ui.actions.CompoundContributionItem;
+
+public class RefactorGroupSubMenu extends CompoundContributionItem {
+
+	RefactorActionGroup fRefactorMenuGroup;
+	
+
+	public RefactorGroupSubMenu(RefactorActionGroup refactorMenuGroup) {
+		super();
+		fRefactorMenuGroup = refactorMenuGroup;
+	}
+
+	public RefactorGroupSubMenu(String id) {
+		super(id);
+	}
+
+	protected IContributionItem[] getContributionItems() {
+		  ArrayList actionsList = new ArrayList();
+		  ArrayList contribList = new ArrayList();
+		  fRefactorMenuGroup.fillActions(actionsList);
+	         
+	        if (actionsList != null && !actionsList.isEmpty()) {
+	            for (Iterator iter = actionsList.iterator(); iter.hasNext();) {
+	     			IAction action = (IAction) iter.next();
+	     			contribList.add(new ActionContributionItem(action));
+	     		}
+	        } else {
+	            Action dummyAction = new Action(RefactoringWizardMessages.RefactorActionGroup_no_refactoring_available) {
+	                // dummy inner class; no methods
+	            };
+	            dummyAction.setEnabled(false);
+	            contribList.add(new ActionContributionItem(dummyAction));
+	        }
+	        return (IContributionItem[]) contribList.toArray(new IContributionItem[contribList.size()]);
+
+	}
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/RefactoringWizardMessages.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/RefactoringWizardMessages.java
new file mode 100644
index 0000000..03140c8
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/RefactoringWizardMessages.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 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.refactor.wizard;
+
+import org.eclipse.osgi.util.NLS;
+
+public class RefactoringWizardMessages  extends NLS {
+
+	private static final String BUNDLE_NAME= "org.eclipse.wst.xsd.ui.internal.refactor.wizard.messages";//$NON-NLS-1$
+
+	public static String RefactorMenu_label;
+	public static String RefactorActionGroup_no_refactoring_available;
+
+	public static String RenameAction_rename;
+	public static String RenameAction_unavailable;
+	public static String RenameAction_text;
+
+	public static String RenameInputWizardPage_new_name;
+	public static String RenameRefactoringWizard_internal_error;
+	
+	public static String RenameTargetNamespace_text;
+
+	public static String RenameXSDElementAction_exception;
+	public static String RenameXSDElementAction_not_available;
+	public static String RenameXSDElementAction_name;
+
+	public static String RenameSupport_dialog_title;
+	public static String RenameSupport_not_available;
+
+	public static String RenameComponentWizard_defaultPageTitle;
+	public static String RenameComponentWizard_inputPage_description;
+
+	public static String RenameInputWizardPage_update_references;
+	public static String XSDComponentRenameChange_name;
+	public static String XSDComponentRenameChange_Renaming;
+	public static String ResourceRenameParticipant_compositeChangeName;
+	public static String RenameResourceChange_rename_resource_reference_change;
+	public static String XSDRenameResourceChange_name;
+	public static String RenameResourceRefactoring_Internal_Error;
+	public static String RenameResourceRefactoring_alread_exists;
+	public static String RenameResourceRefactoring_invalidName;
+	public static String RenameResourceProcessor_name;
+	public static String MakeAnonymousTypeGlobalAction_text; 
+	public static String MakeLocalElementGlobalAction_text;
+	public static String XSDComponentRenameParticipant_Component_Refactoring_updates;
+	public static String WSDLComponentRenameParticipant_Component_Refactoring_updates;
+	public static String RenameComponentProcessor_Component_Refactoring_updates;
+	public static String RenameComponentProcessor_Component_Refactoring_update_declatation;
+	public static String RenameComponentProcessor_Component_Refactoring_update_reference;
+	public static String XSDComponentRenameParticipant_xsd_component_rename_participant;
+	public static String WSDLComponentRenameParticipant_wsdl_component_rename_participant;
+	public static String ResourceRenameParticipant_File_Rename_update_reference;
+
+
+	private RefactoringWizardMessages() {
+		// Do not instantiate
+	}
+
+	static {
+		NLS.initializeMessages(BUNDLE_NAME, RefactoringWizardMessages.class);
+	}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/RenameInputWizardPage.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/RenameInputWizardPage.java
new file mode 100644
index 0000000..5d4ccd4
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/RenameInputWizardPage.java
@@ -0,0 +1,251 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials 
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.xsd.ui.internal.refactor.wizard;
+
+
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.util.Assert;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.ltk.ui.refactoring.UserInputWizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.wst.xsd.ui.internal.refactor.IReferenceUpdating;
+import org.eclipse.wst.xsd.ui.internal.refactor.RefactoringMessages;
+
+/**
+ * @author ebelisar
+ *
+ */
+public class RenameInputWizardPage  extends UserInputWizardPage{
+	private String fInitialValue;
+	private Text fTextField;
+	private Button fUpdateReferences;
+	/**
+	 * Creates a new text input page.
+	 * @param isLastUserPage <code>true</code> if this page is the wizard's last
+	 *  user input page. Otherwise <code>false</code>.
+	 */
+	public RenameInputWizardPage(String description, boolean isLastUserPage) {
+		this(description, isLastUserPage, ""); //$NON-NLS-1$
+	}
+	
+	/**
+	 * Creates a new text input page.
+	 * @param isLastUserPage <code>true</code> if this page is the wizard's last
+	 *  user input page. Otherwise <code>false</code>
+	 * @param initialValue the initial value
+	 */
+	public RenameInputWizardPage(String description, boolean isLastUserPage, String initialValue) {
+	    super("RenameInputWizardPage");
+		Assert.isNotNull(initialValue);
+		setDescription(description);
+		fInitialValue= initialValue;
+	}
+	
+	/**
+	 * Returns whether the initial input is valid. Typically it is not, because the 
+	 * user is required to provide some information e.g. a new type name etc.
+	 * 
+	 * @return <code>true</code> iff the input provided at initialization is valid
+	 */
+	protected boolean isInitialInputValid(){
+		return false;
+	}
+	
+	/**
+	 * Returns whether an empty string is a valid input. Typically it is not, because 
+	 * the user is required to provide some information e.g. a new type name etc.
+	 * 
+	 * @return <code>true</code> iff an empty string is valid
+	 */
+	protected boolean isEmptyInputValid(){
+		return false;
+	}
+	
+	/**
+	 * Returns the content of the text input field.
+	 * 
+	 * @return the content of the text input field. Returns <code>null</code> if
+	 * not text input field has been created
+	 */
+	protected String getText() {
+		if (fTextField == null)
+			return null;
+		return fTextField.getText();	
+	}
+	
+	/**
+	 * Sets the new text for the text field. Does nothing if the text field has not been created.
+	 * @param text the new value
+	 */
+	protected void setText(String text) {
+		if (fTextField == null)
+			return;
+		fTextField.setText(text);
+	}
+	
+	/**
+	 * Performs input validation. Returns a <code>RefactoringStatus</code> which
+	 * describes the result of input validation. <code>Null<code> is interpreted
+	 * as no error.
+	 */
+	protected RefactoringStatus validateTextField(String text){
+		return null;
+	}
+	
+	protected Text createTextInputField(Composite parent) {
+		return createTextInputField(parent, SWT.BORDER);
+	}
+	
+	protected Text createTextInputField(Composite parent, int style) {
+		fTextField= new Text(parent, style);
+		fTextField.addModifyListener(new ModifyListener() {
+			public void modifyText(ModifyEvent e) {
+				textModified(getText());
+			}
+		});
+		fTextField.setText(fInitialValue);
+		return fTextField;
+	}
+	
+	/**
+	 * Checks the page's state and issues a corresponding error message. The page validation
+	 * is computed by calling <code>validatePage</code>.
+	 */
+	protected void textModified(String text) {	
+		if (! isEmptyInputValid() && text.equals("")){ //$NON-NLS-1$
+			setPageComplete(false);
+			setErrorMessage(null);
+			restoreMessage();
+			return;
+		}
+		if ((! isInitialInputValid()) && text.equals(fInitialValue)){
+			setPageComplete(false);
+			setErrorMessage(null);
+			restoreMessage();
+			return;
+		}
+		
+		setPageComplete(validateTextField(text));
+		
+//		 TODO: enable preview in M4
+		getRefactoringWizard().setForcePreviewReview(false);
+		getContainer().updateButtons();
+	
+	}
+	
+	/**
+	 * Subclasses can override if they want to restore the message differently.
+	 * This implementation calls <code>setMessage(null)</code>, which clears the message 
+	 * thus exposing the description.
+	 */
+	protected void restoreMessage(){
+		setMessage(null);
+	}
+	
+	/* (non-Javadoc)
+	 * Method declared in IDialogPage
+	 */
+	public void dispose() {
+		fTextField= null;	
+	}
+	
+	/* (non-Javadoc)
+	 * Method declared in WizardPage
+	 */
+	public void setVisible(boolean visible) {
+		if (visible) {
+			textModified(getText());
+		}
+		super.setVisible(visible);
+		if (visible && fTextField != null) {
+			fTextField.setFocus();
+		}
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+	 */
+	public void createControl(Composite parent) {
+		Composite superComposite= new Composite(parent, SWT.NONE);
+		setControl(superComposite);
+		initializeDialogUnits(superComposite);
+		
+		superComposite.setLayout(new GridLayout());
+		Composite composite= new Composite(superComposite, SWT.NONE);
+		composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));	
+		
+		GridLayout layout= new GridLayout();
+		layout.numColumns= 2;
+		layout.verticalSpacing= 8;
+		composite.setLayout(layout);
+		
+		
+		Label label= new Label(composite, SWT.NONE);
+		label.setText(getLabelText());
+		
+		Text text= createTextInputField(composite);
+		text.selectAll();
+		GridData gd= new GridData(GridData.FILL_HORIZONTAL);
+		gd.widthHint= convertWidthInCharsToPixels(25);
+		text.setLayoutData(gd);
+		
+		addOptionalUpdateReferencesCheckbox(superComposite);
+		gd= new GridData(GridData.FILL_HORIZONTAL);
+		text.setLayoutData(gd);
+		
+		getRefactoringWizard().setForcePreviewReview(false);
+		
+		Dialog.applyDialogFont(superComposite);
+		//WorkbenchHelp.setHelp(getControl(), fHelpContextID);
+
+	}
+	
+	private static Button createCheckbox(Composite parent, String title, boolean value) {
+		Button checkBox= new Button(parent, SWT.CHECK);
+		checkBox.setText(title);
+		checkBox.setSelection(value);
+		return checkBox;		
+	}
+	
+	private void addOptionalUpdateReferencesCheckbox(Composite result) {
+
+		final IReferenceUpdating ref= (IReferenceUpdating)getRefactoring().getAdapter(IReferenceUpdating.class);
+		if (ref == null || !ref.canEnableUpdateReferences())	
+			return;
+		String title= RefactoringMessages.getString("RenameInputWizardPage.update_references"); //$NON-NLS-1$
+		boolean defaultValue= true; 
+		fUpdateReferences= createCheckbox(result, title, defaultValue);
+		ref.setUpdateReferences(fUpdateReferences.getSelection());
+		fUpdateReferences.addSelectionListener(new SelectionAdapter(){
+			public void widgetSelected(SelectionEvent e) {
+    		ref.setUpdateReferences(fUpdateReferences.getSelection());
+			}
+		});				
+		fUpdateReferences.setEnabled(true);		
+	}
+	
+	protected String getLabelText() {
+		return RefactoringMessages.getString("RenameInputWizardPage.new_name"); //$NON-NLS-1$
+	}
+	
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/RenameRefactoringWizard.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/RenameRefactoringWizard.java
new file mode 100644
index 0000000..8200353
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/RenameRefactoringWizard.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials 
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.wst.xsd.ui.internal.refactor.wizard;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ltk.core.refactoring.Refactoring;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.ltk.ui.refactoring.RefactoringWizard;
+import org.eclipse.wst.xsd.ui.internal.refactor.INameUpdating;
+
+public class RenameRefactoringWizard extends RefactoringWizard {
+	
+	private final String fInputPageDescription;
+
+	private final ImageDescriptor fInputPageImageDescriptor;
+	
+	public RenameRefactoringWizard(Refactoring refactoring, String defaultPageTitle, String inputPageDescription, 
+			ImageDescriptor inputPageImageDescriptor) {
+		super(refactoring, DIALOG_BASED_USER_INTERFACE);
+		setDefaultPageTitle(defaultPageTitle);
+    	fInputPageDescription= inputPageDescription;
+		fInputPageImageDescriptor= inputPageImageDescriptor;
+
+	}
+
+	/* non java-doc
+	 * @see RefactoringWizard#addUserInputPages
+	 */ 
+	protected void addUserInputPages() {
+		String initialSetting= getProcessor().getCurrentElementName();
+		RenameInputWizardPage inputPage= createInputPage(fInputPageDescription, initialSetting);
+		inputPage.setImageDescriptor(fInputPageImageDescriptor);
+		addPage(inputPage);
+	}
+
+	protected INameUpdating getProcessor() {
+		
+		return (INameUpdating)getRefactoring().getAdapter(INameUpdating.class);	
+	}
+	
+	
+	protected RenameInputWizardPage createInputPage(String message, String initialSetting) {
+		return new RenameInputWizardPage(message, true, initialSetting) {
+			protected RefactoringStatus validateTextField(String text) {
+				return validateNewName(text);
+			}	
+		};
+	}
+	
+	protected RefactoringStatus validateNewName(String newName) {
+		INameUpdating ref= getProcessor();
+		ref.setNewElementName(newName);
+//		try{
+			return ref.checkNewElementName(newName);
+//		} catch (CoreException e){
+//			//XXX: should log the exception
+//			String msg= e.getMessage() == null ? "": e.getMessage(); //$NON-NLS-1$
+//			return RefactoringStatus.createFatalErrorStatus(RefactoringMessages.getFormattedString("RenameRefactoringWizard.internal_error", msg));//$NON-NLS-1$
+//		}	
+	}
+	
+	
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/messages.properties b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/messages.properties
new file mode 100644
index 0000000..7bcd71f
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/messages.properties
@@ -0,0 +1,55 @@
+###############################################################################
+# Copyright (c) 2001, 2004 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
+###############################################################################
+
+RefactorMenu_label=Refactor
+RefactorActionGroup_no_refactoring_available=<no refactoring available>
+
+RenameAction_rename=Rename
+RenameAction_unavailable=Operation unavailable on the current selection.\nSelect a ....
+RenameAction_text=Re&name...
+
+RenameInputWizardPage_new_name= &New name:
+RenameRefactoringWizard_internal_error= Internal error during name checking: {0}
+
+
+RenameXSDElementAction_exception=Unexpected exception occurred. See log for details
+RenameXSDElementAction_not_available=Operation unavailable on the current selection.\nSelect a XSD project, folder, resource, file, attribute declarations,  attribute group definitions, complex type definitions, element declarations, identity constraint definitions, model groups definitions, notation declarations, or simple type definitions.
+RenameXSDElementAction_name=Rename
+
+
+RenameSupport_dialog_title=Rename
+RenameSupport_not_available=Rename support not available
+
+RenameComponentWizard_defaultPageTitle=Rename wizard
+RenameComponentWizard_inputPage_description=Rename XML Schema component
+
+RenameInputWizardPage_update_references=Update references
+XSDComponentRenameChange_name=XML Schema component renaming in {0}: {1} to {2}
+XSDComponentRenameChange_Renaming=Renaming...
+ResourceRenameParticipant_compositeChangeName=XSD file rename references updating changes
+RenameResourceChange_rename_resource_reference_change=Renaming resource name references
+XSDRenameResourceChange_name=Resource rename: {0} to {1}
+RenameResourceRefactoring_Internal_Error=Internal error
+RenameResourceRefactoring_alread_exists=Resource already exist
+RenameResourceRefactoring_invalidName=Invalid resource name
+RenameResourceProcessor_name=Resource renaming
+MakeAnonymousTypeGlobalAction_text=Make Anonymous Type Global 
+MakeLocalElementGlobalAction_text=Make Local Element Global
+XSDComponentRenameParticipant_Component_Refactoring_updates=XML Schema refactoring changes
+WSDLComponentRenameParticipant_Component_Refactoring_updates=WSDL Schema refactoring changes
+RenameComponentProcessor_Component_Refactoring_updates=Component name refactoring changes
+RenameComponentProcessor_Component_Refactoring_update_declatation=Update component declaration/definition
+RenameComponentProcessor_Component_Refactoring_update_reference=Update component reference
+XSDComponentRenameParticipant_xsd_component_rename_participant=XSD component rename participant
+WSDLComponentRenameParticipant_wsdl_component_rename_participant=WSDL component rename participant
+ResourceRenameParticipant_File_Rename_update_reference=File rename refactoring changes
+
+RenameTargetNamespace_text=Rename Target Namespace
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/IXSDSearchConstants.java b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/IXSDSearchConstants.java
new file mode 100644
index 0000000..5c465b3
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/IXSDSearchConstants.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2006 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.search;
+
+import org.eclipse.wst.common.core.search.pattern.QualifiedName;
+
+public interface IXSDSearchConstants {
+	
+	public static final String XMLSCHEMA_NAMESPACE = "http://www.w3.org/2001/XMLSchema";
+	public static String XSD_CONTENT_TYPE_ID = "org.eclipse.wst.xsd.core.xsdsource";
+
+    public static final QualifiedName   TYPE_META_NAME =  new QualifiedName (XMLSCHEMA_NAMESPACE, "type");
+    public static final QualifiedName   COMPLEX_TYPE_META_NAME =  new QualifiedName (XMLSCHEMA_NAMESPACE, "complexType");
+    public static final QualifiedName   SIMPLE_TYPE_META_NAME =  new QualifiedName (XMLSCHEMA_NAMESPACE, "simpleType");
+    public static final QualifiedName   ELEMENT_META_NAME =  new QualifiedName (XMLSCHEMA_NAMESPACE, "element");
+	public static final QualifiedName   ATTRIBUTE_META_NAME =  new QualifiedName (XMLSCHEMA_NAMESPACE, "attribute");
+	public static final QualifiedName   ATTRIBUTE_GROUP_META_NAME =  new QualifiedName (XMLSCHEMA_NAMESPACE, "attributeGroup");
+	public static final QualifiedName   GROUP_META_NAME =  new QualifiedName (XMLSCHEMA_NAMESPACE, "group");
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/XSDSearchContributor.java b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/XSDSearchContributor.java
new file mode 100644
index 0000000..1def0d9
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/XSDSearchContributor.java
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2006 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.search;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import org.eclipse.wst.common.core.search.pattern.SearchPattern;
+import org.eclipse.wst.xml.core.internal.search.ComponentSearchContributor;
+import org.eclipse.wst.xml.core.internal.search.XMLSearchPattern;
+import org.eclipse.xsd.util.XSDConstants;
+
+public class XSDSearchContributor extends ComponentSearchContributor  {
+ 
+	
+	protected void initializeReferences() {
+		references = new HashMap();
+		String ns = IXSDSearchConstants.XMLSCHEMA_NAMESPACE;
+
+		List patterns = new ArrayList();
+		patterns.add(new XMLSearchPattern( ns, XSDConstants.ELEMENT_ELEMENT_TAG, XSDConstants.REF_ATTRIBUTE));
+		patterns.add(new XMLSearchPattern( ns, XSDConstants.ELEMENT_ELEMENT_TAG, XSDConstants.SUBSTITUTIONGROUP_ATTRIBUTE));
+		references.put(IXSDSearchConstants.ELEMENT_META_NAME, patterns);
+
+		patterns = new ArrayList();
+		patterns.add(new XMLSearchPattern( ns, XSDConstants.RESTRICTION_ELEMENT_TAG, XSDConstants.BASE_ATTRIBUTE));
+		patterns.add(new XMLSearchPattern( ns, XSDConstants.EXTENSION_ELEMENT_TAG, XSDConstants.BASE_ATTRIBUTE));
+		patterns.add(new XMLSearchPattern( ns, XSDConstants.ELEMENT_ELEMENT_TAG, XSDConstants.TYPE_ATTRIBUTE));
+		references.put(IXSDSearchConstants.COMPLEX_TYPE_META_NAME, patterns);
+
+		patterns = new ArrayList();
+		patterns.add(new XMLSearchPattern( ns, XSDConstants.RESTRICTION_ELEMENT_TAG, XSDConstants.BASE_ATTRIBUTE));
+		patterns.add(new XMLSearchPattern( ns, XSDConstants.ELEMENT_ELEMENT_TAG, XSDConstants.TYPE_ATTRIBUTE));
+		patterns.add(new XMLSearchPattern( ns, XSDConstants.ATTRIBUTE_ELEMENT_TAG, XSDConstants.TYPE_ATTRIBUTE));
+		patterns.add(new XMLSearchPattern( ns, XSDConstants.UNION_ELEMENT_TAG, XSDConstants.MEMBERTYPES_ATTRIBUTE));
+		patterns.add(new XMLSearchPattern( ns, XSDConstants.LIST_ELEMENT_TAG, XSDConstants.ITEMTYPE_ATTRIBUTE));
+
+		references.put(IXSDSearchConstants.SIMPLE_TYPE_META_NAME, patterns);
+
+	}
+
+	protected void initializeDeclarations(){
+		
+		declarations = new HashMap();
+		String ns = IXSDSearchConstants.XMLSCHEMA_NAMESPACE;
+
+		SearchPattern pattern = new XMLSearchPattern( ns, "element", "name");
+		declarations.put(IXSDSearchConstants.ELEMENT_META_NAME, pattern);
+
+		pattern = new XMLSearchPattern(ns, "complexType", "name");
+		declarations.put(IXSDSearchConstants.COMPLEX_TYPE_META_NAME, pattern);
+
+		pattern = new XMLSearchPattern(ns, "simpleType", "name");
+		declarations.put(IXSDSearchConstants.SIMPLE_TYPE_META_NAME, pattern);
+
+		pattern = new XMLSearchPattern(ns, "attribute", "name");
+		declarations.put(IXSDSearchConstants.ATTRIBUTE_META_NAME, pattern);
+
+		pattern = new XMLSearchPattern(ns, "attributeGroup", "name");
+		declarations.put(IXSDSearchConstants.ATTRIBUTE_GROUP_META_NAME, pattern);
+
+		pattern = new XMLSearchPattern(ns, "group", "name");
+		declarations.put(IXSDSearchConstants.GROUP_META_NAME, pattern);
+
+	}
+
+	protected void initializeSupportedNamespaces() {
+		namespaces = new String[]{ IXSDSearchConstants.XMLSCHEMA_NAMESPACE};
+	}
+
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/XSDSearchParticipant.java b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/XSDSearchParticipant.java
new file mode 100644
index 0000000..2051804
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/XSDSearchParticipant.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2006 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.search;
+
+import java.util.Map;
+import org.eclipse.wst.common.core.search.pattern.SearchPattern;
+import org.eclipse.wst.xml.core.internal.search.ComponentSearchContributor;
+import org.eclipse.wst.xml.core.internal.search.XMLComponentSearchPattern;
+import org.eclipse.wst.xml.core.internal.search.XMLSearchParticipant;
+
+public class XSDSearchParticipant extends XMLSearchParticipant {
+
+	private static String ID = "org.eclipse.wst.xsd.search.XSDSearchParticipant";
+
+	public XSDSearchParticipant()
+	{
+	  super();
+      id = ID;
+	}	
+	
+	public String[] getSupportedContentTypes()
+	{
+	  String[] result = { "org.eclipse.wst.xsd.core.xsdsource" };
+	  return result;
+	}
+	
+	public boolean isApplicable(SearchPattern pattern, Map searchOptions)
+	{
+		if(pattern instanceof XMLComponentSearchPattern ){
+			XMLComponentSearchPattern componentPattern = (XMLComponentSearchPattern)pattern;
+			String namespace = componentPattern.getMetaName().getNamespace();
+			if(IXSDSearchConstants.XMLSCHEMA_NAMESPACE.equals(namespace)){
+				return true;
+			}
+		}
+		return false;
+	}
+		
+	public ComponentSearchContributor getSearchContributor() {		
+		return new XSDSearchContributor();
+	}
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/XSDSearchQuery.java b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/XSDSearchQuery.java
new file mode 100644
index 0000000..4dfefbd
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/XSDSearchQuery.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2006 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.search;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.wst.common.core.search.pattern.QualifiedName;
+import org.eclipse.wst.common.core.search.pattern.SearchPattern;
+import org.eclipse.wst.common.core.search.scope.SearchScope;
+import org.eclipse.wst.common.ui.internal.search.AbstractSearchQuery;
+import org.eclipse.wst.xml.core.internal.search.XMLComponentDeclarationPattern;
+import org.eclipse.wst.xml.core.internal.search.XMLComponentReferencePattern;
+
+public class XSDSearchQuery extends AbstractSearchQuery
+{   
+  public final static int LIMIT_TO_DECLARATIONS = 1;
+  public final static int LIMIT_TO_REFERENCES   = 2;  
+  
+  int fLimitTo = 0;
+  IFile fContextFile;
+  QualifiedName fElementQName;
+  QualifiedName fTypeName;
+  
+  public XSDSearchQuery(String pattern, IFile file, QualifiedName elementQName, QualifiedName typeName, int limitTo, SearchScope scope, String scopeDescription)
+  {
+    super(pattern, scope, scopeDescription);
+    fLimitTo = limitTo;
+    fContextFile = file;
+    fElementQName = elementQName;
+    fTypeName = typeName;
+  }
+
+  protected SearchPattern createSearchPattern(QualifiedName typeName)
+  {
+    if (fLimitTo == LIMIT_TO_DECLARATIONS)
+    {  
+      return new XMLComponentDeclarationPattern(fContextFile, fElementQName, fTypeName);
+    }  
+    else if (fLimitTo == LIMIT_TO_REFERENCES)
+    {
+      return new XMLComponentReferencePattern(fContextFile, fElementQName, fTypeName);
+    }  
+    return null;
+  }
+}
+
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/BaseGroupActionDelegate.java b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/BaseGroupActionDelegate.java
new file mode 100644
index 0000000..41a7e02
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/BaseGroupActionDelegate.java
@@ -0,0 +1,145 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2006 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.search.actions;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IMenuCreator;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.events.MenuAdapter;
+import org.eclipse.swt.events.MenuEvent;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.ui.IEditorActionDelegate;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+
+public abstract class BaseGroupActionDelegate implements IObjectActionDelegate, IEditorActionDelegate, IMenuCreator
+{
+    protected ISelection fSelection;
+    private IAction fDelegateAction;
+    // whether to re-fill the menu (reset on selection change)
+    private boolean fFillMenu = true;
+    protected IWorkbenchPart workbenchPart; 
+    
+
+    public BaseGroupActionDelegate() 
+    {
+      System.out.println("Create ActionDelegate " + this.getClass().getName());
+    }
+    
+    /*
+     * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction, org.eclipse.ui.IWorkbenchPart)
+     */
+    public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+        workbenchPart = targetPart;
+    }
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.action.IMenuCreator#dispose()
+     */
+    public void dispose() {
+        // nothing to do
+    }
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Control)
+     */
+    public Menu getMenu(Control parent) {
+        // never called
+        return null;
+    }
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Menu)
+     */
+    public Menu getMenu(Menu parent) {
+        //Create the new menu. The menu will get filled when it is about to be shown. see fillMenu(Menu).
+        Menu menu = new Menu(parent);
+        /**
+         * Add listener to repopulate the menu each time
+         * it is shown because MenuManager.update(boolean, boolean) 
+         * doesn't dispose pulldown ActionContribution items for each popup menu.
+         */
+        menu.addMenuListener(new MenuAdapter() {
+            public void menuShown(MenuEvent e) {
+                if (fFillMenu) {
+                    Menu m = (Menu)e.widget;
+                    MenuItem[] items = m.getItems();
+                    for (int i=0; i < items.length; i++) {
+                        items[i].dispose();
+                    }
+                    fillMenu(m);
+                    fFillMenu = false;
+                }
+            }
+        });
+        return menu;
+    }
+
+    /*
+     * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+     */
+    public void run(IAction action) {
+        // Never called because we become a menu.
+    }
+    
+    /*
+     * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+     */
+    public void selectionChanged(IAction action, ISelection selection) {
+        fDelegateAction = action;
+        updateWith(selection);
+        
+    }
+
+  public void setActiveEditor(IAction action, IEditorPart targetEditor) {
+        workbenchPart = targetEditor;
+        fDelegateAction = action;
+        if (targetEditor != null && targetEditor.getEditorSite() != null && targetEditor.getEditorSite().getSelectionProvider() != null) {
+            updateWith(targetEditor.getEditorSite().getSelectionProvider().getSelection());
+        }
+        
+    }
+  
+    public void updateWith(ISelection selection) {
+        fSelection = selection;
+        if (fDelegateAction != null) {
+            boolean enable = false;
+            if (selection != null) {
+                if (selection instanceof ITextSelection) {
+                    //if (((ITextSelection) selection).getLength() > 0) {
+                        enable = true;
+                    //}
+                }
+                else if(selection instanceof IStructuredSelection ){
+                    enable = !selection.isEmpty();
+                }
+            }
+            // enable action
+            fDelegateAction.setEnabled(enable);
+            
+            // fill submenu
+            fFillMenu = true;
+            fDelegateAction.setMenuCreator(this);
+            
+            
+        }
+        
+    }
+    
+    
+  protected abstract void fillMenu(Menu menu);
+    
+   
+  
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/CompositeActionGroup.java b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/CompositeActionGroup.java
new file mode 100644
index 0000000..0bc530a
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/CompositeActionGroup.java
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 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
+ *******************************************************************************/
+// TODO... open a bugzilla to get the JDT class moved to non internal platform
+package org.eclipse.wst.xsd.ui.internal.search.actions;
+
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.util.Assert;
+
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.actions.ActionContext;
+import org.eclipse.ui.actions.ActionGroup;
+
+public class CompositeActionGroup extends ActionGroup {
+
+    private ActionGroup[] fGroups;
+    
+    public CompositeActionGroup() {
+    }
+    
+    public CompositeActionGroup(ActionGroup[] groups) {
+        setGroups(groups);
+    }
+
+    protected void setGroups(ActionGroup[] groups) {
+        Assert.isTrue(fGroups == null);
+        Assert.isNotNull(groups);
+        fGroups= groups;        
+    }
+        
+    public ActionGroup get(int index) {
+        if (fGroups == null)
+            return null;
+        return fGroups[index];
+    }
+    
+    public void addGroup(ActionGroup group) {
+        if (fGroups == null) {
+            fGroups= new ActionGroup[] { group };
+        } else {
+            ActionGroup[] newGroups= new ActionGroup[fGroups.length + 1];
+            System.arraycopy(fGroups, 0, newGroups, 0, fGroups.length);
+            newGroups[fGroups.length]= group;
+            fGroups= newGroups;
+        }
+    }
+    
+    public void dispose() {
+        super.dispose();
+        if (fGroups == null)
+            return;
+        for (int i= 0; i < fGroups.length; i++) {
+            fGroups[i].dispose();
+        }
+    }
+
+    public void fillActionBars(IActionBars actionBars) {
+        super.fillActionBars(actionBars);
+        if (fGroups == null)
+            return;
+        for (int i= 0; i < fGroups.length; i++) {
+            fGroups[i].fillActionBars(actionBars);
+        }
+    }
+
+    public void fillContextMenu(IMenuManager menu) {
+        super.fillContextMenu(menu);
+        if (fGroups == null)
+            return;
+        for (int i= 0; i < fGroups.length; i++) {
+            fGroups[i].fillContextMenu(menu);
+        }
+    }
+
+    public void setContext(ActionContext context) {
+        super.setContext(context);
+        if (fGroups == null)
+            return;
+        for (int i= 0; i < fGroups.length; i++) {
+            fGroups[i].setContext(context);
+        }
+    }
+
+    public void updateActionBars() {
+        super.updateActionBars();
+        if (fGroups == null)
+            return;
+        for (int i= 0; i < fGroups.length; i++) {
+            fGroups[i].updateActionBars();
+        }
+    }
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/DeclarationsSearchGroup.java b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/DeclarationsSearchGroup.java
new file mode 100644
index 0000000..05308e2
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/DeclarationsSearchGroup.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2006 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.search.actions;
+
+// TODO.. fill in the content
+public class DeclarationsSearchGroup
+{
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/FindAction.java b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/FindAction.java
new file mode 100644
index 0000000..c4d6664
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/FindAction.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2006 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.search.actions;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.ui.IEditorPart;
+public class FindAction extends Action implements ISelectionChangedListener
+{
+  IEditorPart editor;
+
+  protected FindAction(IEditorPart editor)
+  {
+    this.editor = editor;
+  }
+
+  public void selectionChanged(SelectionChangedEvent event)
+  {
+    // TODO Auto-generated method stub
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/FindReferencesAction.java b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/FindReferencesAction.java
new file mode 100644
index 0000000..095ccd5
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/FindReferencesAction.java
@@ -0,0 +1,134 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2006 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.search.actions;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.search.ui.NewSearchUI;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.wst.common.core.search.pattern.QualifiedName;
+import org.eclipse.wst.common.core.search.scope.SearchScope;
+import org.eclipse.wst.common.core.search.scope.WorkspaceSearchScope;
+import org.eclipse.wst.xsd.editor.ISelectionMapper;
+import org.eclipse.wst.xsd.ui.internal.search.IXSDSearchConstants;
+import org.eclipse.wst.xsd.ui.internal.search.XSDSearchQuery;
+import org.eclipse.xsd.XSDComplexTypeDefinition;
+import org.eclipse.xsd.XSDElementDeclaration;
+import org.eclipse.xsd.XSDNamedComponent;
+import org.eclipse.xsd.XSDSimpleTypeDefinition;
+public class FindReferencesAction extends FindAction
+{
+  public FindReferencesAction(IEditorPart editor)
+  {
+    super(editor);
+  }
+
+  public void setActionDefinitionId(String string)
+  {
+  }
+
+  /**
+   * To be used by subclass in its run() Returns the file where the selection of
+   * a component (from the user) occurs ie. Returns the file that the user is
+   * currently working on.
+   * 
+   * @return The IFile representation of the current working file.
+   */
+  protected IFile getCurrentFile()
+  {
+    if (editor != null)
+    {
+      IEditorInput input = editor.getEditorInput();
+      if (input instanceof IFileEditorInput)
+      {
+        IFileEditorInput fileEditorInput = (IFileEditorInput) input;
+        return fileEditorInput.getFile();
+      }
+    }
+    return null;
+  }
+
+  /**
+   * To be used by subclass in its run().. Determines the metaName of the XSD
+   * component given to this method.
+   * 
+   * @param component
+   *          The component of which we want to determine the name
+   * @return
+   */
+  protected QualifiedName determineMetaName(XSDNamedComponent component)
+  {
+    QualifiedName metaName = null;
+    if (component instanceof XSDComplexTypeDefinition)
+    {
+      metaName = IXSDSearchConstants.COMPLEX_TYPE_META_NAME;
+    }
+    else if (component instanceof XSDSimpleTypeDefinition)
+    {
+      metaName = IXSDSearchConstants.SIMPLE_TYPE_META_NAME;
+    }
+    else if (component instanceof XSDElementDeclaration)
+    {
+      metaName = IXSDSearchConstants.ELEMENT_META_NAME;
+    }
+    return metaName;
+  }
+  
+  protected XSDNamedComponent getXSDNamedComponent()
+  {
+    if (editor != null)
+    {
+      ISelectionProvider provider = (ISelectionProvider) editor.getAdapter(ISelectionProvider.class);
+      ISelectionMapper mapper = (ISelectionMapper) editor.getAdapter(ISelectionMapper.class);
+      if (provider != null)
+      {
+        ISelection selection = provider.getSelection();
+        if (mapper != null)
+        {
+          selection = mapper.mapSelection(selection);
+        }
+        if (selection != null && selection instanceof IStructuredSelection)
+        {
+          IStructuredSelection s = (IStructuredSelection) selection;
+          Object o = s.getFirstElement();
+          if (o != null && o instanceof XSDNamedComponent)
+          {
+            return (XSDNamedComponent) o;
+          }
+        }
+      }
+    }
+    // The expected component we get from the editor does not meet
+    // our expectation
+    return null;
+  }  
+
+  public void run()
+  {
+    String pattern = "";
+    XSDNamedComponent component = getXSDNamedComponent();
+    IFile file = getCurrentFile();
+    if (file != null && component != null)
+    {
+      QualifiedName metaName = determineMetaName(component);
+      QualifiedName elementQName = new QualifiedName(component.getTargetNamespace(), component.getName());
+      SearchScope scope = new WorkspaceSearchScope();
+      String scopeDescription = "Workspace";
+      XSDSearchQuery searchQuery = new XSDSearchQuery(pattern, file, elementQName, metaName, XSDSearchQuery.LIMIT_TO_REFERENCES, scope, scopeDescription);
+      NewSearchUI.activateSearchResultView();
+      NewSearchUI.runQueryInBackground(searchQuery);
+    }
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/FindReferencesInProjectAction.java b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/FindReferencesInProjectAction.java
new file mode 100644
index 0000000..cab3b94
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/FindReferencesInProjectAction.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2006 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.search.actions;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.search.ui.NewSearchUI;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.wst.common.core.search.pattern.QualifiedName;
+import org.eclipse.wst.common.core.search.scope.ProjectSearchScope;
+import org.eclipse.wst.xsd.ui.internal.search.XSDSearchQuery;
+import org.eclipse.xsd.XSDNamedComponent;
+public class FindReferencesInProjectAction extends FindReferencesAction
+{
+  public FindReferencesInProjectAction(IEditorPart editor)
+  {
+    super(editor);
+  }
+
+  public void run()
+  {
+    String pattern = "";
+    XSDNamedComponent component = getXSDNamedComponent();
+    IFile file = getCurrentFile();
+    if (file != null && component != null)
+    {
+      QualifiedName metaName = determineMetaName(component);
+      QualifiedName elementQName = new QualifiedName(component.getTargetNamespace(), component.getName());
+      IPath fullPath = (IPath) file.getFullPath();
+      ProjectSearchScope scope = new ProjectSearchScope(fullPath);
+      String scopeDescription = "Workspace";
+      XSDSearchQuery searchQuery = new XSDSearchQuery(pattern, file, elementQName, metaName, XSDSearchQuery.LIMIT_TO_REFERENCES, scope, scopeDescription);
+      NewSearchUI.activateSearchResultView();
+      NewSearchUI.runQueryInBackground(searchQuery);
+    }
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/FindReferencesInWorkingSetAction.java b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/FindReferencesInWorkingSetAction.java
new file mode 100644
index 0000000..bfe6947
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/FindReferencesInWorkingSetAction.java
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2006 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.search.actions;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.window.Window;
+import org.eclipse.search.ui.NewSearchUI;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkingSet;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.IWorkingSetSelectionDialog;
+import org.eclipse.wst.common.core.search.pattern.QualifiedName;
+import org.eclipse.wst.common.core.search.scope.WorkingSetSearchScope;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+import org.eclipse.wst.xsd.ui.internal.search.XSDSearchQuery;
+import org.eclipse.xsd.XSDNamedComponent;
+
+public class FindReferencesInWorkingSetAction extends FindReferencesAction{
+
+	public FindReferencesInWorkingSetAction(IEditorPart editor) {
+		super(editor);
+	}
+	
+	public void setActionDefinitionId(String string)
+	{
+		
+	}
+
+	public void run(){
+		IWorkingSet[] workingSets = queryWorkingSets();
+		if ( workingSets == null || workingSets.length == 0)
+			// The user chooses nothing, no point to continue.
+			return;
+		String pattern = "";
+
+		XSDNamedComponent component = getXSDNamedComponent();
+		IFile file = getCurrentFile();
+		if ( file != null && component != null){
+			QualifiedName metaName = determineMetaName(component);
+
+			QualifiedName elementQName = 
+				new QualifiedName(component.getTargetNamespace(), component.getName());
+
+			// Create a scope from the selected working sets
+			WorkingSetSearchScope scope = new WorkingSetSearchScope();
+			for (int i = 0; i < workingSets.length; i++){
+				IAdaptable[] elements = workingSets[i].getElements();
+				scope.addAWorkingSetToScope(elements);
+			}
+
+			String scopeDescription = "Workspace";    
+			XSDSearchQuery searchQuery = 
+				new XSDSearchQuery(pattern, file, elementQName, metaName, XSDSearchQuery.LIMIT_TO_REFERENCES, scope, scopeDescription);    
+			NewSearchUI.activateSearchResultView();
+			NewSearchUI.runQueryInBackground(searchQuery);
+		}
+	}
+
+	/**
+	 * Calls a dialog asking the user to choose the working Sets he wants
+	 * to do the search on
+	 * @return
+	 */
+	public static IWorkingSet[] queryWorkingSets(){
+		Shell shell= XSDEditorPlugin.getShell();
+		if (shell == null)
+			return null;
+		IWorkingSetSelectionDialog dialog =
+			PlatformUI.getWorkbench().getWorkingSetManager().createWorkingSetSelectionDialog(shell, true);
+		if (dialog.open() == Window.OK) {
+			IWorkingSet[] workingSets= dialog.getSelection();
+			if (workingSets.length > 0)
+				return workingSets;
+		}
+		return null;
+	}
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/ImplementorsSearchGroup.java b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/ImplementorsSearchGroup.java
new file mode 100644
index 0000000..0efc8ff
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/ImplementorsSearchGroup.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2006 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.search.actions;
+
+// TODO... fill in the content
+public class ImplementorsSearchGroup
+{
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/OccurrencesSearchGroup.java b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/OccurrencesSearchGroup.java
new file mode 100644
index 0000000..463e241
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/OccurrencesSearchGroup.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2006 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.search.actions;
+
+// TODO... fill in the content
+public class OccurrencesSearchGroup
+{
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/ReferencesSearchGroup.java b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/ReferencesSearchGroup.java
new file mode 100644
index 0000000..b9e4bcc
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/ReferencesSearchGroup.java
@@ -0,0 +1,178 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2006 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.search.actions;
+
+import java.util.List;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.util.Assert;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchSite;
+import org.eclipse.ui.texteditor.ITextEditorActionConstants;
+
+
+public class ReferencesSearchGroup extends SearchGroup  {
+
+    private static final String MENU_TEXT= "References...";//SearchMessages.group_references; 
+
+    private IWorkbenchSite fSite;
+    private IEditorPart fEditor;
+    private IActionBars fActionBars;
+    
+    private String fGroupId;
+    
+    private FindReferencesAction fFindReferencesAction;
+    private FindReferencesInProjectAction fFindReferencesInProjectAction;
+    private FindReferencesInWorkingSetAction fFindReferencesInWorkingSetAction;
+
+
+    /**
+     * Note: This constructor is for internal use only. Clients should not call this constructor.
+     * @param editor
+     */
+    public ReferencesSearchGroup(IEditorPart editor) {
+        Assert.isNotNull(editor);
+        fEditor= editor;
+        fSite= fEditor.getSite();
+        fGroupId= ITextEditorActionConstants.GROUP_FIND;
+
+        fFindReferencesAction= new FindReferencesAction(editor);
+        fFindReferencesAction.setText("Workspace");
+        fFindReferencesAction.setActionDefinitionId("SEARCH_REFERENCES_IN_WORKSPACE");
+        //fEditor.setAction("SearchReferencesInWorkspace", fFindReferencesAction); //$NON-NLS-1$
+
+        fFindReferencesInProjectAction= new FindReferencesInProjectAction(fEditor);
+        fFindReferencesInProjectAction.setText("Project");        
+        fFindReferencesInProjectAction.setActionDefinitionId("SEARCH_REFERENCES_IN_PROJECT");
+        //fEditor.setAction("SearchReferencesInProject", fFindReferencesInProjectAction); //$NON-NLS-1$
+    
+        fFindReferencesInWorkingSetAction= new FindReferencesInWorkingSetAction(fEditor);
+        fFindReferencesInWorkingSetAction.setText("Working Set...");         
+        fFindReferencesInWorkingSetAction.setActionDefinitionId(".SEARCH_REFERENCES_IN_WORKING_SET");
+        //fEditor.setAction("SearchReferencesInWorkingSet", fFindReferencesInWorkingSetAction); //$NON-NLS-1$
+    }
+
+    /*
+    private void registerAction(SelectionDispatchAction action, ISelectionProvider provider, ISelection selection) {
+        action.update(selection);
+        provider.addSelectionChangedListener(action);
+    }*/
+
+    /**
+     * Note: this method is for internal use only. Clients should not call this method.
+     * 
+     * @return the menu label
+     */
+    protected String getName() {
+        return MENU_TEXT;
+    }
+    
+    public void fillActions(List list)
+    {
+      list.add(fFindReferencesAction);
+      //list.add(fFindReferencesInHierarchyAction);
+      list.add(fFindReferencesInProjectAction);
+      list.add(new Separator());
+      list.add(fFindReferencesInWorkingSetAction);
+    }
+    
+    /* (non-Javadoc)
+     * Method declared in ActionGroup
+     */
+    public void fillActionBars(IActionBars actionBars) {
+        Assert.isNotNull(actionBars);
+        super.fillActionBars(actionBars);
+        fActionBars= actionBars;
+        updateGlobalActionHandlers();
+    }
+
+    
+    private void addAction(IAction action, IMenuManager manager) {
+        if (action.isEnabled()) {
+            manager.add(action);
+        }
+    }
+
+    /*
+    private void addWorkingSetAction(IWorkingSet[] workingSets, IMenuManager manager) {
+        FindAction action;
+        if (fEditor != null)
+            action= new WorkingSetFindAction(fEditor, new FindReferencesInWorkingSetAction(fEditor, workingSets), SearchUtil.toString(workingSets));
+        else
+            action= new WorkingSetFindAction(fSite, new FindReferencesInWorkingSetAction(fSite, workingSets), SearchUtil.toString(workingSets));
+        action.update(getContext().getSelection());
+        addAction(action, manager);
+    }
+    */
+    
+    /* (non-Javadoc)
+     * Method declared on ActionGroup.
+     */
+    public void fillContextMenu(IMenuManager manager) {
+      /*
+        MenuManager javaSearchMM= new MenuManager(getName(), IContextMenuConstants.GROUP_SEARCH);
+        addAction(fFindReferencesAction, javaSearchMM);
+        addAction(fFindReferencesInProjectAction, javaSearchMM);
+        addAction(fFindReferencesInHierarchyAction, javaSearchMM);
+        
+        javaSearchMM.add(new Separator());
+        
+        Iterator iter= SearchUtil.getLRUWorkingSets().sortedIterator();
+        while (iter.hasNext()) {
+            addWorkingSetAction((IWorkingSet[]) iter.next(), javaSearchMM);
+        }
+        addAction(fFindReferencesInWorkingSetAction, javaSearchMM);
+
+        if (!javaSearchMM.isEmpty())
+            manager.appendToGroup(fGroupId, javaSearchMM);
+        */    
+    }
+    
+    /* 
+     * Overrides method declared in ActionGroup
+     */
+    public void dispose() {
+        ISelectionProvider provider= fSite.getSelectionProvider();
+        if (provider != null) {
+            disposeAction(fFindReferencesAction, provider);
+            disposeAction(fFindReferencesInProjectAction, provider);
+          //  disposeAction(fFindReferencesInHierarchyAction, provider);
+            disposeAction(fFindReferencesInWorkingSetAction, provider);
+        }
+        fFindReferencesAction= null;
+        fFindReferencesInProjectAction= null;
+        //fFindReferencesInHierarchyAction= null;
+        fFindReferencesInWorkingSetAction= null;
+        updateGlobalActionHandlers();
+        super.dispose();
+    }
+
+    private void updateGlobalActionHandlers() {
+      /*
+        if (fActionBars != null) {
+            fActionBars.setGlobalActionHandler(JdtActionConstants.FIND_REFERENCES_IN_WORKSPACE, fFindReferencesAction);
+            fActionBars.setGlobalActionHandler(JdtActionConstants.FIND_REFERENCES_IN_PROJECT, fFindReferencesInProjectAction);
+            fActionBars.setGlobalActionHandler(JdtActionConstants.FIND_REFERENCES_IN_HIERARCHY, fFindReferencesInHierarchyAction);
+            fActionBars.setGlobalActionHandler(JdtActionConstants.FIND_REFERENCES_IN_WORKING_SET, fFindReferencesInWorkingSetAction);
+        }
+        */
+    }
+
+    private void disposeAction(ISelectionChangedListener action, ISelectionProvider provider) {
+        if (action != null)
+            provider.removeSelectionChangedListener(action);
+    }
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/SearchGroup.java b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/SearchGroup.java
new file mode 100644
index 0000000..18071ba
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/SearchGroup.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2006 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.search.actions;
+
+import java.util.List;
+import org.eclipse.ui.actions.ActionGroup;
+
+public abstract class SearchGroup extends ActionGroup
+{
+  public abstract void fillActions(List list);
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/XSDSearchActionGroup.java b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/XSDSearchActionGroup.java
new file mode 100644
index 0000000..e601f8c
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/XSDSearchActionGroup.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2006 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.search.actions;
+
+import org.eclipse.jface.util.Assert;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.actions.ActionGroup;
+
+public class XSDSearchActionGroup extends ActionGroup
+{
+  private ReferencesSearchGroup fReferencesGroup;
+  private DeclarationsSearchGroup fDeclarationsGroup;
+  private ImplementorsSearchGroup fImplementorsGroup;
+  private OccurrencesSearchGroup fOccurrencesGroup;
+  private IEditorPart fEditor;
+
+  public XSDSearchActionGroup(IEditorPart editor)
+  {
+    Assert.isNotNull(editor);
+    fEditor = editor;
+    fReferencesGroup = new ReferencesSearchGroup(editor);
+    fDeclarationsGroup = new DeclarationsSearchGroup();
+    fImplementorsGroup = new ImplementorsSearchGroup();
+    fOccurrencesGroup = new OccurrencesSearchGroup();
+  }
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/XSDSearchDeclarationsGroupActionDelegate.java b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/XSDSearchDeclarationsGroupActionDelegate.java
new file mode 100644
index 0000000..91c55c6
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/XSDSearchDeclarationsGroupActionDelegate.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2006 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.search.actions;
+
+import org.eclipse.swt.widgets.Menu;
+
+//org.eclipse.wst.xsd.ui.internal.search.actions.XSDSearchGroupActionDelegate
+public class XSDSearchDeclarationsGroupActionDelegate extends BaseGroupActionDelegate
+{
+    protected void fillMenu(Menu menu) {
+
+    }             
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/XSDSearchGroupSubMenu.java b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/XSDSearchGroupSubMenu.java
new file mode 100644
index 0000000..65d6ff4
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/XSDSearchGroupSubMenu.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2006 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.search.actions;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.ActionContributionItem;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.ui.actions.CompoundContributionItem;
+
+public class XSDSearchGroupSubMenu extends CompoundContributionItem
+{
+  SearchGroup searchActionGroup;
+
+  public XSDSearchGroupSubMenu(SearchGroup refactorMenuGroup)
+  {
+    super();
+    searchActionGroup = refactorMenuGroup;
+  }
+
+  public XSDSearchGroupSubMenu(String id)
+  {
+    super(id);
+  }
+
+  protected IContributionItem[] getContributionItems()
+  {
+    ArrayList actionsList = new ArrayList();
+    ArrayList contribList = new ArrayList();
+    searchActionGroup.fillActions(actionsList);
+    if (actionsList != null && !actionsList.isEmpty())
+    {
+      for (Iterator iter = actionsList.iterator(); iter.hasNext();)
+      {
+        Object o = iter.next();
+        if (o instanceof IAction)
+        {  
+          IAction action = (IAction)o;
+          contribList.add(new ActionContributionItem(action));
+        }
+        else if (o instanceof Separator)
+        {
+          Separator separator = (Separator)o;
+          contribList.add(separator);
+        }  
+      }
+    }
+    else
+    {
+      Action dummyAction = new Action("XSDSeachActionGroup_no_refactoring_available")
+      {
+        // dummy inner class; no methods
+      };
+      dummyAction.setEnabled(false);
+      contribList.add(new ActionContributionItem(dummyAction));
+    }
+    return (IContributionItem[]) contribList.toArray(new IContributionItem[contribList.size()]);        
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/XSDSearchReferencesGroupActionDelegate.java b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/XSDSearchReferencesGroupActionDelegate.java
new file mode 100644
index 0000000..6466896
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/XSDSearchReferencesGroupActionDelegate.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2006 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.search.actions;
+
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.ui.IEditorPart;
+
+//org.eclipse.wst.xsd.ui.internal.search.actions.XSDSearchGroupActionDelegate
+public class XSDSearchReferencesGroupActionDelegate extends BaseGroupActionDelegate
+{
+    protected void fillMenu(Menu menu) {
+      try
+      {
+        if (fSelection == null) {
+            return;
+        }  
+        if (workbenchPart instanceof IEditorPart)
+        {            
+          ReferencesSearchGroup referencesGroup = new ReferencesSearchGroup((IEditorPart)workbenchPart);
+          XSDSearchGroupSubMenu subMenu = new XSDSearchGroupSubMenu(referencesGroup);
+          subMenu.fill(menu, -1);
+        }  
+      }
+      catch (Exception e)
+      {
+        e.printStackTrace();
+      }
+    }  
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-validation/org/eclipse/wst/xsd/ui/internal/validation/ValidateAction.java b/bundles/org.eclipse.wst.xsd.ui/src-validation/org/eclipse/wst/xsd/ui/internal/validation/ValidateAction.java
new file mode 100644
index 0000000..817f390
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-validation/org/eclipse/wst/xsd/ui/internal/validation/ValidateAction.java
@@ -0,0 +1,151 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 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.validation;
+
+import java.io.InputStream;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.xml.core.internal.validation.core.ValidationMessage;
+import org.eclipse.wst.xml.core.internal.validation.core.ValidationReport;
+import org.eclipse.wst.xsd.editor.XSDEditorPlugin;
+
+
+
+/**
+ * This class manages the 'UI' related details of validation. Here's a quick
+ * overview of the details : 
+ * - manages Marker creation based on the results of the validation 
+ * - (optionally) displays dialog to summarize the results of validation 
+ * 
+ * @author Lawrence Mandel, IBM
+ * @author Keith Chong, IBM
+ */
+public class ValidateAction extends org.eclipse.wst.xml.ui.internal.validation.core.ValidateAction
+{ 
+  // Property file strings.
+  private static final String _UI_DIALOG_XML_SCHEMA_INVALID_TEXT = "_UI_DIALOG_XML_SCHEMA_INVALID_TEXT";
+  private static final String _UI_DIALOG_XML_SCHEMA_INVALID_TITLE = "_UI_DIALOG_XML_SCHEMA_INVALID_TITLE";
+  private static final String _UI_DIALOG_XML_SCHEMA_VALID_TITLE = "_UI_DIALOG_XML_SCHEMA_VALID_TITLE";
+  private static final String _UI_DIALOG_XML_SCHEMA_VALID_TEXT = "_UI_DIALOG_XML_SCHEMA_VALID_TEXT";
+  private static final String _UI_DIALOG_XML_SCHEMA_VALID_WITH_WARNINGS = "_UI_DIALOG_XML_SCHEMA_VALID_WITH_WARNINGS";
+
+  private InputStream inputStream;
+  
+  /**
+   * Constructor.
+   * 
+   * @param file The file to validate.
+   * @param showDialog Whether or not to show a dialog when validation is complete.
+   */
+  public ValidateAction(IFile file, boolean showDialog)
+  {
+    super(file, showDialog);
+  }
+  
+  /*
+   * Store additional information in the message parameters
+   * param[0] = the column number of the error
+   * param[1] = the 'squiggle selection strategy' for which DOM part to squiggle
+   * param[2] = the name or value of what is to be squiggled
+   */
+  protected void addInfoToMessage (ValidationMessage validationMessage, IMessage message)
+  {   
+    if (inputStream != null)
+    {
+      XSDMessageInfoHelper messageInfoHelper = new XSDMessageInfoHelper();
+	  String[] messageInfo = messageInfoHelper.createMessageInfo(validationMessage.getMessage(), validationMessage.getKey());
+
+	  message.setAttribute(COLUMN_NUMBER_ATTRIBUTE, new Integer(validationMessage.getColumnNumber()));
+	  message.setAttribute(SQUIGGLE_SELECTION_STRATEGY_ATTRIBUTE, messageInfo[0]);
+	  message.setAttribute(SQUIGGLE_NAME_OR_VALUE_ATTRIBUTE, messageInfo[1]);
+    }  
+  }
+  
+  protected void validate(final IFile file)
+  {
+    final ValidationOutcome valoutcome = new ValidationOutcome();
+    IPath path = file.getLocation();
+    final String uri = createURIForFilePath(path.toString());
+    
+    IWorkspaceRunnable op = new IWorkspaceRunnable()
+    {
+
+      public void run(IProgressMonitor progressMonitor) throws CoreException
+      {
+        clearMarkers(file);
+        XSDValidator validator = XSDValidator.getInstance();
+        ValidationReport valreport = validator.validate(uri, inputStream);
+        valoutcome.isValid = valreport.isValid();
+        if(valreport.getValidationMessages().length == 0)
+        {
+          valoutcome.hasMessages = false;
+        }
+        else
+        {
+          valoutcome.hasMessages = true;
+        }
+        createMarkers(file, valreport.getValidationMessages());
+
+        file.setSessionProperty(ValidationMessage.ERROR_MESSAGE_MAP_QUALIFIED_NAME, valreport.getNestedMessages());
+      }
+    };
+
+    try
+    {
+      ResourcesPlugin.getWorkspace().run(op, null);
+      String internalErrorMessage = null;
+
+      if (showDialog)
+      {
+        if (!valoutcome.isValid)
+        {
+          String message = XSDEditorPlugin.getXSDString(_UI_DIALOG_XML_SCHEMA_INVALID_TEXT);
+          String title = XSDEditorPlugin.getXSDString(_UI_DIALOG_XML_SCHEMA_INVALID_TITLE);
+          if (internalErrorMessage != null)
+          {
+            message = message + "\n" + internalErrorMessage;
+          }
+          openErrorDialog(title, message);
+        } 
+        else if (valoutcome.isValid && valoutcome.hasMessages)
+        {
+          String message = XSDEditorPlugin.getXSDString(_UI_DIALOG_XML_SCHEMA_VALID_WITH_WARNINGS);
+          String title = XSDEditorPlugin.getXSDString(_UI_DIALOG_XML_SCHEMA_VALID_TITLE);
+          openWarningDialog(title, message);
+        } 
+        else
+        {
+          String message = XSDEditorPlugin.getXSDString(_UI_DIALOG_XML_SCHEMA_VALID_TEXT);
+          String title = XSDEditorPlugin.getXSDString(_UI_DIALOG_XML_SCHEMA_VALID_TITLE);
+          //String message = validator.isGrammarEncountered() ?
+          //                 XSDValidatorManager.getString("_UI_THE_XML_FILE_IS_VALID") :
+          //                XSDValidatorManager.getString("_UI_THE_XML_FILE_IS_WELL_FORMED") +
+          //                 XSDValidatorManager.getString("_UI_NO_GRAMMAR_WARNING");
+          openValidDialog(title, message);
+        }
+      }
+    } 
+
+	catch (CoreException e)
+    {
+    }
+  }
+  public void setInputStream(InputStream inputStream)
+  { this.inputStream = inputStream;
+  }
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-validation/org/eclipse/wst/xsd/ui/internal/validation/ValidateSchemaActionDelegate.java b/bundles/org.eclipse.wst.xsd.ui/src-validation/org/eclipse/wst/xsd/ui/internal/validation/ValidateSchemaActionDelegate.java
new file mode 100644
index 0000000..5dce0fe
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-validation/org/eclipse/wst/xsd/ui/internal/validation/ValidateSchemaActionDelegate.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 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.validation;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IActionDelegate;
+
+/**
+ * Validate schema - from popup
+ */
+public class ValidateSchemaActionDelegate
+       implements IActionDelegate
+{
+  protected ISelection selection;
+
+  public void run(IAction action)
+  {
+  	try {
+  		// CS.. for now the following line tests to ensure the user has xerces jars installed
+        // so that we can perform some 'fail fast' behaviour
+        //
+        Class theClass = Class.forName("org.apache.xerces.xni.parser.XMLParserConfiguration", true, this.getClass().getClassLoader());
+        if (theClass == null)
+        {
+         throw(new Exception("Missing Xerces jars in plugin's 'jars' folder"));       
+        }
+
+	    IFile fileResource = null;
+	    if (!selection.isEmpty() && selection instanceof IStructuredSelection)
+	    {
+	      IStructuredSelection structuredSelection = (IStructuredSelection) selection;
+	      Object element = structuredSelection.getFirstElement();
+	
+	      if (element instanceof IFile)
+	      {
+	        fileResource = (IFile) element;
+	      }
+	      else
+	      {
+	        return;
+	      }
+	    }
+	    ValidateAction validateaction = new ValidateAction(fileResource, true);
+	    validateaction.setValidator(new Validator());
+	    validateaction.run();
+  	}
+  	catch (Exception e) {
+        // CS..here's where we need to pop up a dialog to tell the user that xerces is not available
+        //
+        String xercesLine1 = "Required files xercesImpl.jar and xmlParserAPIs.jar cannot be found.\n\n";
+        String xercesLine2 = "Download Xerces 2.6.2 and place xercesImpl.jar and xmlParserAPIs.jar in a folder entitled jars in the org.eclipse.wst.xml.validation plugin.\n\n";
+        String xercesLine3 = "For more information see www.eclipse.org/webtools/wst/components/xml/xercesInfo.xml.";
+        MessageDialog.openError(Display.getDefault().getActiveShell(), "Missing Xerces", xercesLine1 + xercesLine2 + xercesLine3);
+  	}
+  }
+
+  public void selectionChanged(IAction action, ISelection selection)
+  {
+    this.selection = selection;
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-validation/org/eclipse/wst/xsd/ui/internal/validation/Validator.java b/bundles/org.eclipse.wst.xsd.ui/src-validation/org/eclipse/wst/xsd/ui/internal/validation/Validator.java
new file mode 100644
index 0000000..b14ec14
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-validation/org/eclipse/wst/xsd/ui/internal/validation/Validator.java
@@ -0,0 +1,172 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 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.validation;
+
+
+import java.io.InputStream;
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.wst.validation.internal.core.ValidationException;
+import org.eclipse.wst.validation.internal.operations.IRuleGroup;
+import org.eclipse.wst.validation.internal.operations.ValidatorManager;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+import org.eclipse.wst.validation.internal.provisional.core.IValidationContext;
+import org.eclipse.wst.validation.internal.provisional.core.IValidator;
+
+
+public class Validator implements IValidator
+{
+  private final String GET_FILE = "getFile";
+  public final String GET_PROJECT_FILES = "getAllFiles";
+
+  public void validate(IFile file)
+  {
+    ValidateAction validateAction = new ValidateAction(file, false);
+    validateAction.setValidator(this);
+    validateAction.run();	
+  }
+  /**
+   * This is the method which performs the validation on the MOF model.
+   * <br><br>
+   * <code>helper</code> and <code>reporter</code> may not be null. <code>changedFiles</code> may be null, if a full
+   * build is desired.
+   * <br><br>
+   * <code>helper</code> returns the ifile for the given information in the IFileDelta array
+   * <br><br>
+   * <code>reporter</code> is an instance of an IReporter interface, which is used for interaction with the user.
+   * <br><br>
+   * <code>changedFiles</code> is an array of file names which have changed since the last validation. 
+   * If <code>changedFiles</code> is null, or if it is an empty array, then a full build
+   * is performed. Otherwise, validation on just the files listed in the Vector is performed.
+   */
+  public void validate(IValidationContext helper, IReporter reporter) throws ValidationException {
+	 String[] changedFiles = helper.getURIs();
+     if (changedFiles != null && changedFiles.length > 0) 
+    {
+      for (int i = 0; i < changedFiles.length; i++) 
+      {
+        String fileName = changedFiles[i];
+        if (fileName != null)
+        {
+          Object []parms = {fileName};
+
+          IFile file = (IFile) helper.loadModel(GET_FILE, parms);
+          if (file != null && shouldValidate(file)) 
+          {            
+            //the helper might not have the file stored in it. could have an InputStream          
+            if (helper.loadModel("inputStream") instanceof InputStream)
+            {
+              validate(file, (InputStream)helper.loadModel("inputStream"), reporter); //do we need the fileName?  what is int ruleGroup?
+            }                    
+            else
+            {  
+              //if (((Helper)helper).isInJavaBuildPath(file) &&
+              //    !((AWorkbenchHelper)helper).isInJavaSourcePath(file))
+              //{
+              //  continue;
+              //}
+              validateIfNeeded(file, helper, reporter);
+            }
+          }
+        }
+      }
+    }
+    else 
+    {
+      Object []parms = {this.getClass().getName()};
+      Collection files = (Collection) helper.loadModel(GET_PROJECT_FILES, parms);
+      Iterator iter = files.iterator();
+      while (iter.hasNext()) 
+      {
+        IFile file = (IFile) iter.next();
+        if(shouldValidate(file))
+        {
+          validateIfNeeded(file, helper, reporter);
+        }
+      }
+    }
+  }
+  
+ 
+  private void validate(IFile file, InputStream inputStream, IReporter reporter)
+  {  
+    ValidateAction validateAction = new ValidateAction(file, false);
+    validateAction.setValidator(this);
+    if (inputStream != null)
+    {
+      validateAction.setInputStream(inputStream);
+      validateAction.setReporter(reporter);
+    }
+    validateAction.run();    
+  }
+  
+  protected void validateIfNeeded(IFile file, IValidationContext helper, IReporter reporter)
+  {
+    ValidatorManager mgr = ValidatorManager.getManager();
+ 
+    Integer ruleGroupInt = (Integer)helper.loadModel(IRuleGroup.PASS_LEVEL, null); // pass in a "null" so that loadModel doesn't attempt to cast the result into a RefObject
+    int ruleGroup = (ruleGroupInt == null) ? IRuleGroup.PASS_FULL : ruleGroupInt.intValue();
+
+    Object stream = helper.loadModel("inputStream");
+    if (stream instanceof InputStream)
+    {
+      validate(file, (InputStream)stream, reporter);      
+    } 
+    else
+    {  
+      validate(file, null, reporter);
+    }  
+  }
+  
+  /**
+   * Unpacks the fileModelPair and returns an IFile object.
+   */
+  //protected IFile getFile(Object object)
+  //{
+  //  IFile result = null;
+  //  if (object instanceof List)
+  //  {
+  //    List fileModelPair = (List)object;
+  //    if (fileModelPair.size()>0)
+  //    {
+  //      Object file = fileModelPair.get(0);
+  //      if (file instanceof IFile)
+  //      {
+  ///        result = (IFile)file;
+  //      }
+  //    }
+  //  }
+  //  return result;
+ // } 
+  
+  /* (non-Javadoc)
+   * @see org.eclipse.wtp.validation.core.IValidator#cleanup(org.eclipse.wtp.validation.core.IReporter)
+   */
+  public void cleanup(IReporter reporter)
+  {
+  }
+
+  boolean shouldValidate(IFile file) {
+    IResource resource = file;
+    do {
+      if (resource.isDerived() || resource.isTeamPrivateMember() || !resource.isAccessible() || resource.getName().charAt(0) == '.') {
+        return false;
+      }
+      resource = resource.getParent();
+    }
+	while ((resource.getType() & IResource.PROJECT) == 0 && (resource.getType() & IResource.ROOT) == 0);
+	return true;
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-validation/org/eclipse/wst/xsd/ui/internal/validation/XSDMessageInfoHelper.java b/bundles/org.eclipse.wst.xsd.ui/src-validation/org/eclipse/wst/xsd/ui/internal/validation/XSDMessageInfoHelper.java
new file mode 100644
index 0000000..3c7307a
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-validation/org/eclipse/wst/xsd/ui/internal/validation/XSDMessageInfoHelper.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 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.validation;
+
+
+/**
+ * @author Mark Hutchinson
+ * 
+ * The XSDMessageInfoHelper creates a string with the
+ */
+public class XSDMessageInfoHelper
+{
+  public XSDMessageInfoHelper()
+  { super();
+  }
+
+  public String[] createMessageInfo(String errorMessage, String errorKey)
+  { 
+    //Now map the error key to what we would want to underline:
+    String nameOrValue = "";
+    String selectionStrategy = "";
+    if (errorKey.equals("s4s-elt-invalid-content.1") || errorKey.equals("s4s-elt-must-match.1") || errorKey.equals("s4s-att-must-appear") || errorKey.equals("s4s-elt-invalid-content.2"))
+    { selectionStrategy = "START_TAG";
+    }
+    else if (errorKey.equals("s4s-att-not-allowed"))
+    { selectionStrategy = "ATTRIBUTE_NAME";
+      nameOrValue = getFirstStringBetweenSingleQuotes(errorMessage);
+    }
+    else if (errorKey.equals("s4s-att-invalid-value"))
+    { selectionStrategy = "ATTRIBUTE_VALUE";
+      nameOrValue = getFirstStringBetweenSingleQuotes(errorMessage);
+    }
+    else if (errorKey.equals("s4s-elt-character"))
+    { selectionStrategy = "TEXT";
+    }
+    else if (errorKey.equals("src-resolve.4.2") || errorKey.equals("src-resolve"))
+    { selectionStrategy = "VALUE_OF_ATTRIBUTE_WITH_GIVEN_VALUE";
+      nameOrValue = getFirstStringBetweenSingleQuotes(errorMessage);
+    }
+    String messageInfo[] = new String[2];
+    messageInfo[0] = selectionStrategy;
+    messageInfo[1] = nameOrValue;
+    return messageInfo;    
+  }
+
+  /*
+   * Mark Hutchinson
+   * 
+   * This method is used to get the value between the first pair of single quotes
+   * It is used to extract information from the error Message (for example
+   * an attribute name)
+   */
+  private String getFirstStringBetweenSingleQuotes(String s)
+  {
+    int first = s.indexOf("'");
+    int second = s.indexOf("'", first + 1);
+    String betweenQuotes = null;
+    if (first != -1 && second != -1)
+    { betweenQuotes = s.substring(first + 1, second);
+    }
+    return betweenQuotes;
+  }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-validation/org/eclipse/wst/xsd/ui/internal/validation/XSDValidator.java b/bundles/org.eclipse.wst.xsd.ui/src-validation/org/eclipse/wst/xsd/ui/internal/validation/XSDValidator.java
new file mode 100644
index 0000000..899f21d
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-validation/org/eclipse/wst/xsd/ui/internal/validation/XSDValidator.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2004 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.validation;
+
+import java.io.InputStream;
+
+import org.eclipse.wst.common.uriresolver.internal.provisional.URIResolverPlugin;
+import org.eclipse.wst.xml.core.internal.validation.core.ValidationReport;
+
+
+/**
+ * An XSD validator specific to Eclipse. This validator will wrap the internal
+ * XSD validator an provide automatic URI resolver support.
+ * Using this class is equivalent to using the internal XSD validator and registering
+ * the URI resolver.
+ */
+public class XSDValidator
+{
+  private static XSDValidator instance = null;
+  private org.eclipse.wst.xsd.core.internal.validation.XSDValidator validator = null;
+  
+  /**
+   * Return the one and only instance of the XSD validator. The validator
+   * can be reused and cannot be customized so there should only be one instance of it.
+   * 
+   * @return The one and only instance of the XSD validator.
+   */
+  public static XSDValidator getInstance()
+  {
+    if(instance == null)
+    {
+      instance = new XSDValidator();
+    }
+    return instance;
+  }
+  /**
+   * Constructor. Create the XSD validator and set the URI resolver.
+   */
+  protected XSDValidator()
+  {
+    validator = new org.eclipse.wst.xsd.core.internal.validation.XSDValidator();
+    validator.setURIResolver(URIResolverPlugin.createResolver());
+  }
+  /**
+   * Validate the file at the given URI.
+   * 
+   * @param uri The URI of the file to validate.
+   */
+  /*public ValidationReport validate(String uri)
+  {
+    return validator.validate(uri);
+  }*/
+  public ValidationReport validate(String uri, InputStream inputStream)
+  {
+    return validator.validate(uri, inputStream);
+  }
+}