Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornitind2011-12-07 18:50:12 +0000
committernitind2011-12-07 18:50:12 +0000
commit92657ae25d54d2d8f3318aadfb4591b5bad0a1b0 (patch)
tree9f079da25506a9fb2170b884079e18910bcb2346 /bundles/org.eclipse.wst.xsd.ui
parent5dc4a3721c537f53c492964027eb5fdd3618a960 (diff)
downloadwebtools.sourceediting-201112071853.tar.gz
webtools.sourceediting-201112071853.tar.xz
webtools.sourceediting-201112071853.zip
This commit was manufactured by cvs2svn to create tag 'v201112071853'.v201112071853
Diffstat (limited to 'bundles/org.eclipse.wst.xsd.ui')
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/.classpath21
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/.cvsignore8
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/.project28
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/.settings/org.eclipse.core.resources.prefs3
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/.settings/org.eclipse.core.runtime.prefs3
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/.settings/org.eclipse.jdt.core.prefs79
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/.settings/org.eclipse.jdt.ui.prefs4
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/.settings/org.eclipse.ltk.core.refactoring.prefs3
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/.settings/org.eclipse.pde.prefs16
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/META-INF/MANIFEST.MF87
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/about.html34
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/build.properties27
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/component.xml7
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/XSDFile.gifbin361 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/blank.gifbin832 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/browsebutton.gifbin825 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/collapse_attr.gifbin854 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/ctool16/NewXSD.gifbin364 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/delete_obj.gifbin351 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/dlcl16/schemaview_co.gifbin336 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/dlcl16/showproperties_obj.gifbin577 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/dtool16/capturescreen.gifbin384 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/dtool16/help_contents.gifbin253 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/dtool16/showproperties_obj.gifbin577 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/elcl16/schemaview_co.gifbin351 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/elcl16/showproperties_obj.gifbin577 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/etool16/capturescreen.gifbin613 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/etool16/help_contents.gifbin259 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/etool16/showproperties_obj.gifbin577 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/etool16/zoomminus.gifbin559 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/etool16/zoomplus.gifbin559 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/expand_attr.gifbin856 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/filter.gifbin219 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDAnyAttributedis.gifbin358 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDAnydis.gifbin365 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDAttributeGroup.gifbin215 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDAttributeGroupRef.gifbin327 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDAttributeGroupRefdis.gifbin212 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDAttributeGroupdis.gifbin209 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDAttributeRefdis.gifbin233 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDAttributedis.gifbin164 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDComplexContent.gifbin348 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDComplexType.gifbin345 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDComplexTypedis.gifbin229 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDElementRefdis.gifbin349 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDElementdis.gifbin223 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDGroup.gifbin327 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDGroupRef.gifbin331 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDGroupRefdis.gifbin215 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDGroupdis.gifbin209 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDSimpleContent.gifbin210 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/obj16/all_obj.gifbin116 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/obj16/alldis_obj.gifbin73 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/obj16/annotationsheader.gifbin376 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/obj16/attributegroupsheader.gifbin369 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/obj16/attributesheader.gifbin367 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/obj16/choice_obj.gifbin130 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/obj16/choicedis_obj.gifbin97 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/obj16/directivesheader.gifbin336 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/obj16/elementsheader.gifbin595 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/obj16/error_marker.gifbin292 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/obj16/error_tsk.gifbin353 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/obj16/extnsn_obj.gifbin185 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/obj16/extnsndis_obj.gifbin130 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/obj16/groupsheader.gifbin372 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/obj16/index.gifbin1109 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/obj16/notationsheader.gifbin345 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/obj16/sequence_obj.gifbin120 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/obj16/sequencedis_obj.gifbin91 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/obj16/simpletype_obj.gifbin149 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/obj16/simpletypedis_obj.gifbin145 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/obj16/smpl_list_obj.gifbin350 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/obj16/smpl_listdis_obj.gifbin224 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/obj16/smpl_restrict_obj.gifbin231 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/obj16/smpl_restrictdis_obj.gifbin213 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/obj16/smpl_union_obj.gifbin243 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/obj16/smpl_uniondis_obj.gifbin230 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/obj16/typesheader.gifbin242 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/ovr16/attributeoverlay.gifbin117 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/ovr16/error_ovr.gifbin82 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/ovr16/extnsn_ovr.gifbin111 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/ovr16/extnsndis_ovr.gifbin111 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/ovr16/textoverlay.gifbin167 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/plugin.properties850
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/plugin.xml695
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/TypeVizEditorMode.java53
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/figures/BoxFigure.java119
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/figures/CompartmentFigure.java188
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/figures/FieldFigure.java312
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/figures/HeadingFigure.java91
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/figures/RoundedLineBorder.java66
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/figures/StructureFigure.java61
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/figures/TypeVizFigureFactory.java64
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/layouts/ColumnData.java83
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/layouts/RowLayout.java179
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/actions/CreateElementAction.java360
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/actions/DOMAttribute.java75
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/actions/IXSDToolbarAction.java19
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/actions/MoveXSDAttributeAction.java248
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/actions/MoveXSDBaseAction.java28
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/actions/MoveXSDElementAction.java173
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/actions/XSDEditNamespacesAction.java292
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/CategoryAdapter.java175
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/RedefineCategoryAdapter.java85
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDAdapterFactory.java153
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDAnyTypeDefinitionAdapter.java56
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDAttributeDeclarationAdapter.java111
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDAttributeGroupDefinitionAdapter.java285
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDAttributeUseAdapter.java101
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDBaseAdapter.java238
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDBaseAttributeAdapter.java236
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDChildUtility.java280
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDComplexTypeDefinitionAdapter.java566
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDElementDeclarationAdapter.java339
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDEmptyFieldAdapter.java120
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDEnumerationFacetAdapter.java90
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDModelGroupAdapter.java260
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDModelGroupDefinitionAdapter.java340
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDParticleAdapter.java161
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDRedefineAdapter.java295
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDSchemaAdapter.java537
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDSchemaDirectiveAdapter.java131
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDSimpleContentAdapter.java93
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDSimpleTypeDefinitionAdapter.java268
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDTypeDefinitionAdapter.java69
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDVisitor.java247
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDVisitorForFields.java188
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDWildcardAdapter.java237
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/commands/BaseDragAndDropCommand.java441
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/commands/XSDAttributeDragAndDropCommand.java259
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/commands/XSDElementDragAndDropCommand.java311
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/AttributeGroupDefinitionEditPart.java128
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/CategoryEditPart.java248
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/ConnectableEditPart.java275
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/ModelGroupDefinitionReferenceEditPart.java148
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/ModelGroupEditPart.java230
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/ReferenceConnection.java67
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/SpaceFillerForFieldEditPart.java48
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/TargetConnectionSpacingFigureEditPart.java46
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/TopLevelComponentEditPart.java473
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/XSDAttributesForAnnotationEditPart.java43
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/XSDBaseFieldEditPart.java164
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/XSDEditPartFactory.java160
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/XSDGroupsForAnnotationEditPart.java74
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/XSDModelGroupRouter.java378
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/XSDSchemaEditPart.java334
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/XSDSimpleTypeEditPart.java239
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/model/SpaceFiller.java169
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/model/TargetConnectionSpaceFiller.java46
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editpolicies/DragAndDropEditPolicy.java92
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editpolicies/GraphNodeDragTracker.java89
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editpolicies/SelectionHandlesEditPolicyImpl.java110
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editpolicies/TopLevelComponentLabelCellEditorLocator.java49
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editpolicies/TopLevelNameDirectEditManager.java189
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/figures/CategoryFigure.java97
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/figures/CenteredIconFigure.java121
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/figures/GenericGroupFigure.java93
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/figures/HyperLinkLabel.java47
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/figures/IExtendedFigureFactory.java18
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/figures/IModelGroupFigure.java17
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/figures/ModelGroupFigure.java58
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/figures/SpacingFigure.java25
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/layouts/ContainerLayout.java219
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/layouts/FillLayout.java158
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/layouts/ModelGroupLayout.java195
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/dialogs/BuiltInTypesTreeViewerProvider.java221
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/dialogs/IOpenInNewEditor.java16
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/dialogs/NewAttributeDialog.java93
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/dialogs/NewComponentDialog.java196
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/dialogs/NewElementButtonHandler.java26
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/dialogs/NewElementDialog.java92
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/dialogs/NewTypeButtonHandler.java26
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/dialogs/NewTypeDialog.java212
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/dialogs/SelectBuiltInTypesForFilteringDialog.java108
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/dialogs/XSDEditSchemaNS.java44
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/dialogs/XSDGraphViewerDialog.java416
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/BaseHyperlinkDetector.java267
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/ISelectionMapper.java18
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/InternalXSDMultiPageEditor.java1468
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/KeyboardDragImpl.java80
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/Logger.java157
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/Messages.java155
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/SourcePageActionContributor.java58
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/StructuredTextViewerConfigurationXSD.java28
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDAttributeReferenceEditManager.java96
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDComplexTypeBaseTypeEditManager.java128
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDEditorCSHelpIds.java140
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDEditorConfiguration.java192
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDEditorContextIds.java464
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDEditorExtensionProperties.java70
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDEditorPlugin.java389
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDElementReferenceEditManager.java143
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDFileEditorInput.java70
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDHyperlink.java134
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDHyperlinkDetector.java151
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDHyperlinkTargetLocator.java301
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDMultiPageEditorContributor.java269
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDSelectionMapper.java44
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDSubstitutionGroupEditManager.java75
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDTabbedPropertySheetPage.java156
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDTypeReferenceEditManager.java227
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/Dot.gifbin806 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/GenerateDtd.gifbin605 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/GenerateJava.gifbin609 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/GraphViewElementRef.gifbin860 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/NewXSD.pngbin4283 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/RegexWizardArrow.gifbin54 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/TriangleToolBar.gifbin92 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/ValidateXSD.gifbin558 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDAll.gifbin88 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDAnnotate.gifbin594 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDAny.gifbin613 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDAnyAttribute.gifbin384 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDAppInfo.gifbin121 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDAttribute.gifbin167 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDAttributeGroup.gifbin235 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDAttributeGroupRef.gifbin361 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDAttributeRef.gifbin350 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDChoice.gifbin145 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDComplexContent.gifbin211 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDComplexType.gifbin155 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDDateAndTimeTypes.gifbin594 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDDoc.gifbin368 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDElement.gifbin351 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDElementRef.gifbin585 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDExtension.gifbin101 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDField.gifbin227 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDFile.gifbin361 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDGlobalAttribute.gifbin167 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDGlobalElement.gifbin351 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDGroup.gifbin205 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDGroupRef.gifbin899 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDImport.gifbin114 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDInclude.gifbin324 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDKey.gifbin323 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDKeyRef.gifbin558 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDNotation.gifbin177 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDNumberTypes.gifbin115 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDRedefine.gifbin373 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDSelector.gifbin136 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDSequence.gifbin91 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDSimpleContent.gifbin210 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDSimpleEnum.gifbin105 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDSimpleList.gifbin347 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDSimplePattern.gifbin120 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDSimpleRestrict.gifbin141 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDSimpleType.gifbin150 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDSimpleTypeForEditPart.gifbin150 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDSimpleUnion.gifbin138 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDUnique.gifbin210 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/appinfo_browse.gifbin323 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/appinfo_category.gifbin583 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/back.gifbin873 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/browsebutton.gifbin825 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/error_st_obj.gifbin339 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/forward.gifbin874 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/generate_xml.gifbin612 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/quickassist.gifbin225 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/regx_wiz.pngbin4272 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/reloadgrammar.gifbin365 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/sort.gifbin159 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/xmlcatalog_obj.gifbin598 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/messages.properties153
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/search/IXSDTypesFilter.java25
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/search/XSDAttributeSearchListProvider.java64
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/search/XSDComponentDescriptionProvider.java195
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/search/XSDElementsSearchListProvider.java59
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/search/XSDSearchListDialogDelegate.java137
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/search/XSDSearchListProvider.java285
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/search/XSDTypesSearchListProvider.java110
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/navigation/DesignViewNavigationLocation.java468
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/navigation/MultiPageEditorTextSelectionNavigationLocation.java50
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/nsedit/SchemaPrefixChangeHandler.java214
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/nsedit/TargetNamespaceChangeHandler.java152
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/nsedit/XSDVisitor.java216
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/preferences/XSDEditorPreferencePage.java147
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/preferences/XSDPreferencePage.java267
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/preferences/XSDValidatorPreferencePage.java126
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/text/XSDModelAdapter.java240
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/text/XSDModelDelayedReconciler.java195
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/text/XSDModelQueryExtension.java197
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/text/XSDModelReconcileAdapter.java196
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/util/DocumentAdapter.java58
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/util/ModelReconcileAdapter.java150
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/util/SelectionAdapter.java83
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/util/TypesHelper.java404
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/util/ViewUtility.java246
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/util/XSDDOMHelper.java477
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/util/XSDSchemaLocationResolverAdapterFactory.java31
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/util/XSDSchemaLocationResolverImpl.java39
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/utils/OpenOnSelectionHelper.java369
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/validation/DelegatingSourceValidatorForXSD.java48
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/widgets/EnumerationsDialog.java111
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/widgets/TypeSection.java335
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/widgets/XSDEditSchemaInfoDialog.java135
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/wizards/NewXSDWizard.java172
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/wizards/RegexCompositionPage.java947
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/wizards/RegexNode.java421
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/wizards/RegexTestingPage.java147
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/wizards/RegexWizard.java68
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/wizards/XSDLocationChoicePage.java69
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/wizards/XSDNewFilePage.java129
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/wizards/XSDSelectIncludeFileWizard.java371
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/AddFieldAction.java77
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/BaseDirectEditAction.java90
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/BaseSelectionAction.java132
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/CaptureScreenAction.java263
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/DeleteAction.java117
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/DesignSelectAll.java75
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/SetInputToGraphView.java74
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/ShowPropertiesViewAction.java56
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/ADTFloatingToolbar.java79
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/BaseGraphicalViewerKeyHandler.java168
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/DesignViewContextMenuProvider.java161
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/DesignViewGraphicalViewer.java449
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/DesignViewerGraphicConstants.java21
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/FlatCCombo.java1488
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/IAnnotationProvider.java17
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/IKeyboardDrag.java19
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/ImageOverlayDescriptor.java60
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/ADTComboBoxCellEditor.java268
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/AttributeReferenceDirectEditManager.java38
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/ComboBoxCellEditorManager.java224
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/ElementReferenceDirectEditManager.java37
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/LabelCellEditorLocator.java90
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/LabelEditManager.java150
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/ReferenceDirectEditManager.java180
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/TypeReferenceDirectEditManager.java43
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/ADTEditPartFactory.java102
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/ADTFloatingToolbarEditPart.java227
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BackToSchemaEditPart.java134
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BaseEditPart.java300
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BaseFieldEditPart.java535
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BaseTypeConnectingEditPart.java207
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BoxEditPart.java92
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/CenteredConnectionAnchor.java115
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/ColumnEditPart.java127
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/CompartmentEditPart.java217
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/ComplexTypeEditPart.java121
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/EditPartNavigationHandlerUtil.java72
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/FieldEditPart.java21
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/IAutoDirectEdit.java20
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/IConnectionContainer.java16
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/IHolderEditPart.java16
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/INamedEditPart.java21
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/RootContentEditPart.java165
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/RootEditPart.java115
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/RootHolderEditPart.java62
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/SectionEditPart.java38
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/StructureEditPart.java249
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/TopLevelFieldEditPart.java135
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/TypeReferenceConnection.java105
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/AbstractModelCollection.java65
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/Annotation.java37
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/Compartment.java73
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/FocusTypeColumn.java60
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/IActionProvider.java18
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/IFeedbackHandler.java17
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/IGraphElement.java24
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/IModelProxy.java18
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/ReferencedTypeColumn.java138
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/RootHolder.java28
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editpolicies/ADTDirectEditPolicy.java46
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editpolicies/ADTSelectionFeedbackEditPolicy.java52
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editpolicies/DirectEditPolicyDelegate.java18
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editpolicies/IADTUpdateCommand.java18
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editpolicies/KeyBoardAccessibilityEditPolicy.java28
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editpolicies/SimpleDirectEditPolicy.java58
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/figures/IADTFigure.java22
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/figures/ICompartmentFigure.java19
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/figures/IFieldFigure.java23
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/figures/IFigureFactory.java18
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/figures/IStructureFigure.java22
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/edit/ComponentReferenceEditManager.java26
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/edit/ComponentReferenceEditManager2.java19
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/edit/IComponentDialog.java31
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/ADTExternalResourceVariant.java153
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/ADTFileStoreEditorInput.java60
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/ADTMultiPageEditor.java373
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/ADTReadOnlyFileEditorInput.java135
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/CommonMultiPageEditor.java942
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/CommonSelectionManager.java124
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/ContextMenuParticipant.java25
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/EditorMode.java37
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/EditorModeManager.java136
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/IADTEditorInput.java19
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/IEditorModeListener.java16
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/Messages.java54
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/ProductCustomizationProvider.java47
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/messages.properties37
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/facade/IADTObject.java18
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/facade/IADTObjectListener.java16
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/facade/IComplexType.java19
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/facade/IField.java35
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/facade/IModel.java18
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/facade/IStructure.java23
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/facade/IType.java24
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/outline/ADTContentOutlinePage.java339
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/outline/ADTContentOutlineProvider.java149
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/outline/ADTContentOutlineRefreshJob.java143
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/outline/ADTLabelProvider.java79
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/outline/ExtensibleContentOutlinePage.java147
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/outline/ITreeElement.java23
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/properties/ADTTabbedPropertySheetPage.java42
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDAnyAttributeAction.java90
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDAnyElementAction.java80
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDAttributeDeclarationAction.java128
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDAttributeGroupDefinitionAction.java78
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDComplexTypeDefinitionAction.java52
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDElementAction.java156
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDEnumerationFacetAction.java108
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDModelGroupAction.java97
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDModelGroupDefinitionAction.java62
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDRedefinableContentAction.java229
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDRedefinedAttributeGroupAction.java68
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDRedefinedComplexTypeAction.java69
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDRedefinedModelGroupAction.java68
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDRedefinedSimpleTypeAction.java70
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDSchemaDirectiveAction.java92
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDSimpleTypeDefinitionAction.java53
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/DeleteXSDConcreteComponentAction.java74
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/OpenInNewEditor.java546
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/SetBaseTypeAction.java78
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/SetMultiplicityAction.java88
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/SetTypeAction.java50
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/XSDBaseAction.java81
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddDocumentationCommand.java131
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddEnumerationsCommand.java98
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddExtensibilityElementCommand.java81
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddExtensionAttributeCommand.java110
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddExtensionCommand.java48
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddExtensionElementCommand.java152
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddRedefinedComponentCommand.java75
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddXSDAnyAttributeCommand.java64
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddXSDAnyElementCommand.java80
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddXSDAttributeDeclarationCommand.java238
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddXSDAttributeGroupDefinitionCommand.java159
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddXSDComplexTypeDefinitionCommand.java122
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddXSDElementCommand.java388
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddXSDImportCommand.java42
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddXSDIncludeCommand.java43
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddXSDModelGroupCommand.java167
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddXSDModelGroupDefinitionCommand.java124
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddXSDRedefineCommand.java44
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddXSDSchemaDirectiveCommand.java60
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddXSDSimpleTypeDefinitionCommand.java91
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/BaseCommand.java200
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/ChangeToLocalSimpleTypeCommand.java80
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/DeleteCommand.java221
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/ExtensibleAddExtensionCommand.java214
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/ExtensibleRemoveExtensionNodeCommand.java94
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/RedefineAttributeGroupCommand.java36
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/RedefineComplexTypeCommand.java40
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/RedefineModelGroupCommand.java36
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/RedefineSimpleTypeCommand.java38
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/RemoveExtensionAttributerCommand.java43
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/RemoveExtensionElementCommand.java46
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/RemoveExtensionNodeCommand.java61
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/SetBaseTypeAndManagerDirectivesCommand.java49
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/SetBaseTypeCommand.java98
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/SetMultiplicityCommand.java70
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/SetTypeCommand.java116
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/SetXSDFacetValueCommand.java50
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateAttributeReferenceAndManagerDirectivesCommand.java60
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateAttributeReferenceCommand.java38
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateAttributeValueCommand.java96
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateComplexTypeDerivationBy.java54
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateComponentReferenceAndManageDirectivesCommand.java150
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateContentModelCommand.java49
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateElementReferenceAndManageDirectivesCommand.java59
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateElementReferenceCommand.java39
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateMaxOccursCommand.java64
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateMinOccursCommand.java91
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateNameCommand.java112
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateNamespaceInformationCommand.java298
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateNumericBoundsFacetCommand.java168
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateStringLengthFacetCommand.java230
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateTextValueCommand.java61
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateTypeReferenceAndManageDirectivesCommand.java62
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateTypeReferenceCommand.java78
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateXSDPatternFacetCommand.java76
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateXSDWhiteSpaceFacetCommand.java60
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/providers/XSDSectionLabelProvider.java172
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/AbstractExtensionsSection.java615
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/AbstractSection.java396
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/AbstractSectionDescriptor.java108
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/AnnotationSection.java166
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/CommonDirectivesSection.java163
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/EnumerationsSection.java392
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/ExtensionsSection.java294
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/FacetViewer.java559
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/IDocumentChangedNotifier.java19
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/MultiplicitySection.java216
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/RefactoringSection.java105
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/SchemaLocationSection.java147
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/SimpleContentUnionMemberTypesDialog.java312
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/SpecificConstraintsWidget.java727
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDActionManager.java148
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDAnyElementContentsSection.java250
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDAttributeDeclarationSection.java908
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDAttributeGroupDefinitionSection.java295
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDComplexTypeAdvancedSection.java257
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDComplexTypeSection.java410
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDElementDeclarationAdvancedSection.java453
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDElementDeclarationSection.java647
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDEnumerationFacetSection.java129
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDFacetSection.java1021
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDFacetSectionFilter.java42
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDImportSection.java264
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDModelGroupDefinitionSection.java360
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDModelGroupSection.java163
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDSchemaAdvancedSection.java208
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDSchemaSection.java319
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDSimpleTypeAdvancedSection.java121
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDSimpleTypeSection.java655
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDTableTreeViewer.java126
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/AddExtensionsComponentDialog.java785
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/AddNewCategoryDialog.java370
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/CategoryProvider.java81
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionDetailsContentProvider.java211
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionItem.java226
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionItemEditManager.java50
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionItemMenuListener.java127
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionTreeContentProvider.java83
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionTreeLabelProvider.java88
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionDetailsContentProvider.java19
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionDetailsViewer.java336
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionItem.java31
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionItemEditManager.java32
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionItemFilter.java28
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionsSchemasRegistry.java330
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/SelectFromCatalogDialog.java207
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/SpecificationForExtensionsSchema.java219
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/XSDExtensionTreeContentProvider.java119
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/DefaultListNodeEditorConfiguration.java27
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/DialogNodeEditorConfiguration.java33
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/ListNodeEditorConfiguration.java35
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/NodeCustomizationRegistry.java157
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/NodeEditorConfiguration.java43
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/NodeEditorProvider.java18
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/NodeFilter.java21
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/util/Messages.java140
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/util/XSDCommonUIUtils.java622
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/util/XSDDirectivesManager.java815
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/util/XSDDirectivesSchemaLocationUpdater.java169
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/util/messages.properties123
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/Checks.java38
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/INameUpdating.java25
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/IReferenceUpdating.java35
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/IXSDRefactorConstants.java15
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/MakeAnonymousTypsGlobalEnablementTester.java65
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/MakeLocalElementGlobalEnablementTester.java47
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/PerformUnsavedRefactoringOperation.java70
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/RefactorEnablementTester.java82
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/RefactoringComponent.java62
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/RefactoringMessages.java49
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/RenameEnablementTester.java82
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/TextChangeManager.java115
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/XMLRefactoringComponent.java78
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/MakeAnonymousTypeGlobalAction.java162
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/MakeLocalElementGlobalAction.java80
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/RenameAction.java118
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/RenameComponentAction.java160
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/RenameResourceAction.java78
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/RenameResourceActionDelegate.java57
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/RenameTargetNamespaceAction.java78
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/SelectionDispatchAction.java195
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/XSDRefactorActionGroup.java70
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/XSDRefactorGroupActionDelegate.java60
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/XSDSelectionDispatchAction.java54
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/handlers/MakeAnonymousTypeGobalHandler.java138
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/handlers/MakeLocalElementGlobalHandler.java61
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/handlers/RefactoringHandler.java44
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/handlers/RenameHandler.java118
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/messages.properties55
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/rename/ComponentRenameArguments.java52
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/rename/RenameComponentProcessor.java519
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/rename/RenameResourceProcessor.java174
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/rename/RenameTargetNamespaceProcessor.java419
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/rename/ResourceRenameChange.java106
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/rename/ResourceRenameParticipant.java296
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/rename/SortingSearchRequestor.java87
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/rename/XMLComponentRenameParticipant.java138
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/rename/XSDComponentRenameParticipant.java43
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/structure/AbstractCommand.java71
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/structure/MakeAnonymousTypeGlobalCommand.java84
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/structure/MakeLocalElementGlobalCommand.java81
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/structure/MakeTypeGlobalChange.java168
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/structure/MakeTypeGlobalProcessor.java220
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/util/TextChangeCompatibility.java97
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/RefactorActionGroup.java215
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/RefactorGroupActionDelegate.java146
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/RefactorGroupSubMenu.java57
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/RefactoringWizardMessages.java70
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/RenameInputWizardPage.java257
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/RenameRefactoringWizard.java72
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/messages.properties55
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/IXSDSearchConstants.java29
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/SearchMessages.java31
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/XSDSearchContributor.java93
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/XSDSearchParticipant.java51
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/XSDSearchQuery.java54
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/BaseGroupActionDelegate.java146
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/CompositeActionGroup.java99
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/DeclarationsSearchGroup.java17
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/FindAction.java30
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/FindReferencesAction.java149
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/FindReferencesInProjectAction.java45
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/FindReferencesInWorkingSetAction.java88
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/ImplementorsSearchGroup.java17
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/OccurrencesSearchGroup.java17
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/ReferencesSearchGroup.java179
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/SearchGroup.java20
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/XSDSearchActionGroup.java35
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/XSDSearchDeclarationsGroupActionDelegate.java22
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/XSDSearchGroupSubMenu.java72
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/XSDSearchReferencesGroupActionDelegate.java46
617 files changed, 0 insertions, 74271 deletions
diff --git a/bundles/org.eclipse.wst.xsd.ui/.classpath b/bundles/org.eclipse.wst.xsd.ui/.classpath
deleted file mode 100644
index 492b51cc29..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/.classpath
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src-refactor"/>
- <classpathentry kind="src" path="src-adt"/>
- <classpathentry kind="src" path="src-adt-xsd"/>
- <classpathentry kind="src" path="src-common"/>
- <classpathentry kind="src" path="src-adt-xsd-typeviz"/>
- <classpathentry kind="src" path="src-search"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
- <accessrules>
- <accessrule kind="accessible" pattern="org/apache/xerces/**"/>
- </accessrules>
- </classpathentry>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
- <accessrules>
- <accessrule kind="accessible" pattern="org/eclipse/wst/validation/**"/>
- <accessrule kind="accessible" pattern="org/eclipse/wst/common/ui/**"/>
- </accessrules>
- </classpathentry>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/bundles/org.eclipse.wst.xsd.ui/.cvsignore b/bundles/org.eclipse.wst.xsd.ui/.cvsignore
deleted file mode 100644
index 6500e4dc83..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/.cvsignore
+++ /dev/null
@@ -1,8 +0,0 @@
-bin
-xsdeditor.jar
-build.xml
-temp.folder
-org.eclipse.wst.xsd.ui_1.0.0.jar
-@dot
-src.zip
-javaCompiler...args
diff --git a/bundles/org.eclipse.wst.xsd.ui/.project b/bundles/org.eclipse.wst.xsd.ui/.project
deleted file mode 100644
index aab3824094..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?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.core.resources.prefs b/bundles/org.eclipse.wst.xsd.ui/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index afa5c91352..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,3 +0,0 @@
-#Tue Apr 04 03:36:32 EDT 2006
-eclipse.preferences.version=1
-encoding/<project>=ISO-8859-1
diff --git a/bundles/org.eclipse.wst.xsd.ui/.settings/org.eclipse.core.runtime.prefs b/bundles/org.eclipse.wst.xsd.ui/.settings/org.eclipse.core.runtime.prefs
deleted file mode 100644
index 7ec5750225..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/.settings/org.eclipse.core.runtime.prefs
+++ /dev/null
@@ -1,3 +0,0 @@
-#Mon Apr 17 01:48:39 EDT 2006
-eclipse.preferences.version=1
-line.separator=\r\n
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
deleted file mode 100644
index 95c882edc6..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,79 +0,0 @@
-#Tue Jan 16 17:48:30 EST 2007
-eclipse.preferences.version=1
-org.eclipse.jdt.core.builder.cleanOutputFolder=clean
-org.eclipse.jdt.core.builder.duplicateResourceTask=warning
-org.eclipse.jdt.core.builder.invalidClasspath=ignore
-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=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.4
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.5
-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.annotationSuperInterface=warning
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
-org.eclipse.jdt.core.compiler.problem.deprecation=ignore
-org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
-org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
-org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
-org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
-org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
-org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
-org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
-org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
-org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=error
-org.eclipse.jdt.core.compiler.problem.invalidJavadoc=ignore
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled
-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=error
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
-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.missingOverrideAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingSerialVersion=error
-org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
-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=error
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=enabled
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
-org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
-org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
-org.eclipse.jdt.core.compiler.problem.typeParameterHiding=ignore
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
-org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
-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.unusedLabel=error
-org.eclipse.jdt.core.compiler.problem.unusedLocal=error
-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=error
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.4
-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
deleted file mode 100644
index 5a782e146c..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/.settings/org.eclipse.jdt.ui.prefs
+++ /dev/null
@@ -1,4 +0,0 @@
-#Tue Jan 16 17:04:13 EST 2007
-eclipse.preferences.version=1
-internal.default.compliance=user
-org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?>\r\n<templates/>
diff --git a/bundles/org.eclipse.wst.xsd.ui/.settings/org.eclipse.ltk.core.refactoring.prefs b/bundles/org.eclipse.wst.xsd.ui/.settings/org.eclipse.ltk.core.refactoring.prefs
deleted file mode 100644
index c59368c5e1..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/.settings/org.eclipse.ltk.core.refactoring.prefs
+++ /dev/null
@@ -1,3 +0,0 @@
-#Tue Apr 04 03:36:32 EDT 2006
-eclipse.preferences.version=1
-org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false
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
deleted file mode 100644
index 061cd53dd0..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/.settings/org.eclipse.pde.prefs
+++ /dev/null
@@ -1,16 +0,0 @@
-#Mon Apr 17 02:01:33 EDT 2006
-compilers.incompatible-environment=0
-compilers.p.build=0
-compilers.p.deprecated=1
-compilers.p.illegal-att-value=0
-compilers.p.no-required-att=0
-compilers.p.not-externalized-att=0
-compilers.p.unknown-attribute=0
-compilers.p.unknown-class=0
-compilers.p.unknown-element=0
-compilers.p.unknown-resource=0
-compilers.p.unresolved-ex-points=0
-compilers.p.unresolved-import=0
-compilers.p.unused-element-or-attribute=0
-compilers.use-project=true
-eclipse.preferences.version=1
diff --git a/bundles/org.eclipse.wst.xsd.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.wst.xsd.ui/META-INF/MANIFEST.MF
deleted file mode 100644
index 74437c9554..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,87 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %_UI_PLUGIN_NAME
-Bundle-SymbolicName: org.eclipse.wst.xsd.ui; singleton:=true
-Bundle-Version: 1.2.404.qualifier
-Bundle-Activator: org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin
-Bundle-Vendor: %Bundle-Vendor.0
-Bundle-Localization: plugin
-Export-Package: org.eclipse.wst.xsd.ui.internal.actions;x-internal:=true,
- org.eclipse.wst.xsd.ui.internal.adapters;x-internal:=true,
- org.eclipse.wst.xsd.ui.internal.adt.actions;x-internal:=true,
- org.eclipse.wst.xsd.ui.internal.adt.design;x-internal:=true,
- org.eclipse.wst.xsd.ui.internal.adt.design.directedit;x-internal:=true,
- org.eclipse.wst.xsd.ui.internal.adt.design.editparts;x-internal:=true,
- org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model;x-internal:=true,
- org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies;x-internal:=true,
- org.eclipse.wst.xsd.ui.internal.adt.design.figures;x-internal:=true,
- org.eclipse.wst.xsd.ui.internal.adt.edit;x-internal:=true,
- org.eclipse.wst.xsd.ui.internal.adt.editor;x-internal:=true,
- org.eclipse.wst.xsd.ui.internal.adt.facade;x-internal:=true,
- org.eclipse.wst.xsd.ui.internal.adt.outline;x-internal:=true,
- org.eclipse.wst.xsd.ui.internal.adt.properties;x-internal:=true,
- org.eclipse.wst.xsd.ui.internal.adt.typeviz;x-internal:=true,
- org.eclipse.wst.xsd.ui.internal.adt.typeviz.design.figures;x-internal:=true,
- org.eclipse.wst.xsd.ui.internal.adt.typeviz.design.layouts;x-internal:=true,
- org.eclipse.wst.xsd.ui.internal.commands;x-internal:=true,
- org.eclipse.wst.xsd.ui.internal.common.actions;x-internal:=true,
- org.eclipse.wst.xsd.ui.internal.common.commands;x-internal:=true,
- org.eclipse.wst.xsd.ui.internal.common.properties.providers;x-internal:=true,
- org.eclipse.wst.xsd.ui.internal.common.properties.sections;x-internal:=true,
- org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo;x-internal:=true,
- org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.custom;x-internal:=true,
- org.eclipse.wst.xsd.ui.internal.common.util;x-internal:=true,
- org.eclipse.wst.xsd.ui.internal.design.editparts;x-internal:=true,
- org.eclipse.wst.xsd.ui.internal.design.editparts.model;x-internal:=true,
- org.eclipse.wst.xsd.ui.internal.design.editpolicies;x-internal:=true,
- org.eclipse.wst.xsd.ui.internal.design.figures;x-internal:=true,
- org.eclipse.wst.xsd.ui.internal.design.layouts;x-internal:=true,
- org.eclipse.wst.xsd.ui.internal.dialogs;x-internal:=true,
- org.eclipse.wst.xsd.ui.internal.editor;x-internal:=true,
- org.eclipse.wst.xsd.ui.internal.editor.icons;x-internal:=true,
- org.eclipse.wst.xsd.ui.internal.editor.search;x-internal:=true,
- org.eclipse.wst.xsd.ui.internal.navigation;x-internal:=true,
- org.eclipse.wst.xsd.ui.internal.nsedit;x-internal:=true,
- org.eclipse.wst.xsd.ui.internal.preferences;x-internal:=true,
- org.eclipse.wst.xsd.ui.internal.refactor;x-internal:=true,
- org.eclipse.wst.xsd.ui.internal.refactor.actions;x-internal:=true,
- org.eclipse.wst.xsd.ui.internal.refactor.handlers,
- org.eclipse.wst.xsd.ui.internal.refactor.rename;x-internal:=true,
- 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.utils;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;bundle-version="[3.2.0,4.0.0)",
- org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
- org.eclipse.wst.common.uriresolver;bundle-version="[1.1.0,1.2.0)",
- org.eclipse.wst.sse.ui;bundle-version="[1.2.0,1.4.0)",
- org.eclipse.wst.sse.core;bundle-version="[1.1.300,1.2.0)",
- org.eclipse.wst.common.core;bundle-version="[1.1.0,1.3.0)",
- org.eclipse.wst.xml.core;bundle-version="[1.1.300,1.2.0)",
- org.eclipse.wst.xml.ui;bundle-version="[1.0.400,1.2.0)",
- org.eclipse.wst.common.ui;bundle-version="[1.1.0,1.2.0)",
- org.eclipse.jface.text;bundle-version="[3.2.0,4.0.0)",
- org.eclipse.gef;bundle-version="[3.4.0,4.0.0)",
- org.eclipse.ui.workbench.texteditor;bundle-version="[3.2.0,4.0.0)",
- org.eclipse.ui.ide;bundle-version="[3.2.0,4.0.0)",
- org.eclipse.emf.ecore.edit;bundle-version="[2.2.0,3.0.0)",
- org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)",
- org.eclipse.xsd.edit;bundle-version="[2.2.0,3.0.0)",
- org.eclipse.emf.edit.ui;bundle-version="[2.2.0,3.0.0)",
- org.eclipse.wst.validation;bundle-version="[1.2.0,1.3.0)",
- org.eclipse.ltk.core.refactoring;bundle-version="[3.2.0,4.0.0)",
- org.eclipse.ltk.ui.refactoring;bundle-version="[3.2.0,4.0.0)",
- org.eclipse.wst.xsd.core;bundle-version="[1.1.300,1.2.0)",
- org.eclipse.search;bundle-version="[3.2.0,4.0.0)",
- org.eclipse.core.expressions;bundle-version="[3.4.0,4.0.0)",
- org.eclipse.core.filesystem;bundle-version="[1.2.0,2.0.0)"
-Import-Package: com.ibm.icu.util;version="3.8.1"
-Bundle-ActivationPolicy: lazy
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/bundles/org.eclipse.wst.xsd.ui/about.html b/bundles/org.eclipse.wst.xsd.ui/about.html
deleted file mode 100644
index 2199df3f05..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/about.html
+++ /dev/null
@@ -1,34 +0,0 @@
-<!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">
-
-<H3>About This Content</H3>
-
-<P>June, 2008</P>
-
-<H3>License</H3>
-
-<P>The Eclipse Foundation makes available all content in this plug-in
-("Content"). Unless otherwise indicated below, the Content is provided to you
-under the terms and conditions of the Eclipse Public License Version 1.0
-("EPL"). A copy of the EPL is available at
-<A href="http://www.eclipse.org/org/documents/epl-v10.php">http://www.eclipse.org/org/documents/epl-v10.php</A>.
-For purposes of the EPL, "Program" 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 ("Redistributor") 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
-and such source code may be obtained at
-<A href="http://www.eclipse.org/">http://www.eclipse.org/</A>.</P>
-
-</BODY>
-</HTML>
diff --git a/bundles/org.eclipse.wst.xsd.ui/build.properties b/bundles/org.eclipse.wst.xsd.ui/build.properties
deleted file mode 100644
index cc91274bdb..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/build.properties
+++ /dev/null
@@ -1,27 +0,0 @@
-###############################################################################
-# Copyright (c) 2001, 2007 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.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-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 = component.xml
-output.. = bin/
-javacSource=1.4
-javacTarget=1.4
-
diff --git a/bundles/org.eclipse.wst.xsd.ui/component.xml b/bundles/org.eclipse.wst.xsd.ui/component.xml
deleted file mode 100644
index 294443a7d4..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/component.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<?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/XSDFile.gif b/bundles/org.eclipse.wst.xsd.ui/icons/XSDFile.gif
deleted file mode 100644
index 3900f1b55d..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/XSDFile.gif
+++ /dev/null
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
deleted file mode 100644
index 1936e21a7c..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/blank.gif
+++ /dev/null
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
deleted file mode 100644
index 13dae59bea..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/browsebutton.gif
+++ /dev/null
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
deleted file mode 100644
index b872beee62..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/collapse_attr.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/ctool16/NewXSD.gif b/bundles/org.eclipse.wst.xsd.ui/icons/ctool16/NewXSD.gif
deleted file mode 100644
index b6efdd3d86..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/ctool16/NewXSD.gif
+++ /dev/null
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
deleted file mode 100644
index b6922ac11c..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/delete_obj.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/dlcl16/schemaview_co.gif b/bundles/org.eclipse.wst.xsd.ui/icons/dlcl16/schemaview_co.gif
deleted file mode 100644
index 5b67950b38..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/dlcl16/schemaview_co.gif
+++ /dev/null
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
deleted file mode 100644
index d94ff10555..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/dlcl16/showproperties_obj.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/dtool16/capturescreen.gif b/bundles/org.eclipse.wst.xsd.ui/icons/dtool16/capturescreen.gif
deleted file mode 100644
index 3570c90f4d..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/dtool16/capturescreen.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/dtool16/help_contents.gif b/bundles/org.eclipse.wst.xsd.ui/icons/dtool16/help_contents.gif
deleted file mode 100644
index 74bf617372..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/dtool16/help_contents.gif
+++ /dev/null
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
deleted file mode 100644
index d94ff10555..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/dtool16/showproperties_obj.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/elcl16/schemaview_co.gif b/bundles/org.eclipse.wst.xsd.ui/icons/elcl16/schemaview_co.gif
deleted file mode 100644
index f2d7f1b8b8..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/elcl16/schemaview_co.gif
+++ /dev/null
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
deleted file mode 100644
index 1dc19a31a0..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/elcl16/showproperties_obj.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/etool16/capturescreen.gif b/bundles/org.eclipse.wst.xsd.ui/icons/etool16/capturescreen.gif
deleted file mode 100644
index 176830af2d..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/etool16/capturescreen.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/etool16/help_contents.gif b/bundles/org.eclipse.wst.xsd.ui/icons/etool16/help_contents.gif
deleted file mode 100644
index 9d70301dae..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/etool16/help_contents.gif
+++ /dev/null
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
deleted file mode 100644
index 1dc19a31a0..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/etool16/showproperties_obj.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/etool16/zoomminus.gif b/bundles/org.eclipse.wst.xsd.ui/icons/etool16/zoomminus.gif
deleted file mode 100644
index dd2c92f9ef..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/etool16/zoomminus.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/etool16/zoomplus.gif b/bundles/org.eclipse.wst.xsd.ui/icons/etool16/zoomplus.gif
deleted file mode 100644
index 466d756b3f..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/etool16/zoomplus.gif
+++ /dev/null
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
deleted file mode 100644
index 5c287e92dd..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/expand_attr.gif
+++ /dev/null
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
deleted file mode 100644
index 6fe6f0e10a..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/filter.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDAnyAttributedis.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDAnyAttributedis.gif
deleted file mode 100644
index 2440a24c26..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDAnyAttributedis.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDAnydis.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDAnydis.gif
deleted file mode 100644
index 44da7510b0..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDAnydis.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDAttributeGroup.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDAttributeGroup.gif
deleted file mode 100644
index 5a8df73015..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDAttributeGroup.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDAttributeGroupRef.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDAttributeGroupRef.gif
deleted file mode 100644
index b2c1db9ef4..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDAttributeGroupRef.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDAttributeGroupRefdis.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDAttributeGroupRefdis.gif
deleted file mode 100644
index 79dc58fe6c..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDAttributeGroupRefdis.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDAttributeGroupdis.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDAttributeGroupdis.gif
deleted file mode 100644
index 1e81677a91..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDAttributeGroupdis.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDAttributeRefdis.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDAttributeRefdis.gif
deleted file mode 100644
index f80af50633..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDAttributeRefdis.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDAttributedis.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDAttributedis.gif
deleted file mode 100644
index 121d192343..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDAttributedis.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDComplexContent.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDComplexContent.gif
deleted file mode 100644
index b90c12e78d..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDComplexContent.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDComplexType.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDComplexType.gif
deleted file mode 100644
index 878b94f132..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDComplexType.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDComplexTypedis.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDComplexTypedis.gif
deleted file mode 100644
index 36d1b3e560..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDComplexTypedis.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDElementRefdis.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDElementRefdis.gif
deleted file mode 100644
index 40bd3aa68e..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDElementRefdis.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDElementdis.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDElementdis.gif
deleted file mode 100644
index 7b56868c26..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDElementdis.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDGroup.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDGroup.gif
deleted file mode 100644
index 462c2d4aa5..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDGroup.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDGroupRef.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDGroupRef.gif
deleted file mode 100644
index 068987bf0b..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDGroupRef.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDGroupRefdis.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDGroupRefdis.gif
deleted file mode 100644
index e217e9b228..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDGroupRefdis.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDGroupdis.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDGroupdis.gif
deleted file mode 100644
index 98df7f416e..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDGroupdis.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDSimpleContent.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDSimpleContent.gif
deleted file mode 100644
index 2ae812cefb..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/XSDSimpleContent.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/all_obj.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/all_obj.gif
deleted file mode 100644
index da37fbad3e..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/all_obj.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/alldis_obj.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/alldis_obj.gif
deleted file mode 100644
index 6f5484c764..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/alldis_obj.gif
+++ /dev/null
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
deleted file mode 100644
index 9bfb682d28..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/annotationsheader.gif
+++ /dev/null
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
deleted file mode 100644
index 78092ff114..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/attributegroupsheader.gif
+++ /dev/null
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
deleted file mode 100644
index 9254879842..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/attributesheader.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/choice_obj.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/choice_obj.gif
deleted file mode 100644
index 8af583f4bd..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/choice_obj.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/choicedis_obj.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/choicedis_obj.gif
deleted file mode 100644
index 7ecc4ff4b9..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/choicedis_obj.gif
+++ /dev/null
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
deleted file mode 100644
index 6000cb80f4..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/directivesheader.gif
+++ /dev/null
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
deleted file mode 100644
index 26f720648d..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/elementsheader.gif
+++ /dev/null
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
deleted file mode 100644
index 61e1e258d7..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/error_marker.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/error_tsk.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/error_tsk.gif
deleted file mode 100644
index 9b048d6053..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/error_tsk.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/extnsn_obj.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/extnsn_obj.gif
deleted file mode 100644
index c24a95fba3..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/extnsn_obj.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/extnsndis_obj.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/extnsndis_obj.gif
deleted file mode 100644
index 843cd0e11c..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/extnsndis_obj.gif
+++ /dev/null
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
deleted file mode 100644
index 7ca11cd95c..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/groupsheader.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/index.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/index.gif
deleted file mode 100644
index 5bf9ac077e..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/index.gif
+++ /dev/null
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
deleted file mode 100644
index e05c6455ea..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/notationsheader.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/sequence_obj.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/sequence_obj.gif
deleted file mode 100644
index 16b8612332..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/sequence_obj.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/sequencedis_obj.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/sequencedis_obj.gif
deleted file mode 100644
index fd972de440..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/sequencedis_obj.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/simpletype_obj.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/simpletype_obj.gif
deleted file mode 100644
index 2e74430cc2..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/simpletype_obj.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/simpletypedis_obj.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/simpletypedis_obj.gif
deleted file mode 100644
index 320973eedd..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/simpletypedis_obj.gif
+++ /dev/null
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
deleted file mode 100644
index 0b518c602b..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/smpl_list_obj.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/smpl_listdis_obj.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/smpl_listdis_obj.gif
deleted file mode 100644
index b83825cd0a..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/smpl_listdis_obj.gif
+++ /dev/null
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
deleted file mode 100644
index d6a9afd1b8..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/smpl_restrict_obj.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/smpl_restrictdis_obj.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/smpl_restrictdis_obj.gif
deleted file mode 100644
index 2b67663dfd..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/smpl_restrictdis_obj.gif
+++ /dev/null
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
deleted file mode 100644
index 6613149c90..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/smpl_union_obj.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/smpl_uniondis_obj.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/smpl_uniondis_obj.gif
deleted file mode 100644
index 717203b3d3..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/smpl_uniondis_obj.gif
+++ /dev/null
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
deleted file mode 100644
index 3267542eac..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/typesheader.gif
+++ /dev/null
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
deleted file mode 100644
index 1931f929b2..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/ovr16/attributeoverlay.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/ovr16/error_ovr.gif b/bundles/org.eclipse.wst.xsd.ui/icons/ovr16/error_ovr.gif
deleted file mode 100644
index 119dcccd5a..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/ovr16/error_ovr.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/ovr16/extnsn_ovr.gif b/bundles/org.eclipse.wst.xsd.ui/icons/ovr16/extnsn_ovr.gif
deleted file mode 100644
index f34420bc3a..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/ovr16/extnsn_ovr.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/ovr16/extnsndis_ovr.gif b/bundles/org.eclipse.wst.xsd.ui/icons/ovr16/extnsndis_ovr.gif
deleted file mode 100644
index 94eb76820b..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/ovr16/extnsndis_ovr.gif
+++ /dev/null
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
deleted file mode 100644
index d455c2b53f..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/ovr16/textoverlay.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/plugin.properties b/bundles/org.eclipse.wst.xsd.ui/plugin.properties
deleted file mode 100644
index f4c5b827ef..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/plugin.properties
+++ /dev/null
@@ -1,850 +0,0 @@
-###############################################################################
-# Copyright (c) 2001, 2011 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.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_XML_SCHEMA_EDITOR_PREFERENCE = Editor
-_UI_XML_SCHEMA_VALIDATOR_PREFERENCE = Validation
-
-_UI_WIZARD_NEW_XSD = XML Schema File
-_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_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.
-
-!
-! 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_LABEL_OTHER_ATTRIBUTES = Other Attributes
-
-_UI_TOOLTIP_ATTRIBUTE_USE = Indicates if the attribute is required, optional, or prohibited
-_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 = O&ptional
-_UI_REGEX_WIZARD_QUANTIFIER_REPEAT = &Repeat
-_UI_REGEX_WIZARD_QUANTIFIER_RANGE = Ran&ge
-
-!
-! 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 = Select a 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_INCLUDE_CHANGE = Include Change
-
-_UI_LABEL_ITEM_TYPE = Item 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
-
-!
-!======================================================================================
-! 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 = Does not exist.
-_ERROR_LABEL_INVALID_PREFIX = 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 = {0} is the current schema. A schema cannot include itself. Reset to the last valid schema.
-
-_ERROR_XSD_GENERATION = Error generating XML schema
-_ERROR_NO_CONTAINER = No folder selected
-_ERROR_NO_FILE_NAME = No file name provided
-_ERROR_FILENAME_MUST_END_XSD = The file name must end in .xsd
-
-
-!
-! For schema that has too many errors, an extended message.
-!
-_ERROR_DIALOG_XML_SCHEMA_INVALID_TEXT = 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 = 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 = Cannot open XML Schema editor
-
-_ERROR_LABEL_PREFIX_EXISTS = Prefix already exists
-
-_ERROR_REMOVE_LOCAL_SIMPLETYPE = Remove local simple type from extension
-
-_WARN_INVALID_TARGET_NAMESPACE = The target namespace is not well-formed
-
-_ERROR_TARGET_NAMESPACE_AND_PREFIX = 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=Refac&tor
-refactoringActionSet.description=XSD Editor refactoring actions
-refactoring.menu.label=Refac&tor
-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
-command.xsd.refactor.renameTargetNamespace.name=Rename Target Namespace
-command.xsd.refactor.renameTargetNamespace.description=Changes the target namespace of the schema
-xsd.resource.rename.participant.name=Rename XSD Component
-ExtensionsSchemasDescription=This extension point is deprecated, use extensionCategories
-ExtensionCategoriesDescription=Extension point for contributing to the 'built in' categories of extension elements for XML Schema
-XSDEditorExtensionConfiguration=This extension point is deprecated, use internalEditorConfiguration
-InternalEditorConfiguration=Extension point for extending the XML Schema Editor
-
-! 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
-
-AddTask.label=Add &Task...
-AddTask.tooltip=Add Task...
-AddBookmark.label=Add Boo&kmark...
-AddBookmark.tooltip=Add Bookmark...
-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 Web Tools Platform
-search.declarations.label = Declarations
-search.references.label = Re&ferences
-
-! extension points
-ExtensionNodeCustomizationsDescription = Extension Node Customizations
-XMLSchemaEditorModes = XML Schema Editor Modes
-##
-XSD_Source_target_name=XML Schema Source
-XSD_hyperlink=XML Schema Content
-
-
-XSD_DESIGN_VIEW_DESCRIPTION=XSD Editor Design View
-XSD_DESIGN_VIEW=XSD Editor Design View
-XSD_SOURCE_VIEW_DESCRIPTION=XSD Editor Source View
-XSD_SOURCE_VIEW=XSD Editor Source View \ 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
deleted file mode 100644
index 94f21e3800..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/plugin.xml
+++ /dev/null
@@ -1,695 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin>
-
- <extension point="org.eclipse.ui.editors">
- <editor
- name="%_UI_EDITOR_NAME"
- icon="icons/XSDFile.gif"
- contributorClass="org.eclipse.wst.xsd.ui.internal.editor.XSDMultiPageEditorContributor"
- class="org.eclipse.wst.xsd.ui.internal.editor.InternalXSDMultiPageEditor"
- id="org.eclipse.wst.xsd.ui.internal.editor.InternalXSDMultiPageEditor">
- <contentTypeBinding
- contentTypeId="org.eclipse.wst.xsd.core.xsdsource" />
- </editor>
- </extension>
-
- <extension point="org.eclipse.ui.editorActions">
- <editorContribution
- targetID="org.eclipse.wst.xsd.ui.internal.editor.InternalXSDMultiPageEditor"
- 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/ctool16/NewXSD.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.xml.ui.preferences.xml"
- class="org.eclipse.wst.xsd.ui.internal.preferences.XSDPreferencePage"
- id="org.eclipse.wst.xsd.ui.internal.preferences.XSDPreferencePage">
- </page>
- <page
- category="org.eclipse.wst.xsd.ui.internal.preferences.XSDPreferencePage"
- class="org.eclipse.wst.xsd.ui.internal.preferences.XSDEditorPreferencePage"
- id="org.eclipse.wst.xsd.ui.internal.preferences.XSDEditorPreferencePage"
- name="%_UI_XML_SCHEMA_EDITOR_PREFERENCE">
- </page>
- <page
- category="org.eclipse.wst.xsd.ui.internal.preferences.XSDPreferencePage"
- class="org.eclipse.wst.xsd.ui.internal.preferences.XSDValidatorPreferencePage"
- id="org.eclipse.wst.xsd.ui.internal.preferences.XSDValidatorPreferencePage"
- name="%_UI_XML_SCHEMA_VALIDATOR_PREFERENCE">
- </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.core.xsdsource" />
- <sourceViewerConfiguration
- class="org.eclipse.wst.xsd.ui.internal.editor.StructuredTextViewerConfigurationXSD"
- 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.ui.internal.editor"
- labelProvider="org.eclipse.wst.xsd.ui.internal.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.ui.internal.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_ADVANCED"
- category="Advanced"
- afterTab="property.tab.general"
- id="property.tab.advanced">
- </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.ui.internal.editor">
- <propertySection tab="property.tab.general"
- class="org.eclipse.wst.xsd.ui.internal.common.properties.sections.XSDSchemaSection"
- id="prop.section.XSDSchemaSection">
- <input type="org.eclipse.xsd.XSDSchema">
- </input>
- </propertySection>
- <propertySection tab="property.tab.advanced"
- class="org.eclipse.wst.xsd.ui.internal.common.properties.sections.XSDSchemaAdvancedSection"
- id="prop.section.XSDSchemaSection">
- <input type="org.eclipse.xsd.XSDSchema">
- </input>
- </propertySection>
- <propertySection tab="property.tab.general"
- class="org.eclipse.wst.xsd.ui.internal.common.properties.sections.SchemaLocationSection"
- id="prop.section.SchemaLocationSection">
- <input type="org.eclipse.xsd.XSDSchemaCompositor">
- </input>
- </propertySection>
- <propertySection tab="property.tab.general"
- class="org.eclipse.wst.xsd.ui.internal.common.properties.sections.XSDComplexTypeSection"
- id="prop.section.XSDComplexTypeSection">
- <input type="org.eclipse.xsd.XSDComplexTypeDefinition">
- </input>
- </propertySection>
- <propertySection tab="property.tab.advanced"
- class="org.eclipse.wst.xsd.ui.internal.common.properties.sections.XSDComplexTypeAdvancedSection"
- id="prop.section.XSDComplexTypeAdvancedSection">
- <input type="org.eclipse.xsd.XSDComplexTypeDefinition">
- </input>
- </propertySection>
- <propertySection tab="property.tab.general"
- class="org.eclipse.wst.xsd.ui.internal.common.properties.sections.XSDElementDeclarationSection"
- id="prop.section.XSDElementDeclarationSection">
- <input type="org.eclipse.xsd.XSDElementDeclaration">
- </input>
- </propertySection>
- <propertySection tab="property.tab.advanced"
- class="org.eclipse.wst.xsd.ui.internal.common.properties.sections.XSDElementDeclarationAdvancedSection"
- id="prop.section.XSDElementDeclarationAdvancedSection">
- <input type="org.eclipse.xsd.XSDElementDeclaration">
- </input>
- </propertySection>
- <propertySection tab="property.tab.general"
- class="org.eclipse.wst.xsd.ui.internal.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.internal.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.internal.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.internal.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.internal.common.properties.sections.XSDSimpleTypeSection"
- id="prop.section.XSDSimpleTypeSection">
- <input type="org.eclipse.xsd.XSDSimpleTypeDefinition">
- </input>
- </propertySection>
- <propertySection tab="property.tab.advanced"
- class="org.eclipse.wst.xsd.ui.internal.common.properties.sections.XSDSimpleTypeAdvancedSection"
- id="prop.section.XSDSimpleTypeAdvancedSection">
- <input type="org.eclipse.xsd.XSDSimpleTypeDefinition">
- </input>
- </propertySection>
- <propertySection tab="property.tab.typeconstraints"
- class="org.eclipse.wst.xsd.ui.internal.common.properties.sections.XSDFacetSection"
- filter="org.eclipse.wst.xsd.ui.internal.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.internal.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.internal.common.properties.sections.ExtensionsSection"
- id="prop.section.ExtensionsSection">
- <input type="org.eclipse.xsd.XSDConcreteComponent">
- </input>
- </propertySection>
- <propertySection tab="property.tab.general"
- class="org.eclipse.wst.xsd.ui.internal.common.properties.sections.XSDAnyElementContentsSection"
- id="prop.section.general">
- <input type="org.eclipse.xsd.XSDWildcard">
- </input>
- </propertySection>
- <propertySection tab="property.tab.general"
- class="org.eclipse.wst.xsd.ui.internal.common.properties.sections.XSDImportSection"
- id="prop.section.general">
- <input type="org.eclipse.xsd.XSDImport">
- </input>
- </propertySection>
- <propertySection tab="property.tab.general"
- class="org.eclipse.wst.xsd.ui.internal.common.properties.sections.XSDEnumerationFacetSection"
- id="prop.section.general">
- <input type="org.eclipse.xsd.XSDEnumerationFacet">
- </input>
- </propertySection>
- </propertySections>
-</extension>
-
- <!-- this extension point is deprecated, use extensionCategories -->
- <extension-point id="ExtensionsSchemasDescription" name="%ExtensionsSchemasDescription"/>
- <extension-point id="extensionCategories" name="%ExtensionCategoriesDescription"/>
-
- <!-- this extension point is deprecated, use internalEditorConfiguration -->
- <extension-point id="XSDEditorExtensionConfiguration" name="%XSDEditorExtensionConfiguration"/>
- <extension-point id="internalEditorConfiguration" name="%InternalEditorConfiguration"/>
-
- <extension-point id="extensibilityNodeCustomizations" name="%ExtensionNodeCustomizationsDescription"/>
- <extension-point id="editorModes" name="%XMLSchemaEditorModes"/>
-
- <!-- 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>
-
- <!-- ============================================================================== -->
- <!-- 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.ui.internal.adapters.XSDBaseAdapter">
- <!--
- cs : declaration search isn't fully implemented yet, removing this menu action for now
- <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>
-
- </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>
- <extension
- point="org.eclipse.ui.workbench.texteditor.hyperlinkDetectorTargets">
- <target
- id="org.eclipse.wst.xsd.core.xsdsource"
- name="%XSD_Source_target_name">
- </target>
- </extension>
- <extension
- point="org.eclipse.ui.workbench.texteditor.hyperlinkDetectors">
- <hyperlinkDetector
- class="org.eclipse.wst.xsd.ui.internal.editor.XSDHyperlinkDetector"
- id="org.eclipse.wst.xsd.ui.internal.editor.XSDHyperlinkDetector"
- name="%XSD_hyperlink"
- targetId="org.eclipse.wst.xsd.core.xsdsource">
- </hyperlinkDetector>
- </extension>
-
- <extension point="org.eclipse.ui.menus">
- <menuContribution locationURI="toolbar:org.eclipse.wst.xml.ui.perspective.NewFileToolBar">
- <command
- commandId="org.eclipse.ui.newWizard"
- icon="icons/ctool16/NewXSD.gif"
- id="org.eclipse.wst.xsd.ui.newXSDFile"
- style="push"
- tooltip="%_UI_NEW_XML_SCHEMA_TITLE">
- <parameter name="newWizardId" value="org.eclipse.wst.xsd.ui.internal.wizards.NewXSDWizard"/>
- <visibleWhen checkEnabled="false">
- <with variable="activeWorkbenchWindow.activePerspective">
- <equals value="org.eclipse.wst.xml.ui.perspective"/>
- </with>
- </visibleWhen>
- </command>
- </menuContribution>
- <menuContribution locationURI="popup:refactorPopupMenuId">
- <command
- commandId="org.eclipse.wst.xsd.ui.refactor.rename.element"
- label="%refactoring.renameAction.label">
- <visibleWhen
- checkEnabled="false">
- <reference
- definitionId="org.eclipse.wst.xsd.ui.editor.active.sourceView.definition">
- </reference>
- </visibleWhen>
- </command>
- </menuContribution>
- <menuContribution
- locationURI="popup:org.eclipse.wst.xsd.ui.refactorMenuId">
- <command
- commandId="org.eclipse.wst.xsd.ui.refactor.rename.element"
- label="%refactoring.renameAction.label">
- <visibleWhen
- checkEnabled="false">
- </visibleWhen>
- </command>
- </menuContribution>
- <menuContribution
- locationURI="menu:refactorMenuId">
- <command
- commandId="org.eclipse.wst.xsd.ui.refactor.rename.element"
- label="%refactoring.renameAction.label">
- <visibleWhen
- checkEnabled="false">
- <or>
- <reference
- definitionId="org.eclipse.wst.xsd.ui.editor.active.designView.definition">
- </reference>
- <reference
- definitionId="org.eclipse.wst.xsd.ui.editor.active.sourceView.definition">
- </reference>
- </or>
- </visibleWhen>
-
- </command>
- </menuContribution>
- <menuContribution locationURI="popup:refactorPopupMenuId">
- <command
- commandId="org.eclipse.wst.xsd.ui.refactor.makeElementGlobal"
- label="%command.xsd.refactor.makeElementGlobal.element.name">
- <visibleWhen
- checkEnabled="false">
- <reference
- definitionId="org.eclipse.wst.xsd.ui.editor.active.sourceView.definition">
- </reference>
- </visibleWhen>
- </command>
- </menuContribution>
- <menuContribution
- locationURI="popup:org.eclipse.wst.xsd.ui.refactorMenuId">
- <command
- commandId="org.eclipse.wst.xsd.ui.refactor.makeElementGlobal"
- label="%command.xsd.refactor.makeElementGlobal.element.name">
- <visibleWhen
- checkEnabled="false">
- </visibleWhen>
- </command>
- </menuContribution>
- <menuContribution
- locationURI="menu:refactorMenuId">
- <command
- commandId="org.eclipse.wst.xsd.ui.refactor.makeElementGlobal"
- label="%command.xsd.refactor.makeElementGlobal.element.name">
- <visibleWhen
- checkEnabled="false">
- <or>
- <reference
- definitionId="org.eclipse.wst.xsd.ui.editor.active.designView.definition">
- </reference>
- <reference
- definitionId="org.eclipse.wst.xsd.ui.editor.active.sourceView.definition">
- </reference>
- </or>
- </visibleWhen>
-
- </command>
- </menuContribution>
- <menuContribution locationURI="popup:refactorPopupMenuId">
- <command
- commandId="org.eclipse.wst.xsd.ui.refactor.makeTypeGlobal"
- label="%command.xsd.refactor.makeTypeGlobal.element.name">
- <visibleWhen
- checkEnabled="false">
- <reference
- definitionId="org.eclipse.wst.xsd.ui.editor.active.sourceView.definition">
- </reference>
- </visibleWhen>
- </command>
- </menuContribution>
- <menuContribution
- locationURI="popup:org.eclipse.wst.xsd.ui.refactorMenuId">
- <command
- commandId="org.eclipse.wst.xsd.ui.refactor.makeTypeGlobal"
- label="%command.xsd.refactor.makeTypeGlobal.element.name">
- <visibleWhen
- checkEnabled="false">
- </visibleWhen>
- </command>
- </menuContribution>
- <menuContribution
- locationURI="menu:refactorMenuId">
- <command
- commandId="org.eclipse.wst.xsd.ui.refactor.makeTypeGlobal"
- label="%command.xsd.refactor.makeTypeGlobal.element.name">
- <visibleWhen
- checkEnabled="false">
- <or>
- <reference
- definitionId="org.eclipse.wst.xsd.ui.editor.active.designView.definition">
- </reference>
- <reference
- definitionId="org.eclipse.wst.xsd.ui.editor.active.sourceView.definition">
- </reference>
- </or>
- </visibleWhen>
-
- </command>
- </menuContribution>
- </extension>
-
- <extension point="org.eclipse.ui.navigator.navigatorContent">
- <commonWizard type="new" wizardId="org.eclipse.wst.xsd.ui.internal.wizards.NewXSDWizard" menuGroupId="org.eclipse.wst.xml.new.menuGroup">
- <enablement>
- <instanceof value="org.eclipse.core.resources.IResource"/>
- <with variable="activeWorkbenchWindow.activePerspective">
- <equals value="org.eclipse.wst.xml.ui.perspective"/>
- </with>
- </enablement>
- </commonWizard>
- </extension>
- <extension
- point="org.eclipse.ui.handlers">
- <handler
- class="org.eclipse.wst.xsd.ui.internal.refactor.handlers.RenameHandler"
- commandId="org.eclipse.wst.xsd.ui.refactor.rename.element">
- <enabledWhen>
- <with
- variable="selection">
- <test
- property="org.eclipse.wst.xsd.ui.refactor.renameEnabled">
- </test>
-
- </with>
- </enabledWhen>
- </handler>
- <handler
- class="org.eclipse.wst.xsd.ui.internal.refactor.handlers.MakeLocalElementGlobalHandler"
- commandId="org.eclipse.wst.xsd.ui.refactor.makeElementGlobal">
- <enabledWhen>
- <with
- variable="selection">
- <test
- property="org.eclipse.wst.xsd.ui.refactor.makeLocalElementGlobalEnabled">
- </test>
-
- </with>
- </enabledWhen>
- </handler>
- <handler
- class="org.eclipse.wst.xsd.ui.internal.refactor.handlers.MakeAnonymousTypeGobalHandler"
- commandId="org.eclipse.wst.xsd.ui.refactor.makeTypeGlobal">
- <enabledWhen>
- <with
- variable="selection">
- <test
- property="org.eclipse.wst.xsd.ui.refactor.makeAnonymousTypeGlobalEnabled">
- </test>
-
- </with>
- </enabledWhen>
- </handler>
- </extension>
- <extension
- point="org.eclipse.core.expressions.propertyTesters">
- <propertyTester
- class="org.eclipse.wst.xsd.ui.internal.refactor.RenameEnablementTester"
- id="org.eclipse.wst.xsd.ui.refactor.rename.enablement"
- namespace="org.eclipse.wst.xsd.ui.refactor"
- properties="renameEnabled"
- type="org.eclipse.jface.viewers.ISelection">
- </propertyTester>
- <propertyTester
- class="org.eclipse.wst.xsd.ui.internal.refactor.MakeLocalElementGlobalEnablementTester"
- id="org.eclipse.wst.xsd.ui.refactor.makeLocalElementGlobalEnabled"
- namespace="org.eclipse.wst.xsd.ui.refactor"
- properties="makeLocalElementGlobalEnabled"
- type="org.eclipse.jface.viewers.ISelection">
- </propertyTester>
- <propertyTester
- class="org.eclipse.wst.xsd.ui.internal.refactor.MakeAnonymousTypsGlobalEnablementTester"
- id="org.eclipse.wst.xsd.ui.refactor.makeAnonymousTypeGlobalEnabled"
- namespace="org.eclipse.wst.xsd.ui.refactor"
- properties="makeAnonymousTypeGlobalEnabled"
- type="org.eclipse.jface.viewers.ISelection">
- </propertyTester>
-
- </extension>
- <extension
- point="org.eclipse.ui.contexts">
- <context
- description="%XSD_DESIGN_VIEW_DESCRIPTION"
- id="org.eclipse.wst.xsd.ui.editor.designView"
- name="%XSD_DESIGN_VIEW">
- </context>
- <context
- description="%XSD_SOURCE_VIEW_DESCRIPTION"
- id="org.eclipse.wst.xsd.ui.editor.sourceView"
- name="%XSD_SOURCE_VIEW">
- </context>
- </extension>
- <extension
- point="org.eclipse.core.expressions.definitions">
- <definition
- id="org.eclipse.wst.xsd.ui.editor.active.designView.definition">
- <with
- variable="activeContexts">
- <iterate
- operator="or">
- <equals
- value="org.eclipse.wst.xsd.ui.editor.designView">
- </equals>
- </iterate>
- </with>
- </definition>
- <definition
- id="org.eclipse.wst.xsd.ui.editor.active.sourceView.definition">
- <with
- variable="activeContexts">
- <iterate
- operator="or">
- <equals
- value="org.eclipse.wst.xsd.ui.editor.sourceView">
- </equals>
- </iterate>
- </with>
- </definition>
- </extension>
-
-</plugin>
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/TypeVizEditorMode.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/TypeVizEditorMode.java
deleted file mode 100644
index c48d12bdcc..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/TypeVizEditorMode.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * 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.internal.adt.typeviz;
-
-import org.eclipse.gef.EditPartFactory;
-import org.eclipse.jface.viewers.IContentProvider;
-import org.eclipse.wst.xsd.ui.internal.adt.editor.EditorMode;
-import org.eclipse.wst.xsd.ui.internal.adt.outline.ADTContentOutlineProvider;
-import org.eclipse.wst.xsd.ui.internal.adt.typeviz.design.figures.TypeVizFigureFactory;
-import org.eclipse.wst.xsd.ui.internal.design.editparts.XSDEditPartFactory;
-
-public class TypeVizEditorMode extends EditorMode
-{
- private EditPartFactory editPartFactory;
- public final static String ID = "org.eclipse.wst.xsd.ui.typeviz";
-
- public Object getAdapter(Class adapter)
- {
- return null;
- }
-
- public String getDisplayName()
- {
- return "Advanced";
- }
-
- public EditPartFactory getEditPartFactory()
- {
- if (editPartFactory == null)
- {
- editPartFactory = new XSDEditPartFactory(new TypeVizFigureFactory());
- }
- return editPartFactory;
- }
-
- public String getId()
- {
- return ID;
- }
-
- public IContentProvider getOutlineProvider()
- {
- return new ADTContentOutlineProvider();
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/figures/BoxFigure.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/figures/BoxFigure.java
deleted file mode 100644
index 95a904d0ad..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/figures/BoxFigure.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.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.swt.widgets.Display;
-import org.eclipse.wst.xsd.ui.internal.adt.typeviz.design.layouts.ColumnData;
-
-public class BoxFigure extends Figure
-{
- protected ColumnData columnData = new ColumnData();
- public HeadingFigure headingFigure;
- protected Figure contentPane;
-
- public boolean isSelected = false;
-
- public BoxFigure()
- {
- super();
-
- boolean highContrast = false;
- try
- {
- highContrast = Display.getDefault().getHighContrast();
- }
- catch (Exception e)
- {
- }
- if (!highContrast)
- {
- setBackgroundColor(ColorConstants.white);
- }
-
- headingFigure = new HeadingFigure();
- add(headingFigure);
-
- contentPane = new Figure()
- {
- public void paint(Graphics graphics)
- {
- graphics.fillRectangle(getBounds());
- 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/ui/internal/adt/typeviz/design/figures/CompartmentFigure.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/figures/CompartmentFigure.java
deleted file mode 100644
index a019ada90e..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/figures/CompartmentFigure.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*******************************************************************************
- * 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.internal.adt.typeviz.design.figures;
-
-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.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.ui.internal.adt.design.DesignViewerGraphicConstants;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.StructureEditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.design.figures.ICompartmentFigure;
-import org.eclipse.wst.xsd.ui.internal.adt.design.figures.IStructureFigure;
-import org.eclipse.wst.xsd.ui.internal.adt.typeviz.design.layouts.RowLayout;
-import org.eclipse.wst.xsd.ui.internal.design.figures.GenericGroupFigure;
-
-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() {
-
- public void paint(Graphics graphics)
- {
- super.paint(graphics);
- try
- {
- graphics.pushState();
- graphics.setForegroundColor(ColorConstants.blue);
- graphics.setFont(DesignViewerGraphicConstants.smallFont);
- List children = getChildren();
- for (Iterator i = children.iterator(); i.hasNext(); )
- {
- Figure object = (Figure)i.next();
- traverse(object, graphics);
- }
- }
- finally
- {
- graphics.popState();
- }
- }
-
- private void traverse(Figure figure, Graphics graphics)
- {
- List children = figure.getChildren();
- for (Iterator i = children.iterator(); i.hasNext(); )
- {
- Figure object = (Figure)i.next();
-
- if (object instanceof GenericGroupFigure)
- {
- GenericGroupFigure fig = (GenericGroupFigure) object;
- if (fig.hasText())
- graphics.drawText(fig.getText(), fig.getTextCoordinates());
- }
- traverse(object, graphics);
- }
-
- }
-
- };
- 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/ui/internal/adt/typeviz/design/figures/FieldFigure.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/figures/FieldFigure.java
deleted file mode 100644
index c1d87cc6a0..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/figures/FieldFigure.java
+++ /dev/null
@@ -1,312 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.adt.typeviz.design.figures;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.draw2d.Figure;
-import org.eclipse.draw2d.Graphics;
-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.draw2d.geometry.Rectangle;
-import org.eclipse.gef.EditPart;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.StructureEditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.design.figures.IFieldFigure;
-import org.eclipse.wst.xsd.ui.internal.adt.design.figures.IStructureFigure;
-import org.eclipse.wst.xsd.ui.internal.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);
-
-// For fix to https://bugs.eclipse.org/bugs/show_bug.cgi?id=161940
-// public static final Color leftOuterBorderColor = new Color(null, 253, 196, 88);
-// public static final Color leftInnerBorderColor = new Color(null, 253, 226, 172);
-// public static final Color rightOuterBorderColor = new Color(null, 150, 179, 224);
-// public static final Color rightInnerBorderColor = new Color(null, 49, 106, 197);
-
- // 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 boolean hasFocus = false;
-
- public FieldFigure()
- {
- super();
- setLayoutManager(new ToolbarLayout());
- rowFigure = new Figure();
- 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();
-// Don't show tooltip for now. Annoying vertical line shows up. Safe fix.
-// 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);
-// Don't show tooltip for now. Annoying vertical line shows up. Safe fix.
-// 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()
- {
- boolean highContrast = false;
- try
- {
- highContrast = Display.getDefault().getHighContrast();
- }
- catch (Exception e)
- {
- }
- if (highContrast)
- {
- rowFigure.setForegroundColor(Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
- rowFigure.setBackgroundColor(Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND));
- }
- else
- {
- rowFigure.setBackgroundColor(cellColor);
- }
- }
-
- public void removeSelectionFeedback()
- {
- boolean highContrast = false;
- try
- {
- highContrast = Display.getDefault().getHighContrast();
- }
- catch (Exception e)
- {
- }
- if (highContrast)
- {
- rowFigure.setForegroundColor(Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND));
- rowFigure.setBackgroundColor(Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
- }
- else
- {
- rowFigure.setBackgroundColor(getBackgroundColor());
- }
- }
-
- public void refreshVisuals(Object model)
- {
- }
-
- public void paint(Graphics graphics)
- {
- super.paint(graphics);
- if (hasFocus)
- {
- try
- {
- graphics.pushState();
- Rectangle r = getBounds();
- graphics.setXORMode(true);
- graphics.drawFocus(r.x, r.y + 1, r.width - 1, r.height - 2);
- }
- finally
- {
- graphics.popState();
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/figures/HeadingFigure.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/figures/HeadingFigure.java
deleted file mode 100644
index 6c275d68b3..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/figures/HeadingFigure.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*******************************************************************************
- * 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.internal.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/ui/internal/adt/typeviz/design/figures/RoundedLineBorder.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/figures/RoundedLineBorder.java
deleted file mode 100644
index 93e80f1bee..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/figures/RoundedLineBorder.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * 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.internal.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/ui/internal/adt/typeviz/design/figures/StructureFigure.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/figures/StructureFigure.java
deleted file mode 100644
index 990f64b8ea..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/figures/StructureFigure.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * 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.internal.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.ui.internal.adt.design.figures.IStructureFigure;
-import org.eclipse.wst.xsd.ui.internal.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());
- getHeadingFigure().setIsReadOnly(structure.isReadOnly());
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/figures/TypeVizFigureFactory.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/figures/TypeVizFigureFactory.java
deleted file mode 100644
index 08260fb34f..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/figures/TypeVizFigureFactory.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * 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.internal.adt.typeviz.design.figures;
-
-import org.eclipse.draw2d.LineBorder;
-import org.eclipse.draw2d.MarginBorder;
-import org.eclipse.draw2d.ToolbarLayout;
-import org.eclipse.wst.xsd.ui.internal.adt.design.figures.ICompartmentFigure;
-import org.eclipse.wst.xsd.ui.internal.adt.design.figures.IFieldFigure;
-import org.eclipse.wst.xsd.ui.internal.adt.design.figures.IStructureFigure;
-import org.eclipse.wst.xsd.ui.internal.adt.outline.ITreeElement;
-import org.eclipse.wst.xsd.ui.internal.design.figures.IExtendedFigureFactory;
-import org.eclipse.wst.xsd.ui.internal.design.figures.IModelGroupFigure;
-import org.eclipse.wst.xsd.ui.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/ui/internal/adt/typeviz/design/layouts/ColumnData.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/layouts/ColumnData.java
deleted file mode 100644
index 58e9dab1ee..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/layouts/ColumnData.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * 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.internal.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/ui/internal/adt/typeviz/design/layouts/RowLayout.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/layouts/RowLayout.java
deleted file mode 100644
index fc9067779f..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd-typeviz/org/eclipse/wst/xsd/ui/internal/adt/typeviz/design/layouts/RowLayout.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*******************************************************************************
- * 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.internal.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);
- 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);
- }
- r.width = Math.max(childSize.width, columnWidth);
- requiredWidth += r.width;
- bounds[i] = new Rectangle(r);
- r.x += r.width;
- }
- if (totalColumnWeight < 1)
- {
- totalColumnWeight = 1;
- }
- int extraWidth = Math.max(clientArea.width - requiredWidth, 0);
- 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);
-
- 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();
-
- }
-}
-
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
deleted file mode 100644
index 15f3b73146..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/actions/CreateElementAction.java
+++ /dev/null
@@ -1,360 +0,0 @@
-/*******************************************************************************
- * 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.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 = getDocument();
-
- doc.getModel().endRecording(this);
- }
-
- public Element createAndAddNewChildElement()
- {
- String prefix = parentNode.getPrefix();
- prefix = (prefix == null) ? "" : (prefix + ":"); //$NON-NLS-1$ //$NON-NLS-2$
- 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
- {
- parentNode.insertBefore(childNode,getRelativeNode());
- }
-
- if (isGlobal && getRelativeNode() == null)
- {
- Text textNode = getDocument().createTextNode("\n\n"); //$NON-NLS-1$
- parentNode.appendChild(textNode);
- }
- else if (isGlobal && getRelativeNode() != null)
- {
- Text textNode = getDocument().createTextNode("\n\n"); //$NON-NLS-1$
- 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(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
deleted file mode 100644
index 5c4f35a8ab..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/actions/DOMAttribute.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * 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.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/IXSDToolbarAction.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/actions/IXSDToolbarAction.java
deleted file mode 100644
index 52199f65e9..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/actions/IXSDToolbarAction.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*******************************************************************************
- * 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.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/ui/internal/actions/MoveXSDAttributeAction.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/actions/MoveXSDAttributeAction.java
deleted file mode 100644
index 069a2f77d5..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/actions/MoveXSDAttributeAction.java
+++ /dev/null
@@ -1,248 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.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.XSDConcreteComponent;
-import org.eclipse.xsd.XSDElementDeclaration;
-import org.w3c.dom.Node;
-
-public class MoveXSDAttributeAction extends MoveXSDBaseAction
-{
- private static int INSERT_BEFORE = 0;
- private static int INSERT_AFTER = 1;
- private static int INSERT_DIRECT = 2;
- protected List selectedNodes;
- protected Node parentNode;
- protected Node previousRefChild, nextRefChild;
- int insertType;
-
- XSDConcreteComponent parentComponent;
- XSDConcreteComponent selected, previousRefComponent, nextRefComponent;
- boolean insertAtEnd = true;
-
- public MoveXSDAttributeAction(XSDConcreteComponent parentComponent, XSDConcreteComponent selected, XSDConcreteComponent previousRefChildComponent, XSDConcreteComponent nextRefChildComponent)
- {
- super();
- this.parentComponent = parentComponent;
- this.selected = selected;
- this.previousRefComponent = previousRefChildComponent;
- this.nextRefComponent = nextRefChildComponent;
-
- if (parentComponent == null)
- return;
- parentNode = parentComponent.getElement();
- nextRefChild = nextRefChildComponent != null ? nextRefChildComponent.getElement() : null;
- previousRefChild = previousRefChildComponent != null ? previousRefChildComponent.getElement() : null;
-
- if (nextRefComponent != null)
- {
- if (nextRefComponent.getContainer().getContainer() == parentComponent)
- {
- insertType = INSERT_BEFORE;
- }
- }
- if (previousRefComponent != null)
- {
- if (previousRefComponent.getContainer().getContainer() == parentComponent)
- {
- insertType = INSERT_AFTER;
- }
- }
- if (nextRefChildComponent == null && previousRefChildComponent == null)
- {
- insertType = INSERT_DIRECT;
- }
- }
-
- public MoveXSDAttributeAction(XSDConcreteComponent parentComponent, XSDConcreteComponent selected, XSDConcreteComponent previousRefChildComponent, XSDConcreteComponent nextRefChildComponent, boolean insertAtEnd)
- {
- this(parentComponent, selected, previousRefChildComponent, nextRefChildComponent);
- this.insertAtEnd = insertAtEnd;
- }
-
- public boolean canMove()
- {
- boolean result = true;
-
- if (nextRefComponent instanceof XSDElementDeclaration || previousRefComponent instanceof XSDElementDeclaration || parentComponent == null)
- return false;
-
- return result;
- }
-
- /*
- * @see IAction#run()
- */
- public void run()
- {
- if (parentComponent instanceof XSDAttributeGroupDefinition)
- {
- moveUnderXSDAttributeGroupDefinition((XSDAttributeGroupDefinition) parentComponent);
- }
- else if (parentComponent instanceof XSDComplexTypeDefinition)
- {
- moveUnderXSDComplexTypeDefinition((XSDComplexTypeDefinition) parentComponent);
- }
- }
-
- protected void moveUnderXSDAttributeGroupDefinition(XSDAttributeGroupDefinition parentGroup)
- {
- int originalIndex = 0;
- for (Iterator iterator = parentGroup.getContents().iterator(); iterator.hasNext();)
- {
- XSDAttributeGroupContent attributeGroupContent = (XSDAttributeGroupContent) iterator.next();
- if (attributeGroupContent instanceof XSDAttributeUse)
- {
- XSDAttributeDeclaration attribute = ((XSDAttributeUse) attributeGroupContent).getContent();
- if (attribute == selected)
- {
- parentGroup.getContents().remove(attribute.getContainer());
- break;
- }
- }
- originalIndex++;
- }
- int index = 0;
- boolean addedBack = false;
- if (insertType == INSERT_DIRECT)
- {
- XSDConcreteComponent container = selected.getContainer();
- if (container != null)
- {
- if (insertAtEnd)
- ((XSDAttributeGroupDefinition) parentComponent).getResolvedAttributeGroupDefinition().getContents().add(container);
- else
- ((XSDAttributeGroupDefinition) parentComponent).getResolvedAttributeGroupDefinition().getContents().add(0, container);
- addedBack = true;
- }
- return;
- }
-
- List attributeGroupContents = parentGroup.getContents();
- for (Iterator iterator = attributeGroupContents.iterator(); iterator.hasNext();)
- {
- XSDAttributeGroupContent attributeGroupContent = (XSDAttributeGroupContent) iterator.next();
- if (attributeGroupContent instanceof XSDAttributeUse)
- {
- XSDAttributeDeclaration attribute = ((XSDAttributeUse) attributeGroupContent).getContent();
- if (insertType == INSERT_BEFORE)
- {
- if (attribute == nextRefComponent)
- {
- parentGroup.getContents().add(index, selected.getContainer());
- addedBack = true;
- break;
- }
- if (selected == nextRefComponent && originalIndex == index)
- {
- parentGroup.getContents().add(index, selected.getContainer());
- addedBack = true;
- break;
- }
- }
- else if (insertType == INSERT_AFTER)
- {
- if (attribute == previousRefComponent)
- {
- parentGroup.getContents().add(index + 1, selected.getContainer());
- addedBack = true;
- break;
- }
- if (selected == previousRefComponent && originalIndex == index)
- {
- parentGroup.getContents().add(index, selected.getContainer());
- addedBack = true;
- break;
- }
- }
- }
- index++;
- }
- if (attributeGroupContents.size() == 0)
- {
- parentGroup.getContents().add(selected.getContainer());
- addedBack = true;
- }
-
- if (!addedBack)
- {
- parentGroup.getContents().add(originalIndex, selected.getContainer());
- }
- }
-
- protected void moveUnderXSDComplexTypeDefinition(XSDComplexTypeDefinition complexType)
- {
- int originalIndex = 0;
- for (Iterator iterator = complexType.getAttributeContents().iterator(); iterator.hasNext();)
- {
- XSDAttributeGroupContent attributeGroupContent = (XSDAttributeGroupContent) iterator.next();
- if (attributeGroupContent instanceof XSDAttributeUse)
- {
- XSDAttributeDeclaration attribute = ((XSDAttributeUse) attributeGroupContent).getContent();
- if (attribute == selected)
- {
- complexType.getAttributeContents().remove(attribute.getContainer());
- break;
- }
- }
- originalIndex++;
- }
- int index = 0;
- boolean addedBack = false;
- List attributeGroupContents = complexType.getAttributeContents();
- for (Iterator iterator = attributeGroupContents.iterator(); iterator.hasNext();)
- {
- XSDAttributeGroupContent attributeGroupContent = (XSDAttributeGroupContent) iterator.next();
- if (attributeGroupContent instanceof XSDAttributeUse)
- {
- XSDAttributeDeclaration attribute = ((XSDAttributeUse) attributeGroupContent).getContent();
- if (insertType == INSERT_AFTER)
- {
- if (attribute == previousRefComponent)
- {
- complexType.getAttributeContents().add(index + 1, selected.getContainer());
- addedBack = true;
- break;
- }
- }
- else if (insertType == INSERT_BEFORE)
- {
- if (attribute == nextRefComponent)
- {
- complexType.getAttributeContents().add(index, selected.getContainer());
- addedBack = true;
- break;
- }
- }
- }
- index++;
- }
- if (attributeGroupContents.size() == 0)
- {
- complexType.getAttributeContents().add(selected.getContainer());
- addedBack = true;
- }
-
- if (!addedBack)
- {
- complexType.getAttributeContents().add(originalIndex, selected.getContainer());
- }
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/actions/MoveXSDBaseAction.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/actions/MoveXSDBaseAction.java
deleted file mode 100644
index c6d99065be..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/actions/MoveXSDBaseAction.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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 org.eclipse.jface.action.Action;
-
-public class MoveXSDBaseAction extends Action
-{
-
- public MoveXSDBaseAction()
- {
- super();
- }
-
- public boolean canMove()
- {
- return true;
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/actions/MoveXSDElementAction.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/actions/MoveXSDElementAction.java
deleted file mode 100644
index 7e73ff5e9f..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/actions/MoveXSDElementAction.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.Iterator;
-import java.util.List;
-
-import org.eclipse.xsd.XSDAttributeDeclaration;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDModelGroup;
-import org.eclipse.xsd.XSDParticle;
-import org.eclipse.xsd.XSDParticleContent;
-import org.w3c.dom.Node;
-
-public class MoveXSDElementAction extends MoveXSDBaseAction
-{
- private static int INSERT_BEFORE = 0;
- private static int INSERT_AFTER = 1;
- private static int INSERT_DIRECT = 2;
- protected List selectedNodes;
- protected Node parentNode;
- protected Node previousRefChild, nextRefChild;
- int insertType;
-
- XSDModelGroup parentModelGroup;
- XSDConcreteComponent selected, previousRefComponent, nextRefComponent;
- boolean insertAtEnd = true;
-
- public MoveXSDElementAction(XSDModelGroup parentComponent, XSDConcreteComponent selected, XSDConcreteComponent previousRefChildComponent, XSDConcreteComponent nextRefChildComponent)
- {
- super();
- this.parentModelGroup = parentComponent;
- this.selected = selected;
- this.previousRefComponent = previousRefChildComponent;
- this.nextRefComponent = nextRefChildComponent;
-
- if (parentComponent == null)
- return;
- parentNode = parentComponent.getElement();
- nextRefChild = nextRefChildComponent != null ? nextRefChildComponent.getElement() : null;
- previousRefChild = previousRefChildComponent != null ? previousRefChildComponent.getElement() : null;
-
- if (nextRefComponent != null)
- {
- if (nextRefComponent.getContainer().getContainer() == parentModelGroup)
- {
- insertType = INSERT_BEFORE;
- }
- }
- if (previousRefComponent != null)
- {
- if (previousRefComponent.getContainer().getContainer() == parentModelGroup)
- {
- insertType = INSERT_AFTER;
- }
- }
- if (nextRefChildComponent == null && previousRefChildComponent == null)
- {
- insertType = INSERT_DIRECT;
- }
- }
-
- public MoveXSDElementAction(XSDModelGroup parentComponent, XSDConcreteComponent selected, XSDConcreteComponent previousRefChildComponent, XSDConcreteComponent nextRefChildComponent, boolean insertAtEnd)
- {
- this(parentComponent, selected, previousRefChildComponent, nextRefChildComponent);
- this.insertAtEnd = insertAtEnd;
- }
-
- public boolean canMove()
- {
- boolean result = true;
-
- if (nextRefComponent instanceof XSDAttributeDeclaration || previousRefComponent instanceof XSDAttributeDeclaration || parentModelGroup == null)
- return false;
-
- return result;
- }
-
- /*
- * @see IAction#run()
- */
- public void run()
- {
- int originalIndex = 0;
- for (Iterator particles = parentModelGroup.getContents().iterator(); particles.hasNext();)
- {
- XSDParticle particle = (XSDParticle) particles.next();
- XSDParticleContent particleContent = particle.getContent();
- if (particleContent == selected)
- {
- parentModelGroup.getContents().remove(particle);
- break;
- }
- originalIndex++;
- }
- int index = 0;
- boolean addedBack = false;
- if (insertType == INSERT_DIRECT)
- {
- XSDConcreteComponent container = selected.getContainer();
- if (container != null)
- {
- XSDConcreteComponent container2 = container.getContainer();
- if (container2 instanceof XSDModelGroup)
- {
- ((XSDModelGroup) container2).getContents().remove(container);
- }
- if (insertAtEnd)
- parentModelGroup.getContents().add(container);
- else
- parentModelGroup.getContents().add(0, container);
- addedBack = true;
- }
- return;
- }
-
- List particles = parentModelGroup.getContents();
- for (Iterator iterator = particles.iterator(); iterator.hasNext();)
- {
- XSDParticle particle = (XSDParticle) iterator.next();
- XSDParticleContent particleContent = particle.getContent();
- if (insertType == INSERT_BEFORE)
- {
- if (particleContent == nextRefComponent)
- {
- parentModelGroup.getContents().add(index, selected.getContainer());
- addedBack = true;
- break;
- }
- if (selected == nextRefComponent && originalIndex == index)
- {
- parentModelGroup.getContents().add(index, selected.getContainer());
- addedBack = true;
- break;
- }
- }
- else if (insertType == INSERT_AFTER)
- {
- if (particleContent == previousRefComponent)
- {
- parentModelGroup.getContents().add(index + 1, selected.getContainer());
- addedBack = true;
- break;
- }
- if (selected == previousRefComponent && originalIndex == index)
- {
- parentModelGroup.getContents().add(index, selected.getContainer());
- addedBack = true;
- break;
- }
- }
- index++;
- }
- if (particles.size() == 0)
- {
- parentModelGroup.getContents().add(selected.getContainer());
- addedBack = true;
- }
-
- if (!addedBack)
- {
- parentModelGroup.getContents().add(originalIndex, selected.getContainer());
- }
- }
-}
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
deleted file mode 100644
index 6a573b3107..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/actions/XSDEditNamespacesAction.java
+++ /dev/null
@@ -1,292 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.util.XMLCommonResources;
-import org.eclipse.wst.xsd.ui.internal.common.commands.UpdateNamespaceInformationCommand;
-import org.eclipse.wst.xsd.ui.internal.common.util.Messages;
-import org.eclipse.wst.xsd.ui.internal.editor.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;
-import org.w3c.dom.NodeList;
-
-
-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); //$NON-NLS-1$
- }
-
- dialog.setNamespaceInfoList(namespaceInfoList);
- dialog.create();
- dialog.getShell().setSize(500, 400);
- dialog.getShell().setText(XMLCommonResources.getInstance().getString("_UI_MENU_EDIT_SCHEMA_INFORMATION_TITLE")); //$NON-NLS-1$
- dialog.setBlockOnOpen(true);
- dialog.open();
-
- String xsdPrefix = null; //$NON-NLS-1$
- String origXSDPrefix = xsdSchema.getSchemaForSchemaQNamePrefix();
- String newTNSPrefix = "";
-
- 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);
-
- String origTNSPrefix = null;
- Map origPrefixMap = xsdSchema.getQNamePrefixToNamespaceMap();
- for (Iterator iter = origPrefixMap.keySet().iterator(); iter.hasNext();)
- {
- String key = (String) iter.next();
- String ns = (String) origPrefixMap.get(key);
- if ((targetNamespace == null && ns == null) || targetNamespace != null && targetNamespace.equals(ns))
- {
- origTNSPrefix = key;
- break;
- }
- }
- 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 = ""; //$NON-NLS-1$
- if (uri == null)
- uri = ""; //$NON-NLS-1$
- if (XSDConstants.isSchemaForSchemaNamespace(uri))
- {
- xsdPrefix = pref;
- }
- if (uri.equals(dialog.getTargetNamespace()))
- {
- newTNSPrefix = pref;
- }
- map2.put(pref, uri);
- }
-
- if (map2.size() > 0)
- {
- try
- {
-
- doc.getModel().beginRecording(this, XSDEditorPlugin.getXSDString("_UI_NAMESPACE_CHANGE"));
- boolean targetNamespaceChanged = (targetNamespace != null && !targetNamespace.equals(dialog.getTargetNamespace()) || targetNamespace == null && dialog.getTargetNamespace() != null);
- boolean tnsPrefixChanged = !newTNSPrefix.equals(origTNSPrefix);
- boolean xsdPrefixChanged = (!(origXSDPrefix == null && xsdPrefix.equals("")) || (origXSDPrefix != null && !origXSDPrefix.equals(xsdPrefix)));
-
- xsdSchema.setIncrementalUpdate(false);
-
- // First handle the prefix change for the target namespace
- if (tnsPrefixChanged)
- {
- prefixMapping.remove(origTNSPrefix);
- UpdateNamespaceInformationCommand command = new UpdateNamespaceInformationCommand(Messages._UI_ACTION_NAMESPACE_INFORMATION_CHANGE, xsdSchema, newTNSPrefix, targetNamespace);
- command.execute();
- xsdSchema.update();
- }
- // Second, handle the target namespace change
- if (targetNamespaceChanged)
- {
- // set the targetNamespace attribute
- xsdSchema.setTargetNamespace(dialog.getTargetNamespace());
-
- TargetNamespaceChangeHandler targetNamespaceChangeHandler = new TargetNamespaceChangeHandler(xsdSchema, targetNamespace, dialog.getTargetNamespace());
- targetNamespaceChangeHandler.resolve();
- }
-
-
- // Now handle the other changes. PrefixMapping size should be
- // greater than 0 for any remaining prefix changes
-
- if (prefixMapping.size() > 0)
- {
- for (Iterator iter = prefixMapping.keySet().iterator(); iter.hasNext();)
- {
- String oldPrefix = (String) iter.next();
- String newPrefix = (String) prefixMapping.get(oldPrefix);
-
- // Now update any references to this old prefix in the schema
- // with the value of the new prefix
- String ns = (String) origPrefixMap.get(oldPrefix);
- SchemaPrefixChangeHandler spch = new SchemaPrefixChangeHandler(xsdSchema, newPrefix, ns != null? ns : ""); //$NON-NLS-1$
- spch.resolve();
- }
- }
- namespaceInfoManager.removeNamespaceInfo(element);
- namespaceInfoManager.addNamespaceInfo(element, newInfoList, false);
-
- // Third, handle the schema for schema prefix change
- if (xsdPrefixChanged)
- {
- if (xsdPrefix != null && xsdPrefix.length() == 0)
- {
- xsdSchema.setSchemaForSchemaQNamePrefix(null);
- }
- else
- {
- xsdSchema.setSchemaForSchemaQNamePrefix(xsdPrefix);
- }
-
- namespaceInfoManager.removeNamespaceInfo(element);
- namespaceInfoManager.addNamespaceInfo(element, newInfoList, false);
- xsdSchema.setIncrementalUpdate(true);
-
- // Now change the references to any schema types/components ie. string --> xs:string
- SchemaPrefixChangeHandler spch = new SchemaPrefixChangeHandler(xsdSchema, xsdPrefix);
- spch.resolve();
-
- // Change the prefix for all schema components
- updateAllNodes(element, xsdPrefix);
-
- prefixMapping.remove(origXSDPrefix != null? origXSDPrefix : ""); //$NON-NLS-1$
- }
- xsdSchema.setIncrementalUpdate(true);
- }
- catch (Exception e)
- {
- }
- 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 : ""); //$NON-NLS-1$
-
- // 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"); //$NON-NLS-1$
- }
-
- if (oldInfo != null)
- {
- String newPrefix = newInfo.prefix != null ? newInfo.prefix : ""; //$NON-NLS-1$
- String oldPrefix = oldInfo.prefix != null ? oldInfo.prefix : ""; //$NON-NLS-1$
- 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/adapters/CategoryAdapter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/CategoryAdapter.java
deleted file mode 100644
index cd995eeeae..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/CategoryAdapter.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.adapters;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.BaseSelectionAction;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.ShowPropertiesViewAction;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IActionProvider;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IModelProxy;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObjectListener;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IModel;
-import org.eclipse.wst.xsd.ui.internal.adt.outline.ITreeElement;
-import org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDAttributeDeclarationAction;
-import org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDAttributeGroupDefinitionAction;
-import org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDComplexTypeDefinitionAction;
-import org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDElementAction;
-import org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDSchemaDirectiveAction;
-import org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDModelGroupDefinitionAction;
-import org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDSimpleTypeDefinitionAction;
-import org.eclipse.xsd.XSDSchema;
-
-public class CategoryAdapter extends XSDBaseAdapter implements IModelProxy, IActionProvider, IADTObjectListener
-{
- protected String text;
- protected Image image;
- protected Object parent;
- protected int groupType;
- protected Collection children, allChildren; // children from current schema, children from current schema and includes
- 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 ITreeElement[] getAllChildren()
- {
- return (ITreeElement[]) allChildren.toArray(new ITreeElement[0]);
- }
-
- public void setChildren(Collection list)
- {
- children = list;
- }
-
- public void setAllChildren(Collection list)
- {
- allChildren = 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);
- actionIDs.add(AddXSDAttributeGroupDefinitionAction.ID);
- break;
- }
- case ATTRIBUTE_GROUPS : {
- actionIDs.add(AddXSDAttributeGroupDefinitionAction.ID);
- break;
- }
- case DIRECTIVES : {
- actionIDs.add(AddXSDSchemaDirectiveAction.INCLUDE_ID);
- actionIDs.add(AddXSDSchemaDirectiveAction.IMPORT_ID);
- actionIDs.add(AddXSDSchemaDirectiveAction.REDEFINE_ID);
- break;
- }
- }
- actionIDs.add(BaseSelectionAction.SEPARATOR_ID);
- actionIDs.add(ShowPropertiesViewAction.ID);
- return (String [])actionIDs.toArray(new String[0]);
- }
-
- public void propertyChanged(Object object, String property)
- {
- if (getText().equals(property))
- notifyListeners(this, property);
- }
-
- public List getTypes()
- {
- return null;
- }
-
- public IModel getModel()
- {
- return (IModel)XSDAdapterFactory.getInstance().adapt(xsdSchema);
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/RedefineCategoryAdapter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/RedefineCategoryAdapter.java
deleted file mode 100644
index 83e8c924ba..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/RedefineCategoryAdapter.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.adapters;
-
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.BaseSelectionAction;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.ShowPropertiesViewAction;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IModel;
-import org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDRedefinedAttributeGroupAction;
-import org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDRedefinedComplexTypeAction;
-import org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDRedefinedModelGroupAction;
-import org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDRedefinedSimpleTypeAction;
-import org.eclipse.xsd.XSDRedefine;
-
-
-public class RedefineCategoryAdapter extends CategoryAdapter
-{
- protected XSDRedefine xsdRedefine;
- private XSDRedefineAdapter xsdRedefineAdapter;
-
- public RedefineCategoryAdapter(String label, Image image, Collection children, XSDRedefine xsdRedefine, XSDRedefineAdapter xsdRedefineAdapter, int groupType)
- {
- super(label, image, children, xsdRedefine.getSchema(), groupType);
- this.xsdRedefine = xsdRedefine;
- this.target = xsdRedefine;
- this.xsdRedefineAdapter = xsdRedefineAdapter;
- }
-
- public XSDRedefine getXSDRedefine()
- {
- return xsdRedefine;
- }
-
- public String[] getActions(Object object)
- {
- Collection actionIDs = new ArrayList();
-
- switch (groupType)
- {
- case TYPES:
- {
- actionIDs.add(AddXSDRedefinedComplexTypeAction.ID);
- actionIDs.add(AddXSDRedefinedSimpleTypeAction.ID);
- break;
- }
- case GROUPS:
- {
- actionIDs.add(AddXSDRedefinedModelGroupAction.ID);
- break;
- }
- case ATTRIBUTES:
- case ATTRIBUTE_GROUPS:
- {
- actionIDs.add(AddXSDRedefinedAttributeGroupAction.ID);
- break;
- }
- }
- actionIDs.add(BaseSelectionAction.SEPARATOR_ID);
- actionIDs.add(ShowPropertiesViewAction.ID);
- return (String[])actionIDs.toArray(new String [0]);
- }
-
- public IModel getModel()
- {
- return (IModel)XSDAdapterFactory.getInstance().adapt(xsdRedefine.getSchema());
- }
-
-
- public XSDRedefineAdapter getXsdRedefineAdapter() {
- return xsdRedefineAdapter;
- }
-
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDAdapterFactory.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDAdapterFactory.java
deleted file mode 100644
index a05ce01b12..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDAdapterFactory.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.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.ui.internal.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.XSDEnumerationFacet;
-import org.eclipse.xsd.XSDModelGroup;
-import org.eclipse.xsd.XSDModelGroupDefinition;
-import org.eclipse.xsd.XSDParticle;
-import org.eclipse.xsd.XSDRedefine;
-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)
- {
- 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())) //$NON-NLS-1$
- {
- return new XSDAnyTypeDefinitionAdapter();
- }
- else
- {
- return new XSDComplexTypeDefinitionAdapter();
- }
- }
-
- public Object caseXSDModelGroup(XSDModelGroup object)
- {
- return new XSDModelGroupAdapter();
- }
-
- public Object caseXSDSchema(XSDSchema object)
- {
- return new XSDSchemaAdapter();
- }
-
- public Object caseXSDEnumerationFacet(XSDEnumerationFacet object)
- {
- return new XSDEnumerationFacetAdapter();
- }
-
- public Object caseXSDRedefine(XSDRedefine object)
- {
- return new XSDRedefineAdapter();
- }
- };
- Object o = xsdSwitch.doSwitch((EObject) target);
- Adapter result = null;
- if (o instanceof Adapter)
- {
- result = (Adapter) o;
- }
- else
- {
-// 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/ui/internal/adapters/XSDAnyTypeDefinitionAdapter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDAnyTypeDefinitionAdapter.java
deleted file mode 100644
index 3e8dc51a32..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDAnyTypeDefinitionAdapter.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.adapters;
-
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IModel;
-import org.eclipse.xsd.XSDConcreteComponent;
-
-public class XSDAnyTypeDefinitionAdapter extends XSDTypeDefinitionAdapter
-{
- public boolean isComplexType()
- {
- return false;
- }
-
- public boolean isFocusAllowed()
- {
- return false;
- }
-
- public String[] getActions(Object object)
- {
- return null;
- }
-
- public boolean isAnonymous()
- {
- return false;
- }
-
- public IADTObject getTopContainer()
- {
- return null;
- }
-
- public Command getDeleteCommand()
- {
- return null;
- }
-
- public IModel getModel()
- {
- Adapter adapter = XSDAdapterFactory.getInstance().adapt(((XSDConcreteComponent)target).getSchema());
- return (IModel)adapter;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDAttributeDeclarationAdapter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDAttributeDeclarationAdapter.java
deleted file mode 100644
index 2ed6b4fb10..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDAttributeDeclarationAdapter.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.adapters;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.BaseSelectionAction;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IActionProvider;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IModel;
-import org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDAttributeDeclarationAction;
-import org.eclipse.wst.xsd.ui.internal.editor.Messages;
-import org.eclipse.xsd.XSDAttributeDeclaration;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.XSDTypeDefinition;
-
-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 boolean isReference()
- {
- return getXSDAttributeDeclaration().isAttributeDeclarationReference();
- }
-
- public IModel getModel()
- {
- Adapter adapter = XSDAdapterFactory.getInstance().adapt(getXSDAttributeDeclaration().getSchema());
- return (IModel)adapter;
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=251008
- public String[] getActions(Object object)
- {
- if(!isGlobal())
- {
- List defaultActions = new ArrayList();
- defaultActions = Arrays.asList(super.getActions(object));
-
- ArrayList list = new ArrayList();
- list.add(BaseSelectionAction.SUBMENU_START_ID + Messages._UI_ACTION_INSERT_ATTRIBUTE);
- list.add(AddXSDAttributeDeclarationAction.BEFORE_SELECTED_ID);
- list.add(AddXSDAttributeDeclarationAction.AFTER_SELECTED_ID);
- list.add(BaseSelectionAction.SUBMENU_END_ID);
-
- int len = defaultActions.size();
- for(int i = 0; i < len; i++)
- {
- if (defaultActions.get(i).equals(AddXSDAttributeDeclarationAction.ID))
- {
- continue;
- }
- list.add(defaultActions.get(i));
- }
- return (String [])list.toArray(new String[0]);
- }
- else
- {
- return super.getActions(object);
- }
- }
-
-
- public boolean isFocusAllowed()
- {
- return isGlobal();
- }
-
- public String getTypeNameQualifier()
- {
- XSDTypeDefinition type = getResolvedXSDAttributeDeclaration().getTypeDefinition();
- if (type != null)
- {
- return type.getTargetNamespace();
- }
- return "";
- }
-
- public IADTObject getTopContainer()
- {
- if (!isGlobal())
- {
- return getGlobalXSDContainer(getXSDAttributeDeclaration());
- }
- return this;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDAttributeGroupDefinitionAdapter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDAttributeGroupDefinitionAdapter.java
deleted file mode 100644
index 6ecebef7e5..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDAttributeGroupDefinitionAdapter.java
+++ /dev/null
@@ -1,285 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.adapters;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-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.gef.commands.Command;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.BaseSelectionAction;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.DeleteAction;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.SetInputToGraphView;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.ShowPropertiesViewAction;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IActionProvider;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IGraphElement;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObjectListener;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IModel;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IStructure;
-import org.eclipse.wst.xsd.ui.internal.adt.outline.ITreeElement;
-import org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDAnyAttributeAction;
-import org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDAttributeDeclarationAction;
-import org.eclipse.wst.xsd.ui.internal.common.actions.OpenInNewEditor;
-import org.eclipse.wst.xsd.ui.internal.common.commands.DeleteCommand;
-import org.eclipse.wst.xsd.ui.internal.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-import org.eclipse.xsd.XSDAttributeGroupDefinition;
-import org.eclipse.xsd.XSDAttributeUse;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDRedefine;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.XSDWildcard;
-
-public class XSDAttributeGroupDefinitionAdapter extends XSDBaseAdapter implements IStructure, IActionProvider, IGraphElement, IADTObjectListener
-{
- public static final Image ATTRIBUTE_GROUP_REF_ICON_IMAGE = XSDEditorPlugin.getPlugin().getIcon("obj16/XSDAttributeGroupRef.gif");
- public static final Image ATTRIBUTE_GROUP_REF_DISABLED_ICON_IMAGE = XSDEditorPlugin.getPlugin().getIcon("obj16/XSDAttributeGroupRefdis.gif");
- public static final Image ATTRIBUTE_GROUP_ICON_IMAGE = XSDEditorPlugin.getPlugin().getIcon("obj16/XSDAttributeGroup.gif");
- public static final Image ATTRIBUTE_GROUP_DISABLED_ICON_IMAGE = XSDEditorPlugin.getPlugin().getIcon("obj16/XSDAttributeGroupdis.gif");
-
- protected List fields = null;
- protected List otherThingsToListenTo = null;
- protected boolean readOnly;
- protected boolean changeReadOnlyField =false;
- protected HashMap deletedTypes = new HashMap();
-
- public XSDAttributeGroupDefinitionAdapter()
- {
- super();
- }
-
- public XSDAttributeGroupDefinition getXSDAttributeGroupDefinition()
- {
- return (XSDAttributeGroupDefinition) target;
- }
-
- public Image getImage()
- {
- XSDAttributeGroupDefinition xsdAttributeGroupDefinition = (XSDAttributeGroupDefinition) target;
- if (xsdAttributeGroupDefinition.isAttributeGroupDefinitionReference())
- {
- return isReadOnly() ? ATTRIBUTE_GROUP_REF_DISABLED_ICON_IMAGE : ATTRIBUTE_GROUP_REF_ICON_IMAGE;
- }
- else
- {
- return isReadOnly() ? ATTRIBUTE_GROUP_DISABLED_ICON_IMAGE : ATTRIBUTE_GROUP_ICON_IMAGE;
- }
- }
-
- public String getText()
- {
- XSDAttributeGroupDefinition xsdAttributeGroupDefinition = (XSDAttributeGroupDefinition) target;
- String result = xsdAttributeGroupDefinition.isAttributeGroupDefinitionReference() ? xsdAttributeGroupDefinition.getQName() : xsdAttributeGroupDefinition.getName();
- return result == null ? Messages._UI_LABEL_ABSENT : result;
- }
-
- public ITreeElement[] getChildren()
- {
- XSDAttributeGroupDefinition xsdAttributeGroup = (XSDAttributeGroupDefinition) target;
- List list = new ArrayList();
- Iterator iterator = xsdAttributeGroup.getContents().iterator();
- while (iterator.hasNext())
- {
- Object o = iterator.next();
- if (o instanceof XSDAttributeUse)
- {
- list.add(((XSDAttributeUse)o).getAttributeDeclaration());
- }
- else
- {
- list.add(o);
- }
- }
- 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(AddXSDAnyAttributeAction.ID);
- list.add(BaseSelectionAction.SEPARATOR_ID);
- list.add(DeleteAction.ID);
- list.add(BaseSelectionAction.SEPARATOR_ID);
- Object schema = getEditorSchema();
- XSDAttributeGroupDefinition attributeGroupDefinition = getXSDAttributeGroupDefinition();
- if (attributeGroupDefinition.getSchema() == schema)
- {
- XSDConcreteComponent container = attributeGroupDefinition.getContainer();
- if (container == schema || container instanceof XSDRedefine)
- {
- list.add(SetInputToGraphView.ID);
- }
- }
- else
- {
- list.add(OpenInNewEditor.ID);
- }
- list.add(BaseSelectionAction.SEPARATOR_ID);
- list.add(ShowPropertiesViewAction.ID);
- return (String [])list.toArray(new String[0]);
- }
-
- public Command getAddNewFieldCommand(String fieldKind)
- {
- return null;
- }
-
- public Command getDeleteCommand()
- {
- return new DeleteCommand(getXSDAttributeGroupDefinition());
- }
-
- public List getFields()
- {
- if (fields == null)
- {
- fields = new ArrayList();
- otherThingsToListenTo = new ArrayList();
- XSDVisitorForFields visitor = new XSDVisitorForFields();
- visitor.visitAttributeGroupDefinition(getXSDAttributeGroupDefinition());
- 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);
- }
- }
- }
- return fields;
- }
-
- 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 IModel getModel()
- {
- Adapter adapter = XSDAdapterFactory.getInstance().adapt(getXSDAttributeGroupDefinition().getSchema());
- return (IModel)adapter;
- }
-
- public String getName()
- {
- // TODO (cs) ... review this
- return getText();
- }
-
- public boolean isFocusAllowed()
- {
- XSDAttributeGroupDefinition xsdAttributeGroupDefinition = (XSDAttributeGroupDefinition) target;
- if (xsdAttributeGroupDefinition.isAttributeGroupDefinitionReference())
- {
- return false;
- }
- return true;
- }
-
- public IADTObject getTopContainer()
- {
- XSDAttributeGroupDefinition attrGroupDef = getXSDAttributeGroupDefinition();
- XSDConcreteComponent container = attrGroupDef.getContainer();
- if (container instanceof XSDSchema || container instanceof XSDRedefine)
- return this;
- else
- return getGlobalXSDContainer(attrGroupDef);
- }
-
- public void notifyChanged(Notification msg)
- {
- clearFields();
- super.notifyChanged(msg);
- }
-
- public void propertyChanged(Object object, String property)
- {
- clearFields();
- notifyListeners(this, null);
- }
- public boolean isReadOnly()
- {
- XSDAttributeGroupDefinition xsdAttributeGroupDefinition = (XSDAttributeGroupDefinition) target;
- if (hasSetReadOnlyField())
- {
- deletedTypes.put(xsdAttributeGroupDefinition.getName(), new Boolean(true));
- changeReadOnlyField = false;
- return readOnly;
- }
- else
- {
- if (deletedTypes!= null )
- {
- Boolean deleted = ((Boolean)deletedTypes.get(xsdAttributeGroupDefinition.getName()));
- if (deleted != null && deleted.booleanValue())
- {
- return true;
- }
- else
- {
- return super.isReadOnly();
- }
- }
- else
- {
- return super.isReadOnly();
- }
- }
- }
-
- public void setReadOnly(boolean readOnly) {
- this.readOnly = readOnly;
- }
-
- public boolean hasSetReadOnlyField() {
- return changeReadOnlyField;
- }
-
- public void setChangeReadOnlyField(boolean setReadOnlyField) {
- this.changeReadOnlyField = setReadOnlyField;
- }
-
- public void updateDeletedMap(String addComponent) {
- if (deletedTypes.get(addComponent) != null)
- {
- deletedTypes.clear();
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDAttributeUseAdapter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDAttributeUseAdapter.java
deleted file mode 100644
index 668365c990..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDAttributeUseAdapter.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.adapters;
-
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IActionProvider;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IModel;
-import org.eclipse.xsd.XSDAttributeDeclaration;
-import org.eclipse.xsd.XSDAttributeUse;
-import org.eclipse.xsd.XSDTypeDefinition;
-
-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;
- }
-
- public String getTypeNameQualifier()
- {
- XSDTypeDefinition type = getResolvedXSDAttributeDeclaration().getTypeDefinition();
- if (type != null)
- {
- return type.getTargetNamespace();
- }
- return "";
- }
-
- public IADTObject getTopContainer()
- {
- return getGlobalXSDContainer(getXSDAttributeUse());
- }
-
- public boolean isReference()
- {
- return getXSDAttributeUse().getAttributeDeclaration().isAttributeDeclarationReference();
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDBaseAdapter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDBaseAdapter.java
deleted file mode 100644
index 4db258d737..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDBaseAdapter.java
+++ /dev/null
@@ -1,238 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.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.notify.impl.AdapterImpl;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbench;
-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.ui.internal.adt.facade.IADTObject;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObjectListener;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IComplexType;
-import org.eclipse.wst.xsd.ui.internal.adt.outline.ITreeElement;
-import org.eclipse.xsd.XSDAttributeGroupDefinition;
-import org.eclipse.xsd.XSDComplexTypeDefinition;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDModelGroupDefinition;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.XSDSimpleTypeDefinition;
-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 ""; //$NON-NLS-1$
- }
-
- 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;
- }
-
- protected Object getEditorSchema()
- {
- IWorkbench workbench = PlatformUI.getWorkbench();
- IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
- IEditorPart editorPart = workbenchWindow.getActivePage().getActiveEditor();
- return editorPart.getAdapter(XSDSchema.class);
- }
-
- protected IADTObject getGlobalXSDContainer(XSDConcreteComponent component)
- {
- XSDConcreteComponent c = component.getContainer();
- // We want the top most structural component
- while (c != null &&
- !(c.getContainer() instanceof XSDSchema) &&
- !(c instanceof XSDComplexTypeDefinition) &&
- !(c instanceof XSDSimpleTypeDefinition) &&
- !(c instanceof XSDModelGroupDefinition) &&
- !(c instanceof XSDAttributeGroupDefinition))
- {
- c = c.getContainer();
- }
- Adapter adapter = XSDAdapterFactory.getInstance().adapt(c);
- if (adapter instanceof IADTObject)
- return (IADTObject)adapter;
- return null;
- }
-
- /**
- * Indicates the presence of an abstract attribute
- * @return true if the component's abstract attribute is true
- */
- public boolean isAbstract()
- {
- return false;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDBaseAttributeAdapter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDBaseAttributeAdapter.java
deleted file mode 100644
index 9984076ba4..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDBaseAttributeAdapter.java
+++ /dev/null
@@ -1,236 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.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.ui.internal.adt.actions.BaseSelectionAction;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.DeleteAction;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.SetInputToGraphView;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.ShowPropertiesViewAction;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IGraphElement;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IField;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IModel;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IType;
-import org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDAttributeDeclarationAction;
-import org.eclipse.wst.xsd.ui.internal.common.actions.OpenInNewEditor;
-import org.eclipse.wst.xsd.ui.internal.common.commands.DeleteCommand;
-import org.eclipse.wst.xsd.ui.internal.common.commands.UpdateNameCommand;
-import org.eclipse.wst.xsd.ui.internal.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-import org.eclipse.xsd.XSDAttributeDeclaration;
-import org.eclipse.xsd.XSDTypeDefinition;
-import org.eclipse.xsd.util.XSDConstants;
-
-// a base adapter for reuse by an AttributeUse and AttributeDeclaration
-//
-public abstract class XSDBaseAttributeAdapter extends XSDBaseAdapter implements IField, IGraphElement
-{
- protected abstract XSDAttributeDeclaration getXSDAttributeDeclaration();
- protected abstract XSDAttributeDeclaration getResolvedXSDAttributeDeclaration();
-
- public XSDBaseAttributeAdapter()
- {
- super();
- }
-
- public String[] getActions(Object object)
- {
- List list = new ArrayList();
- if (!isGlobal())
- {
- list.add(AddXSDAttributeDeclarationAction.ID);
- list.add(BaseSelectionAction.SEPARATOR_ID);
- }
- list.add(DeleteAction.ID);
- list.add(BaseSelectionAction.SEPARATOR_ID);
- Object schema = getEditorSchema();
- if (getXSDAttributeDeclaration().getSchema() == schema)
- {
- if (getXSDAttributeDeclaration().getContainer() == schema)
- {
- list.add(SetInputToGraphView.ID);
- }
- }
- else
- {
- list.add(OpenInNewEditor.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 XSDConstants.ATTRIBUTE_ELEMENT_TAG;
- }
-
- 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; //$NON-NLS-1$
- }
-
- public IType getType()
- {
- XSDTypeDefinition td = getResolvedXSDAttributeDeclaration().getTypeDefinition();
- return (td != null) ? (IType) XSDAdapterFactory.getInstance().adapt(td) : null;
- }
-
- public String getTypeName()
- {
- IType type = getType();
- if (type != null)
- {
- return type.getName();
- }
- return "";
- }
-
- public String getTypeNameQualifier()
- {
- XSDAttributeDeclaration attr = getResolvedXSDAttributeDeclaration();
- if (attr != null)
- {
- if (attr.getTypeDefinition() != null)
- {
- return attr.getTypeDefinition().getTargetNamespace();
- }
- }
- 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(Messages._UI_ACTION_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.ui.internal.adt.outline.ITreeElement#getImage()
- */
- public Image getImage()
- {
- XSDAttributeDeclaration xsdAttributeDeclaration = getXSDAttributeDeclaration(); // don't want the resolved attribute
- if (xsdAttributeDeclaration.isAttributeDeclarationReference())
- {
- if (isReadOnly())
- {
- return XSDEditorPlugin.getPlugin().getIcon("obj16/XSDAttributeRefdis.gif");
- }
- return XSDEditorPlugin.getXSDImage("icons/XSDAttributeRef.gif"); //$NON-NLS-1$
- }
- else
- {
- if (isReadOnly())
- {
- return XSDEditorPlugin.getPlugin().getIcon("obj16/XSDAttributedis.gif");
- }
- return XSDEditorPlugin.getXSDImage("icons/XSDAttribute.gif"); //$NON-NLS-1$
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.xsd.ui.internal.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(" " + Messages._UI_LABEL_ABSENT + " "); //$NON-NLS-1$ //$NON-NLS-2$
- }
- else
- {
- result.append(name);
- }
- if (ad.getAnonymousTypeDefinition() == null && ad.getTypeDefinition() != null)
- {
- result.append(" : "); //$NON-NLS-1$
- // result.append(resolvedAttributeDeclaration.getTypeDefinition().getQName(xsdAttributeDeclaration));
- result.append(ad.getTypeDefinition().getName());
- }
- return result.toString();
- }
-
- public boolean isGlobal()
- {
- return false;
- }
-
- public boolean isReference()
- {
- return false;
- }
-
- public IModel getModel()
- {
- Adapter adapter = XSDAdapterFactory.getInstance().adapt(getXSDAttributeDeclaration().getSchema());
- return (IModel)adapter;
- }
-
- public boolean isFocusAllowed()
- {
- return false;
- }
-}
-
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDChildUtility.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDChildUtility.java
deleted file mode 100644
index 191110cd66..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDChildUtility.java
+++ /dev/null
@@ -1,280 +0,0 @@
-/*******************************************************************************
- * 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.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)
- {
- indent += 2;
- for (Iterator iterator = xsdSchema.getElementDeclarations().iterator(); iterator.hasNext(); )
- {
- visitXSDObject(iterator.next());
- }
- indent -= 2;
- }
-
- public void visitXSDElementDeclaration(XSDElementDeclaration xsdElementDeclaration)
- {
- indent += 2;
- XSDTypeDefinition td = xsdElementDeclaration.getTypeDefinition();
- if (td == null)
- {
- td = xsdElementDeclaration.getAnonymousTypeDefinition();
- }
- visitXSDObject(td);
- indent -= 2;
- }
-
- public void visitXSDComplexTypeDefinition(XSDComplexTypeDefinition xsdComplexTypeDefinition)
- {
- indent += 2;
- for (Iterator i = xsdComplexTypeDefinition.getAttributeUses().iterator(); i.hasNext(); )
- {
- visitXSDObject(i.next());
- }
- visitXSDObject(xsdComplexTypeDefinition.getContent());
- indent -= 2;
- }
-
- public void visitXSDModelGroup(XSDModelGroup xsdModelGroup)
- {
- indent += 2;
- for (Iterator iterator = xsdModelGroup.getContents().iterator(); iterator.hasNext(); )
- {
- visitXSDObject(iterator.next());
- }
- indent -= 2;
- }
-
- public void visitXSDModelGroupDefinition(XSDModelGroupDefinition xsdModelGroupDefinition)
- {
- indent += 2;
- visitXSDObject(xsdModelGroupDefinition.getResolvedModelGroupDefinition().getModelGroup());
- indent -= 2;
- }
-
- public void visitXSDParticle(XSDParticle xsdParticle)
- {
- indent += 2;
- if (xsdParticle.getContent() != null)
- visitXSDObject(xsdParticle.getContent());
- indent -= 2;
- }
-
- public void visitXSDWildcard(XSDWildcard object)
- {
-
- }
-
- public void printIndented(String string)
- {
- //String spaces = "";
- //for (int i = 0; i < indent; i++)
- //{
- // spaces += " ";
- //}
-
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDComplexTypeDefinitionAdapter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDComplexTypeDefinitionAdapter.java
deleted file mode 100644
index 4ad7e9057b..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDComplexTypeDefinitionAdapter.java
+++ /dev/null
@@ -1,566 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.adapters;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-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.wst.xsd.ui.internal.adt.actions.BaseSelectionAction;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.DeleteAction;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.SetInputToGraphView;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.ShowPropertiesViewAction;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObjectListener;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IComplexType;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IModel;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IType;
-import org.eclipse.wst.xsd.ui.internal.adt.outline.ITreeElement;
-import org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDAnyAttributeAction;
-import org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDAnyElementAction;
-import org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDAttributeDeclarationAction;
-import org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDAttributeGroupDefinitionAction;
-import org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDElementAction;
-import org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDEnumerationFacetAction;
-import org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDModelGroupAction;
-import org.eclipse.wst.xsd.ui.internal.common.actions.SetBaseTypeAction;
-import org.eclipse.wst.xsd.ui.internal.common.actions.OpenInNewEditor;
-import org.eclipse.wst.xsd.ui.internal.common.commands.AddXSDElementCommand;
-import org.eclipse.wst.xsd.ui.internal.common.commands.DeleteCommand;
-import org.eclipse.wst.xsd.ui.internal.common.commands.UpdateNameCommand;
-import org.eclipse.wst.xsd.ui.internal.design.editparts.model.SpaceFiller;
-import org.eclipse.wst.xsd.ui.internal.design.editparts.model.TargetConnectionSpaceFiller;
-import org.eclipse.wst.xsd.ui.internal.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-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.XSDConcreteComponent;
-import org.eclipse.xsd.XSDDerivationMethod;
-import org.eclipse.xsd.XSDEnumerationFacet;
-import org.eclipse.xsd.XSDModelGroup;
-import org.eclipse.xsd.XSDModelGroupDefinition;
-import org.eclipse.xsd.XSDParticle;
-import org.eclipse.xsd.XSDParticleContent;
-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.util.XSDConstants;
-
-public class XSDComplexTypeDefinitionAdapter extends XSDTypeDefinitionAdapter implements IComplexType, IADTObjectListener
-{
- protected List fields = null;
- protected List otherThingsToListenTo = null;
- protected boolean readOnly;
- protected boolean changeReadOnlyField =false;
- protected HashMap deletedTypes = new HashMap();
-
- 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")) //$NON-NLS-1$
- {
- 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);
- }
- }
- }
- 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")); //$NON-NLS-1$
- }
- visitAttributeGroupDefinition(attrGroup);
- }
- }
- }
- }
-
- public void visitModelGroup(XSDModelGroup modelGroup)
- {
- int numOfChildren = modelGroup.getContents().size();
- if (numOfChildren == 0)
- {
- concreteComponentList.add(new SpaceFiller("element")); //$NON-NLS-1$
- }
- super.visitModelGroup(modelGroup);
- }
-
- public void visitModelGroupDefinition(XSDModelGroupDefinition modelGroupDef)
- {
- XSDModelGroupDefinition resolvedModelGroupDef = modelGroupDef.getResolvedModelGroupDefinition();
- if (visitedGroups.contains(resolvedModelGroupDef.getModelGroup()))
- {
- concreteComponentList.add(new SpaceFiller("element")); //$NON-NLS-1$
- }
- super.visitModelGroupDefinition(modelGroupDef);
- }
- }
-
- 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(Messages._UI_ACTION_UPDATE_NAME, getXSDComplexTypeDefinition(), newName);
- }
-
- public Command getAddNewFieldCommand(String fieldKind)
- {
- return new AddXSDElementCommand(Messages._UI_ACTION_ADD_FIELD, 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();
- Object schema = getEditorSchema();
-
- XSDComplexTypeDefinition complexType = getXSDComplexTypeDefinition();
- Object contentType = getContentType();
- XSDDerivationMethod derivation = complexType.getDerivationMethod();
- if (contentType instanceof XSDSimpleTypeDefinition)
- {
- List fields = getFields();
- boolean hasSimpleContentAttributes = false;
- for (Iterator iterator = fields.iterator(); iterator.hasNext(); )
- {
- Object field = iterator.next();
- // We have attributes, so we need to add the compartment for housing the attributes
- if (field instanceof XSDAttributeDeclarationAdapter)
- {
- hasSimpleContentAttributes = true;
- break;
- }
- }
-
- if (hasSimpleContentAttributes || XSDDerivationMethod.EXTENSION_LITERAL.equals(derivation))
- {
- list.add(AddXSDAttributeDeclarationAction.ID);
- }
- else if (XSDDerivationMethod.RESTRICTION_LITERAL.equals(derivation))
- {
- list.add(AddXSDEnumerationFacetAction.ID);
- }
- list.add(BaseSelectionAction.SEPARATOR_ID);
- list.add(SetBaseTypeAction.ID);
- list.add(BaseSelectionAction.SEPARATOR_ID);
- list.add(DeleteAction.ID);
- list.add(BaseSelectionAction.SEPARATOR_ID);
- }
- else
- {
- list.add(AddXSDElementAction.ID);
- list.add(AddXSDElementAction.REF_ID);
- list.add(AddXSDAnyElementAction.ID);
- list.add(BaseSelectionAction.SEPARATOR_ID);
- list.add(AddXSDAttributeDeclarationAction.ID);
- list.add(AddXSDAttributeDeclarationAction.REF_ID);
- list.add(AddXSDAttributeGroupDefinitionAction.REF_ID);
- list.add(AddXSDAnyAttributeAction.ID);
- list.add(BaseSelectionAction.SEPARATOR_ID);
- list.add(AddXSDModelGroupAction.SEQUENCE_ID);
- list.add(AddXSDModelGroupAction.CHOICE_ID);
- list.add(AddXSDModelGroupAction.ALL_ID);
- list.add(BaseSelectionAction.SEPARATOR_ID);
- list.add(DeleteAction.ID);
- list.add(BaseSelectionAction.SEPARATOR_ID);
- list.add(SetBaseTypeAction.ID);
- list.add(BaseSelectionAction.SEPARATOR_ID);
- }
- if (complexType.getSchema() == schema)
- {
- XSDConcreteComponent container = complexType.getContainer();
- if (container == schema || container instanceof XSDRedefine)
- {
- 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(((XSDAttributeUse)obj).getAttributeDeclaration());
- }
- else if (obj instanceof XSDAttributeGroupDefinition)
- {
- getAttributeUses((XSDAttributeGroupDefinition) obj, list);
- }
- }
- // Add enumerations
- boolean canHaveEnumerations = xsdComplexTypeDefinition.getContentType() instanceof XSDSimpleTypeDefinition &&
- XSDDerivationMethod.RESTRICTION_LITERAL.equals(xsdComplexTypeDefinition.getDerivationMethod());
- if (canHaveEnumerations)
- {
- Object contentType = getContentType();
- if (contentType != null)
- {
- for (Iterator iterator = ((XSDSimpleTypeDefinition)contentType).getEnumerationFacets().iterator(); iterator.hasNext();)
- {
- XSDEnumerationFacet enumerationFacet = (XSDEnumerationFacet)iterator.next();
- list.add(enumerationFacet);
- }
- }
- }
- XSDWildcard anyAttr = xsdComplexTypeDefinition.getAttributeWildcard();
- if (anyAttr != null)
- list.add(anyAttr);
- // 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(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(particleContent);
- }
- }
- }
- }
- }
- }
- List adapterList = new ArrayList();
- populateAdapterList(list, adapterList);
- return (ITreeElement[]) adapterList.toArray(new ITreeElement[0]);
- }
-
- public Image getImage()
- {
- if (isReadOnly())
- {
- return XSDEditorPlugin.getPlugin().getIcon("obj16/XSDComplexTypedis.gif"); //$NON-NLS-1$
- }
- return XSDEditorPlugin.getPlugin().getIcon("obj16/XSDComplexType.gif"); //$NON-NLS-1$
- }
-
- public String getText()
- {
- XSDComplexTypeDefinition xsdComplexTypeDefinition = (XSDComplexTypeDefinition) target;
-
- StringBuffer result = new StringBuffer();
-
- result.append(xsdComplexTypeDefinition.getName() == null ? "local type" : xsdComplexTypeDefinition.getName()); //$NON-NLS-1$
-
- XSDTypeDefinition baseTypeDefinition = xsdComplexTypeDefinition.getBaseTypeDefinition();
- if (baseTypeDefinition != null && baseTypeDefinition != xsdComplexTypeDefinition.getContent() && baseTypeDefinition.getName() != null && !XSDConstants.isURType(baseTypeDefinition))
- {
-
- try{
- String qName = baseTypeDefinition.getQName(xsdComplexTypeDefinition);
- result.append(" : "); //$NON-NLS-1$
- result.append(qName);
- }
- catch (Exception e)
- {
- return result.toString();
- }
-
- }
-
- 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;
- }
-
- public boolean isAnonymous()
- {
- XSDComplexTypeDefinition xsdComplexTypeDefinition = (XSDComplexTypeDefinition) target;
- return !(xsdComplexTypeDefinition.eContainer() instanceof XSDSchema ||
- xsdComplexTypeDefinition.eContainer() instanceof XSDRedefine);
- }
-
- public IADTObject getTopContainer()
- {
- return this;
- }
-
- public boolean isAbstract()
- {
- return getXSDComplexTypeDefinition().isAbstract();
- }
-
- public Object getContentType()
- {
- return getXSDComplexTypeDefinition().getContent();
- }
- public boolean isReadOnly()
- {
- XSDComplexTypeDefinition xsdComplexTypeDefinition = (XSDComplexTypeDefinition) target;
- if (hasSetReadOnlyField())
- {
- deletedTypes.put(xsdComplexTypeDefinition.getName(), new Boolean(true));
- changeReadOnlyField = false;
- return readOnly;
- }
- else
- {
- if (deletedTypes!= null )
- {
- Boolean deleted = ((Boolean)deletedTypes.get(xsdComplexTypeDefinition.getName()));
- if (deleted != null && deleted.booleanValue())
- return true;
- else return super.isReadOnly();
- }
- else
- return super.isReadOnly();
- }
- }
-
-public void setReadOnly(boolean readOnly) {
- this.readOnly = readOnly;
-}
-
-public boolean hasSetReadOnlyField() {
- return changeReadOnlyField;
-}
-
-public void setChangeReadOnlyField(boolean setReadOnlyField) {
- this.changeReadOnlyField = setReadOnlyField;
-}
-
-public void updateDeletedMap(String addComponent)
-{
- if (deletedTypes.get(addComponent) != null)
- {
- deletedTypes.clear();
- }
-}
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDElementDeclarationAdapter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDElementDeclarationAdapter.java
deleted file mode 100644
index c1501d72d0..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDElementDeclarationAdapter.java
+++ /dev/null
@@ -1,339 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.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.osgi.util.TextProcessor;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.BaseSelectionAction;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.DeleteAction;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.SetInputToGraphView;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.ShowPropertiesViewAction;
-import org.eclipse.wst.xsd.ui.internal.adt.design.IAnnotationProvider;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IActionProvider;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IGraphElement;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IField;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IModel;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IType;
-import org.eclipse.wst.xsd.ui.internal.adt.outline.ITreeElement;
-import org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDElementAction;
-import org.eclipse.wst.xsd.ui.internal.common.actions.OpenInNewEditor;
-import org.eclipse.wst.xsd.ui.internal.common.actions.SetMultiplicityAction;
-import org.eclipse.wst.xsd.ui.internal.common.actions.SetTypeAction;
-import org.eclipse.wst.xsd.ui.internal.common.commands.DeleteCommand;
-import org.eclipse.wst.xsd.ui.internal.common.commands.UpdateNameCommand;
-import org.eclipse.wst.xsd.ui.internal.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-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, IGraphElement
-{
- protected XSDElementDeclaration getXSDElementDeclaration()
- {
- return (XSDElementDeclaration) target;
- }
-
- public String getName()
- {
- String name = getXSDElementDeclaration().getResolvedElementDeclaration().getName();
- return (name == null) ? "" : name; //$NON-NLS-1$
- }
-
- public String getTypeName()
- {
- IType type = getType();
- if (type != null)
- {
- return type.getName();
- }
- return null;
- }
-
- public String getTypeNameQualifier()
- {
- XSDTypeDefinition type = getXSDElementDeclaration().getResolvedElementDeclaration().getTypeDefinition();
- if (type != null)
- {
- return type.getTargetNamespace();
- }
- return "";
- }
-
- 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())
- {
- if (isReadOnly())
- {
- return XSDEditorPlugin.getPlugin().getIcon("obj16/XSDElementdis.gif");
- }
- return XSDEditorPlugin.getXSDImage("icons/XSDElement.gif"); //$NON-NLS-1$
- }
- else
- {
- if (isReadOnly())
- {
- return XSDEditorPlugin.getPlugin().getIcon("obj16/XSDElementRefdis.gif");
- }
- return XSDEditorPlugin.getXSDImage("icons/XSDElementRef.gif"); //$NON-NLS-1$
- }
- }
-
- 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(Messages._UI_LABEL_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(" ["); //$NON-NLS-1$
- if (hasMinOccurs)
- {
- int min = ((XSDParticle) xsdElementDeclaration.getContainer()).getMinOccurs();
- if (min == XSDParticle.UNBOUNDED)
- {
- result.append("*"); //$NON-NLS-1$
- }
- 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(".."); //$NON-NLS-1$
- if (max == XSDParticle.UNBOUNDED)
- {
- result.append("*"); //$NON-NLS-1$
- }
- else
- {
- result.append(String.valueOf(max));
- }
- }
- else
- // print default
- {
- result.append(".."); //$NON-NLS-1$
- int max = ((XSDParticle) xsdElementDeclaration.getContainer()).getMaxOccurs();
- result.append(String.valueOf(max));
-
- }
- result.append("]"); //$NON-NLS-1$
- }
- }
-
- if (resolvedElementDeclaration.getAnonymousTypeDefinition() == null && resolvedElementDeclaration.getTypeDefinition() != null)
- {
- result.append(" : "); //$NON-NLS-1$
- // result.append(resolvedElementDeclaration.getTypeDefinition().getQName(xsdElementDeclaration));
- result.append(resolvedElementDeclaration.getTypeDefinition().getName());
- }
-
- String text = result.toString();
- String processedString = TextProcessor.process(text, ":");
- return processedString;
-
- }
-
- 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"; //$NON-NLS-1$
- }
-
- public boolean isGlobal()
- {
- return getXSDElementDeclaration().eContainer() instanceof XSDSchema;
- }
-
- public boolean isReference()
- {
- 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(Messages._UI_ACTION_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(BaseSelectionAction.SUBMENU_START_ID + Messages._UI_ACTION_INSERT_ELEMENT);
- list.add(AddXSDElementAction.BEFORE_SELECTED_ID);
- list.add(AddXSDElementAction.AFTER_SELECTED_ID);
- list.add(BaseSelectionAction.SUBMENU_END_ID);
- }
-
- list.add(BaseSelectionAction.SUBMENU_START_ID + Messages._UI_ACTION_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 + Messages._UI_ACTION_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);
- Object schema = getEditorSchema();
- if (getXSDElementDeclaration().getSchema() == schema)
- {
- if (getXSDElementDeclaration().getContainer() == schema)
- {
- list.add(SetInputToGraphView.ID);
- }
- }
- else
- {
- list.add(OpenInNewEditor.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;
- }
-
- public boolean isFocusAllowed()
- {
- return isGlobal();
- }
-
- public IADTObject getTopContainer()
- {
- if (!isGlobal())
- {
- return getGlobalXSDContainer(getXSDElementDeclaration());
- }
- return this;
- }
-
- public boolean isAbstract()
- {
- return getXSDElementDeclaration().isAbstract();
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDEmptyFieldAdapter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDEmptyFieldAdapter.java
deleted file mode 100644
index 7e9b8fc997..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDEmptyFieldAdapter.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*******************************************************************************
- * 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.internal.adapters;
-
-import org.eclipse.gef.commands.Command;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IField;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IModel;
-import org.eclipse.wst.xsd.ui.internal.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;
- }
-
- public boolean isReference()
- {
- // TODO Auto-generated method stub
- return false;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDEnumerationFacetAdapter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDEnumerationFacetAdapter.java
deleted file mode 100644
index e6dfbe9685..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDEnumerationFacetAdapter.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.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.ui.internal.adt.actions.BaseSelectionAction;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.DeleteAction;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.ShowPropertiesViewAction;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IActionProvider;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IGraphElement;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IModel;
-import org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDEnumerationFacetAction;
-import org.eclipse.wst.xsd.ui.internal.common.commands.DeleteCommand;
-import org.eclipse.wst.xsd.ui.internal.common.util.Messages;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-import org.eclipse.xsd.XSDEnumerationFacet;
-
-public class XSDEnumerationFacetAdapter extends XSDBaseAdapter implements IActionProvider, IGraphElement
-{
- public XSDEnumerationFacet getXSDEnumerationFacet()
- {
- return (XSDEnumerationFacet)target;
- }
-
- public XSDEnumerationFacetAdapter()
- {
- super();
- }
-
- public String[] getActions(Object object)
- {
- List list = new ArrayList();
-
- list.add(BaseSelectionAction.SUBMENU_START_ID + Messages._UI_ACTION_INSERT_ENUMERATION);
- list.add(AddXSDEnumerationFacetAction.BEFORE_SELECTED_ID);
- list.add(AddXSDEnumerationFacetAction.AFTER_SELECTED_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 Image getImage()
- {
- return XSDEditorPlugin.getXSDImage("icons/XSDSimpleEnum.gif"); //$NON-NLS-1$
- }
-
- public Command getDeleteCommand()
- {
- return new DeleteCommand(getXSDEnumerationFacet());
- }
-
- public IModel getModel()
- {
- Adapter adapter = XSDAdapterFactory.getInstance().adapt(getXSDEnumerationFacet().getSchema());
- return (IModel)adapter;
- }
-
- public IADTObject getTopContainer()
- {
- return getGlobalXSDContainer(getXSDEnumerationFacet());
- }
-
- public boolean isFocusAllowed()
- {
- return false;
- }
-
- public String getText()
- {
- return getXSDEnumerationFacet().getLexicalValue();
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDModelGroupAdapter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDModelGroupAdapter.java
deleted file mode 100644
index 904acec553..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDModelGroupAdapter.java
+++ /dev/null
@@ -1,260 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.adapters;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-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.ui.internal.adt.actions.BaseSelectionAction;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.DeleteAction;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.ShowPropertiesViewAction;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IActionProvider;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IGraphElement;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IModel;
-import org.eclipse.wst.xsd.ui.internal.adt.outline.ITreeElement;
-import org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDAnyElementAction;
-import org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDElementAction;
-import org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDModelGroupAction;
-import org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDModelGroupDefinitionAction;
-import org.eclipse.wst.xsd.ui.internal.common.actions.SetMultiplicityAction;
-import org.eclipse.wst.xsd.ui.internal.common.commands.DeleteCommand;
-import org.eclipse.wst.xsd.ui.internal.design.figures.ModelGroupFigure;
-import org.eclipse.wst.xsd.ui.internal.editor.Messages;
-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, IGraphElement
-{
- XSDModelGroup getXSDModelGroup()
- {
- return (XSDModelGroup) target;
- }
-
- public XSDModelGroupAdapter()
- {
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.xsd.ui.internal.adt.outline.ITreeElement#getImage()
- */
- public Image getImage()
- {
- XSDModelGroup xsdModelGroup = getXSDModelGroup();
- if (XSDCompositor.CHOICE_LITERAL == xsdModelGroup.getCompositor())
- {
- return ModelGroupFigure.CHOICE_ICON_IMAGE;
- }
- else if (XSDCompositor.ALL_LITERAL == xsdModelGroup.getCompositor())
- {
- return ModelGroupFigure.ALL_ICON_IMAGE;
- }
- else
- {
- return ModelGroupFigure.SEQUENCE_ICON_IMAGE;
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.xsd.ui.internal.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(" ["); //$NON-NLS-1$
- if (hasMinOccurs)
- {
- int min = ((XSDParticle) xsdModelGroup.getContainer()).getMinOccurs();
- if (min == XSDParticle.UNBOUNDED)
- {
- result.append("*"); //$NON-NLS-1$
- }
- 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(".."); //$NON-NLS-1$
- if (max == XSDParticle.UNBOUNDED)
- {
- result.append("*"); //$NON-NLS-1$
- }
- else
- {
- result.append(String.valueOf(max));
- }
- }
- else
- // print default
- {
- result.append(".."); //$NON-NLS-1$
- int max = ((XSDParticle) xsdModelGroup.getContainer()).getMaxOccurs();
- result.append(String.valueOf(max));
- }
- result.append("]"); //$NON-NLS-1$
- }
- }
- 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(particle);
- }
- else if (particle instanceof XSDWildcard)
- {
- list.add(particle);
- }
- else if (particle instanceof XSDModelGroup)
- {
- list.add(particle);
- }
- else if (particle instanceof XSDModelGroupDefinition)
- {
- //list.add(((XSDModelGroupDefinition)particle).getResolvedModelGroupDefinition());
- list.add(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.ui.internal.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);
- actionIDs.add(AddXSDAnyElementAction.ID);
- // Add Element Ref
- actionIDs.add(BaseSelectionAction.SEPARATOR_ID);
- actionIDs.add(AddXSDModelGroupAction.SEQUENCE_ID);
- actionIDs.add(AddXSDModelGroupAction.CHOICE_ID);
- actionIDs.add(AddXSDModelGroupAction.ALL_ID);
- actionIDs.add(BaseSelectionAction.SEPARATOR_ID);
- actionIDs.add(AddXSDModelGroupDefinitionAction.MODELGROUPDEFINITIONREF_ID);
-// actionIDs.add(AddFieldAction.ID);
- actionIDs.add(BaseSelectionAction.SEPARATOR_ID);
- // Add Any
-
- actionIDs.add(BaseSelectionAction.SUBMENU_START_ID + Messages._UI_ACTION_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(DeleteAction.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());
- }
-
- public IADTObject getTopContainer()
- {
- XSDModelGroup xsdModelGroup = getXSDModelGroup();
- return getGlobalXSDContainer(xsdModelGroup);
- }
-
- public boolean isFocusAllowed()
- {
- return false;
- }
-
- public Command getDeleteCommand()
- {
- return new DeleteCommand(getXSDModelGroup());
- }
-
- public IModel getModel()
- {
- Adapter adapter = XSDAdapterFactory.getInstance().adapt(getXSDModelGroup().getSchema());
- return (IModel)adapter;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDModelGroupDefinitionAdapter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDModelGroupDefinitionAdapter.java
deleted file mode 100644
index 6fcd1934f1..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDModelGroupDefinitionAdapter.java
+++ /dev/null
@@ -1,340 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.adapters;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-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.ui.internal.adt.actions.BaseSelectionAction;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.DeleteAction;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.SetInputToGraphView;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.ShowPropertiesViewAction;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IActionProvider;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IGraphElement;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObjectListener;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IModel;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IStructure;
-import org.eclipse.wst.xsd.ui.internal.adt.outline.ITreeElement;
-import org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDElementAction;
-import org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDModelGroupAction;
-import org.eclipse.wst.xsd.ui.internal.common.actions.OpenInNewEditor;
-import org.eclipse.wst.xsd.ui.internal.common.actions.SetMultiplicityAction;
-import org.eclipse.wst.xsd.ui.internal.common.commands.DeleteCommand;
-import org.eclipse.wst.xsd.ui.internal.design.editparts.model.SpaceFiller;
-import org.eclipse.wst.xsd.ui.internal.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDModelGroup;
-import org.eclipse.xsd.XSDModelGroupDefinition;
-import org.eclipse.xsd.XSDRedefine;
-import org.eclipse.xsd.XSDSchema;
-
-public class XSDModelGroupDefinitionAdapter extends XSDParticleAdapter implements IStructure, IActionProvider, IGraphElement, IADTObjectListener
-{
- public static final Image MODEL_GROUP_ICON = XSDEditorPlugin.getPlugin().getIcon("obj16/XSDGroup.gif"); //$NON-NLS-1$
- public static final Image MODEL_GROUP_DISABLED_ICON = XSDEditorPlugin.getPlugin().getIcon("obj16/XSDGroupdis.gif"); //$NON-NLS-1$
- public static final Image MODEL_GROUP_REF_ICON = XSDEditorPlugin.getPlugin().getIcon("obj16/XSDGroupRef.gif"); //$NON-NLS-1$
- public static final Image MODEL_GROUP_REF_DISABLED_ICON = XSDEditorPlugin.getPlugin().getIcon("obj16/XSDGroupRefdis.gif"); //$NON-NLS-1$
-
- protected List fields = null;
- protected List otherThingsToListenTo = null;
- protected boolean readOnly;
- protected boolean changeReadOnlyField =false;
- protected HashMap deletedTypes = new HashMap();
-
- public XSDModelGroupDefinitionAdapter()
- {
- super();
- }
-
- public XSDModelGroupDefinition getXSDModelGroupDefinition()
- {
- return (XSDModelGroupDefinition) target;
- }
-
- public Image getImage()
- {
- XSDModelGroupDefinition xsdModelGroupDefinition = (XSDModelGroupDefinition) target;
-
- if (xsdModelGroupDefinition.isModelGroupDefinitionReference())
- {
- if (isReadOnly())
- {
- return MODEL_GROUP_REF_DISABLED_ICON;
- }
- return MODEL_GROUP_REF_ICON;
- }
- else
- {
- if (isReadOnly())
- {
- return MODEL_GROUP_DISABLED_ICON;
- }
- return MODEL_GROUP_ICON;
- }
- }
-
- public String getText()
- {
- XSDModelGroupDefinition xsdModelGroupDefinition = (XSDModelGroupDefinition) target;
- if (xsdModelGroupDefinition.getResolvedModelGroupDefinition().getContainer() == null && xsdModelGroupDefinition.getName() ==null) return ""; // Removed
- String result = xsdModelGroupDefinition.isModelGroupDefinitionReference() ? xsdModelGroupDefinition.getQName() : xsdModelGroupDefinition.getName();
- return result == null ? Messages._UI_LABEL_ABSENT : result;
- }
-
- public ITreeElement[] getChildren()
- {
- XSDModelGroupDefinition def = (XSDModelGroupDefinition)target;
- List list = new ArrayList();
- // Bug246036 - need to stop showing element content in a cycle.
- // And, we should not show any element content for references otherwise there will be two
- // entries in the tree viewer for the same item
- if (!def.isModelGroupDefinitionReference())
- {
- 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.ui.internal.adt.design.editparts.model.IActionProvider#getActions(java.lang.Object)
- */
- public String[] getActions(Object object)
- {
- Collection list = new ArrayList();
-
- XSDModelGroupDefinition modelGroupDefinition = getXSDModelGroupDefinition();
- boolean isModelGroupReference = modelGroupDefinition.isModelGroupDefinitionReference();
- if (!isModelGroupReference)
- {
- 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(AddXSDModelGroupAction.ALL_ID);
- list.add(BaseSelectionAction.SEPARATOR_ID);
- }
-
- list.add(DeleteAction.ID);
-
- if (isModelGroupReference)
- {
- list.add(BaseSelectionAction.SEPARATOR_ID);
- list.add(BaseSelectionAction.SUBMENU_START_ID + Messages._UI_ACTION_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);
- Object schema = getEditorSchema();
- if (modelGroupDefinition.getSchema() == schema)
- {
- XSDConcreteComponent container = modelGroupDefinition.getContainer();
- if (container == schema || container instanceof XSDRedefine)
- {
- list.add(SetInputToGraphView.ID);
- }
- }
- else
- {
- list.add(OpenInNewEditor.ID);
- }
- list.add(BaseSelectionAction.SEPARATOR_ID);
- list.add(ShowPropertiesViewAction.ID);
-
- return (String [])list.toArray(new String[0]);
- }
-
- public Command getAddNewFieldCommand(String fieldKind)
- {
- return null;
- }
-
- public Command getDeleteCommand()
- {
- return new DeleteCommand(getXSDModelGroupDefinition());
- }
-
- // TODO Common this up with XSDComplexType's. See also getFields
- 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()
- {
- List fields = new ArrayList();
- otherThingsToListenTo = new ArrayList();
- XSDVisitorForFields visitor = new XSDVisitorForGroupFieldsWithSpaceFillers();
- 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);
- }
- }
- return fields;
- }
-
- protected class XSDVisitorForGroupFieldsWithSpaceFillers extends XSDVisitorForFields
- {
- public XSDVisitorForGroupFieldsWithSpaceFillers()
- {
- super();
- }
-
- public void visitModelGroup(XSDModelGroup modelGroup)
- {
- int numOfChildren = modelGroup.getContents().size();
- if (numOfChildren == 0)
- {
- concreteComponentList.add(new SpaceFiller("element")); //$NON-NLS-1$
- }
- super.visitModelGroup(modelGroup);
- }
-
- public void visitModelGroupDefinition(XSDModelGroupDefinition modelGroupDef)
- {
- XSDModelGroupDefinition resolvedModelGroupDef = modelGroupDef.getResolvedModelGroupDefinition();
- if (visitedGroups.contains(resolvedModelGroupDef.getModelGroup()))
- {
- concreteComponentList.add(new SpaceFiller("element")); //$NON-NLS-1$
- }
- super.visitModelGroupDefinition(modelGroupDef);
- }
- }
-
- public IModel getModel()
- {
- Adapter adapter = XSDAdapterFactory.getInstance().adapt(getXSDModelGroupDefinition().getSchema());
- return (IModel)adapter;
- }
- public String getName()
- {
- return getText();
- }
-
- public boolean isFocusAllowed()
- {
- XSDModelGroupDefinition xsdModelGroupDefinition = (XSDModelGroupDefinition) target;
- if (xsdModelGroupDefinition.isModelGroupDefinitionReference())
- {
- return false;
- }
- return true;
- }
-
- public void propertyChanged(Object object, String property)
- {
- clearFields();
- notifyListeners(this, null);
- }
-
- public int getMaxOccurs()
- {
- return getMaxOccurs(getXSDModelGroupDefinition());
- }
-
- public int getMinOccurs()
- {
- return getMinOccurs(getXSDModelGroupDefinition());
- }
-
- public IADTObject getTopContainer()
- {
- XSDModelGroupDefinition group = getXSDModelGroupDefinition();
- XSDConcreteComponent container = group.getContainer();
- if (container instanceof XSDSchema || container instanceof XSDRedefine)
- return this;
- else
- return getGlobalXSDContainer(group);
- }
- public boolean isReadOnly()
- {
- XSDModelGroupDefinition xsdModelGroupDefinition = (XSDModelGroupDefinition) target;
- if (hasSetReadOnlyField())
- {
- deletedTypes.put(xsdModelGroupDefinition.getName(), new Boolean(true));
- changeReadOnlyField = false;
- return readOnly;
- }
- else
- {
- if (deletedTypes!= null )
- {
- Boolean deleted = ((Boolean)deletedTypes.get(xsdModelGroupDefinition.getName()));
- if (deleted != null && deleted.booleanValue())
- return true;
- else return super.isReadOnly();
- }
- else
- return super.isReadOnly();
- }
-
-
- }
-
- public void setReadOnly(boolean readOnly) {
- this.readOnly = readOnly;
- }
-
- public boolean hasSetReadOnlyField() {
- return changeReadOnlyField;
- }
-
- public void setChangeReadOnlyField(boolean setReadOnlyField) {
- this.changeReadOnlyField = setReadOnlyField;
- }
-
- public void updateDeletedMap(String addComponent) {
- if (deletedTypes.get(addComponent) != null)
- deletedTypes.clear();
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDParticleAdapter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDParticleAdapter.java
deleted file mode 100644
index a26649ce7a..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDParticleAdapter.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*******************************************************************************
- * 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.internal.adapters;
-
-import org.eclipse.wst.xsd.ui.internal.adt.design.IAnnotationProvider;
-import org.eclipse.wst.xsd.ui.internal.editor.Messages;
-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 = ""; //$NON-NLS-1$
- String toolTipDescription = ""; //$NON-NLS-1$
- // 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 = ""; //$NON-NLS-1$
- }
- else if (minOccurs == 0 && (maxOccurs == -2 || maxOccurs == 1))
- {
- occurenceDescription = "[0..1]"; //$NON-NLS-1$
- toolTipDescription = Messages._UI_LABEL_OPTIONAL;
- }
- else if (minOccurs == 0 && maxOccurs == -1)
- {
- occurenceDescription = "[0..*]"; //$NON-NLS-1$
- toolTipDescription = Messages._UI_LABEL_ZERO_OR_MORE;
- }
- else if ((minOccurs == 1 && maxOccurs == -1) || (minOccurs == -2 && maxOccurs == -1))
- {
- occurenceDescription = "[1..*]"; //$NON-NLS-1$
- toolTipDescription = Messages._UI_LABEL_ONE_OR_MORE;
- }
- else if ((minOccurs == 1 && maxOccurs == 1) || (minOccurs == -2 && maxOccurs == 1) || (minOccurs == 1 && maxOccurs == -2))
- {
- occurenceDescription = "[1..1]"; //$NON-NLS-1$
- toolTipDescription = Messages._UI_LABEL_REQUIRED;
- }
- else if (minOccurs == -2 && maxOccurs == -2)
- {
- occurenceDescription = ""; //$NON-NLS-1$
- // none specified, so don't have any toolTip description
- }
- else
- {
- if (maxOccurs == -2)
- maxOccurs = 1;
- String maxSymbol = maxOccurs == -1 ? "*" : "" + maxOccurs; //$NON-NLS-1$ //$NON-NLS-2$
- String minSymbol = minOccurs == -2 ? "1" : "" + minOccurs; //$NON-NLS-1$ //$NON-NLS-2$
- occurenceDescription = "[" + minSymbol + ".." + maxSymbol + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- toolTipDescription = Messages._UI_LABEL_ARRAY;
- }
-
- if (isForLabel)
- {
- return occurenceDescription;
- }
- else
- {
- return toolTipDescription;
- }
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDRedefineAdapter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDRedefineAdapter.java
deleted file mode 100644
index 66bc64fe21..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDRedefineAdapter.java
+++ /dev/null
@@ -1,295 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.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.swt.graphics.Image;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.BaseSelectionAction;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.DeleteAction;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.SetInputToGraphView;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.ShowPropertiesViewAction;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-import org.eclipse.wst.xsd.ui.internal.adt.outline.ITreeElement;
-import org.eclipse.wst.xsd.ui.internal.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-import org.eclipse.xsd.XSDAttributeGroupDefinition;
-import org.eclipse.xsd.XSDComplexTypeDefinition;
-import org.eclipse.xsd.XSDModelGroupDefinition;
-import org.eclipse.xsd.XSDPackage;
-import org.eclipse.xsd.XSDRedefine;
-import org.eclipse.xsd.XSDRedefineContent;
-import org.eclipse.xsd.XSDSimpleTypeDefinition;
-
-
-public class XSDRedefineAdapter extends XSDSchemaDirectiveAdapter
-{
-
- public XSDRedefineAdapter()
- {
- super();
- }
-
- public ITreeElement[] getChildren()
- {
- XSDRedefine xsdRedefine = (XSDRedefine)getTarget();
-
- children = new ArrayList();
-
- if (attributesCategory != null)
- {
- List attributes = getCategoryChildren(CategoryAdapter.ATTRIBUTES);
- List groups = getCategoryChildren(CategoryAdapter.GROUPS);
- List types = getCategoryChildren(CategoryAdapter.TYPES);
-
- attributesCategory.setChildren(attributes);
- attributesCategory.setAllChildren(attributes);
- typesCategory.setChildren(types);
- typesCategory.setAllChildren(types);
- groupsCategory.setChildren(groups);
- groupsCategory.setAllChildren(groups);
- }
- else
- {
- createCategoryAdapters(xsdRedefine);
- }
-
- children.add(attributesCategory);
- children.add(typesCategory);
- children.add(groupsCategory);
-
- return (ITreeElement[])children.toArray(new ITreeElement [0]);
- }
-
- public IADTObject getTopContainer()
- {
- return this;
- }
-
- public boolean isFocusAllowed()
- {
- return true;
- }
-
- protected List types = null;
-
- protected List children, allChildren;
-
- protected CategoryAdapter attributesCategory;
-
- protected CategoryAdapter typesCategory;
-
- protected CategoryAdapter groupsCategory;
-
- /**
- * Create all the category adapters
- *
- * @param xsdRedefine the parent redefine component
- */
- private void createCategoryAdapters(XSDRedefine xsdRedefine)
- {
- List attributes = getCategoryChildren(CategoryAdapter.ATTRIBUTES);
- List groups = getCategoryChildren(CategoryAdapter.GROUPS);
- List types = getCategoryChildren(CategoryAdapter.TYPES);
-
- XSDEditorPlugin xsdEditorPlugin = XSDEditorPlugin.getDefault();
- attributesCategory = new RedefineCategoryAdapter(
- Messages._UI_GRAPH_REDEFINE_ATTRIBUTE_GROUPS,
- xsdEditorPlugin.getIconImage("obj16/attributesheader"), attributes, xsdRedefine, this, CategoryAdapter.ATTRIBUTES); //$NON-NLS-1$
- attributesCategory.setAllChildren(attributes);
- registerListener(attributesCategory);
-
- typesCategory = new RedefineCategoryAdapter(
- Messages._UI_GRAPH_REDEFINE_TYPES,
- xsdEditorPlugin.getIconImage("obj16/typesheader"), types, xsdRedefine, this, CategoryAdapter.TYPES); //$NON-NLS-1$
- typesCategory.setAllChildren(types);
- registerListener(typesCategory);
-
- groupsCategory = new RedefineCategoryAdapter(
- Messages._UI_GRAPH_REDEFINE_GROUPS,
- xsdEditorPlugin.getIconImage("obj16/groupsheader"), groups, xsdRedefine, this, CategoryAdapter.GROUPS); //$NON-NLS-1$
- groupsCategory.setAllChildren(groups);
- registerListener(groupsCategory);
- }
-
- 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();
- }
-
- Object newValue = msg.getNewValue();
- Object oldValue = msg.getOldValue();
-
- if (XSDPackage.eINSTANCE.getXSDRedefine_Contents() == msg.getFeature())
- {
- if ((newValue instanceof XSDAttributeGroupDefinition) || oldValue instanceof XSDAttributeGroupDefinition)
- {
- CategoryAdapter adapter = getCategory(CategoryAdapter.ATTRIBUTES);
- Assert.isTrue(adapter != null);
- List list = getCategoryChildren(CategoryAdapter.ATTRIBUTES);
- adapter.setChildren(list);
- adapter.setAllChildren(list);
-
- if (adapter.getModel() instanceof XSDSchemaAdapter)
- {
- XSDSchemaAdapter schemaAdapter = (XSDSchemaAdapter)adapter.getModel();
- schemaAdapter.notifyChanged(msg);
- }
-
- notifyListeners(new CategoryNotification(adapter), adapter.getText());
- return;
- }
- else if ((newValue instanceof XSDComplexTypeDefinition || newValue instanceof XSDSimpleTypeDefinition) || (oldValue instanceof XSDComplexTypeDefinition || oldValue instanceof XSDSimpleTypeDefinition))
- {
- CategoryAdapter adapter = getCategory(CategoryAdapter.TYPES);
- Assert.isTrue(adapter != null);
- List types = getCategoryChildren(CategoryAdapter.TYPES);
- adapter.setChildren(types);
- adapter.setAllChildren(types);
- if (adapter.getModel() instanceof XSDSchemaAdapter)
- {
- XSDSchemaAdapter schemaAdapter = (XSDSchemaAdapter)adapter.getModel();
- schemaAdapter.notifyChanged(msg);
- }
- notifyListeners(new CategoryNotification(adapter), adapter.getText());
- return;
- }
- else if (newValue instanceof XSDModelGroupDefinition || oldValue instanceof XSDModelGroupDefinition)
- {
- CategoryAdapter adapter = getCategory(CategoryAdapter.GROUPS);
- Assert.isTrue(adapter != null);
- List list = getCategoryChildren(CategoryAdapter.GROUPS);
- adapter.setChildren(list);
- adapter.setAllChildren(list);
- if (adapter.getModel() instanceof XSDSchemaAdapter)
- {
- XSDSchemaAdapter schemaAdapter = (XSDSchemaAdapter)adapter.getModel();
- schemaAdapter.notifyChanged(msg);
- }
- notifyListeners(new CategoryNotification(adapter), adapter.getText());
- return;
- }
- else if (msg.getFeature() == XSDPackage.eINSTANCE.getXSDSchema_Annotations())
- {
- return;
- }
- }
- super.notifyChanged(msg);
- }
-
- private void updateCategories()
- {
- getChildren();
- }
-
- public CategoryAdapter getCategory(int category)
- {
- if (children == null)
- {
- updateCategories();
- }
- int length = children.size();
- CategoryAdapter adapter = null;
- for (int index = 0; index < length; index++)
- {
- adapter = (CategoryAdapter)children.get(index);
- if (adapter.getGroupType() == category)
- {
- break;
- }
- }
- return adapter;
- }
-
- public String[] getActions(Object object)
- {
- Collection actionIDs = new ArrayList();
-
- actionIDs.add(DeleteAction.ID);
- actionIDs.add(BaseSelectionAction.SEPARATOR_ID);
- actionIDs.add(SetInputToGraphView.ID);
- actionIDs.add(BaseSelectionAction.SEPARATOR_ID);
- actionIDs.add(ShowPropertiesViewAction.ID);
-
- return (String[])actionIDs.toArray(new String [0]);
- }
-
- public void propertyChanged(Object object, String property)
- {
- notifyListeners(object, property);
- }
-
- public Image getImage()
- {
- return XSDEditorPlugin.getXSDImage("icons/XSDRedefine.gif"); //$NON-NLS-1$
- }
-
- private List getCategoryChildren(int category)
- {
- List list = new ArrayList();
- XSDRedefine redefine = (XSDRedefine)target;
- Iterator iterator = redefine.getContents().iterator();
- while (iterator.hasNext())
- {
- XSDRedefineContent redefineContent = (XSDRedefineContent)iterator.next();
-
- if (redefineContent instanceof XSDAttributeGroupDefinition && category == CategoryAdapter.ATTRIBUTES)
- {
- list.add(redefineContent);
- }
- else if (redefineContent instanceof XSDModelGroupDefinition && category == CategoryAdapter.GROUPS)
- {
- list.add(redefineContent);
- }
- else if (redefineContent instanceof XSDComplexTypeDefinition && category == CategoryAdapter.TYPES)
- {
- list.add(redefineContent);
- }
- else if (redefineContent instanceof XSDSimpleTypeDefinition && category == CategoryAdapter.TYPES)
- {
- list.add(redefineContent);
- }
- }
- List adapterList = new ArrayList();
- populateAdapterList(list, adapterList);
- return adapterList;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDSchemaAdapter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDSchemaAdapter.java
deleted file mode 100644
index fe30e58473..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDSchemaAdapter.java
+++ /dev/null
@@ -1,537 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Tada Takatoshi / Fujitsu - bug 245480 - provided initial patch
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.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.swt.graphics.Image;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.BaseSelectionAction;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.ShowPropertiesViewAction;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IActionProvider;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObjectListener;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IModel;
-import org.eclipse.wst.xsd.ui.internal.adt.outline.ITreeElement;
-import org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDComplexTypeDefinitionAction;
-import org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDElementAction;
-import org.eclipse.wst.xsd.ui.internal.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-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.XSDImport;
-import org.eclipse.xsd.XSDInclude;
-import org.eclipse.xsd.XSDModelGroupDefinition;
-import org.eclipse.xsd.XSDNamedComponent;
-import org.eclipse.xsd.XSDPackage;
-import org.eclipse.xsd.XSDRedefine;
-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;
-
-public class XSDSchemaAdapter extends XSDBaseAdapter implements IActionProvider, IModel, IADTObjectListener
-{
- protected List types = null;
- protected List children, allChildren;
-
- protected CategoryAdapter fDirectivesCategory;
- protected CategoryAdapter fElementsCategory;
- protected CategoryAdapter fAttributesCategory;
- 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 attributesList = getAttributeList(xsdSchema);
- List groups = getGroups(xsdSchema);
- List types = getComplexTypes(xsdSchema);
- types.addAll(getSimpleTypes(xsdSchema));
-
- fDirectivesCategory = new CategoryAdapter(Messages._UI_GRAPH_DIRECTIVES, XSDEditorPlugin.getDefault().getIconImage("obj16/directivesheader"), directivesList, xsdSchema, CategoryAdapter.DIRECTIVES); //$NON-NLS-1$
- fDirectivesCategory.setAllChildren(directivesList);
- registerListener(fDirectivesCategory);
-
- fElementsCategory = new CategoryAdapter(Messages._UI_GRAPH_ELEMENTS, XSDEditorPlugin.getDefault().getIconImage("obj16/elementsheader"), elementsList, xsdSchema, CategoryAdapter.ELEMENTS); //$NON-NLS-1$
- fElementsCategory.setAllChildren(getGlobalElements(xsdSchema, true));
- registerListener(fElementsCategory);
-
- fAttributesCategory = new CategoryAdapter(Messages._UI_GRAPH_ATTRIBUTES, XSDEditorPlugin.getDefault().getIconImage("obj16/attributesheader"), attributesList, xsdSchema, CategoryAdapter.ATTRIBUTES); //$NON-NLS-1$
- fAttributesCategory.setAllChildren(getAttributeList(xsdSchema,true));
- registerListener(fAttributesCategory);
-
- fTypesCategory = new CategoryAdapter(Messages._UI_GRAPH_TYPES, XSDEditorPlugin.getDefault().getIconImage("obj16/typesheader"), types, xsdSchema, CategoryAdapter.TYPES); //$NON-NLS-1$
- fTypesCategory.setAllChildren(getTypes(xsdSchema, true));
- registerListener(fTypesCategory);
-
- fGroupsCategory = new CategoryAdapter(Messages._UI_GRAPH_GROUPS, XSDEditorPlugin.getDefault().getIconImage("obj16/groupsheader"), groups, xsdSchema, CategoryAdapter.GROUPS); //$NON-NLS-1$
- fGroupsCategory.setAllChildren(getGroups(xsdSchema,true));
- 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;
- }
-
- protected boolean isSameNamespace(String ns1, String ns2)
- {
- if (ns1 == null) ns1 = "";
- if (ns2 == null) ns2 = "";
-
- if (ns1.equals(ns2))
- {
- return true;
- }
- return false;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.xsd.ui.internal.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 attributesList = getAttributeList(xsdSchema);
- List groups = getGroups(xsdSchema);
- List types = getComplexTypes(xsdSchema);
- types.addAll(getSimpleTypes(xsdSchema));
-
- fDirectivesCategory.setChildren(directivesList);
- fDirectivesCategory.setAllChildren(directivesList);
- fElementsCategory.setChildren(elementsList);
- fElementsCategory.setAllChildren(getGlobalElements(xsdSchema, true));
- fAttributesCategory.setChildren(attributesList);
- fAttributesCategory.setAllChildren(getAttributeList(xsdSchema, true));
- fTypesCategory.setChildren(types);
- fTypesCategory.setAllChildren(getTypes(xsdSchema, true));
- fGroupsCategory.setChildren(groups);
- fGroupsCategory.setAllChildren(getGroups(xsdSchema, true));
- }
- else
- {
- createCategoryAdapters(xsdSchema);
- }
-
- children.add(fDirectivesCategory);
- children.add(fElementsCategory);
- children.add(fAttributesCategory);
- 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();
- }
-
- Object newValue = msg.getNewValue();
-
- Object oldValue = msg.getOldValue();
- // Bug 245480 - Deletion of Include, Import and Redefine is not reflected in the Outline view
- // We only want to refresh the Directives folder for any changes to XSDDirectives. The first case covers
- // changes to one directive, whereas the missing case as reported in bug 245480 covers changes to a list
- // of directives.
- boolean updateDirectivesCategory = false;
- if (oldValue instanceof XSDSchemaDirective)
- {
- updateDirectivesCategory = true;
- }
- else if (oldValue instanceof Collection)
- {
- Iterator iterator = ((Collection) oldValue).iterator();
- while (iterator.hasNext())
- {
- Object obj = iterator.next();
- if (obj instanceof XSDSchemaDirective)
- {
- // if we find at least one directive, then we should refresh the folder
- updateDirectivesCategory = true;
- break;
- }
- }
- }
-
- if (newValue instanceof XSDInclude || newValue instanceof XSDImport || newValue instanceof XSDRedefine ||
- (msg.getFeature() == XSDPackage.eINSTANCE.getXSDSchema_Contents() && updateDirectivesCategory) || // handle the case for delete directive
- msg.getFeature() == XSDPackage.eINSTANCE.getXSDSchema_IncorporatedVersions()) // updates to the imports/includes
- {
- CategoryAdapter adapter = getCategory(CategoryAdapter.DIRECTIVES);
- Assert.isTrue(adapter != null);
- XSDSchema xsdSchema = adapter.getXSDSchema();
- adapter.setChildren(getDirectives(xsdSchema));
- adapter.setAllChildren(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));
- adapter.setAllChildren(getGlobalElements(xsdSchema, true));
- notifyListeners(new CategoryNotification(adapter), adapter.getText());
- return;
- }
- else if (msg.getFeature() == XSDPackage.eINSTANCE.getXSDSchema_AttributeDeclarations() ||
- msg.getFeature() == XSDPackage.eINSTANCE.getXSDSchema_AttributeGroupDefinitions())
- {
- CategoryAdapter adapter = getCategory(CategoryAdapter.ATTRIBUTES);
- Assert.isTrue(adapter != null);
- XSDSchema xsdSchema = adapter.getXSDSchema();
- adapter.setChildren(getAttributeList(xsdSchema));
- adapter.setAllChildren(getAttributeList(xsdSchema, true));
- 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);
- adapter.setAllChildren(getTypes(xsdSchema, true));
- 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));
- adapter.setAllChildren(getGroups(xsdSchema, true));
- 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);
- }
-
- public void updateCategories()
- {
- // TODO: revisit this
- getChildren();
- }
-
- public CategoryAdapter getCategory(int category)
- {
- if (children == null) updateCategories(); // init categories
- 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;
- }
-
- public 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;
- }
-
- public List getGlobalElements(XSDSchema schema, boolean showFromIncludes)
- {
- List elements = schema.getElementDeclarations();
- List list = new ArrayList();
- for (Iterator i = elements.iterator(); i.hasNext();)
- {
- XSDElementDeclaration elem = (XSDElementDeclaration) i.next();
- if (shouldShowComponent(elem, schema, showFromIncludes))
- {
- list.add(elem);
- }
- }
- List adapterList = new ArrayList();
- populateAdapterList(list, adapterList);
- return adapterList;
- }
-
- public List getGlobalElements(XSDSchema schema)
- {
- return getGlobalElements(schema, false);
- }
-
- /**
- * @param schema
- * @return
- */
- public List getComplexTypes(XSDSchema schema, boolean showFromIncludes)
- {
- 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 (shouldShowComponent(ct, schema, showFromIncludes))
- {
- list.add(ct);
- }
- }
- }
- List adapterList = new ArrayList();
- populateAdapterList(list, adapterList);
- return adapterList;
- }
-
- public List getComplexTypes(XSDSchema schema)
- {
- return getComplexTypes(schema, false);
- }
-
- public List getTypes(XSDSchema schema, boolean showFromIncludes)
- {
- List list = getComplexTypes(schema, showFromIncludes);
- list.addAll(getSimpleTypes(schema, showFromIncludes));
- return list;
- }
-
- public List getAttributeGroupList(XSDSchema xsdSchema, boolean showFromIncludes)
- {
- List attributeGroupList = new ArrayList();
- for (Iterator i = xsdSchema.getAttributeGroupDefinitions().iterator(); i.hasNext();)
- {
- XSDAttributeGroupDefinition attrGroup = (XSDAttributeGroupDefinition) i.next();
- if (shouldShowComponent(attrGroup, xsdSchema, showFromIncludes))
- {
- attributeGroupList.add(attrGroup);
- }
- }
- List adapterList = new ArrayList();
- populateAdapterList(attributeGroupList, adapterList);
- return adapterList;
- }
-
- public List getAttributeGroupList(XSDSchema xsdSchema)
- {
- return getAttributeGroupList(xsdSchema, false);
- }
-
- public List getAttributeList(XSDSchema xsdSchema, boolean showFromIncludes)
- {
- 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(XSDConstants.SCHEMA_INSTANCE_URI_2001)))
- {
- if (shouldShowComponent(attr, xsdSchema,showFromIncludes))
- {
- attributesList.add(attr);
- }
- }
- }
- else
- {
- if (shouldShowComponent(attr, xsdSchema,showFromIncludes))
- {
- attributesList.add(attr);
- }
- }
- }
- }
- }
-
- attributesList.addAll(getAttributeGroupList(xsdSchema, showFromIncludes));
-
- List adapterList = new ArrayList();
- populateAdapterList(attributesList, adapterList);
- return adapterList;
- }
-
- public List getAttributeList(XSDSchema xsdSchema)
- {
- return getAttributeList(xsdSchema, false);
- }
-
- public List getSimpleTypes(XSDSchema schema, boolean showFromIncludes)
- {
- 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 (shouldShowComponent(st, schema, showFromIncludes))
- {
- list.add(st);
- }
- }
- }
- List adapterList = new ArrayList();
- populateAdapterList(list, adapterList);
- return adapterList;
- }
-
- public List getSimpleTypes(XSDSchema schema)
- {
- return getSimpleTypes(schema, false);
- }
-
- public List getGroups(XSDSchema schema, boolean showFromIncludes)
- {
- List groups = schema.getModelGroupDefinitions();
- List list = new ArrayList();
- for (Iterator i = groups.iterator(); i.hasNext();)
- {
- XSDModelGroupDefinition group = (XSDModelGroupDefinition) i.next();
- if (shouldShowComponent(group, schema, showFromIncludes))
- {
- list.add(group);
- }
- }
- List adapterList = new ArrayList();
- populateAdapterList(list, adapterList);
- return adapterList;
- }
-
- public List getGroups(XSDSchema schema)
- {
- return getGroups(schema, false);
- }
-
- public String[] getActions(Object object)
- {
- Collection actionIDs = new ArrayList();
- actionIDs.add(AddXSDElementAction.ID);
- actionIDs.add(AddXSDComplexTypeDefinitionAction.ID);
-
- actionIDs.add(BaseSelectionAction.SEPARATOR_ID);
- actionIDs.add(ShowPropertiesViewAction.ID);
- return (String [])actionIDs.toArray(new String[0]);
- }
-
- public void propertyChanged(Object object, String property)
- {
- notifyListeners(object, property);
- }
-
- public Image getImage()
- {
- return XSDEditorPlugin.getXSDImage("icons/XSDFile.gif"); //$NON-NLS-1$
- }
-
- protected boolean shouldShowComponent(XSDNamedComponent component, XSDSchema schema, boolean showFromIncludes)
- {
- return isSameNamespace(component.getTargetNamespace(), schema.getTargetNamespace()) && (component.getRootContainer() == schema || showFromIncludes);
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDSchemaDirectiveAdapter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDSchemaDirectiveAdapter.java
deleted file mode 100644
index d7e89eb4ae..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDSchemaDirectiveAdapter.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.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.ui.internal.adt.actions.BaseSelectionAction;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.DeleteAction;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.ShowPropertiesViewAction;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IActionProvider;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IGraphElement;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IModel;
-import org.eclipse.wst.xsd.ui.internal.adt.outline.ITreeElement;
-import org.eclipse.wst.xsd.ui.internal.common.actions.OpenInNewEditor;
-import org.eclipse.wst.xsd.ui.internal.common.commands.DeleteCommand;
-import org.eclipse.wst.xsd.ui.internal.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-import org.eclipse.xsd.XSDImport;
-import org.eclipse.xsd.XSDInclude;
-import org.eclipse.xsd.XSDRedefine;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.XSDSchemaDirective;
-
-public class XSDSchemaDirectiveAdapter extends XSDBaseAdapter implements IActionProvider, IGraphElement
-{
- public Image getImage()
- {
- XSDSchemaDirective object = (XSDSchemaDirective) target;
- if (object instanceof XSDImport)
- {
- return XSDEditorPlugin.getXSDImage("icons/XSDImport.gif"); //$NON-NLS-1$
- }
- else if (object instanceof XSDInclude)
- {
- return XSDEditorPlugin.getXSDImage("icons/XSDInclude.gif"); //$NON-NLS-1$
- }
- else if (object instanceof XSDRedefine)
- {
- return XSDEditorPlugin.getXSDImage("icons/XSDRedefine.gif"); //$NON-NLS-1$
- }
- return null;
- }
-
- public String getText()
- {
- XSDSchemaDirective directive = (XSDSchemaDirective) target;
- String result = "";
-
- String location = directive.getSchemaLocation();
- if (location == null || location.equals("") )
- {
- result = "(" + Messages._UI_LABEL_NO_LOCATION_SPECIFIED + ")";
- }
- else
- {
- result = location;
- }
-
- // only show the namespace when the directiave is an import
- // (otherwise the namespace is obviously the same as the containing schema's)
- if (directive instanceof XSDImport)
- {
- XSDImport importObj = (XSDImport) directive;
- String namespace = importObj.getNamespace();
- if (namespace != null)
- {
- result += " {" + namespace + "}";
- }
- }
- return result;
- }
-
- public ITreeElement[] getChildren()
- {
- List list = new ArrayList();
-
- 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(OpenInNewEditor.ID);
- list.add(DeleteAction.ID);
- list.add(BaseSelectionAction.SEPARATOR_ID);
- list.add(ShowPropertiesViewAction.ID);
-
- return (String [])list.toArray(new String[0]);
- }
-
- public Command getDeleteCommand()
- {
- XSDSchemaDirective object = (XSDSchemaDirective) target;
- return new DeleteCommand(object);
- }
-
- public IModel getModel()
- {
- XSDSchema object = ((XSDSchemaDirective) target).getSchema();
- Adapter adapter = XSDAdapterFactory.getInstance().adapt(object);
- return (IModel)adapter;
- }
-
- public IADTObject getTopContainer()
- {
- // There is currently no drill-down details view of directives
- // The top level container is the schema
- return getModel();
- }
-
- public boolean isFocusAllowed()
- {
- return false;
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDSimpleContentAdapter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDSimpleContentAdapter.java
deleted file mode 100644
index a66f6a9fab..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDSimpleContentAdapter.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.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.ui.internal.adt.design.editparts.model.IActionProvider;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IGraphElement;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IModel;
-import org.eclipse.wst.xsd.ui.internal.common.commands.DeleteCommand;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-import org.eclipse.xsd.XSDComplexTypeDefinition;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDSimpleTypeDefinition;
-
-public class XSDSimpleContentAdapter extends XSDBaseAdapter implements IActionProvider, IGraphElement
-{
-
- public XSDSimpleContentAdapter()
- {
- }
-
- public XSDSimpleTypeDefinition getXSDSimpleTypeContent()
- {
- return (XSDSimpleTypeDefinition)target;
- }
-
- public String[] getActions(Object object)
- {
- List list = new ArrayList();
- return (String [])list.toArray(new String[0]);
- }
-
- public Command getDeleteCommand()
- {
- return new DeleteCommand(getXSDSimpleTypeContent());
- }
-
- public IModel getModel()
- {
- Adapter adapter = XSDAdapterFactory.getInstance().adapt(getXSDSimpleTypeContent().getSchema());
- return (IModel)adapter;
- }
-
- public IADTObject getTopContainer()
- {
- XSDConcreteComponent c = getXSDSimpleTypeContent().getContainer();
- if (c instanceof XSDComplexTypeDefinition)
- {
- XSDComplexTypeDefinition ct = (XSDComplexTypeDefinition) c;
- Adapter adapter = XSDAdapterFactory.getInstance().adapt(ct);
- if (adapter instanceof IADTObject)
- return (IADTObject)adapter;
- }
-
- return null;
- }
-
- public boolean isFocusAllowed()
- {
- return false;
- }
-
- public Image getImage()
- {
- if (isReadOnly())
- {
- return XSDEditorPlugin.getPlugin().getIcon("obj16/XSDSimpleContent.gif"); //$NON-NLS-1$
- }
- return XSDEditorPlugin.getPlugin().getIcon("obj16/XSDSimpleContent.gif"); //$NON-NLS-1$
- }
-
- public String getText()
- {
- return "";
- }
-
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDSimpleTypeDefinitionAdapter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDSimpleTypeDefinitionAdapter.java
deleted file mode 100644
index 105c362866..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDSimpleTypeDefinitionAdapter.java
+++ /dev/null
@@ -1,268 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.adapters;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.BaseSelectionAction;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.DeleteAction;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.SetInputToGraphView;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.ShowPropertiesViewAction;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IModel;
-import org.eclipse.wst.xsd.ui.internal.adt.outline.ITreeElement;
-import org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDEnumerationFacetAction;
-import org.eclipse.wst.xsd.ui.internal.common.actions.OpenInNewEditor;
-import org.eclipse.wst.xsd.ui.internal.common.actions.SetBaseTypeAction;
-import org.eclipse.wst.xsd.ui.internal.common.commands.DeleteCommand;
-import org.eclipse.wst.xsd.ui.internal.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDRedefine;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.XSDSimpleTypeDefinition;
-import org.eclipse.xsd.XSDTypeDefinition;
-import org.eclipse.xsd.XSDVariety;
-import org.eclipse.xsd.util.XSDConstants;
-
-public class XSDSimpleTypeDefinitionAdapter extends XSDTypeDefinitionAdapter
-{
- protected boolean readOnly;
- protected boolean changeReadOnlyField =false;
- protected HashMap deletedTypes = new HashMap();
- public Image getImage()
- {
- if (isReadOnly())
- {
- return XSDEditorPlugin.getPlugin().getIcon("obj16/simpletypedis_obj.gif"); //$NON-NLS-1$
- }
- return XSDEditorPlugin.getPlugin().getIcon("obj16/simpletype_obj.gif"); //$NON-NLS-1$
- }
-
- public String getDisplayName()
- {
- return 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 ? Messages._UI_LABEL_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))
- {
- try {
- String qName = baseTypeDefinition.getQName(xsdSimpleTypeDefinition);
- result.append(" : "); //$NON-NLS-1$
- result.append(qName);
- }
- catch (Exception e)
- {
- }
- }
- }
- else
- {
- XSDSimpleTypeDefinition itemTypeDefinition = xsdSimpleTypeDefinition.getItemTypeDefinition();
- if (itemTypeDefinition != null)
- {
- if (itemTypeDefinition.getName() != null)
- {
- result.append(" : "); //$NON-NLS-1$
- 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(" : "); //$NON-NLS-1$
- first = false;
- }
- else
- {
- result.append(" | "); //$NON-NLS-1$
- }
- result.append(memberTypeDefinition.getQName(xsdSimpleTypeDefinition));
- }
- else
- {
- break;
- }
- }
- }
- else if (result.length() == 0)
- {
- result.append(Messages._UI_LABEL_ABSENT);
- }
- }
- }
- }
-
- return result.toString();
- }
-
- public boolean hasChildren()
- {
- return true;
- }
-
- 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 isAnonymous();
- }
- return true;
- }
-
- public String[] getActions(Object object)
- {
- List list = new ArrayList();
- list.add(AddXSDEnumerationFacetAction.ID);
- list.add(BaseSelectionAction.SEPARATOR_ID);
- list.add(SetBaseTypeAction.ID);
- list.add(BaseSelectionAction.SEPARATOR_ID);
- list.add(DeleteAction.ID);
- list.add(BaseSelectionAction.SEPARATOR_ID);
- Object schema = getEditorSchema();
- XSDTypeDefinition typeDefinition = getXSDTypeDefinition();
- if (typeDefinition.getSchema() == schema)
- {
- XSDConcreteComponent container = typeDefinition.getContainer();
- if (container == schema || container instanceof XSDRedefine)
- {
- list.add(SetInputToGraphView.ID);
- }
- }
- else
- {
- list.add(OpenInNewEditor.ID);
- }
- list.add(BaseSelectionAction.SEPARATOR_ID);
- list.add(ShowPropertiesViewAction.ID);
-
- return (String [])list.toArray(new String[0]);
- }
-
- public boolean isAnonymous()
- {
- XSDSimpleTypeDefinition xsdSimpleTypeDefinition = (XSDSimpleTypeDefinition) target;
- EObject eContainer = xsdSimpleTypeDefinition.eContainer();
- return !(eContainer instanceof XSDSchema ||
- eContainer instanceof XSDRedefine);
- }
-
- public IADTObject getTopContainer()
- {
- return this;
- }
-
- public Command getDeleteCommand()
- {
- return new DeleteCommand(getXSDTypeDefinition());
- }
-
- public IModel getModel()
- {
- Adapter adapter = XSDAdapterFactory.getInstance().adapt(getXSDTypeDefinition().getSchema());
- return (IModel)adapter;
- }
-
- public ITreeElement[] getChildren()
- {
- List adapterList = new ArrayList();
- XSDSimpleTypeDefinition xsdSimpleTypeDefinition = (XSDSimpleTypeDefinition) target;
- List list = xsdSimpleTypeDefinition.getEnumerationFacets();
- populateAdapterList(list, adapterList);
- return (ITreeElement[]) adapterList.toArray(new ITreeElement[0]);
- }
- public boolean isReadOnly()
- {
- XSDSimpleTypeDefinition xsdSimpleTypeDefinition = (XSDSimpleTypeDefinition) target;
- if (hasSetReadOnlyField())
- {
- deletedTypes.put(xsdSimpleTypeDefinition.getName(), new Boolean(true));
- changeReadOnlyField = false;
- return readOnly;
- }
- else
- {
- if (deletedTypes!= null )
- {
- Boolean deleted = ((Boolean)deletedTypes.get(xsdSimpleTypeDefinition.getName()));
- if (deleted != null && deleted.booleanValue())
- return true;
- else return super.isReadOnly();
- }
- else
- return super.isReadOnly();
- }
-
-
- }
-
- public void setReadOnly(boolean readOnly) {
- this.readOnly = readOnly;
- }
-
- public boolean hasSetReadOnlyField() {
- return changeReadOnlyField;
- }
-
- public void setChangeReadOnlyField(boolean setReadOnlyField) {
- this.changeReadOnlyField = setReadOnlyField;
- }
-
- public void updateDeletedMap(String addComponent) {
- if (deletedTypes.get(addComponent) != null)
- deletedTypes.clear();
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDTypeDefinitionAdapter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDTypeDefinitionAdapter.java
deleted file mode 100644
index 7ecd548cc6..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDTypeDefinitionAdapter.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.adapters;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IActionProvider;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IGraphElement;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IType;
-import org.eclipse.xsd.XSDNamedComponent;
-import org.eclipse.xsd.XSDRedefine;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.XSDTypeDefinition;
-
-public abstract class XSDTypeDefinitionAdapter extends XSDBaseAdapter implements IType, IActionProvider, IGraphElement
-{
- public XSDTypeDefinition getXSDTypeDefinition()
- {
- return (XSDTypeDefinition)target;
- }
-
- public String getName()
- {
- EObject eContainer = getXSDTypeDefinition().eContainer();
- if (eContainer instanceof XSDSchema || eContainer instanceof XSDRedefine)
- {
- return getXSDTypeDefinition().getName();
- }
- else
- {
- if (eContainer instanceof XSDNamedComponent)
- {
- XSDNamedComponent ed = (XSDNamedComponent)eContainer;
- return "(" + ed.getName() + "Type)"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- 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/ui/internal/adapters/XSDVisitor.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDVisitor.java
deleted file mode 100644
index 5e2b5c15b4..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDVisitor.java
+++ /dev/null
@@ -1,247 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.adapters;
-
-import java.util.Iterator;
-import java.util.Stack;
-
-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.XSDRedefine;
-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()
- {
- circularDefinitionFound = false;
- visitedGroups = new Stack();
- }
-
- public boolean circularDefinitionFound = false;
- protected XSDSchema schema;
- protected Stack visitedGroups = new Stack();
-
- 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)
- {
- if ((visitedGroups.contains(modelGroupDef.getResolvedModelGroupDefinition().getModelGroup())))
- {
- circularDefinitionFound = true;
- return;
- }
- visitedGroups.push(modelGroupDef.getModelGroup());
- visitModelGroup(modelGroupDef.getModelGroup());
- visitedGroups.pop();
- }
- }
- else
- {
- XSDModelGroupDefinition resolvedGroupDef = modelGroupDef.getResolvedModelGroupDefinition();
- XSDModelGroup modelGroup = resolvedGroupDef.getModelGroup();
-
- if ((visitedGroups.contains(modelGroup)))
- {
- circularDefinitionFound = true;
- return;
- }
-
- visitedGroups.push(modelGroup);
- if (modelGroup != null)
- {
- visitModelGroup(modelGroup);
- }
- visitedGroups.pop();
- }
- }
-
- 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 visitRedefine(XSDRedefine redefine)
- {
-
- }
-
- 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/ui/internal/adapters/XSDVisitorForFields.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDVisitorForFields.java
deleted file mode 100644
index 48a0f34396..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDVisitorForFields.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/**
- *
- */
-package org.eclipse.wst.xsd.ui.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;
-import org.eclipse.xsd.XSDWildcard;
-
-public class XSDVisitorForFields extends XSDVisitor
-{
- public XSDVisitorForFields()
- {
- super();
- }
-
- 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);
- }
- }
- }
- }
- if (type.getAttributeWildcard() != null)
- {
- thingsWeNeedToListenTo.add(type.getAttributeWildcard());
- concreteComponentList.add(type.getAttributeWildcard());
- }
- super.visitComplexTypeDefinition(type);
- }
-
- public void visitComplexTypeContent(XSDSimpleTypeDefinition content)
- {
- thingsWeNeedToListenTo.add(content);
-
- super.visitComplexTypeContent(content);
- }
-
-
- public void visitModelGroupDefinition(XSDModelGroupDefinition modelGroupDef)
- {
- // listen to definition in case it changes
- XSDModelGroupDefinition resolvedModelGroupDef = modelGroupDef.getResolvedModelGroupDefinition();
- if (visitedGroups.contains(resolvedModelGroupDef.getModelGroup())) return;
-
- if (modelGroupDef.isModelGroupDefinitionReference())
- {
- // if it's a reference we need to listen to the reference incase it changes
- if (!thingsWeNeedToListenTo.contains(modelGroupDef))
- thingsWeNeedToListenTo.add(modelGroupDef);
- }
- 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);
- }
- }
- }
-
- XSDWildcard anyAttribute = attributeGroup.getAttributeWildcardContent();
- if (anyAttribute != null)
- {
- concreteComponentList.add(anyAttribute);
- thingsWeNeedToListenTo.add(anyAttribute);
- }
-
- }
-
- public void visitParticle(XSDParticle particle)
- {
- thingsWeNeedToListenTo.add(particle);
- super.visitParticle(particle);
- }
-
- public void visitWildcard(XSDWildcard wildcard)
- {
- concreteComponentList.add(wildcard);
- }
-
- 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/ui/internal/adapters/XSDWildcardAdapter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDWildcardAdapter.java
deleted file mode 100644
index 1d9c140ee9..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDWildcardAdapter.java
+++ /dev/null
@@ -1,237 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.adapters;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import org.eclipse.gef.commands.Command;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.BaseSelectionAction;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.DeleteAction;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.ShowPropertiesViewAction;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IActionProvider;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IGraphElement;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IField;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IModel;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IType;
-import org.eclipse.wst.xsd.ui.internal.common.commands.DeleteCommand;
-import org.eclipse.wst.xsd.ui.internal.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 XSDParticleAdapter implements IField, IActionProvider, IGraphElement
-{
-// public static final Image ANYELEMENT_ICON = XSDEditorPlugin.getPlugin().getIcon("obj16/XSDAny.gif"); //$NON-NLS-1$
-// public static final Image ANYELEMENT_DISABLED_ICON = XSDEditorPlugin.getPlugin().getIcon("obj16/XSDAny.gif"); //$NON-NLS-1$
-
- public XSDWildcardAdapter()
- {
-
- }
-
- public Image getImage()
- {
- XSDWildcard xsdWildcard = (XSDWildcard) target;
-
- if (xsdWildcard.eContainer() instanceof XSDParticle)
- {
- if (isReadOnly())
- {
- return XSDEditorPlugin.getPlugin().getIcon("obj16/XSDAnydis.gif"); //$NON-NLS-1$
- }
- return XSDEditorPlugin.getXSDImage("icons/XSDAny.gif"); //$NON-NLS-1$
- }
- else
- {
- if (isReadOnly())
- {
- return XSDEditorPlugin.getPlugin().getIcon("obj16/XSDAnyAttributedis.gif"); //$NON-NLS-1$
- }
- return XSDEditorPlugin.getXSDImage("icons/XSDAnyAttribute.gif"); //$NON-NLS-1$
- }
- }
-
- 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("*"); //$NON-NLS-1$
- }
- 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(".."); //$NON-NLS-1$
- if (max == XSDParticle.UNBOUNDED)
- {
- result.append("*"); //$NON-NLS-1$
- }
- else
- {
- result.append(String.valueOf(max));
- }
- }
- else
- // print default
- {
- result.append(".."); //$NON-NLS-1$
- int max = ((XSDParticle) xsdWildcard.getContainer()).getMaxOccurs();
- result.append(String.valueOf(max));
- }
- result.append("]"); //$NON-NLS-1$
- }
- }
- return result.toString();
-
- }
-
- public boolean hasChildren()
- {
- return false;
- }
-
- public Object getParent(Object object)
- {
- XSDWildcard xsdWildcard = (XSDWildcard) target;
- return xsdWildcard.getContainer();
- }
-
- public Command getDeleteCommand()
- {
- return new DeleteCommand((XSDWildcard) target);
- }
-
- public String getKind()
- {
- XSDWildcard xsdWildcard = (XSDWildcard) target;
- if (xsdWildcard.eContainer() instanceof XSDParticle)
- {
- return "element"; //$NON-NLS-1$
- }
- return "attribute";
- }
-
- public IModel getModel()
- {
- return null;
- }
-
- public String getName()
- {
- XSDWildcard xsdWildcard = (XSDWildcard) target;
- if (xsdWildcard.eContainer() instanceof XSDParticle)
- {
- return "any"; //$NON-NLS-1$
- }
- return "anyAttribute"; //$NON-NLS-1$
- }
-
- public IType getType()
- {
- return null;
- }
-
- public String getTypeName()
- {
- return ""; //$NON-NLS-1$
- }
-
- 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)
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Command getUpdateTypeNameCommand(String typeName, String quailifier)
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public boolean isGlobal()
- {
- return false;
- }
-
- public boolean isReference()
- {
- return false;
- }
-
- public String[] getActions(Object object)
- {
- Collection actionIDs = new ArrayList();
- actionIDs.add(DeleteAction.ID);
- actionIDs.add(BaseSelectionAction.SEPARATOR_ID);
- actionIDs.add(ShowPropertiesViewAction.ID);
- return (String [])actionIDs.toArray(new String[0]);
- }
-
- public IADTObject getTopContainer()
- {
- return getGlobalXSDContainer((XSDWildcard) target);
- }
-
- public boolean isFocusAllowed()
- {
- return false;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/commands/BaseDragAndDropCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/commands/BaseDragAndDropCommand.java
deleted file mode 100644
index 2edf44efaf..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/commands/BaseDragAndDropCommand.java
+++ /dev/null
@@ -1,441 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.commands;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.draw2d.Figure;
-import org.eclipse.draw2d.FreeformLayout;
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Polyline;
-import org.eclipse.draw2d.PositionConstants;
-import org.eclipse.draw2d.RoundedRectangle;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.PointList;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.EditPartViewer;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gef.editparts.ScalableRootEditPart;
-import org.eclipse.gef.requests.ChangeBoundsRequest;
-import org.eclipse.wst.xsd.ui.internal.actions.MoveXSDBaseAction;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.BaseFieldEditPart;
-import org.eclipse.wst.xsd.ui.internal.common.commands.BaseCommand;
-import org.eclipse.wst.xsd.ui.internal.design.editparts.ConnectableEditPart;
-import org.eclipse.wst.xsd.ui.internal.design.editparts.TargetConnectionSpacingFigureEditPart;
-import org.eclipse.wst.xsd.ui.internal.design.editparts.XSDBaseFieldEditPart;
-import org.eclipse.wst.xsd.ui.internal.design.figures.GenericGroupFigure;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.w3c.dom.Element;
-
-public abstract class BaseDragAndDropCommand extends BaseCommand
-{
- protected static int ABOVE_IS_CLOSER = 0;
- protected static int BELOW_IS_CLOSER = 1;
-
- protected EditPartViewer viewer;
- protected ChangeBoundsRequest request;
- protected boolean canExecute;
- protected GraphicalEditPart target;
-
- protected GraphicalEditPart leftSiblingEditPart;
- protected GraphicalEditPart rightSiblingEditPart;
- protected Point location;
-
- protected ConnectableEditPart parentEditPart;
- protected XSDConcreteComponent previousRefComponent = null, nextRefComponent = null, xsdComponentToDrag;
- protected XSDBaseFieldEditPart itemToDrag;
- protected Rectangle originalLocation;
- protected Polyline polyLine;
-
- protected MoveXSDBaseAction action;
- protected List targetSpacesList = new ArrayList();
- protected int closerSibling;
-
- public BaseDragAndDropCommand(EditPartViewer viewer, ChangeBoundsRequest request)
- {
- this.viewer = viewer;
- this.request = request;
- }
-
- protected abstract void setup();
-
- /**
- * Provides the DOM element associated with the parent XSD component.
- * This element is used in the the undo/redo mechanism.
- * @return the DOM element associated with the parent XSD component.
- */
- protected abstract Element getElement();
-
- public PointList getConnectionPoints(Rectangle draggedFigureBounds)
- {
- PointList pointList = null;
- if (target != null && itemToDrag != null && parentEditPart != null)
- {
- pointList = getConnectionPoints(parentEditPart, itemToDrag, draggedFigureBounds);
- }
- return pointList != null ? pointList : new PointList();
- }
-
- // This method supports the preview connection line function related to drag and drop
- //
- public PointList getConnectionPoints(ConnectableEditPart parentEditPart, BaseFieldEditPart childRefEditPart, Rectangle draggedFigureBounds)
- {
- PointList pointList = new PointList();
- int[] data = new int[1];
- Point a = getConnectionPoint(parentEditPart, childRefEditPart, data);
- if (a != null)
- {
- int draggedFigureBoundsY = draggedFigureBounds.y + draggedFigureBounds.height/2;
-
- pointList.addPoint(a);
-
- if (data[0] == 0) // insert between 2 items
- {
- int x = a.x + 5;
- pointList.addPoint(new Point(x, a.y));
- pointList.addPoint(new Point(x, draggedFigureBoundsY));
- pointList.addPoint(new Point(draggedFigureBounds.x, draggedFigureBoundsY));
- }
- else // insert at first or last position
- {
- pointList.addPoint(new Point(a.x, draggedFigureBoundsY));
- pointList.addPoint(new Point(draggedFigureBounds.x, draggedFigureBoundsY));
- }
- }
- return pointList;
- }
-
- // This method supports the preview connection line function related to drag and drop
- //
- protected Point getConnectionPoint(ConnectableEditPart parentEditPart, BaseFieldEditPart childRefEditPart, int[] data)
- {
- Point point = null;
- List childList = parentEditPart.getChildren();
- if (parentEditPart.getFigure() instanceof GenericGroupFigure && childList.size() > 0)
- {
- point = new Point();
-
- Rectangle r = getConnectedEditPartConnectionBounds(parentEditPart);
- point.x = r.x + r.width;
- point.y = r.y + r.height/2;
- }
- return point;
- }
-
- protected Rectangle getConnectedEditPartConnectionBounds(ConnectableEditPart editPart)
- {
- return getZoomedBounds(((GenericGroupFigure)editPart.getFigure()).getIconFigure().getBounds());
- }
-
- public void redo()
- {
- }
-
- public void undo()
- {
- }
-
- public void execute()
- {
- if (canExecute)
- {
- // Wrap the drag and drop operation for easy undo and redo.
- beginRecording(this.getElement());
- action.run();
- endRecording();
- }
- }
-
- public boolean canExecute()
- {
- return canExecute;
- }
-
- protected void commonSetup(List siblings, GraphicalEditPart movingEditPart)
- {
- closerSibling = ABOVE_IS_CLOSER;
- int pointerYLocation = location.y;
- int index;
-
- for (index = 0; index < siblings.size(); index++)
- {
- GraphicalEditPart sibling = (GraphicalEditPart) siblings.get(index);
- if (sibling instanceof BaseFieldEditPart)
- {
- int siblingYLocation = getZoomedBounds(sibling.getFigure().getBounds()).getCenter().y;
-
- if (siblingYLocation > pointerYLocation)
- {
- rightSiblingEditPart = sibling;
- if (index > 0)
- {
- leftSiblingEditPart = (GraphicalEditPart) siblings.get(index - 1);
- }
-
- if (leftSiblingEditPart != null && Math.abs(getZoomedBounds(leftSiblingEditPart.getFigure().getBounds()).getCenter().y - pointerYLocation) > Math.abs(siblingYLocation - pointerYLocation))
- {
- closerSibling = BELOW_IS_CLOSER;
- }
- break;
- }
- }
- }
-
- boolean isHandled = handleFirstAndLastDropTargets(index, siblings);
- if (!isHandled)
- handleOtherTargets(index);
-
- calculateLeftAndRightXSDComponents();
-
- xsdComponentToDrag = (XSDConcreteComponent) ((XSDBaseAdapter) itemToDrag.getModel()).getTarget();
- }
-
- protected void calculateLeftAndRightXSDComponents()
- {
- if (leftSiblingEditPart instanceof XSDBaseFieldEditPart)
- {
- Object leftModel = ((XSDBaseFieldEditPart) leftSiblingEditPart).getModel();
- previousRefComponent = null;
- if (leftModel instanceof XSDBaseAdapter)
- {
- XSDBaseAdapter leftAdapter = (XSDBaseAdapter) leftModel;
- previousRefComponent = (XSDConcreteComponent) leftAdapter.getTarget();
- }
- }
-
- if (rightSiblingEditPart instanceof XSDBaseFieldEditPart)
- {
- Object rightModel = ((XSDBaseFieldEditPart) rightSiblingEditPart).getModel();
- nextRefComponent = null;
- if (rightModel instanceof XSDBaseAdapter)
- {
- XSDBaseAdapter rightAdapter = (XSDBaseAdapter) rightModel;
- nextRefComponent = (XSDConcreteComponent) rightAdapter.getTarget();
- }
- }
- }
-
- protected boolean handleFirstAndLastDropTargets(int index, List siblings)
- {
- // Handle case where you drop to first position
- if (index == 0 && siblings.size() > 0)
- {
- leftSiblingEditPart = null;
- rightSiblingEditPart = (GraphicalEditPart) siblings.get(0);
- closerSibling = BELOW_IS_CLOSER;
- }
- // Handle case where you drop to last position
- else if (index > 0 && index == siblings.size())
- {
- leftSiblingEditPart = (GraphicalEditPart) siblings.get(index - 1);
- rightSiblingEditPart = null;
- }
- return false;
- }
-
- protected void handleOtherTargets(int index)
- {
- int in = 0;
- ConnectableEditPart previousModelEditPart = null;
- for (Iterator i = targetSpacesList.iterator(); i.hasNext();)
- {
- Object o = i.next();
- previousModelEditPart = parentEditPart;
- TargetConnectionSpacingFigureEditPart sp = (TargetConnectionSpacingFigureEditPart) o;
- if (sp.getParent() instanceof ConnectableEditPart)
- parentEditPart = (ConnectableEditPart)sp.getParent();
- else
- parentEditPart = null;
- in++;
- if (in > index)
- {
- if (closerSibling == ABOVE_IS_CLOSER)
- {
- parentEditPart = previousModelEditPart;
- }
- break;
- }
- }
- }
-
- protected List calculateFieldEditParts()
- {
- List list = target.getParent().getChildren();
- List listOfFields = new ArrayList();
- for (Iterator i = list.iterator(); i.hasNext();)
- {
- Object o = i.next();
- if (o instanceof BaseFieldEditPart)
- {
- listOfFields.add(o);
- }
- }
- return listOfFields;
- }
-
- protected PointList drawLines(Polyline polyLine)
- {
- PointList pointList = new PointList();
-
- if (leftSiblingEditPart != null)
- {
- Rectangle leftRectangle = getZoomedBounds(leftSiblingEditPart.getFigure().getBounds());
- int xCoord = leftRectangle.x;
- int yCoord = leftRectangle.y;
- int height = leftRectangle.height;
- int width = leftRectangle.width;
-
- // Draw left end line
- addLineToPolyline(polyLine, xCoord, yCoord + height + 3, xCoord, yCoord + height - 3);
- addLineToPolyline(polyLine, xCoord, yCoord + height - 3, xCoord, yCoord + height);
-
- // Draw horizontal line
- addLineToPolyline(polyLine, xCoord, yCoord + height, xCoord + width, yCoord + height);
-
- // Draw right end line
- addLineToPolyline(polyLine, xCoord + width, yCoord + height, xCoord + width, yCoord + height - 3);
- addLineToPolyline(polyLine, xCoord + width, yCoord + height, xCoord + width, yCoord + height + 3);
- }
- else if (rightSiblingEditPart != null)
- {
- Rectangle rightRectangle = getZoomedBounds(rightSiblingEditPart.getFigure().getBounds());
- int xCoord = rightRectangle.x;
- int yCoord = rightRectangle.y;
- int width = rightRectangle.width;
-
- // Draw left end line
- addLineToPolyline(polyLine, xCoord, yCoord + 3, xCoord, yCoord - 3);
- addLineToPolyline(polyLine, xCoord, yCoord - 3, xCoord, yCoord);
-
- // Draw horizontal line
- addLineToPolyline(polyLine, xCoord, yCoord, xCoord + width, yCoord);
-
- // Draw right end line
- addLineToPolyline(polyLine, xCoord + width, yCoord, xCoord + width, yCoord - 3);
- addLineToPolyline(polyLine, xCoord + width, yCoord, xCoord + width, yCoord + 3);
- }
-
- return pointList;
- }
-
- protected Polyline addLineToPolyline(Polyline polyline, int x1, int y1, int x2, int y2)
- {
- polyline.addPoint(new Point(x1, y1));
- polyline.addPoint(new Point(x2, y2));
-
- return polyline;
- }
-
- public IFigure getFeedbackFigure()
- {
- Figure panel = new Figure();
- panel.setLayoutManager(new FreeformLayout());
- panel.setOpaque(false);
-
- Polyline feedbackFigure = new Polyline();
- feedbackFigure.setLineWidth(2);
- drawLines(feedbackFigure);
- originalLocation = new Rectangle(feedbackFigure.getBounds());
- panel.add(feedbackFigure);
-
- polyLine = new Polyline();
- polyLine.setLineStyle(Graphics.LINE_DASHDOT);
- polyLine.setLineWidth(1);
- panel.add(polyLine);
-
- panel.setBounds(originalLocation);
-
- addConnectorToParent(panel);
-
- if (parentEditPart != null && parentEditPart.getFigure() instanceof GenericGroupFigure)
- {
- GenericGroupFigure fig = (GenericGroupFigure)parentEditPart.getFigure();
- Rectangle iconBounds = getZoomedBounds(fig.getIconFigure().getBounds());
- RoundedRectangle roundedRectangle = new RoundedRectangle();
- roundedRectangle.setFill(false);
- roundedRectangle.setOpaque(true);
-// roundedRectangle.setBounds(new Rectangle(iconBounds.x, iconBounds.y, iconBounds.width - 1, iconBounds.height - 1));
- roundedRectangle.setBounds(iconBounds);
- panel.add(roundedRectangle);
- }
- return panel;
- }
-
- protected void addConnectorToParent(IFigure p)
- {
- Rectangle r = originalLocation.getCopy();
- Rectangle pBounds = r.getCopy();
- PointList pointList = getConnectionPoints(r);
-
- if (pointList != null && pointList.size() > 0)
- {
- polyLine.setPoints(pointList);
- Point firstPoint = pointList.getFirstPoint();
- if (firstPoint != null)
- {
- pBounds = pBounds.getUnion(new Rectangle(firstPoint.x, firstPoint.y, 1, 1));
- }
- }
-
- if (parentEditPart != null)
- {
- if (parentEditPart.getFigure() instanceof GenericGroupFigure)
- {
- GenericGroupFigure fig = (GenericGroupFigure)parentEditPart.getFigure();
- Rectangle iconBounds = getZoomedBounds(fig.getIconFigure().getBounds());
- pBounds = pBounds.getUnion(iconBounds);
- }
- }
-
- p.setBounds(pBounds);
- p.validate();
- }
-
- public Point getZoomedPoint(Point p)
- {
- double factor = ((ScalableRootEditPart)viewer.getRootEditPart()).getZoomManager().getZoom();
-
- int x = (int)Math.round(p.x * factor);
- int y = (int)Math.round(p.y * factor);
-
- return new Point(x, y);
- }
-
- public Rectangle getZoomedBounds(Rectangle r)
- {
- double factor = ((ScalableRootEditPart)viewer.getRootEditPart()).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);
- }
-
- protected void handleKeyboardDragAndDrop(XSDBaseFieldEditPart leftField, XSDBaseFieldEditPart rightField, int direction)
- {
- target = leftField;
- if (direction == PositionConstants.SOUTH)
- {
- if (itemToDrag == target)
- return;
- target = rightField;
- }
- this.location = null;
- if (target != null)
- this.location = target.getFigure().getBounds().getCenter();
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/commands/XSDAttributeDragAndDropCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/commands/XSDAttributeDragAndDropCommand.java
deleted file mode 100644
index 7c09eb072b..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/commands/XSDAttributeDragAndDropCommand.java
+++ /dev/null
@@ -1,259 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.commands;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.draw2d.PositionConstants;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPartViewer;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gef.requests.ChangeBoundsRequest;
-import org.eclipse.wst.xsd.ui.internal.actions.MoveXSDAttributeAction;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDAttributeDeclarationAdapter;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDWildcardAdapter;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.BaseFieldEditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.CompartmentEditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.ComplexTypeEditPart;
-import org.eclipse.wst.xsd.ui.internal.design.editparts.AttributeGroupDefinitionEditPart;
-import org.eclipse.wst.xsd.ui.internal.design.editparts.TargetConnectionSpacingFigureEditPart;
-import org.eclipse.wst.xsd.ui.internal.design.editparts.XSDAttributesForAnnotationEditPart;
-import org.eclipse.wst.xsd.ui.internal.design.editparts.XSDBaseFieldEditPart;
-import org.eclipse.wst.xsd.ui.internal.design.figures.GenericGroupFigure;
-import org.eclipse.wst.xsd.ui.internal.editor.Messages;
-import org.eclipse.xsd.XSDAttributeDeclaration;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDWildcard;
-import org.w3c.dom.Element;
-
-public class XSDAttributeDragAndDropCommand extends BaseDragAndDropCommand
-{
- public XSDAttributeDragAndDropCommand(EditPartViewer viewer, ChangeBoundsRequest request, GraphicalEditPart target, XSDBaseFieldEditPart itemToDrag, Point location)
- {
- super(viewer, request);
- setLabel(Messages._UI_ACTION_DRAG_DROP_ATTRIBUTE);
- this.target = target;
- this.itemToDrag = itemToDrag;
- this.location = location;
- setup();
- }
-
- public XSDAttributeDragAndDropCommand(XSDBaseFieldEditPart itemToDrag, XSDBaseFieldEditPart leftField, XSDBaseFieldEditPart rightField, int direction)
- {
- super(itemToDrag.getViewer(), null);
- setLabel(Messages._UI_ACTION_DRAG_DROP_ATTRIBUTE);
- this.itemToDrag = itemToDrag;
- canExecute = false;
- handleKeyboardDragAndDrop(leftField, rightField, direction);
- }
-
- protected void handleKeyboardDragAndDrop(XSDBaseFieldEditPart leftField, XSDBaseFieldEditPart rightField, int direction)
- {
- super.handleKeyboardDragAndDrop(leftField, rightField, direction);
- if (direction == PositionConstants.NORTH)
- {
- if (target == null)
- {
- target = rightField;
- this.location = target.getFigure().getBounds().getTop();
- }
- else if (!(leftField.getModel() instanceof XSDAttributeDeclarationAdapter)
- || leftField.getModel() instanceof XSDWildcardAdapter)
- {
- target = rightField;
- this.location = target.getFigure().getBounds().getTop();
- }
- }
- if (location == null) return;
- setup();
- }
-
- protected void setup()
- {
- canExecute = false;
-
- // Drop target is attribute group ref
- if (target instanceof AttributeGroupDefinitionEditPart)
- {
- parentEditPart = (AttributeGroupDefinitionEditPart) target;
- if (((GenericGroupFigure) parentEditPart.getFigure()).getIconFigure().getBounds().contains(location))
- {
- xsdComponentToDrag = (XSDConcreteComponent) ((XSDAttributeDeclarationAdapter) itemToDrag.getModel()).getTarget();
- action = new MoveXSDAttributeAction(((AttributeGroupDefinitionEditPart) parentEditPart).getXSDAttributeGroupDefinition(), xsdComponentToDrag, null, null);
- canExecute = action.canMove();
- }
- }
- else if (target instanceof BaseFieldEditPart)
- {
- targetSpacesList = new ArrayList();
- // Calculate the list of all sibling field edit parts;
- List targetEditPartSiblings = calculateFieldEditParts();
- calculateAttributeGroupList();
-
- // Get 'left' and 'right' siblings
- doDrop(targetEditPartSiblings, itemToDrag);
- }
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.wst.xsd.ui.internal.commands.BaseDragAndDropCommand#getElement()
- */
- protected Element getElement()
- {
- XSDAttributeDeclarationAdapter adapter = (XSDAttributeDeclarationAdapter) itemToDrag.getModel();
- XSDAttributeDeclaration target = (XSDAttributeDeclaration)adapter.getTarget();
- XSDConcreteComponent parent = (XSDConcreteComponent)target.eContainer();
- return parent.getElement();
- }
-
- protected void doDrop(List siblings, GraphicalEditPart movingEditPart)
- {
- commonSetup(siblings, movingEditPart);
-
- if ((previousRefComponent instanceof XSDAttributeDeclaration || previousRefComponent instanceof XSDWildcard)
- && (nextRefComponent instanceof XSDAttributeDeclaration || nextRefComponent instanceof XSDWildcard))
- {
- XSDConcreteComponent parent = previousRefComponent.getContainer().getContainer();
- if (closerSibling == BELOW_IS_CLOSER)
- {
- parent = nextRefComponent.getContainer().getContainer();
- }
- action = new MoveXSDAttributeAction(parent, xsdComponentToDrag, previousRefComponent, nextRefComponent);
- }
- else if (previousRefComponent == null && (nextRefComponent instanceof XSDAttributeDeclaration || nextRefComponent instanceof XSDWildcard))
- {
- XSDConcreteComponent parent = nextRefComponent.getContainer().getContainer();
- if (closerSibling == ABOVE_IS_CLOSER)
- {
- if (leftSiblingEditPart == null)
- {
- action = new MoveXSDAttributeAction(parent, xsdComponentToDrag, previousRefComponent, nextRefComponent);
- }
- else if (parentEditPart != null)
- {
- action = new MoveXSDAttributeAction(parentEditPart.getXSDConcreteComponent(), xsdComponentToDrag, previousRefComponent, nextRefComponent);
- }
- }
- else
- {
- action = new MoveXSDAttributeAction(parent, xsdComponentToDrag, previousRefComponent, nextRefComponent);
- }
- }
- else if (previousRefComponent instanceof XSDAttributeDeclaration && nextRefComponent == null)
- {
- XSDConcreteComponent parent = previousRefComponent.getContainer().getContainer();
- if (closerSibling == ABOVE_IS_CLOSER)
- {
- action = new MoveXSDAttributeAction(parent, xsdComponentToDrag, previousRefComponent, nextRefComponent);
- }
- else
- {
- if (rightSiblingEditPart == null)
- {
- action = new MoveXSDAttributeAction(parent, xsdComponentToDrag, previousRefComponent, nextRefComponent);
- }
- else
- {
- action = new MoveXSDAttributeAction(parent, xsdComponentToDrag, previousRefComponent, nextRefComponent);
- }
- }
- }
-
- if (action != null)
- canExecute = action.canMove();
- }
-
-
- // Attribute Group related helper method
-
- protected void calculateAttributeGroupList()
- {
- EditPart editPart = target;
- while (editPart != null)
- {
- if (editPart instanceof ComplexTypeEditPart)
- {
- List list = editPart.getChildren();
- for (Iterator i = list.iterator(); i.hasNext();)
- {
- Object child = i.next();
- if (child instanceof CompartmentEditPart)
- {
- List compartmentList = ((CompartmentEditPart) child).getChildren();
- for (Iterator it = compartmentList.iterator(); it.hasNext();)
- {
- Object obj = it.next();
- if (obj instanceof XSDAttributesForAnnotationEditPart)
- {
- XSDAttributesForAnnotationEditPart groups = (XSDAttributesForAnnotationEditPart) obj;
- List groupList = groups.getChildren();
- for (Iterator iter = groupList.iterator(); iter.hasNext();)
- {
- Object groupChild = iter.next();
- if (groupChild instanceof TargetConnectionSpacingFigureEditPart)
- {
- targetSpacesList.add(groupChild);
- }
- else if (groupChild instanceof AttributeGroupDefinitionEditPart)
- {
- getAttributeGroupEditParts((AttributeGroupDefinitionEditPart) groupChild);
- }
- }
- }
- }
- }
- }
- }
- editPart = editPart.getParent();
- }
-
- }
-
- // Attribute Group related helper method
-
- protected List getAttributeGroupEditParts(AttributeGroupDefinitionEditPart attributeGroupEditPart)
- {
- List groupList = new ArrayList();
- List list = attributeGroupEditPart.getChildren();
- for (Iterator i = list.iterator(); i.hasNext();)
- {
- Object object = i.next();
- if (object instanceof TargetConnectionSpacingFigureEditPart)
- {
- targetSpacesList.add(object);
- }
- else if (object instanceof AttributeGroupDefinitionEditPart)
- {
- AttributeGroupDefinitionEditPart groupRef = (AttributeGroupDefinitionEditPart) object;
- List groupRefChildren = groupRef.getChildren();
- for (Iterator it = groupRefChildren.iterator(); it.hasNext();)
- {
- Object o = it.next();
- if (o instanceof TargetConnectionSpacingFigureEditPart)
- {
- targetSpacesList.add(o);
- }
- else if (o instanceof AttributeGroupDefinitionEditPart)
- {
- AttributeGroupDefinitionEditPart aGroup = (AttributeGroupDefinitionEditPart) o;
- groupList.add(aGroup);
- groupList.addAll(getAttributeGroupEditParts(aGroup));
- }
- }
- }
- }
- return groupList;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/commands/XSDElementDragAndDropCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/commands/XSDElementDragAndDropCommand.java
deleted file mode 100644
index 95f45b301e..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/commands/XSDElementDragAndDropCommand.java
+++ /dev/null
@@ -1,311 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.commands;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.draw2d.PositionConstants;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPartViewer;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gef.requests.ChangeBoundsRequest;
-import org.eclipse.wst.xsd.ui.internal.actions.MoveXSDElementAction;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDElementDeclarationAdapter;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDWildcardAdapter;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.BaseFieldEditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.CompartmentEditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.ComplexTypeEditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.StructureEditPart;
-import org.eclipse.wst.xsd.ui.internal.design.editparts.ModelGroupDefinitionReferenceEditPart;
-import org.eclipse.wst.xsd.ui.internal.design.editparts.ModelGroupEditPart;
-import org.eclipse.wst.xsd.ui.internal.design.editparts.TargetConnectionSpacingFigureEditPart;
-import org.eclipse.wst.xsd.ui.internal.design.editparts.XSDBaseFieldEditPart;
-import org.eclipse.wst.xsd.ui.internal.design.editparts.XSDGroupsForAnnotationEditPart;
-import org.eclipse.wst.xsd.ui.internal.design.figures.GenericGroupFigure;
-import org.eclipse.wst.xsd.ui.internal.editor.Messages;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDElementDeclaration;
-import org.eclipse.xsd.XSDModelGroup;
-import org.eclipse.xsd.XSDWildcard;
-import org.w3c.dom.Element;
-
-
-public class XSDElementDragAndDropCommand extends BaseDragAndDropCommand
-{
- protected ModelGroupEditPart topMostGroup;
-
- public XSDElementDragAndDropCommand(EditPartViewer viewer, ChangeBoundsRequest request, GraphicalEditPart target, XSDBaseFieldEditPart itemToDrag, Point location)
- {
- super(viewer, request);
- setLabel(Messages._UI_ACTION_DRAG_DROP_ELEMENT);
- this.target = target;
- this.itemToDrag = itemToDrag;
- this.location = location;
- setup();
- }
-
- public XSDElementDragAndDropCommand(XSDBaseFieldEditPart itemToDrag, XSDBaseFieldEditPart leftField, XSDBaseFieldEditPart rightField, int direction)
- {
- super(itemToDrag.getViewer(), null);
- setLabel(Messages._UI_ACTION_DRAG_DROP_ELEMENT);
- this.itemToDrag = itemToDrag;
- canExecute = false;
- handleKeyboardDragAndDrop(leftField, rightField, direction);
- }
-
- protected void handleKeyboardDragAndDrop(XSDBaseFieldEditPart leftField, XSDBaseFieldEditPart rightField, int direction)
- {
- super.handleKeyboardDragAndDrop(leftField, rightField, direction);
- if (direction == PositionConstants.NORTH)
- {
- if (target == null)
- {
- target = rightField;
- this.location = target.getFigure().getBounds().getTop();
- }
- else if (!(leftField.getModel() instanceof XSDElementDeclarationAdapter)
- || leftField.getModel() instanceof XSDWildcardAdapter)
- {
- target = rightField;
- this.location = target.getFigure().getBounds().getTop();
- }
- }
- if (location == null) return;
- setup();
- }
-
- protected void setup()
- {
- canExecute = false;
-
- // Drop target is model group
- if (target instanceof ModelGroupEditPart)
- {
- parentEditPart = (ModelGroupEditPart) target;
- if (((GenericGroupFigure) parentEditPart.getFigure()).getIconFigure().getBounds().contains(location))
- {
- xsdComponentToDrag = (XSDConcreteComponent) ((XSDElementDeclarationAdapter) itemToDrag.getModel()).getTarget();
- action = new MoveXSDElementAction(((ModelGroupEditPart) target).getXSDModelGroup(), xsdComponentToDrag, null, null);
- canExecute = action.canMove();
- }
- }
- else if (target instanceof BaseFieldEditPart)
- {
- targetSpacesList = new ArrayList();
- // Calculate the list of all sibling field edit parts;
- List targetEditPartSiblings = calculateFieldEditParts();
- calculateModelGroupList();
-
- doDrop(targetEditPartSiblings, itemToDrag);
- }
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.wst.xsd.ui.internal.commands.BaseDragAndDropCommand#getElement()
- */
- protected Element getElement()
- {
- XSDElementDeclarationAdapter adapter = (XSDElementDeclarationAdapter) itemToDrag.getModel();
- XSDElementDeclaration target = (XSDElementDeclaration)adapter.getTarget();
- XSDConcreteComponent parent = (XSDConcreteComponent)target.eContainer();
- return parent.getElement();
- }
-
- protected void doDrop(List siblings, GraphicalEditPart movingEditPart)
- {
- commonSetup(siblings, movingEditPart);
-
- // Can common this code up with XSDAttributeDragAndDropCommand...
- if ((previousRefComponent instanceof XSDElementDeclaration || previousRefComponent instanceof XSDWildcard)
- && (nextRefComponent instanceof XSDElementDeclaration || nextRefComponent instanceof XSDWildcard))
- {
- XSDModelGroup modelGroup = (XSDModelGroup) previousRefComponent.getContainer().getContainer();
- if (parentEditPart != null)
- modelGroup = ((ModelGroupEditPart) parentEditPart).getXSDModelGroup();
- action = new MoveXSDElementAction(modelGroup, xsdComponentToDrag, previousRefComponent, nextRefComponent);
- }
- else if (previousRefComponent == null && (nextRefComponent instanceof XSDElementDeclaration || nextRefComponent instanceof XSDWildcard))
- {
- if (closerSibling == ABOVE_IS_CLOSER)
- {
- if (leftSiblingEditPart == null)
- {
- action = new MoveXSDElementAction(topMostGroup.getXSDModelGroup(), xsdComponentToDrag, null, null, false);
- }
- else if (parentEditPart != null)
- {
- action = new MoveXSDElementAction(((ModelGroupEditPart) parentEditPart).getXSDModelGroup(), xsdComponentToDrag, previousRefComponent, nextRefComponent);
- }
- }
- else
- {
- XSDModelGroup modelGroup = (XSDModelGroup) nextRefComponent.getContainer().getContainer();
- action = new MoveXSDElementAction(modelGroup, xsdComponentToDrag, previousRefComponent, nextRefComponent);
- }
- }
- else if ((previousRefComponent instanceof XSDElementDeclaration || previousRefComponent instanceof XSDWildcard)
- && nextRefComponent == null)
- {
- XSDModelGroup modelGroup = (XSDModelGroup)previousRefComponent.getContainer().getContainer();
- if (parentEditPart != null)
- modelGroup = ((ModelGroupEditPart) parentEditPart).getXSDModelGroup();
- if (closerSibling == ABOVE_IS_CLOSER)
- {
- action = new MoveXSDElementAction(modelGroup, xsdComponentToDrag, previousRefComponent, nextRefComponent);
- }
- else
- {
- if (rightSiblingEditPart == null)
- {
- action = new MoveXSDElementAction(topMostGroup.getXSDModelGroup(), xsdComponentToDrag, null, null, true);
- }
- else
- {
- action = new MoveXSDElementAction(modelGroup, xsdComponentToDrag, previousRefComponent, nextRefComponent);
- }
- }
- }
-
- if (action != null)
- canExecute = action.canMove();
- }
-
- /**
- * overrides base
- */
- protected boolean handleFirstAndLastDropTargets(int index, List siblings)
- {
- // This boolean is to handle the Top and Bottom drop targets for which we want to drop
- // to the top most model group
- // TODO: I need to rearrange this code better
- boolean isHandled = false;
- int pointerYLocation = location.y;
- // We need to find the parent editpart, which is the model group
- // Handle case where you drop to first position
- if (index == 0 && siblings.size() > 0)
- {
- leftSiblingEditPart = null;
- rightSiblingEditPart = (GraphicalEditPart) siblings.get(0);
- int siblingYLocation = getZoomedBounds(rightSiblingEditPart.getFigure().getBounds()).getCenter().y;
- closerSibling = BELOW_IS_CLOSER;
- if (Math.abs(pointerYLocation - siblingYLocation) > getZoomedBounds(rightSiblingEditPart.getFigure().getBounds()).height / 4)
- {
- isHandled = true;
- parentEditPart = topMostGroup;
- if (topMostGroup != null)
- closerSibling = ABOVE_IS_CLOSER;
- }
- }
- // Handle case where you drop to last position
- if (index > 0 && index == siblings.size())
- {
- leftSiblingEditPart = (GraphicalEditPart) siblings.get(index - 1);
- int siblingYLocation = getZoomedBounds(leftSiblingEditPart.getFigure().getBounds()).getCenter().y;
- if (Math.abs(pointerYLocation - siblingYLocation) > getZoomedBounds(leftSiblingEditPart.getFigure().getBounds()).height / 4)
- {
- isHandled = true;
- parentEditPart = topMostGroup;
- if (topMostGroup != null)
- closerSibling = BELOW_IS_CLOSER;
- }
- }
- return isHandled;
- }
-
- // Methods specific to element as drag source
-
- // Model Group related helper method
- protected void calculateModelGroupList()
- {
- EditPart editPart = target;
- while (editPart != null)
- {
- if (editPart instanceof ModelGroupEditPart)
- {
- getModelGroupEditParts((ModelGroupEditPart) editPart);
- }
- else if (editPart instanceof ComplexTypeEditPart || editPart instanceof StructureEditPart)
- {
- boolean foundTop = false;
- List list = editPart.getChildren();
- for (Iterator i = list.iterator(); i.hasNext();)
- {
- Object child = i.next();
- if (child instanceof CompartmentEditPart)
- {
- List compartmentList = ((CompartmentEditPart) child).getChildren();
- for (Iterator it = compartmentList.iterator(); it.hasNext();)
- {
- Object obj = it.next();
- if (obj instanceof XSDGroupsForAnnotationEditPart)
- {
- XSDGroupsForAnnotationEditPart groups = (XSDGroupsForAnnotationEditPart) obj;
- List groupList = groups.getChildren();
- for (Iterator iter = groupList.iterator(); iter.hasNext();)
- {
- Object groupChild = iter.next();
- if (groupChild instanceof ModelGroupEditPart)
- {
- if (!foundTop)
- {
- foundTop = true;
- topMostGroup = (ModelGroupEditPart) groupChild;
- }
- getModelGroupEditParts((ModelGroupEditPart) groupChild);
- }
- }
- }
- }
- }
- }
- }
- editPart = editPart.getParent();
- }
- }
-
- // Model Group related helper method
-
- protected List getModelGroupEditParts(ModelGroupEditPart modelGroupEditPart)
- {
- List modelGroupList = new ArrayList();
- List list = modelGroupEditPart.getChildren();
- for (Iterator i = list.iterator(); i.hasNext();)
- {
- Object object = i.next();
- if (object instanceof TargetConnectionSpacingFigureEditPart)
- {
- targetSpacesList.add(object);
- }
- else if (object instanceof ModelGroupDefinitionReferenceEditPart)
- {
- ModelGroupDefinitionReferenceEditPart groupRef = (ModelGroupDefinitionReferenceEditPart) object;
- List groupRefChildren = groupRef.getChildren();
- for (Iterator it = groupRefChildren.iterator(); it.hasNext();)
- {
- Object o = it.next();
- if (o instanceof ModelGroupEditPart)
- {
- getModelGroupEditParts((ModelGroupEditPart) o);
- }
- }
- }
- else if (object instanceof ModelGroupEditPart)
- {
- getModelGroupEditParts((ModelGroupEditPart) object);
- }
- }
- return modelGroupList;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/AttributeGroupDefinitionEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/AttributeGroupDefinitionEditPart.java
deleted file mode 100644
index f5bbd30fc7..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/AttributeGroupDefinitionEditPart.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.design.editparts;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDAdapterFactory;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDAttributeGroupDefinitionAdapter;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.BaseEditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.CenteredConnectionAnchor;
-import org.eclipse.wst.xsd.ui.internal.design.editparts.model.TargetConnectionSpaceFiller;
-import org.eclipse.wst.xsd.ui.internal.design.figures.GenericGroupFigure;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-import org.eclipse.xsd.XSDAttributeGroupContent;
-import org.eclipse.xsd.XSDAttributeGroupDefinition;
-import org.eclipse.xsd.XSDAttributeUse;
-
-public class AttributeGroupDefinitionEditPart extends ConnectableEditPart
-{
- ReferenceConnection figure;
- GenericGroupFigure groupFigure;
- 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()
- {
- groupFigure = new GenericGroupFigure();
- XSDAttributeGroupDefinitionAdapter adapter = (XSDAttributeGroupDefinitionAdapter) getModel();
- groupFigure.getIconFigure().image = adapter.getImage();
- Label toolTipsLabel = new Label();
- toolTipsLabel.setText(XSDEditorPlugin.getXSDString("_UI_PAGE_HEADING_ATTRIBUTEGROUP_REF"));
- groupFigure.setToolTip(toolTipsLabel);
- return groupFigure;
- }
-
- 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 if (attrGroupContent instanceof XSDAttributeUse)
- {
- list.add(new TargetConnectionSpaceFiller((XSDBaseAdapter)XSDAdapterFactory.getInstance().adapt(((XSDAttributeUse)attrGroupContent).getAttributeDeclaration())));
- }
- 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);
- figure = connectionFigure;
- return connectionFigure;
- }
-
- public String getReaderText()
- {
- String text = ((Label) groupFigure.getToolTip()).getText();
- return text;
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/CategoryEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/CategoryEditPart.java
deleted file mode 100644
index bc8008e0ca..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/CategoryEditPart.java
+++ /dev/null
@@ -1,248 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.design.editparts;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.draw2d.Figure;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.MarginBorder;
-import org.eclipse.draw2d.PositionConstants;
-import org.eclipse.draw2d.RectangleFigure;
-import org.eclipse.draw2d.ScrollPane;
-import org.eclipse.draw2d.ToolbarLayout;
-import org.eclipse.draw2d.Viewport;
-import org.eclipse.draw2d.ViewportLayout;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
-import org.eclipse.swt.SWT;
-import org.eclipse.wst.xsd.ui.internal.adapters.CategoryAdapter;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.BaseEditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.EditPartNavigationHandlerUtil;
-import org.eclipse.wst.xsd.ui.internal.adt.typeviz.design.figures.HeadingFigure;
-import org.eclipse.wst.xsd.ui.internal.adt.typeviz.design.figures.RoundedLineBorder;
-import org.eclipse.wst.xsd.ui.internal.design.editpolicies.SelectionHandlesEditPolicyImpl;
-import org.eclipse.wst.xsd.ui.internal.design.layouts.ContainerLayout;
-
-public class CategoryEditPart extends BaseEditPart
-{
- protected SelectionHandlesEditPolicyImpl selectionHandlesEditPolicy;
- protected Figure outerPane;
- HeadingFigure headingFigure;
- protected ScrollPane scrollpane;
- protected int minimumHeight = 400;
-
- public int getType()
- {
- return ((CategoryAdapter) getModel()).getGroupType();
- }
-
- protected IFigure createFigure()
- {
- outerPane = new Figure();
- outerPane.setBorder(new RoundedLineBorder(1, 6));
-
- createHeadingFigure();
-
- int minHeight = SWT.DEFAULT;
- switch (getType())
- {
- case CategoryAdapter.DIRECTIVES:
- {
- minHeight = 80;
- break;
- }
- case CategoryAdapter.ATTRIBUTES:
- case CategoryAdapter.GROUPS:
- {
- minHeight = 100;
- break;
- }
- }
-
- final int theMinHeight = minHeight;
-
- ToolbarLayout outerLayout = new ToolbarLayout(false)
- {
- protected Dimension calculatePreferredSize(IFigure parent, int width, int height)
- {
- Dimension d = super.calculatePreferredSize(parent, width, height);
- d.union(new Dimension(250, theMinHeight));
- return d;
- }
- };
- outerLayout.setStretchMinorAxis(true);
- outerPane.setLayoutManager(outerLayout);
-
- RectangleFigure line = new RectangleFigure()
- {
- public Dimension getPreferredSize(int wHint, int hHint)
- {
- Dimension d = super.getPreferredSize(wHint, hHint);
- d.width += 20;
- d.height = 1;
- return d;
- }
- };
- ToolbarLayout lineLayout = new ToolbarLayout(false);
- lineLayout.setVertical(true);
- lineLayout.setStretchMinorAxis(true);
- line.setLayoutManager(lineLayout);
- outerPane.add(line);
-
- scrollpane = new ScrollPane();
- scrollpane.setVerticalScrollBarVisibility(ScrollPane.AUTOMATIC); // ScrollPane.ALWAYS);
- outerPane.add(scrollpane);
-
- Figure pane = new Figure();
- pane.setBorder(new MarginBorder(5, 8, 5, 8));
- ContainerLayout layout = new ContainerLayout();
- layout.setHorizontal(false);
- layout.setSpacing(0);
- pane.setLayoutManager(layout);
-
- Viewport viewport = new Viewport();
- viewport.setContentsTracksHeight(true);
- ViewportLayout viewportLayout = new ViewportLayout()
- {
- protected Dimension calculatePreferredSize(IFigure parent, int width, int height)
- {
- Dimension d = super.calculatePreferredSize(parent, width, height);
- if (theMinHeight > 0)
- d.height = Math.min(d.height, theMinHeight);
- else
- {
- double factor = getZoomManager().getZoom();
- int scaledHeight = (int)Math.round((getViewer().getControl().getBounds().height - minimumHeight) / factor); // adjust for other categories and spaces
- d.height = Math.max(250, scaledHeight);
- }
- d.width = Math.min(d.width, 300);
- return d;
- }
- };
- viewport.setLayoutManager(viewportLayout);
-
- scrollpane.setViewport(viewport);
- scrollpane.setContents(pane);
-
- return outerPane;
- }
-
- protected void createHeadingFigure()
- {
- headingFigure = new HeadingFigure();
- outerPane.add(headingFigure);
- headingFigure.getLabel().setText(((CategoryAdapter) getModel()).getText());
- headingFigure.getLabel().setIcon(((CategoryAdapter) getModel()).getImage());
- }
-
- public void refreshVisuals()
- {
- super.refreshVisuals();
-
- RoundedLineBorder border = (RoundedLineBorder) outerPane.getBorder();
- border.setWidth(isSelected ? 2 : 1);
- headingFigure.setSelected(isSelected);
- outerPane.repaint();
-
- headingFigure.getLabel().setText(((CategoryAdapter) getModel()).getText());
- }
-
- public IFigure getContentPane()
- {
- return scrollpane.getContents();
- }
-
- public Label getNameLabel()
- {
- return headingFigure.getLabel();
- }
-
- public HeadingFigure getHeadingFigure()
- {
- return headingFigure;
- }
-
- protected EditPart createChild(Object model)
- {
- EditPart editPart = new TopLevelComponentEditPart();
- editPart.setModel(model);
- editPart.setParent(this);
- return editPart;
- }
-
- public EditPart doGetRelativeEditPart(EditPart editPart, int direction)
- {
- EditPart result = null;
- if (editPart instanceof TopLevelComponentEditPart)
- {
- if (direction == PositionConstants.SOUTH)
- {
- result = EditPartNavigationHandlerUtil.getNextSibling(editPart);
- }
- else if (direction == PositionConstants.NORTH)
- {
- result = EditPartNavigationHandlerUtil.getPrevSibling(editPart);
- }
- if (result != null)
- {
- scrollTo((AbstractGraphicalEditPart)editPart);
- }
- }
- else
- {
- result = ((BaseEditPart)getParent()).doGetRelativeEditPart(editPart, direction);
- }
- return result;
- }
-
- protected void createEditPolicies()
- {
- super.createEditPolicies();
- // cs : oddly arrowing up and down true items in the list is not handled nicely
- // by the canned GEF GraphicalViewerKeyHandler so this navigation policy is need to fix that
- selectionHandlesEditPolicy = new SelectionHandlesEditPolicyImpl();
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, selectionHandlesEditPolicy);
- }
-
- protected List getModelChildren()
- {
- CategoryAdapter adapter = (CategoryAdapter) getModel();
- List children = new ArrayList(Arrays.asList(adapter.getAllChildren()));
- return children;
- }
-
- public void scrollTo(AbstractGraphicalEditPart topLevel)
- {
- Rectangle topLevelBounds = topLevel.getFigure().getBounds();
- Rectangle categoryBounds = figure.getBounds();
- int scrollValue = scrollpane.getVerticalScrollBar().getValue();
- int location = topLevelBounds.y + scrollValue - categoryBounds.y;
- scrollpane.scrollVerticalTo(location - categoryBounds.height / 2);
- }
-
- public void setMinimumHeight(int minimumHeight)
- {
- this.minimumHeight = minimumHeight;
- }
-
- public String getReaderText()
- {
- return getNameLabel().getText();
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/ConnectableEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/ConnectableEditPart.java
deleted file mode 100644
index 5132936e10..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/ConnectableEditPart.java
+++ /dev/null
@@ -1,275 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.design.editparts;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.draw2d.Figure;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.PositionConstants;
-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.ui.internal.adapters.XSDBaseAdapter;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.BaseEditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.BaseFieldEditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.CompartmentEditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.ADTSelectionFeedbackEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.KeyBoardAccessibilityEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.design.figures.CenteredIconFigure;
-import org.eclipse.wst.xsd.ui.internal.design.figures.GenericGroupFigure;
-import org.eclipse.wst.xsd.ui.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"); //$NON-NLS-1$
- 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();
- }
- }
-
- 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();
- figure.getIconFigure().setMode(CenteredIconFigure.SELECTED);
- figure.getIconFigure().refresh();
- }
-
- public void removeFeedback()
- {
- ReferenceConnection connectionFigure;
- if (connectionFigures != null && !connectionFigures.isEmpty())
- {
- for (Iterator i = connectionFigures.iterator(); i.hasNext();)
- {
- connectionFigure = (ReferenceConnection) i.next();
- connectionFigure.setHighlight(false);
- }
- }
- GenericGroupFigure figure = (GenericGroupFigure)getFigure();
- figure.getIconFigure().setMode(CenteredIconFigure.NORMAL);
- figure.getIconFigure().refresh();
- }
-
- protected void refreshVisuals()
- {
- super.refreshVisuals();
- GenericGroupFigure figure = (GenericGroupFigure)getFigure();
- figure.getIconFigure().refresh();
- }
-
- protected void createEditPolicies()
- {
- super.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();
- }
-
- public EditPart doGetRelativeEditPart(EditPart editPart, int direction)
- {
- EditPart result = null;
- if (direction == PositionConstants.WEST)
- {
- if (getParent() instanceof ConnectableEditPart)
- {
- result = getParent();
- }
- else
- {
- result = this;
- }
- }
- else if (direction == PositionConstants.EAST)
- {
- result = (EditPart) editPart.getChildren().get(0);
- TargetConnectionSpacingFigureEditPart target = null;
- boolean foundSelectableGroup = false;
- for (Iterator i = editPart.getChildren().iterator(); i.hasNext(); )
- {
- EditPart child = (EditPart)i.next();
- if (!(child instanceof TargetConnectionSpacingFigureEditPart))
- {
- foundSelectableGroup = true;
- result = child;
- break;
- }
- }
- if (result instanceof TargetConnectionSpacingFigureEditPart)
- {
- target = (TargetConnectionSpacingFigureEditPart) result;
- }
- if (!foundSelectableGroup && target != null)
- {
- EditPart parent = editPart.getParent();
- while (!(parent instanceof CompartmentEditPart))
- {
- parent = parent.getParent();
- if (parent == null) break;
- }
- for (Iterator i = parent.getChildren().iterator(); i.hasNext(); )
- {
- EditPart child = (EditPart) i.next();
- if (child instanceof BaseFieldEditPart && !(child instanceof SpaceFillerForFieldEditPart))
- {
- BaseFieldEditPart field = (BaseFieldEditPart) child;
- if (field.getFigure().getBounds().getCenter().y < target.getFigure().getBounds().bottom() &&
- field.getFigure().getBounds().getCenter().y > target.getFigure().getBounds().y)
- {
- return child;
- }
- }
- }
- return editPart;
- }
- }
- else if (direction == KeyBoardAccessibilityEditPolicy.IN_TO_FIRST_CHILD)
- {
- result = (EditPart) editPart.getChildren().get(0);
- }
- return result;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/ModelGroupDefinitionReferenceEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/ModelGroupDefinitionReferenceEditPart.java
deleted file mode 100644
index 8a1ff8bd72..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/ModelGroupDefinitionReferenceEditPart.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.design.editparts;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.gef.EditPart;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDAdapterFactory;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDModelGroupDefinitionAdapter;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.BaseEditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.CenteredConnectionAnchor;
-import org.eclipse.wst.xsd.ui.internal.design.editparts.model.TargetConnectionSpaceFiller;
-import org.eclipse.wst.xsd.ui.internal.design.figures.GenericGroupFigure;
-import org.eclipse.xsd.XSDModelGroup;
-import org.eclipse.xsd.XSDModelGroupDefinition;
-
-public class ModelGroupDefinitionReferenceEditPart extends ConnectableEditPart
-{
- GenericGroupFigure figure;
-
- public ModelGroupDefinitionReferenceEditPart()
- {
- super();
- }
-
- protected IFigure createFigure()
- {
- figure = new GenericGroupFigure();
- return figure;
- }
-
- protected void refreshVisuals()
- {
- super.refreshVisuals();
- XSDModelGroupDefinitionAdapter adapter = (XSDModelGroupDefinitionAdapter)getModel();
- figure.getIconFigure().image = adapter.getImage();
-
- GenericGroupFigure groupFigure = (GenericGroupFigure)getFigure();
- String nodeName = "";
-
- // TODO: commmon this up with ModelGroupEditPart, 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 = ""; //$NON-NLS-1$
-
- if (minOccurs == -3 && maxOccurs == -3)
- {
- occurenceDescription = nodeName;
- groupFigure.setText(null);
- }
- else if (minOccurs == 0 && (maxOccurs == -2 || maxOccurs == 1))
- {
- occurenceDescription = nodeName + " [0..1]"; //$NON-NLS-1$
- groupFigure.setText("0..1");
- }
- else if ((minOccurs == 1 && maxOccurs == 1) ||
- (minOccurs == -2 && maxOccurs == 1) ||
- (minOccurs == 1 && maxOccurs == -2))
- {
- occurenceDescription = nodeName + " [1..1]"; //$NON-NLS-1$
- groupFigure.setText("1..1");
- }
- else if (minOccurs == -2 && maxOccurs == -2)
- {
- occurenceDescription = nodeName;
- groupFigure.setText(null);
- }
- else
- {
- if (maxOccurs == -2) maxOccurs = 1;
- String maxSymbol = maxOccurs == -1 ? "*" : "" + maxOccurs; //$NON-NLS-1$ //$NON-NLS-2$
-
- String minSymbol = minOccurs == -2 ? "1" : "" + minOccurs; //$NON-NLS-1$ //$NON-NLS-2$
- occurenceDescription = nodeName + " [" + minSymbol + ".." + maxSymbol + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- groupFigure.setText(minSymbol + ".." + maxSymbol);
- }
-
- groupFigure.getIconFigure().setToolTipText(occurenceDescription);
- groupFigure.getIconFigure().repaint();
-
- }
-
- protected List getModelChildren()
- {
- List list = new ArrayList();
-
- XSDModelGroupDefinitionAdapter adapter = (XSDModelGroupDefinitionAdapter)getModel();
- XSDModelGroupDefinition groupDef = ((XSDModelGroupDefinition) adapter.getTarget());
- XSDModelGroupDefinition resolvedGroupDef = groupDef.getResolvedModelGroupDefinition();
- XSDModelGroup xsdModelGroup = resolvedGroupDef.getModelGroup();
-
- ArrayList listOfVisibleGroupRefs = new ArrayList();
- for (EditPart ep = getParent(); ep != null; )
- {
- Object object = ep.getModel();
- if (object instanceof XSDModelGroupDefinitionAdapter)
- {
- Object model = ((XSDModelGroupDefinitionAdapter)object).getTarget();
- if (model instanceof XSDModelGroupDefinition)
- {
- listOfVisibleGroupRefs.add(((XSDModelGroupDefinition)model).getResolvedModelGroupDefinition());
- }
- }
- ep = ep.getParent();
- }
-
- boolean isCyclic = (listOfVisibleGroupRefs.contains(resolvedGroupDef));
-
- if (xsdModelGroup != null && !isCyclic)
- list.add(XSDAdapterFactory.getInstance().adapt(xsdModelGroup));
-
- if (isCyclic)
- list.add(new TargetConnectionSpaceFiller(null));
-
- 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));
- }
- else // for the cyclic group references
- {
- connectionFigure.setTargetAnchor(new CenteredConnectionAnchor(((GenericGroupFigure) getFigure()).getIconFigure(), CenteredConnectionAnchor.RIGHT, 0, 0));
- }
-
- connectionFigure.setHighlight(false);
-
- return connectionFigure;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/ModelGroupEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/ModelGroupEditPart.java
deleted file mode 100644
index 9359394f89..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/ModelGroupEditPart.java
+++ /dev/null
@@ -1,230 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.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.swt.graphics.Image;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDAdapterFactory;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDModelGroupAdapter;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.BaseEditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.CenteredConnectionAnchor;
-import org.eclipse.wst.xsd.ui.internal.common.util.XSDCommonUIUtils;
-import org.eclipse.wst.xsd.ui.internal.design.editparts.model.TargetConnectionSpaceFiller;
-import org.eclipse.wst.xsd.ui.internal.design.figures.GenericGroupFigure;
-import org.eclipse.wst.xsd.ui.internal.design.figures.ModelGroupFigure;
-import org.eclipse.xsd.XSDCompositor;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDElementDeclaration;
-import org.eclipse.xsd.XSDModelGroup;
-import org.eclipse.xsd.XSDModelGroupDefinition;
-import org.eclipse.xsd.XSDParticle;
-import org.eclipse.xsd.XSDWildcard;
-import org.eclipse.xsd.util.XSDConstants;
-
-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()
- {
- boolean isReadOnly = false;
- GenericGroupFigure modelGroupFigure = (GenericGroupFigure)getFigure();
-
- XSDModelGroupAdapter adapter = (XSDModelGroupAdapter) getModel();
- isReadOnly = adapter.isReadOnly();
-
- String nodeName = "";
- Image image;
- switch (getXSDModelGroup().getCompositor().getValue())
- {
- case XSDCompositor.ALL:
- {
- image = isReadOnly ? ModelGroupFigure.ALL_ICON_DISABLED_IMAGE :ModelGroupFigure.ALL_ICON_IMAGE;
- modelGroupFigure.getIconFigure().image = XSDCommonUIUtils.getUpdatedImage((XSDConcreteComponent)adapter.getTarget(), image, isReadOnly);
- nodeName = XSDConstants.ALL_ELEMENT_TAG;
- break;
- }
- case XSDCompositor.CHOICE:
- {
- image = isReadOnly ? ModelGroupFigure.CHOICE_ICON_DISABLED_IMAGE : ModelGroupFigure.CHOICE_ICON_IMAGE;
- modelGroupFigure.getIconFigure().image = XSDCommonUIUtils.getUpdatedImage((XSDConcreteComponent)adapter.getTarget(), image, isReadOnly);
- nodeName = XSDConstants.CHOICE_ELEMENT_TAG;
- break;
- }
- case XSDCompositor.SEQUENCE:
- {
- image = isReadOnly ? ModelGroupFigure.SEQUENCE_ICON_DISABLED_IMAGE : ModelGroupFigure.SEQUENCE_ICON_IMAGE;
- modelGroupFigure.getIconFigure().image = XSDCommonUIUtils.getUpdatedImage((XSDConcreteComponent)adapter.getTarget(), image, isReadOnly);
- nodeName = XSDConstants.SEQUENCE_ELEMENT_TAG;
- break;
- }
- }
-
-// 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 = ""; //$NON-NLS-1$
-
- if (minOccurs == -3 && maxOccurs == -3)
- {
- occurenceDescription = nodeName;
- modelGroupFigure.setText(null);
- }
- else if (minOccurs == 0 && (maxOccurs == -2 || maxOccurs == 1))
- {
- occurenceDescription = nodeName + " [0..1]"; //$NON-NLS-1$
- modelGroupFigure.setText("0..1");
- }
- else if ((minOccurs == 1 && maxOccurs == 1) ||
- (minOccurs == -2 && maxOccurs == 1) ||
- (minOccurs == 1 && maxOccurs == -2))
- {
- occurenceDescription = nodeName + " [1..1]"; //$NON-NLS-1$
- modelGroupFigure.setText("1..1");
- }
- else if (minOccurs == -2 && maxOccurs == -2)
- {
- occurenceDescription = nodeName;
- modelGroupFigure.setText(null);
- }
- else
- {
- if (maxOccurs == -2) maxOccurs = 1;
- String maxSymbol = maxOccurs == -1 ? "*" : "" + maxOccurs; //$NON-NLS-1$ //$NON-NLS-2$
-
- String minSymbol = minOccurs == -2 ? "1" : "" + minOccurs; //$NON-NLS-1$ //$NON-NLS-2$
- occurenceDescription = nodeName + " [" + minSymbol + ".." + maxSymbol + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- modelGroupFigure.setText(minSymbol + ".." + maxSymbol);
- }
-
- modelGroupFigure.getIconFigure().setToolTipText(occurenceDescription);
- modelGroupFigure.getIconFigure().repaint();
-
- refreshConnection();
- }
-
- protected List getModelChildren()
- {
-// XSDModelGroupAdapter modelGroupAdapter = (XSDModelGroupAdapter)getModel();
-// ArrayList ch = new ArrayList();
-// ITreeElement [] tree = modelGroupAdapter.getChildren();
-// int length = tree.length;
-// for (int i = 0; i < length; i++)
-// {
-// ch.add(tree[i]);
-// }
-
- 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);
- }
- else if (next.getTerm() instanceof XSDWildcard)
- {
- XSDWildcard wildCard = (XSDWildcard)next.getTerm();
- Adapter adapter = XSDAdapterFactory.getInstance().adapt(wildCard);
- list.add(new TargetConnectionSpaceFiller((XSDBaseAdapter)adapter));
- }
- }
-
- if (list.size() == 0)
- list.add(new TargetConnectionSpaceFiller(null));
-
- return list;
-// return ch;
- }
-
- 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, 1));
- }
- else if (child instanceof ModelGroupDefinitionReferenceEditPart)
- {
- ModelGroupDefinitionReferenceEditPart elem = (ModelGroupDefinitionReferenceEditPart) child;
- connectionFigure.setTargetAnchor(new CenteredConnectionAnchor(elem.getFigure(), CenteredConnectionAnchor.LEFT, 0, 1));
- }
- connectionFigure.setHighlight(false);
- return connectionFigure;
- }
-
- public String getReaderText()
- {
- XSDModelGroup xsdModelGroup = getXSDModelGroup();
- return xsdModelGroup.getCompositor().getName();
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/ReferenceConnection.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/ReferenceConnection.java
deleted file mode 100644
index fd63dbe166..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/ReferenceConnection.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.design.editparts;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.ConnectionRouter;
-import org.eclipse.draw2d.PolylineConnection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.widgets.Display;
-
-public class ReferenceConnection extends PolylineConnection
-{
- protected boolean highlight = false;
-
- protected static final Color activeConnection = ColorConstants.black;
- public 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;
-
- boolean highContrast = false;
- try
- {
- highContrast = Display.getDefault().getHighContrast();
- }
- catch (Exception e)
- {
- }
- if (highContrast)
- {
- setForegroundColor(highlight ? Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND) : ColorConstants.lightGray);
- }
- else
- {
- setForegroundColor(highlight ? activeConnection : inactiveConnection);
- }
- setOpaque(highlight);
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/SpaceFillerForFieldEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/SpaceFillerForFieldEditPart.java
deleted file mode 100644
index 30f44ee1d0..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/SpaceFillerForFieldEditPart.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.design.editparts;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.MarginBorder;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.BaseFieldEditPart;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-
-public class SpaceFillerForFieldEditPart extends BaseFieldEditPart
-{
- Label space;
- public SpaceFillerForFieldEditPart()
- {
- super();
- }
-
- protected IFigure createFigure()
- {
- space = new Label(""); //$NON-NLS-1$
- space.setIcon(XSDEditorPlugin.getXSDImage("icons/Dot.gif")); //$NON-NLS-1$
- space.setBorder(new MarginBorder(3, 0, 3, 0));
- return space;
- }
-
- protected void refreshVisuals()
- {
- }
-
- protected void createEditPolicies()
- {
-
- }
-
- public boolean isSelectable()
- {
- return false;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/TargetConnectionSpacingFigureEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/TargetConnectionSpacingFigureEditPart.java
deleted file mode 100644
index dad1a8b8e8..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/TargetConnectionSpacingFigureEditPart.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.design.editparts;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.BaseEditPart;
-import org.eclipse.wst.xsd.ui.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()
- {
-
- }
-
- public boolean isSelectable()
- {
- return false;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/TopLevelComponentEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/TopLevelComponentEditPart.java
deleted file mode 100644
index 44042f396e..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/TopLevelComponentEditPart.java
+++ /dev/null
@@ -1,473 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.design.editparts;
-
-import java.util.Collections;
-import java.util.List;
-
-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.MarginBorder;
-import org.eclipse.draw2d.ToolbarLayout;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.DragTracker;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.RequestConstants;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.editpolicies.SelectionEditPolicy;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gef.requests.LocationRequest;
-import org.eclipse.gef.ui.actions.ActionRegistry;
-import org.eclipse.gef.ui.parts.AbstractEditPartViewer;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.wst.common.uriresolver.internal.util.URIHelper;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDSchemaDirectiveAdapter;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.BaseEditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.IAutoDirectEdit;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.INamedEditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.RootContentEditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IFeedbackHandler;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IGraphElement;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.ADTDirectEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.IADTUpdateCommand;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.SimpleDirectEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.adt.typeviz.design.figures.FieldFigure;
-import org.eclipse.wst.xsd.ui.internal.common.actions.OpenInNewEditor;
-import org.eclipse.wst.xsd.ui.internal.common.commands.UpdateNameCommand;
-import org.eclipse.wst.xsd.ui.internal.common.util.XSDCommonUIUtils;
-import org.eclipse.wst.xsd.ui.internal.design.editpolicies.GraphNodeDragTracker;
-import org.eclipse.wst.xsd.ui.internal.design.editpolicies.SelectionHandlesEditPolicyImpl;
-import org.eclipse.wst.xsd.ui.internal.design.editpolicies.TopLevelComponentLabelCellEditorLocator;
-import org.eclipse.wst.xsd.ui.internal.design.editpolicies.TopLevelNameDirectEditManager;
-import org.eclipse.wst.xsd.ui.internal.design.figures.HyperLinkLabel;
-import org.eclipse.wst.xsd.ui.internal.design.layouts.FillLayout;
-import org.eclipse.wst.xsd.ui.internal.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.utils.OpenOnSelectionHelper;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDNamedComponent;
-import org.eclipse.xsd.XSDSchemaDirective;
-import org.eclipse.xsd.impl.XSDImportImpl;
-
-public class TopLevelComponentEditPart extends BaseEditPart implements IFeedbackHandler, INamedEditPart, IAutoDirectEdit
-{
- protected Label label;
- // protected Label arrowLabel;
- protected Figure labelHolder = new Figure();
- protected SelectionHandlesEditPolicyImpl selectionHandlesEditPolicy;
- protected ADTDirectEditPolicy adtDirectEditPolicy = new ADTDirectEditPolicy();
- protected SimpleDirectEditPolicy simpleDirectEditPolicy = new SimpleDirectEditPolicy();
- protected boolean isReadOnly;
- protected boolean isSelected;
- private Font italicFont;
-
- protected IFigure createFigure()
- {
- Figure typeGroup = new Figure()
- {
- public void paint(Graphics graphics)
- {
- super.paint(graphics);
- if (hasFocus)
- {
- try
- {
- graphics.pushState();
- Rectangle r = getBounds();
- graphics.setXORMode(true);
- graphics.drawFocus(r.x, r.y + 1, r.width - 1, r.height - 2);
- }
- finally
- {
- graphics.popState();
- }
- }
-
- }
- };
- typeGroup.setLayoutManager(new ToolbarLayout());
-
- labelHolder = new Figure();
- FillLayout fillLayout = new FillLayout();
- labelHolder.setLayoutManager(fillLayout);
- typeGroup.add(labelHolder);
-
- label = new HyperLinkLabel();
- label.setOpaque(true);
- label.setBorder(new MarginBorder(1, 2, 2, 5));
- if (!isHighContrast)
- label.setForegroundColor(ColorConstants.black);
- labelHolder.add(label);
-
- return typeGroup;
- }
-
- public void deactivate()
- {
- if (italicFont != null)
- {
- italicFont.dispose();
- italicFont = null;
- }
- super.deactivate();
- }
-
- public void refreshVisuals()
- {
- XSDBaseAdapter adapter = (XSDBaseAdapter) getModel();
- if (adapter != null)
- {
- isReadOnly = adapter.isReadOnly();
- label.setForegroundColor(computeLabelColor());
- label.setText(adapter.getText());
- Image image = adapter.getImage();
- if (image != null)
- {
- label.setIcon(XSDCommonUIUtils.getUpdatedImage((XSDConcreteComponent) adapter.getTarget(), image, isReadOnly));
- }
- // arrowLabel.setVisible(Boolean.TRUE.equals(adapter.getProperty(getModel(),
- // "drillDown")));
-
- if (adapter.isAbstract())
- {
- if (italicFont == null)
- {
- Font font = label.getFont();
- italicFont = getItalicFont(font);
- }
- if (italicFont != null)
- {
- label.setFont(italicFont);
- }
- }
- else
- {
- label.setFont(label.getParent().getFont());
- }
- }
- else
- {
- label.setText(Messages._UI_GRAPH_UNKNOWN_OBJECT + getModel().getClass().getName());
- // arrowLabel.setVisible(false);
- }
-
- if (reselect)
- {
- getViewer().select(this);
- setReselect(false);
- }
- }
-
- public List getModelChildren()
- {
- return Collections.EMPTY_LIST;
- }
-
- public EditPart doGetRelativeEditPart(EditPart editPart, int direction)
- {
- return ((BaseEditPart)this.getParent()).doGetRelativeEditPart(editPart, direction);
- }
-
- protected void createEditPolicies()
- {
- super.createEditPolicies();
- // installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new
- // NonResizableEditPolicy());
- // selectionHandlesEditPolicy = new SelectionHandlesEditPolicyImpl();
- // installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE,
- // selectionHandlesEditPolicy);
-
- SelectionHandlesEditPolicyImpl policy = new SelectionHandlesEditPolicyImpl();
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, policy);
-
- SelectionEditPolicy feedBackSelectionEditPolicy = new SelectionEditPolicy()
- {
- protected void hideSelection()
- {
- EditPart editPart = getHost();
- if (editPart instanceof IFeedbackHandler)
- {
- ((IFeedbackHandler) editPart).removeFeedback();
- }
- }
-
- protected void showSelection()
- {
- EditPart editPart = getHost();
- if (editPart instanceof IFeedbackHandler)
- {
- ((IFeedbackHandler) editPart).addFeedback();
- }
- }
- };
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, feedBackSelectionEditPolicy);
-
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, adtDirectEditPolicy);
- }
-
- public Color computeLabelColor()
- {
- Color color = ColorConstants.black;
- if (isHighContrast)
- {
- color = Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND);
- }
-
- if (isSelected)
- {
- if (isHighContrast)
- {
- color = ColorConstants.listBackground;
- }
- else
- {
- if (isReadOnly)
- {
- color = ColorConstants.gray;
- }
- else
- {
- color = ColorConstants.black;
- }
- }
- }
- else if (isReadOnly)
- {
- color = ColorConstants.gray;
- }
- return color;
- }
-
- public void addFeedback()
- {
- isSelected = true;
-
- if (isHighContrast)
- {
- labelHolder.setBackgroundColor(ColorConstants.listForeground);
- }
- else
- {
- labelHolder.setBackgroundColor(FieldFigure.cellColor);
- }
- label.setForegroundColor(computeLabelColor());
- // labelHolder.setFill(true);
-
- if (doScroll)
- {
- CategoryEditPart categoryEP = (CategoryEditPart) getParent();
- categoryEP.scrollTo(this);
- setScroll(false);
- }
- }
-
- private boolean doScroll = false;
-
- public void setScroll(boolean doScroll)
- {
- this.doScroll = doScroll;
- }
-
- public void removeFeedback()
- {
- isSelected = false;
- labelHolder.setBackgroundColor(null);
- label.setForegroundColor(computeLabelColor());
- // labelHolder.setFill(false);
- }
-
- public void performRequest(Request request)
- {
- // Do not open on or set focus on direct edit type
- if (request.getType() == RequestConstants.REQ_OPEN)
- {
-
- Object model = getModel();
- if (model instanceof IGraphElement)
- {
- if (((IGraphElement)model).isFocusAllowed())
- {
- if (request instanceof LocationRequest)
- {
- LocationRequest locationRequest = (LocationRequest) request;
- Point p = locationRequest.getLocation();
-
- if (hitTest(labelHolder, p))
- {
- performDrillDownAction();
- }
- }
- }
- }
- else if (model instanceof XSDSchemaDirectiveAdapter)
- {
- if (request instanceof LocationRequest)
- {
- LocationRequest locationRequest = (LocationRequest) request;
- Point p = locationRequest.getLocation();
-
- if (hitTest(labelHolder, p))
- {
- XSDSchemaDirective dir = (XSDSchemaDirective)((XSDSchemaDirectiveAdapter)model).getTarget();
- String schemaLocation = "";
- // force load of imported schema
- if (dir instanceof XSDImportImpl)
- {
- ((XSDImportImpl)dir).importSchema();
- }
- if (dir.getResolvedSchema() != null)
- {
- schemaLocation = URIHelper.removePlatformResourceProtocol(dir.getResolvedSchema().getSchemaLocation());
- if (schemaLocation != null)
- {
- OpenOnSelectionHelper.openXSDEditor(dir.getResolvedSchema());
- }
- }
- }
- }
- }
- }
- }
-
- public boolean hitTest(IFigure target, Point location)
- {
- Rectangle b = target.getBounds().getCopy();
- target.translateToAbsolute(b);
- return b.contains(location);
- }
-
- protected void performDrillDownAction()
- {
- Runnable runnable = new Runnable()
- {
- public void run()
- {
- EditPart editPart = ((AbstractEditPartViewer) getViewer()).getRootEditPart().getContents();
- if (editPart instanceof RootContentEditPart)
- {
- IEditorPart editorPart = getEditorPart();
-// ActionRegistry registry = (ActionRegistry) editorPart.getAdapter(ActionRegistry.class);
-// IAction action = registry.getAction(SetInputToGraphView.ID);
-// action.run();
- ActionRegistry registry = (ActionRegistry) editorPart.getAdapter(ActionRegistry.class);
- if (registry != null)
- {
- IAction action = registry.getAction(OpenInNewEditor.ID);
- if (action != null)
- action.run();
- return;
- }
- }
- }
- };
- Display.getCurrent().asyncExec(runnable);
- }
-
- public void doEditName(boolean addFromDesign)
- {
- if (!addFromDesign) return;
-
-// removeFeedback();
-
- Object object = ((XSDBaseAdapter) getModel()).getTarget();
- if (object instanceof XSDNamedComponent)
- {
- Point p = label.getLocation();
- TopLevelNameDirectEditManager manager = new TopLevelNameDirectEditManager(TopLevelComponentEditPart.this, new TopLevelComponentLabelCellEditorLocator(TopLevelComponentEditPart.this, p), (XSDNamedComponent) object);
- NameUpdateCommandWrapper wrapper = new NameUpdateCommandWrapper();
- adtDirectEditPolicy.setUpdateCommand(wrapper);
- manager.show();
- }
- }
-
- class NameUpdateCommandWrapper extends Command implements IADTUpdateCommand
- {
- Command command;
- protected DirectEditRequest request;
-
- public NameUpdateCommandWrapper()
- {
- super(Messages._UI_ACTION_UPDATE_NAME);
- }
-
- public void setRequest(DirectEditRequest request)
- {
- this.request = request;
- }
-
- public void execute()
- {
- XSDBaseAdapter adapter = (XSDBaseAdapter)getModel();
- Object newValue = request.getCellEditor().getValue();
- if (newValue instanceof String && ((String)newValue).length() > 0)
- {
- UpdateNameCommand command = new UpdateNameCommand(Messages._UI_ACTION_UPDATE_NAME, (XSDNamedComponent)adapter.getTarget(), (String)newValue);
- if (command != null)
- command.execute();
- }
- }
- }
-
- static boolean reselect = false;
-
- public void setReselect(boolean state)
- {
- reselect = state;
- }
-
- public Label getNameLabelFigure()
- {
- return label;
- }
-
- public void performDirectEdit(Point cursorLocation)
- {
-
- }
-
- public void setSelected(int value)
- {
- // if it is selected, we want to scroll to it
- if (doScroll)
- setScroll(true);
- super.setSelected(value);
- }
-
- public void setFocus(boolean b)
- {
- super.setFocus(b);
- hasFocus = b;
- getFigure().repaint();
- }
-
- public DragTracker getDragTracker(Request request)
- {
- return new GraphNodeDragTracker(this);
- }
-
- public String getReaderText()
- {
- return getNameLabelFigure().getText();
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/XSDAttributesForAnnotationEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/XSDAttributesForAnnotationEditPart.java
deleted file mode 100644
index 13b4dd5ce4..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/XSDAttributesForAnnotationEditPart.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.design.editparts;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDComplexTypeDefinitionAdapter;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.SectionEditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.Annotation;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IComplexType;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IStructure;
-
-public class XSDAttributesForAnnotationEditPart extends SectionEditPart
-{
- public XSDAttributesForAnnotationEditPart()
- {
- super();
- }
-
- 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/ui/internal/design/editparts/XSDBaseFieldEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/XSDBaseFieldEditPart.java
deleted file mode 100644
index 6edac9c1c6..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/XSDBaseFieldEditPart.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.design.editparts;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDAttributeDeclarationAdapter;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDElementDeclarationAdapter;
-import org.eclipse.wst.xsd.ui.internal.adt.design.IAnnotationProvider;
-import org.eclipse.wst.xsd.ui.internal.adt.design.directedit.AttributeReferenceDirectEditManager;
-import org.eclipse.wst.xsd.ui.internal.adt.design.directedit.ElementReferenceDirectEditManager;
-import org.eclipse.wst.xsd.ui.internal.adt.design.directedit.LabelCellEditorLocator;
-import org.eclipse.wst.xsd.ui.internal.adt.design.directedit.LabelEditManager;
-import org.eclipse.wst.xsd.ui.internal.adt.design.directedit.ReferenceDirectEditManager;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.BaseFieldEditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.design.figures.IFieldFigure;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IField;
-import org.eclipse.wst.xsd.ui.internal.adt.typeviz.design.figures.FieldFigure;
-import org.eclipse.wst.xsd.ui.internal.common.util.XSDCommonUIUtils;
-import org.eclipse.wst.xsd.ui.internal.design.editpolicies.DragAndDropEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.design.editpolicies.SelectionHandlesEditPolicyImpl;
-import org.eclipse.xsd.XSDConcreteComponent;
-
-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());
- if (field.isReadOnly())
- {
- figure.setForegroundColor(ColorConstants.darkGray);
- }
- else
- {
- if (isHighContrast)
- {
- figure.setForegroundColor(Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND));
- figure.setBackgroundColor(Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
- }
- else
- figure.setForegroundColor(ColorConstants.black);
- }
-
- String occurrenceDescription = ""; //$NON-NLS-1$
- if (field instanceof IAnnotationProvider)
- {
- occurrenceDescription = ((IAnnotationProvider)field).getNameAnnotationString();
- }
- refreshIcon();
- figure.getNameAnnotationLabel().setText(occurrenceDescription);
-
- figure.recomputeLayout();
-
-
- if (getRoot() != null)
- ((GraphicalEditPart)getRoot()).getFigure().invalidateTree();
- }
-
- protected void refreshIcon()
- {
- IFieldFigure figure = getFieldFigure();
- // our model implements ITreeElement
- if (getModel() instanceof XSDBaseAdapter)
- {
- Image image = ((XSDBaseAdapter)getModel()).getImage();
- boolean isReadOnly = ((XSDBaseAdapter)getModel()).isReadOnly();
- figure.getNameLabel().setIcon(image);
-
- if (image != null)
- {
- XSDConcreteComponent comp = (XSDConcreteComponent) ((XSDBaseAdapter)getModel()).getTarget();
- figure.getNameLabel().setIcon(XSDCommonUIUtils.getUpdatedImage(comp, image, isReadOnly));
- }
- }
- }
-
- public void addNotify()
- {
- super.addNotify();
- getFieldFigure().editPartAttached(this);
- }
-
- protected SelectionHandlesEditPolicyImpl selectionHandlesEditPolicy = new SelectionHandlesEditPolicyImpl();
- protected void createEditPolicies()
- {
- super.createEditPolicies();
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, selectionHandlesEditPolicy);
- if (!isFileReadOnly())
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DragAndDropEditPolicy(getViewer(), selectionHandlesEditPolicy));
- }
-
- protected void directEditNameField()
- {
- Object model = getModel();
- IFieldFigure fieldFigure = getFieldFigure();
- if ( model instanceof IField)
- {
- IField field = (IField) model;
- if (field.isReference())
- {
- ReferenceDirectEditManager manager = null;
- if (field instanceof XSDElementDeclarationAdapter)
- {
- manager = new ElementReferenceDirectEditManager((IField) model, this, fieldFigure.getNameLabel());
- }
- else if (field instanceof XSDAttributeDeclarationAdapter)
- {
- manager = new AttributeReferenceDirectEditManager((IField) model, this, fieldFigure.getNameLabel());
- }
- if (manager != null)
- {
- ReferenceUpdateCommand elementUpdateCommand = new ReferenceUpdateCommand();
- elementUpdateCommand.setDelegate(manager);
- adtDirectEditPolicy.setUpdateCommand(elementUpdateCommand);
- manager.show();
- }
- }
- else
- {
- LabelEditManager manager = new LabelEditManager(this, new LabelCellEditorLocator(this, null));
- NameUpdateCommandWrapper wrapper = new NameUpdateCommandWrapper();
- adtDirectEditPolicy.setUpdateCommand(wrapper);
- manager.show();
- }
- }
- }
-
- public void setFocus(boolean focus)
- {
- super.setFocus(focus);
- hasFocus = focus;
- ((FieldFigure)getFigure()).hasFocus = hasFocus;
- getFigure().repaint();
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/XSDEditPartFactory.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/XSDEditPartFactory.java
deleted file mode 100644
index 211b7873c8..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/XSDEditPartFactory.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.design.editparts;
-
-import org.eclipse.gef.EditPart;
-import org.eclipse.wst.xsd.ui.internal.adapters.CategoryAdapter;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDAttributeGroupDefinitionAdapter;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDModelGroupAdapter;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDModelGroupDefinitionAdapter;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDSchemaAdapter;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDSimpleTypeDefinitionAdapter;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.ADTEditPartFactory;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.ColumnEditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.CompartmentEditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.Annotation;
-import org.eclipse.wst.xsd.ui.internal.adt.design.figures.ICompartmentFigure;
-import org.eclipse.wst.xsd.ui.internal.adt.design.figures.IFieldFigure;
-import org.eclipse.wst.xsd.ui.internal.adt.design.figures.IStructureFigure;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IField;
-import org.eclipse.wst.xsd.ui.internal.adt.typeviz.design.figures.TypeVizFigureFactory;
-import org.eclipse.wst.xsd.ui.internal.common.util.XSDCommonUIUtils;
-import org.eclipse.wst.xsd.ui.internal.design.editparts.model.SpaceFiller;
-import org.eclipse.wst.xsd.ui.internal.design.editparts.model.TargetConnectionSpaceFiller;
-import org.eclipse.wst.xsd.ui.internal.design.figures.IExtendedFigureFactory;
-import org.eclipse.wst.xsd.ui.internal.design.figures.IModelGroupFigure;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-import org.eclipse.xsd.XSDConcreteComponent;
-
-public class XSDEditPartFactory extends ADTEditPartFactory implements IExtendedFigureFactory
-{
- protected IExtendedFigureFactory delegate;
-
- public XSDEditPartFactory()
- {
- delegate = XSDEditorPlugin.getPlugin().getXSDEditorConfiguration().getFigureFactory();
- if (delegate == null)
- delegate = new TypeVizFigureFactory();
- }
-
- public XSDEditPartFactory(IExtendedFigureFactory figureFactory)
- {
- delegate = figureFactory;
- }
-
-
- public EditPart doCreateEditPart(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 XSDSchemaAdapter)
- {
- child = new XSDSchemaEditPart();
- }
- else if (model instanceof CategoryAdapter)
- {
- child = new CategoryEditPart();
- }
- 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")) //$NON-NLS-1$
- {
- child = new XSDGroupsForAnnotationEditPart();
- }
- else if (kind.equals("attribute")) //$NON-NLS-1$
- {
- 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.doCreateEditPart(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();
- }
- return child;
- }
-
- public ICompartmentFigure createCompartmentFigure(Object model)
- {
- return delegate.createCompartmentFigure(model);
- }
-
- public IStructureFigure createStructureFigure(Object model)
- {
- IStructureFigure figure = delegate.createStructureFigure(model);
- if (model instanceof XSDBaseAdapter)
- {
- XSDConcreteComponent comp = (XSDConcreteComponent) ((XSDBaseAdapter)model).getTarget();
- boolean isReadOnly = ((XSDBaseAdapter)model).isReadOnly();
- figure.getNameLabel().setIcon(XSDCommonUIUtils.getUpdatedImage( comp, ((XSDBaseAdapter)model).getImage(), isReadOnly));
- }
- return figure;
- }
-
- 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/ui/internal/design/editparts/XSDGroupsForAnnotationEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/XSDGroupsForAnnotationEditPart.java
deleted file mode 100644
index c065b36e47..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/XSDGroupsForAnnotationEditPart.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.design.editparts;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDAdapterFactory;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDComplexTypeDefinitionAdapter;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDModelGroupDefinitionAdapter;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.SectionEditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.Annotation;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IComplexType;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IStructure;
-import org.eclipse.xsd.XSDModelGroup;
-import org.eclipse.xsd.XSDModelGroupDefinition;
-
-public class XSDGroupsForAnnotationEditPart extends SectionEditPart
-{
- public XSDGroupsForAnnotationEditPart()
- {
- super();
- }
-
- 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/ui/internal/design/editparts/XSDModelGroupRouter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/XSDModelGroupRouter.java
deleted file mode 100644
index a1957822c7..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/XSDModelGroupRouter.java
+++ /dev/null
@@ -1,378 +0,0 @@
-/*******************************************************************************
- * 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.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.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 org.eclipse.draw2d.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 org.eclipse.draw2d.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 org.eclipse.draw2d.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 + 4, 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/ui/internal/design/editparts/XSDSchemaEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/XSDSchemaEditPart.java
deleted file mode 100644
index b2698be2c8..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/XSDSchemaEditPart.java
+++ /dev/null
@@ -1,334 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.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.Label;
-import org.eclipse.draw2d.LineBorder;
-import org.eclipse.draw2d.MarginBorder;
-import org.eclipse.draw2d.PositionConstants;
-import org.eclipse.draw2d.RectangleFigure;
-import org.eclipse.draw2d.ToolbarLayout;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.osgi.util.TextProcessor;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.wst.xsd.ui.internal.adapters.CategoryAdapter;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDSchemaAdapter;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.BaseEditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.KeyBoardAccessibilityEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.adt.typeviz.design.figures.HeadingFigure;
-import org.eclipse.wst.xsd.ui.internal.common.util.XSDCommonUIUtils;
-import org.eclipse.wst.xsd.ui.internal.design.editpolicies.SelectionHandlesEditPolicyImpl;
-import org.eclipse.wst.xsd.ui.internal.design.layouts.FillLayout;
-import org.eclipse.wst.xsd.ui.internal.editor.Messages;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDSchema;
-
-public class XSDSchemaEditPart extends BaseEditPart
-{
- protected Label label;
-
- protected Figure outer, contentFigure;
- protected HeadingFigure headingFigure;
-
- public IFigure getContentPane()
- {
- return contentFigure;
- }
-
- protected IFigure createFigure()
- {
- outer = new Figure();
- outer.setBorder(new LineBorder(1));
-
- FillLayout fillLayout = new FillLayout(4);
- outer.setLayoutManager(fillLayout);
-
- headingFigure = new HeadingFigure();
- outer.add(headingFigure);
-
- RectangleFigure line = new RectangleFigure()
- {
- public Dimension getPreferredSize(int wHint, int hHint)
- {
- Dimension d = super.getPreferredSize(wHint, hHint);
- d.height = 1;
- return d;
- }
- };
- ToolbarLayout lineLayout = new ToolbarLayout(false);
- lineLayout.setVertical(true);
- lineLayout.setStretchMinorAxis(true);
- line.setLayoutManager(lineLayout);
- outer.add(line);
-
- contentFigure = new Figure();
- contentFigure.setBorder(new MarginBorder(4));
- fillLayout = new FillLayout(4);
- contentFigure.setLayoutManager(fillLayout);
-
- outer.add(contentFigure);
- return outer;
- }
-
- protected List getModelChildren()
- {
- XSDSchemaAdapter schemaAdapter = (XSDSchemaAdapter) getModel();
- List list = new ArrayList();
-
-// Bug 103870: undo blanks out schema view
-// schemaAdapter.updateCategories();
-
- List templist = new ArrayList();
- templist.add(schemaAdapter.getCategory(CategoryAdapter.DIRECTIVES));
- Holder holder = new Holder(templist);
- list.add(holder);
-
- templist = new ArrayList();
- templist.add(schemaAdapter.getCategory(CategoryAdapter.ELEMENTS));
- templist.add(schemaAdapter.getCategory(CategoryAdapter.TYPES));
- holder = new Holder(templist);
- list.add(holder);
-
- templist = new ArrayList();
- templist.add(schemaAdapter.getCategory(CategoryAdapter.ATTRIBUTES));
- templist.add(schemaAdapter.getCategory(CategoryAdapter.GROUPS));
- holder = new Holder(templist);
- list.add(holder);
-
- return list;
- }
-
- protected EditPart createChild(Object model)
- {
- CategoryRowEditPart result = new CategoryRowEditPart();
- result.setModel(model);
- result.setParent(this);
- return result;
- }
-
- protected void refreshVisuals()
- {
- super.refreshVisuals();
-
- LineBorder border = (LineBorder) outer.getBorder();
- border.setWidth(isSelected ? 2 : 1);
- headingFigure.setSelected(isSelected);
-
- XSDSchemaAdapter schemaAdapter = (XSDSchemaAdapter) getModel();
- Image image = schemaAdapter.getImage();
- headingFigure.getLabel().setIcon(image);
- if (image != null)
- {
- headingFigure.getLabel().setIcon(XSDCommonUIUtils.getUpdatedImage((XSDConcreteComponent) schemaAdapter.getTarget(), image, false));
- }
- outer.repaint();
-
- String targetNamespaceValue = ((XSDSchema) ((XSDSchemaAdapter) getModel()).getTarget()).getTargetNamespace();
- targetNamespaceValue = TextProcessor.process(targetNamespaceValue);
-
- if (targetNamespaceValue == null || targetNamespaceValue.length() == 0)
- {
- targetNamespaceValue = Messages._UI_GRAPH_XSDSCHEMA_NO_NAMESPACE;
- }
- headingFigure.getLabel().setText(Messages._UI_GRAPH_XSDSCHEMA + " : " + targetNamespaceValue); //$NON-NLS-1$
- }
-
- public EditPart doGetRelativeEditPart(EditPart editPart, int direction)
- {
- EditPart result = null;
- if (editPart instanceof CategoryEditPart)
- {
- CategoryAdapter adapter = (CategoryAdapter)editPart.getModel();
- switch (adapter.getGroupType())
- {
- case CategoryAdapter.DIRECTIVES:
- {
- if (direction == PositionConstants.SOUTH)
- {
- result = getCategoryEditPart(CategoryAdapter.ELEMENTS);
- }
- break;
- }
- case CategoryAdapter.ELEMENTS:
- {
- if (direction == PositionConstants.SOUTH)
- {
- result = getCategoryEditPart(CategoryAdapter.ATTRIBUTES);
- }
- else if (direction == PositionConstants.NORTH)
- {
- result = getCategoryEditPart(CategoryAdapter.DIRECTIVES);
- }
- break;
- }
- case CategoryAdapter.TYPES:
- {
- if (direction == PositionConstants.SOUTH)
- {
- result = getCategoryEditPart(CategoryAdapter.GROUPS);
- }
- else if (direction == PositionConstants.NORTH)
- {
- result = getCategoryEditPart(CategoryAdapter.DIRECTIVES);
- }
- break;
- }
- case CategoryAdapter.ATTRIBUTES:
- {
- if (direction == PositionConstants.NORTH)
- {
- result = getCategoryEditPart(CategoryAdapter.ELEMENTS);
- }
- break;
- }
- case CategoryAdapter.GROUPS:
- {
- if (direction == PositionConstants.NORTH)
- {
- result = getCategoryEditPart(CategoryAdapter.TYPES);
- }
- break;
- }
- }
- }
- else if (editPart == this)
- {
- if (direction == KeyBoardAccessibilityEditPolicy.IN_TO_FIRST_CHILD)
- {
- result = ((CategoryRowEditPart)getChildren().get(0)).doGetRelativeEditPart(editPart, direction);
- }
- }
- return result;
- }
-
- protected EditPart getCategoryEditPart(int kind)
- {
- for (Iterator j = getChildren().iterator(); j.hasNext(); )
- {
- EditPart row = (EditPart)j.next();
- for (Iterator i = row.getChildren().iterator(); i.hasNext(); )
- {
- EditPart editPart = (EditPart)i.next();
- if (editPart instanceof CategoryEditPart)
- {
- CategoryEditPart categoryEditPart = (CategoryEditPart)editPart;
- CategoryAdapter adapter = (CategoryAdapter)categoryEditPart.getModel();
- if (adapter.getGroupType() == kind)
- {
- return editPart;
- }
- }
- }
- }
- return null;
- }
-
- protected void createEditPolicies()
- {
- super.createEditPolicies();
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new SelectionHandlesEditPolicyImpl());
- }
-
- public String getReaderText()
- {
- return headingFigure.getLabel().getSubStringText();
- }
-
-
- protected class Holder
- {
- List list;
-
- public Holder(List list)
- {
- this.list = list;
- }
-
- public List getList()
- {
- return list;
- }
- }
-
- protected class CategoryRowEditPart extends BaseEditPart
- {
- protected XSDSchema schema;
- protected Figure contentPane;
-
- protected IFigure createFigure()
- {
- Figure containerFigure = new Figure();
- containerFigure.setBorder(new MarginBorder(4, 4, 4, 4));
- // containerFigure.setBorder(new LineBorder(1));
- // containerFigure.setBackgroundColor(ColorConstants.green);
-
- FillLayout fillLayout = new FillLayout(4);
- fillLayout.setHorizontal(true);
- containerFigure.setLayoutManager(fillLayout);
-
- return containerFigure;
- }
-
- public EditPart doGetRelativeEditPart(EditPart editPart, int direction)
- {
- if (editPart instanceof CategoryEditPart)
- {
- if (direction == KeyBoardAccessibilityEditPolicy.OUT_TO_PARENT)
- {
- return getParent();
- }
- }
- else if (editPart instanceof XSDSchemaEditPart)
- {
- if (direction == KeyBoardAccessibilityEditPolicy.IN_TO_FIRST_CHILD)
- {
- return (EditPart)getChildren().get(0);
- }
- }
- return ((XSDSchemaEditPart)getParent()).doGetRelativeEditPart(editPart, direction);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#getContentPane()
- */
- public IFigure getContentPane()
- {
- return super.getContentPane();
- }
-
- protected List getModelChildren()
- {
- Holder holder = (Holder) getModel();
- return holder.getList();
- }
-
- protected void createEditPolicies()
- {
- super.createEditPolicies();
- }
-
- public boolean isSelectable()
- {
- return false;
- }
-
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/XSDSimpleTypeEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/XSDSimpleTypeEditPart.java
deleted file mode 100644
index db5b8774a2..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/XSDSimpleTypeEditPart.java
+++ /dev/null
@@ -1,239 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.design.editparts;
-
-import java.util.Iterator;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.ManhattanConnectionRouter;
-import org.eclipse.draw2d.ToolbarLayout;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.gef.EditPart;
-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.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.ui.internal.adapters.XSDSimpleTypeDefinitionAdapter;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.SetInputToGraphView;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.BaseEditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.BaseTypeConnectingEditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.CenteredConnectionAnchor;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.ColumnEditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.TypeReferenceConnection;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.ADTDirectEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.ADTSelectionFeedbackEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.adt.design.figures.IStructureFigure;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IType;
-import org.eclipse.wst.xsd.ui.internal.adt.typeviz.design.figures.HeadingFigure;
-import org.eclipse.wst.xsd.ui.internal.adt.typeviz.design.figures.RoundedLineBorder;
-import org.eclipse.wst.xsd.ui.internal.adt.typeviz.design.figures.StructureFigure;
-import org.eclipse.wst.xsd.ui.internal.common.actions.OpenInNewEditor;
-import org.eclipse.wst.xsd.ui.internal.common.util.XSDCommonUIUtils;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.XSDSimpleTypeDefinition;
-
-public class XSDSimpleTypeEditPart extends BaseTypeConnectingEditPart
-{
- protected 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);
- return figure;
- }
-
- protected void refreshVisuals()
- {
- XSDSimpleTypeDefinitionAdapter adapter = (XSDSimpleTypeDefinitionAdapter)getModel();
- String name = adapter.getDisplayName();
- HeadingFigure headingFigure = figure.getHeadingFigure();
- headingFigure.setIsReadOnly(adapter.isReadOnly());
- Label label = headingFigure.getLabel();
- label.setText(name);
- label.setIcon(XSDCommonUIUtils.getUpdatedImage(adapter.getXSDTypeDefinition(), adapter.getImage(), adapter.isReadOnly()));
- }
-
- public IStructureFigure getStructureFigure()
- {
- return (IStructureFigure)getFigure();
- }
-
- public IFigure getContentPane()
- {
- return getStructureFigure().getContentPane();
- }
-
-
- protected void createEditPolicies()
- {
- super.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()
- {
- TypeReferenceConnection connectionFigure = null;
- XSDSimpleTypeDefinitionAdapter adapter = (XSDSimpleTypeDefinitionAdapter)getModel();
- IType superType = adapter.getSuperType();
-
- if (superType != null)
- {
- AbstractGraphicalEditPart referenceTypePart = (AbstractGraphicalEditPart)getTargetEditPart(superType);
-
- if (referenceTypePart != null)
- {
- connectionFigure = new TypeReferenceConnection(true);
- // 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.setConnectionRouter(new ManhattanConnectionRouter());
- ((CenteredConnectionAnchor)connectionFigure.getSourceAnchor()).setOther((CenteredConnectionAnchor)connectionFigure.getTargetAnchor());
- connectionFigure.setHighlight(false);
-
- }
- }
- return connectionFigure;
- }
-
- protected EditPart getTargetEditPart(IType type)
- {
- ColumnEditPart columnEditPart = null;
- for (EditPart editPart = this; editPart != null; editPart = editPart.getParent())
- {
- if (editPart instanceof ColumnEditPart)
- {
- columnEditPart = (ColumnEditPart)editPart;
- break;
- }
- }
- if (columnEditPart != null)
- {
- for (Iterator i = columnEditPart.getChildren().iterator(); i.hasNext(); )
- {
- EditPart child = (EditPart)i.next();
- if (child.getModel() == type)
- {
- return child;
- }
- }
- }
- return null;
- }
-
- public void performRequest(Request request)
- {
- if (request.getType() == RequestConstants.REQ_OPEN)
- {
- Object model = getModel();
- if (request instanceof LocationRequest)
- {
- LocationRequest locationRequest = (LocationRequest)request;
- Point p = locationRequest.getLocation();
-
- if (getStructureFigure().hitTestHeader(p))
- {
- // TODO: !!! This should be moved to the adt-xsd package
- //
- if (model instanceof XSDSimpleTypeDefinitionAdapter)
- {
- XSDSimpleTypeDefinitionAdapter adapter = (XSDSimpleTypeDefinitionAdapter)model;
- XSDSimpleTypeDefinition st = (XSDSimpleTypeDefinition)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 == st.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()
- {
- if (getModel() instanceof IType)
- {
- if (((IType)getModel()).getSuperType() != null)
- return true;
- }
- return false;
- }
-
- public String getReaderText()
- {
- HeadingFigure headingFigure = figure.getHeadingFigure();
- return headingFigure.getLabel().getText();
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/model/SpaceFiller.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/model/SpaceFiller.java
deleted file mode 100644
index 30ab79a88f..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/model/SpaceFiller.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.design.editparts.model;
-
-import org.eclipse.gef.commands.Command;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObjectListener;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IComplexType;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IField;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IModel;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IType;
-import org.eclipse.wst.xsd.ui.internal.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")) //$NON-NLS-1$
- {
- return XSDEditorPlugin.getXSDImage("icons/XSDAttribute.gif"); //$NON-NLS-1$
- }
- else
- {
- return XSDEditorPlugin.getXSDImage("icons/XSDElement.gif"); //$NON-NLS-1$
- }
- }
-
- 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;
- }
-
- public boolean isReference()
- {
- // TODO Auto-generated method stub
- return false;
- }
-
- public boolean isAbstract()
- {
- // TODO Auto-generated method stub
- return false;
- }
-}
-
-
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/model/TargetConnectionSpaceFiller.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/model/TargetConnectionSpaceFiller.java
deleted file mode 100644
index 73eae5aa24..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/model/TargetConnectionSpaceFiller.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.design.editparts.model;
-
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObjectListener;
-
-public class TargetConnectionSpaceFiller implements IADTObject
-{
- private XSDBaseAdapter adapter;
-
- public TargetConnectionSpaceFiller(XSDBaseAdapter adapter)
- {
- this.adapter = adapter;
- }
-
- public XSDBaseAdapter getAdapter()
- {
- return adapter;
- }
-
- public void registerListener(IADTObjectListener listener)
- {
-
- }
-
- public void unregisterListener(IADTObjectListener listener)
- {
-
- }
-
- public boolean isReadOnly()
- {
- return false;
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editpolicies/DragAndDropEditPolicy.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editpolicies/DragAndDropEditPolicy.java
deleted file mode 100644
index 142e3f6dad..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editpolicies/DragAndDropEditPolicy.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.design.editpolicies;
-
-import java.util.List;
-
-import org.eclipse.draw2d.FigureCanvas;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.gef.EditPartViewer;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.ChangeBoundsRequest;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAttributeAdapter;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDElementDeclarationAdapter;
-import org.eclipse.wst.xsd.ui.internal.commands.BaseDragAndDropCommand;
-import org.eclipse.wst.xsd.ui.internal.commands.XSDAttributeDragAndDropCommand;
-import org.eclipse.wst.xsd.ui.internal.commands.XSDElementDragAndDropCommand;
-import org.eclipse.wst.xsd.ui.internal.design.editparts.XSDBaseFieldEditPart;
-
-
-public class DragAndDropEditPolicy extends org.eclipse.gef.editpolicies.GraphicalEditPolicy
-{
- protected EditPartViewer viewer;
- protected SelectionHandlesEditPolicyImpl selectionHandlesEditPolicy;
-
- public DragAndDropEditPolicy(EditPartViewer viewer, SelectionHandlesEditPolicyImpl selectionHandlesEditPolicy)
- {
- this.viewer = viewer;
- this.selectionHandlesEditPolicy = selectionHandlesEditPolicy;
- }
-
- public boolean understandsRequest(Request req)
- {
- return true;
- }
-
-
- public org.eclipse.gef.commands.Command getCommand(Request request)
- {
- BaseDragAndDropCommand command = null;
- if (request instanceof ChangeBoundsRequest)
- {
- ChangeBoundsRequest changeBoundsRequest = (ChangeBoundsRequest)request;
- Point location = changeBoundsRequest.getLocation();
-
- GraphicalEditPart target = (GraphicalEditPart)viewer.findObjectAt(location);
- location = getPointerLocation(changeBoundsRequest.getLocation());
- ((GraphicalEditPart)viewer.getRootEditPart()).getFigure().translateToRelative(location);
-
- List list = changeBoundsRequest.getEditParts();
- // allow drag and drop of only one selected object
- if (list.size() == 1)
- {
- Object itemToDrag = list.get(0);
- if (itemToDrag instanceof XSDBaseFieldEditPart)
- {
- XSDBaseFieldEditPart selected = (XSDBaseFieldEditPart) itemToDrag;
- if (selected.getModel() instanceof XSDElementDeclarationAdapter)
- {
- command = new XSDElementDragAndDropCommand(viewer, (ChangeBoundsRequest)request, target, selected, location);
- selectionHandlesEditPolicy.setDragAndDropCommand(command);
- }
- else if (selected.getModel() instanceof XSDBaseAttributeAdapter)
- {
- command = new XSDAttributeDragAndDropCommand(viewer, (ChangeBoundsRequest)request, target, selected, location);
- selectionHandlesEditPolicy.setDragAndDropCommand(command);
- }
- }
- }
- }
- return command;
- }
-
- protected Point getPointerLocation(Point origPointerLocation)
- {
- Point compensatedLocation = origPointerLocation;
- FigureCanvas figureCanvas = (FigureCanvas) viewer.getControl();
- int yOffset = figureCanvas.getViewport().getVerticalRangeModel().getValue();
- int xOffset = figureCanvas.getViewport().getHorizontalRangeModel().getValue();
- compensatedLocation.y = compensatedLocation.y + yOffset;
- compensatedLocation.x = compensatedLocation.x + xOffset;
- return compensatedLocation;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editpolicies/GraphNodeDragTracker.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editpolicies/GraphNodeDragTracker.java
deleted file mode 100644
index 26b229bd94..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editpolicies/GraphNodeDragTracker.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.design.editpolicies;
-import java.util.List;
-
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPartViewer;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.tools.DragEditPartsTracker;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.BaseEditPart;
-
-
-public class GraphNodeDragTracker extends DragEditPartsTracker
-{
- protected EditPart editPart;
-
- public GraphNodeDragTracker(EditPart editPart)
- {
- super(editPart);
- this.editPart = editPart;
- }
-
- protected Command getCommand()
- {
- Request request = getTargetRequest();
- return editPart.getCommand(request);
- }
-
- protected void performSelection()
- {
- performAdditionalSelection();
- super.performSelection();
- }
-
- protected void performAdditionalSelection()
- {
- EditPartViewer viewer = getCurrentViewer();
- // This code selects the fields in-between the last selected field and the newly
- // selected field, if the shift key is held down. Note that the selection logic
- // can be improved so that already selected but, a) incompatible edit part figures, or b)
- // like-edit part figures from other parents, should be unselected.
- if (getCurrentInput().isShiftKeyDown())
- {
- // This list contains the fields
- List list = editPart.getParent().getChildren();
- // Get the index of the current selection
- int currentIndex = list.indexOf(editPart);
- // List of all the currently selected edit parts
- List currentSelected = viewer.getSelectedEditParts();
- int size = currentSelected.size();
- if (size > 0)
- {
- Object lastSelected = currentSelected.get(size - 1);
- if (lastSelected instanceof BaseEditPart)
- {
- // Here, we determine the upper and lower limit of the indices
- int lowerIndex = -1, upperIndex = -1;
- int lastSelectedIndex = list.indexOf(lastSelected);
- if (lastSelectedIndex >= 0 && lastSelectedIndex < currentIndex)
- {
- lowerIndex = lastSelectedIndex;
- upperIndex = currentIndex;
- }
- else if (lastSelectedIndex >= 0 && lastSelectedIndex > currentIndex)
- {
- lowerIndex = currentIndex;
- upperIndex = lastSelectedIndex;
- }
- if (lowerIndex >= 0 && upperIndex >= 0)
- {
- for (int i = lowerIndex; i < upperIndex; i++)
- {
- viewer.appendSelection((EditPart) list.get(i));
- }
- }
- }
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editpolicies/SelectionHandlesEditPolicyImpl.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editpolicies/SelectionHandlesEditPolicyImpl.java
deleted file mode 100644
index d7f0b3951a..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editpolicies/SelectionHandlesEditPolicyImpl.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.design.editpolicies;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Polyline;
-import org.eclipse.draw2d.RectangleFigure;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.ChangeBoundsRequest;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.ADTSelectionFeedbackEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.commands.BaseDragAndDropCommand;
-
-public class SelectionHandlesEditPolicyImpl extends ADTSelectionFeedbackEditPolicy
-{
- protected IFigure feedback;
- protected Rectangle originalLocation;
- protected BaseDragAndDropCommand dragAndDropCommand;
- protected Polyline polyLine;
- protected RectangleFigure ghostShape;
-
- public boolean understandsRequest(Request request)
- {
- boolean result = false;
-
- if (REQ_MOVE.equals(request.getType()))
- {
- result = false;
- }
- else
- {
- result = super.understandsRequest(request);
- }
- return result;
- }
-
-
- public org.eclipse.gef.commands.Command getCommand(Request request)
- {
- return null;
- }
-
- public void setDragAndDropCommand(BaseDragAndDropCommand dragAndDropCommand)
- {
- this.dragAndDropCommand = dragAndDropCommand;
- }
-
- public void showSourceFeedback(Request request)
- {
- eraseChangeBoundsFeedback(null);
- if (dragAndDropCommand != null && dragAndDropCommand.canExecute()) {
- if (REQ_MOVE.equals(request.getType()) || REQ_ADD.equals(request.getType())) {
- if (dragAndDropCommand != null && dragAndDropCommand.getFeedbackFigure() != null) {
- feedback = dragAndDropCommand.getFeedbackFigure();
- addFeedback(feedback);
- }
- }
- }
- }
-
- public void deactivate()
- {
- if (feedback != null)
- {
- removeFeedback(feedback);
- feedback = null;
- }
- hideFocus();
- super.deactivate();
- }
-
- /**
- * Erase feedback indicating that the receiver object is
- * being dragged. This method is called when a drag is
- * completed or cancelled on the receiver object.
- * @param dragTracker org.eclipse.gef.tools.DragTracker The drag tracker of the tool performing the drag.
- */
- protected void eraseChangeBoundsFeedback(ChangeBoundsRequest request)
- {
- if (feedback != null)
- {
- removeFeedback(feedback);
- }
- feedback = null;
- originalLocation = null;
- }
-
- /**
- * Erase feedback indicating that the receiver object is
- * being dragged. This method is called when a drag is
- * completed or cancelled on the receiver object.
- * @param dragTracker org.eclipse.gef.tools.DragTracker The drag tracker of the tool performing the drag.
- */
- public void eraseSourceFeedback(Request request)
- {
- if (REQ_MOVE.equals(request.getType()) || REQ_ADD.equals(request.getType()))
- {
- eraseChangeBoundsFeedback((ChangeBoundsRequest)request);
- }
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editpolicies/TopLevelComponentLabelCellEditorLocator.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editpolicies/TopLevelComponentLabelCellEditorLocator.java
deleted file mode 100644
index a594a502f9..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editpolicies/TopLevelComponentLabelCellEditorLocator.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * 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.internal.design.editpolicies;
-
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.wst.xsd.ui.internal.adt.design.directedit.LabelCellEditorLocator;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.INamedEditPart;
-
-public class TopLevelComponentLabelCellEditorLocator extends LabelCellEditorLocator
-{
- public TopLevelComponentLabelCellEditorLocator(INamedEditPart namedEditPart, Point cursorLocation)
- {
- super(namedEditPart, cursorLocation);
- }
-
- public void relocate(CellEditor celleditor)
- {
- Text text = (Text) celleditor.getControl();
-
- Label label = namedEditPart.getNameLabelFigure();
-
- if (text.getBounds().x <= 0)
- {
- super.relocate(celleditor);
- }
- else
- {
- org.eclipse.swt.graphics.Point sel = text.getSelection();
- org.eclipse.swt.graphics.Point pref = text.computeSize(-1, -1);
- Rectangle rect = label.getTextBounds().getCopy();
- label.translateToAbsolute(rect);
- text.setBounds(rect.x, rect.y-1, rect.width, pref.y+1);
- text.setSelection(0);
- text.setSelection(sel);
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editpolicies/TopLevelNameDirectEditManager.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editpolicies/TopLevelNameDirectEditManager.java
deleted file mode 100644
index fd92420bc0..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editpolicies/TopLevelNameDirectEditManager.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.design.editpolicies;
-
-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.ISelectionProvider;
-import org.eclipse.jface.viewers.StructuredSelection;
-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.Display;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.part.CellEditorActionHandler;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.BaseSelectionAction;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.INamedEditPart;
-import org.eclipse.wst.xsd.ui.internal.design.editparts.TopLevelComponentEditPart;
-import org.eclipse.xsd.XSDNamedComponent;
-
-public class TopLevelNameDirectEditManager extends DirectEditManager
-{
- protected XSDNamedComponent component;
- private IActionBars actionBars;
- private CellEditorActionHandler actionHandler;
- private IAction copy, cut, paste, undo, redo, find, selectAll, delete;
- private Font scaledFont;
-
- public TopLevelNameDirectEditManager(GraphicalEditPart source, CellEditorLocator locator, XSDNamedComponent component)
- {
- super(source, null, locator);
- this.component = component;
- }
-
- /**
- * @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();
-
- if (getEditPart() instanceof TopLevelComponentEditPart)
- {
- Runnable runnable = new Runnable()
- {
- public void run()
- {
- IWorkbench workbench = PlatformUI.getWorkbench();
- IEditorPart editor = workbench.getActiveWorkbenchWindow().getActivePage().getActiveEditor();
- Object adapter = editor.getAdapter(ISelectionProvider.class);
- if (adapter instanceof ISelectionProvider)
- {
- ISelectionProvider sel = (ISelectionProvider) adapter;
- sel.setSelection(new StructuredSelection(getEditPart().getModel()));
- }
- }
- };
- Display.getCurrent().asyncExec(runnable);
- }
- }
-
- public void showFeedback()
- {
- super.showFeedback();
- }
-
- 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 = component.getName();
- 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);
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=252509
- // Delete action (key) doesn't always work. The saved action could be the
- // CellEditorActionHandler's DeleteActionHandler...due to timing issues.
- // We'll only restore the delete action if it is indeed the one for the Design view.
- // We should update the other actions too, but currently, none are applicable.
- if (delete instanceof BaseSelectionAction)
- {
- 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());
- IAction currentDeleteAction = actionBars.getGlobalActionHandler(ActionFactory.DELETE.getId());
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=252509
- // Delete action (key) doesn't always work. The saved action could be the
- // CellEditorActionHandler's DeleteActionHandler...due to timing issues.
- // We'll only restore the delete action if it is indeed the one for the Design view.
- // We should update the other actions too, but currently, none are applicable.
- if (currentDeleteAction instanceof BaseSelectionAction)
- {
- delete = currentDeleteAction;
- }
- 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());
- }
-
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/figures/CategoryFigure.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/figures/CategoryFigure.java
deleted file mode 100644
index ad125399d4..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/figures/CategoryFigure.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * 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.internal.design.figures;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.Figure;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.LineBorder;
-import org.eclipse.draw2d.MarginBorder;
-import org.eclipse.draw2d.ScrollPane;
-import org.eclipse.draw2d.ToolbarLayout;
-import org.eclipse.draw2d.Viewport;
-import org.eclipse.draw2d.ViewportLayout;
-import org.eclipse.wst.xsd.ui.internal.adt.typeviz.design.figures.HeadingFigure;
-import org.eclipse.wst.xsd.ui.internal.adt.typeviz.design.figures.RoundedLineBorder;
-import org.eclipse.wst.xsd.ui.internal.design.layouts.FillLayout;
-
-public class CategoryFigure extends Figure
-{
- protected ScrollPane scrollpane;
- protected Figure outerPane;
- public HeadingFigure headingFigure;
- Figure contentPane;
-
- public CategoryFigure(int type)
- {
- super();
-
- outerPane = new Figure();
- outerPane.setBorder(new RoundedLineBorder(1, 6));
-
- ToolbarLayout layout = new ToolbarLayout(false);
- layout.setVertical(true);
- layout.setStretchMinorAxis(true);
- FillLayout fillLayout = new FillLayout(3);
- fillLayout.setHorizontal(false);
-
- FillLayout outerLayout = new FillLayout();
- outerPane.setLayoutManager(outerLayout);
-
- add(outerPane);
-
- headingFigure = new HeadingFigure();
- outerPane.add(headingFigure);
-
- Figure line = new Figure();
- line.setBorder(new LineBorder(1));
- ToolbarLayout lineLayout = new ToolbarLayout(false);
- lineLayout.setVertical(true);
- lineLayout.setStretchMinorAxis(true);
- line.setLayoutManager(lineLayout);
- outerPane.add(line);
-
- scrollpane = new ScrollPane();
- scrollpane.setForegroundColor(ColorConstants.black);
- scrollpane.setVerticalScrollBarVisibility(ScrollPane.AUTOMATIC);
- outerPane.add(scrollpane);
-
- Figure pane = new Figure();
- pane.setBorder(new MarginBorder(5, 8, 5, 8));
- ToolbarLayout toolbarLayout = new ToolbarLayout(false);
- toolbarLayout.setSpacing(3);
- pane.setLayoutManager(toolbarLayout); // good
-
- Viewport viewport = new Viewport();
- viewport.setContentsTracksHeight(true);
- ViewportLayout viewportLayout = new ViewportLayout();
- viewport.setLayoutManager(viewportLayout);
-
- scrollpane.setViewport(viewport);
- scrollpane.setContents(pane);
- }
-
- public HeadingFigure getHeadingFigure()
- {
- return headingFigure;
- }
-
- public ScrollPane getScrollPane()
- {
- return scrollpane;
- }
-
- public IFigure getContentPane()
- {
- return scrollpane.getContents();
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/figures/CenteredIconFigure.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/figures/CenteredIconFigure.java
deleted file mode 100644
index 21772890b2..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/figures/CenteredIconFigure.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.design.figures;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.RoundedRectangle;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.wst.xsd.ui.internal.design.editparts.ReferenceConnection;
-
-public class CenteredIconFigure extends RoundedRectangle
-{
- public static final int NORMAL = 0;
- public static final int SELECTED = 1;
- public static final int HOVER = 2;
- public Image image;
- protected Label toolTipLabel;
- protected int mode = 0;
-
- public CenteredIconFigure()
- {
- super();
- setFill(true);
- toolTipLabel = new Label();
- setCornerDimensions(new Dimension(5,5));
- }
-
- public CenteredIconFigure(Image img)
- {
- this();
- this.image = img;
- }
-
- public void refresh()
- {
- repaint();
- }
-
- protected void outlineShape(Graphics graphics)
- {
- graphics.pushState();
- try
- {
- if (mode == NORMAL)
- { // TODO: common up and organize colors....
- graphics.setForegroundColor(ReferenceConnection.inactiveConnection);
- }
- else if (mode == SELECTED)
- {
- boolean highContrast = false;
- try
- {
- highContrast = Display.getDefault().getHighContrast();
- }
- catch (Exception e)
- {
- }
- if (highContrast)
- {
- graphics.setForegroundColor(Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND));
- }
- else
- {
- graphics.setForegroundColor(ColorConstants.black);
- }
- }
- super.outlineShape(graphics);
- }
- finally
- {
- graphics.popState();
- }
- }
-
- 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 - 1);
- }
- }
-
- public Label getToolTipLabel()
- {
- return toolTipLabel;
- }
-
- public void setMode(int mode)
- {
- this.mode = mode;
- }
-
- 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/ui/internal/design/figures/GenericGroupFigure.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/figures/GenericGroupFigure.java
deleted file mode 100644
index c0117ce8cb..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/figures/GenericGroupFigure.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * 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.internal.design.figures;
-
-import org.eclipse.draw2d.Figure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.wst.xsd.ui.internal.design.layouts.ModelGroupLayout;
-
-public class GenericGroupFigure extends Figure
-{
- protected CenteredIconFigure centeredIconFigure;
- protected Figure contentFigure;
- protected String text;
- protected boolean hasText = false;
- protected Label textFigure;
-
- 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 setText(String text)
- {
- this.text = text;
- hasText = false;
- if (text != null && text.length() > 0)
- {
- hasText = true;
- }
- }
-
- public boolean hasText()
- {
- return hasText;
- }
-
- public String getText()
- {
- return text;
- }
-
- public Point getTextCoordinates()
- {
- Rectangle rect = centeredIconFigure.getBounds();
- return new Point(rect.x, rect.y + 14);
- }
-
- 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/ui/internal/design/figures/HyperLinkLabel.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/figures/HyperLinkLabel.java
deleted file mode 100644
index b4ef29f118..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/figures/HyperLinkLabel.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * 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.internal.design.figures;
-
-import org.eclipse.draw2d.FigureUtilities;
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Point;
-
-public class HyperLinkLabel extends Label
-{
- protected void paintFigure(Graphics graphics)
- {
- super.paintFigure(graphics);
- graphics.setFont(getFont());
-
- // TODO (cs) this lookup to find " :" is a hack
- // that's specialized for element and type label text
- // we need to make the TopLevelComponent use two labels in this case
- //
- String string = getText();
- int index = string.indexOf(" :");
- if (index != -1)
- {
- string = string.substring(0, index);
- }
- // end hack
-
- Point p = getTextLocation();
- Dimension textSize = FigureUtilities.getTextExtents(string, getFont());
- int textWidth = textSize.width;
- int textHeight = textSize.height;
- int descent = graphics.getFontMetrics().getDescent();
- int lineY = bounds.y + p.y + textHeight - descent + 1;
- int lineX = bounds.x + p.x;
- graphics.drawLine(lineX, lineY, lineX + textWidth, lineY);
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/figures/IExtendedFigureFactory.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/figures/IExtendedFigureFactory.java
deleted file mode 100644
index e107b577a4..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/figures/IExtendedFigureFactory.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/*******************************************************************************
- * 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.internal.design.figures;
-
-import org.eclipse.wst.xsd.ui.internal.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/ui/internal/design/figures/IModelGroupFigure.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/figures/IModelGroupFigure.java
deleted file mode 100644
index 10ff423a21..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/figures/IModelGroupFigure.java
+++ /dev/null
@@ -1,17 +0,0 @@
-/*******************************************************************************
- * 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.internal.design.figures;
-
-import org.eclipse.wst.xsd.ui.internal.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/ui/internal/design/figures/ModelGroupFigure.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/figures/ModelGroupFigure.java
deleted file mode 100644
index 7009930d7c..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/figures/ModelGroupFigure.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * 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.internal.design.figures;
-
-import org.eclipse.gef.EditPart;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-
-public class ModelGroupFigure extends GenericGroupFigure implements IModelGroupFigure
-{
- public static final Image SEQUENCE_ICON_IMAGE = XSDEditorPlugin.getPlugin().getIcon("obj16/sequence_obj.gif"); //$NON-NLS-1$
- public static final Image SEQUENCE_ICON_DISABLED_IMAGE = XSDEditorPlugin.getPlugin().getIcon("obj16/sequencedis_obj.gif"); //$NON-NLS-1$
- public static final Image CHOICE_ICON_IMAGE = XSDEditorPlugin.getPlugin().getIcon("obj16/choice_obj.gif"); //$NON-NLS-1$
- public static final Image CHOICE_ICON_DISABLED_IMAGE = XSDEditorPlugin.getPlugin().getIcon("obj16/choicedis_obj.gif"); //$NON-NLS-1$
- public static final Image ALL_ICON_IMAGE = XSDEditorPlugin.getPlugin().getIcon("obj16/all_obj.gif"); //$NON-NLS-1$
- public static final Image ALL_ICON_DISABLED_IMAGE = XSDEditorPlugin.getPlugin().getIcon("obj16/alldis_obj.gif"); //$NON-NLS-1$
-
- 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/ui/internal/design/figures/SpacingFigure.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/figures/SpacingFigure.java
deleted file mode 100644
index fa6a55a68f..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/figures/SpacingFigure.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * 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.internal.design.figures;
-
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.MarginBorder;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-
-public class SpacingFigure extends Label
-{
- public SpacingFigure()
- {
- super(""); //$NON-NLS-1$
- setIcon(XSDEditorPlugin.getXSDImage("icons/Dot.gif")); //$NON-NLS-1$
- setBorder(new MarginBorder(3, 0, 3, 0));
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/layouts/ContainerLayout.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/layouts/ContainerLayout.java
deleted file mode 100644
index 6209800b93..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/layouts/ContainerLayout.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*******************************************************************************
- * 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.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.ui.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/ui/internal/design/layouts/FillLayout.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/layouts/FillLayout.java
deleted file mode 100644
index 14fe8e5b3d..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/layouts/FillLayout.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*******************************************************************************
- * 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.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.Rectangle;
-
-public class FillLayout extends AbstractLayout
-{
- protected boolean isHorizontal = false;
- protected int spacing = 0;
- public Dimension min;
-
- public FillLayout()
- {
- }
-
- public FillLayout(int spacing)
- {
- this.spacing = spacing;
- }
-
- public void setHorizontal(boolean isHorizontal)
- {
- this.isHorizontal = isHorizontal;
- }
-
- /**
- * Calculates and returns the preferred size of the input container. This is
- * the size of the largest child of the container, as all other children fit
- * into this size.
- *
- * @param figure
- * Container figure for which preferred size is required.
- * @return The preferred size of the input figure.
- */
-
- protected Dimension calculatePreferredSize(IFigure figure, int width, int height)
- {
- Dimension d = calculatePreferredClientAreaSize(figure);
- d.expand(figure.getInsets().getWidth(), figure.getInsets().getHeight());
- d.union(getBorderPreferredSize(figure));
- return d;
- }
-
- protected Dimension calculatePreferredClientAreaSize(IFigure figure)
- {
- Dimension d = new Dimension();
- List children = figure.getChildren();
-
- for (Iterator i = children.iterator(); i.hasNext();)
- {
- IFigure child = (IFigure) i.next();
- Dimension childSize = child.getPreferredSize();
-
- if (isHorizontal)
- {
- d.width += childSize.width;
- d.height = Math.max(childSize.height, d.height);
- }
- else
- {
- d.height += childSize.height;
- d.width = Math.max(childSize.width, d.width);
- }
- }
-
- int childrenSize = children.size();
- if (childrenSize > 0)
- {
- if (isHorizontal)
- {
- d.width += spacing * (childrenSize - 1);
- }
- else
- {
- d.height += spacing * (childrenSize - 1);
- }
- }
-
- if (min != null)
- {
- d.width = Math.max(d.width, min.width);
- d.height = Math.max(d.height, min.height);
- }
- return d;
- }
-
- /*
- * Returns the minimum size required by the input container. This is the size
- * of the largest child of the container, as all other children fit into this
- * size.
- */
- public Dimension getMinimumSize(IFigure figure, int width, int height)
- {
- Dimension d = new Dimension();
- List children = figure.getChildren();
- IFigure child;
-
- for (int i = 0; i < children.size(); i++)
- {
- child = (IFigure) children.get(i);
- d.union(child.getMinimumSize());
- }
- d.expand(figure.getInsets().getWidth(), figure.getInsets().getHeight());
- return d;
- }
-
- public Dimension getPreferredSize(IFigure figure, int width, int height)
- {
- return calculatePreferredSize(figure, width, height);
- }
-
- /*
- * Lays out the children on top of each other with their sizes equal to that
- * of the available paintable area of the input container figure.
- */
- public void layout(IFigure figure)
- {
- Dimension preferredSize = calculatePreferredClientAreaSize(figure);
- Rectangle r = figure.getClientArea().getCopy();
- List children = figure.getChildren();
-
- int nChildren = children.size();
- int extraHorizontalSpace = r.width - preferredSize.width;
-
- for (Iterator i = children.iterator(); i.hasNext();)
- {
- IFigure child = (IFigure) i.next();
- Dimension preferredChildSize = child.getPreferredSize();
-
- if (isHorizontal)
- {
- int w = preferredChildSize.width + (extraHorizontalSpace / nChildren);
- child.setBounds(new Rectangle(r.x, r.y, w, Math.max(preferredSize.height, r.height)));
- r.x += w + spacing;
- }
- else
- {
- child.setBounds(new Rectangle(r.x, r.y, Math.max(preferredSize.width, r.width), preferredChildSize.height));
- r.y += preferredChildSize.height + spacing;
- }
- }
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/layouts/ModelGroupLayout.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/layouts/ModelGroupLayout.java
deleted file mode 100644
index db5a0ca42a..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/layouts/ModelGroupLayout.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.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.ui.internal.design.figures.ModelGroupFigure;
-import org.eclipse.wst.xsd.ui.internal.design.figures.SpacingFigure;
-
-public class ModelGroupLayout extends AbstractLayout
-{
- protected boolean isHorizontal;
- protected int spacing = 10;
- 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();
-
- 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);
- }
- 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/ui/internal/dialogs/BuiltInTypesTreeViewerProvider.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/dialogs/BuiltInTypesTreeViewerProvider.java
deleted file mode 100644
index f0cecbb770..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/dialogs/BuiltInTypesTreeViewerProvider.java
+++ /dev/null
@@ -1,221 +0,0 @@
-/*******************************************************************************
- * 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.ui.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.ui.internal.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 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/ui/internal/dialogs/IOpenInNewEditor.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/dialogs/IOpenInNewEditor.java
deleted file mode 100644
index 5e2c520e61..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/dialogs/IOpenInNewEditor.java
+++ /dev/null
@@ -1,16 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.dialogs;
-
-public interface IOpenInNewEditor
-{
- public void openXSDEditor();
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/dialogs/NewAttributeDialog.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/dialogs/NewAttributeDialog.java
deleted file mode 100644
index 5602942882..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/dialogs/NewAttributeDialog.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.dialogs;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification;
-import org.eclipse.wst.xsd.ui.internal.adt.edit.IComponentDialog;
-import org.eclipse.wst.xsd.ui.internal.common.util.XSDCommonUIUtils;
-import org.eclipse.wst.xsd.ui.internal.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.search.IXSDSearchConstants;
-import org.eclipse.xsd.XSDAttributeDeclaration;
-import org.eclipse.xsd.XSDSchema;
-
-public class NewAttributeDialog extends NewComponentDialog implements IComponentDialog
-{
- protected XSDSchema schema;
- protected Object setObject;
- protected int typeKind;
- protected Object selection;
-
- public NewAttributeDialog()
- {
- super(Display.getCurrent().getActiveShell(), Messages._UI_LABEL_NEW_ATTRIBUTE, "NewAttribute"); //$NON-NLS-1$
- }
-
- public NewAttributeDialog(XSDSchema schema)
- {
- super(Display.getCurrent().getActiveShell(), Messages._UI_LABEL_NEW_ATTRIBUTE, "NewAttribute"); //$NON-NLS-1$
- this.schema = schema;
- }
-
- private void setup() {
- if (schema != null) {
- List usedNames = getUsedElementNames();
- setUsedNames(usedNames);
- setDefaultName(XSDCommonUIUtils.createUniqueElementName("NewAttribute", schema.getAttributeDeclarations()));
- }
- }
-
- public int createAndOpen()
- {
- setup();
- 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(IXSDSearchConstants.ATTRIBUTE_META_NAME);
- componentSpecification.setNew(true);
- return componentSpecification;
- }
-
- public void setInitialSelection(ComponentSpecification componentSpecification)
- {
- // TODO Auto-generated method stub
- }
-
- private List getUsedElementNames() {
- List usedNames = new ArrayList();
- if (schema != null ) {
- List elementsList = schema.getAttributeDeclarations();
- Iterator elements = elementsList.iterator();
- while (elements.hasNext()) {
- usedNames.add(((XSDAttributeDeclaration) elements.next()).getName());
- }
- }
-
- return usedNames;
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/dialogs/NewComponentDialog.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/dialogs/NewComponentDialog.java
deleted file mode 100644
index aa0c49e02e..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/dialogs/NewComponentDialog.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/*******************************************************************************
- * 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.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;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.xsd.ui.internal.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorCSHelpIds;
-
-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(Messages.UI_LABEL_NAME);
-
- 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);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(nameField, XSDEditorCSHelpIds.NEWTYPE_NAME);
-
- 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 org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_ERROR_NAME_ALREADY_USED; //$NON-NLS-1$
- }
- }
-
- return null;
- }
-
- protected void updateErrorMessage()
- {
- String errorMessage = null;
- String name = nameField.getText().trim();
- if (name.length() > 0)
- {
- errorMessage = computeErrorMessage(name);
- }
- else
- {
- errorMessage = ""; //$NON-NLS-1$
- }
- errorMessageLabel.setText(errorMessage != null ? errorMessage : ""); //$NON-NLS-1$
- 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;
- }
-
- public void setUsedNames(List usedNames) {
- this.usedNames = usedNames;
- }
-
- public void setDefaultName(String name) {
- this.name = name;
- }
-}
-
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/dialogs/NewElementButtonHandler.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/dialogs/NewElementButtonHandler.java
deleted file mode 100644
index 9c83571743..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/dialogs/NewElementButtonHandler.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * 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.internal.dialogs;
-
-import org.eclipse.wst.common.ui.internal.search.dialogs.INewComponentHandler;
-
-public class NewElementButtonHandler implements INewComponentHandler
-{
- public NewElementButtonHandler()
- {
- }
-
- public void openNewComponentDialog()
- {
- NewElementDialog newElementDialog = new NewElementDialog();
- newElementDialog.createAndOpen();
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/dialogs/NewElementDialog.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/dialogs/NewElementDialog.java
deleted file mode 100644
index 2a0619b52b..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/dialogs/NewElementDialog.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * 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.internal.dialogs;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification;
-import org.eclipse.wst.xsd.ui.internal.adt.edit.IComponentDialog;
-import org.eclipse.wst.xsd.ui.internal.common.util.XSDCommonUIUtils;
-import org.eclipse.wst.xsd.ui.internal.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.search.IXSDSearchConstants;
-import org.eclipse.xsd.XSDElementDeclaration;
-import org.eclipse.xsd.XSDSchema;
-
-public class NewElementDialog extends NewComponentDialog implements IComponentDialog
-{
- protected XSDSchema schema;
- protected Object setObject;
- protected int typeKind;
- protected Object selection;
-
- public NewElementDialog()
- {
- super(Display.getCurrent().getActiveShell(), Messages._UI_LABEL_NEW_ELEMENT, "NewElement"); //$NON-NLS-1$
- }
-
- public NewElementDialog(XSDSchema schema)
- {
- super(Display.getCurrent().getActiveShell(), Messages._UI_LABEL_NEW_ELEMENT, "NewElement"); //$NON-NLS-1$
- this.schema = schema;
- }
-
- private void setup() {
- if (schema != null) {
- List usedNames = getUsedElementNames();
- setUsedNames(usedNames);
- setDefaultName(XSDCommonUIUtils.createUniqueElementName("NewElement", schema.getElementDeclarations()));
- }
- }
-
- public int createAndOpen()
- {
- setup();
- 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(IXSDSearchConstants.ELEMENT_META_NAME);
- componentSpecification.setNew(true);
- return componentSpecification;
- }
-
- public void setInitialSelection(ComponentSpecification componentSpecification)
- {
- // TODO Auto-generated method stub
- }
-
- private List getUsedElementNames() {
- List usedNames = new ArrayList();
- if (schema != null ) {
- List elementsList = schema.getElementDeclarations();
- Iterator elements = elementsList.iterator();
- while (elements.hasNext()) {
- usedNames.add(((XSDElementDeclaration) elements.next()).getName());
- }
- }
-
- return usedNames;
- }
- }
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/dialogs/NewTypeButtonHandler.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/dialogs/NewTypeButtonHandler.java
deleted file mode 100644
index e815a88b8d..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/dialogs/NewTypeButtonHandler.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * 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.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.createAndOpen();
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/dialogs/NewTypeDialog.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/dialogs/NewTypeDialog.java
deleted file mode 100644
index 45fec61d50..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/dialogs/NewTypeDialog.java
+++ /dev/null
@@ -1,212 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.dialogs;
-
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.FileLocator;
-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.ui.PlatformUI;
-import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification;
-import org.eclipse.wst.xsd.ui.internal.adt.edit.IComponentDialog;
-import org.eclipse.wst.xsd.ui.internal.common.util.XSDCommonUIUtils;
-import org.eclipse.wst.xsd.ui.internal.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorCSHelpIds;
-import org.eclipse.wst.xsd.ui.internal.search.IXSDSearchConstants;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.XSDTypeDefinition;
-
-public class NewTypeDialog extends NewComponentDialog implements IComponentDialog
-{
- protected XSDSchema schema;
- protected static int SIMPLE_TYPE = 0;
- protected static int COMPLEX_TYPE = 1;
- protected Object setObject;
- protected int typeKind;
- protected Object selection;
- protected boolean allowComplexType = true;
- protected boolean allowAnonymousType = true;
- protected boolean anonymousType = false;
- private Button complexTypeButton;
- private Button simpleTypeButton;
- private Button anonymousTypeCheckBox;
-
- public NewTypeDialog()
- {
- super(Display.getCurrent().getActiveShell(), Messages._UI_LABEL_NEW_TYPE, "NewType"); //$NON-NLS-1$
- }
-
- public NewTypeDialog(XSDSchema schema)
- {
- super(Display.getCurrent().getActiveShell(), Messages._UI_LABEL_NEW_TYPE, "NewType"); //$NON-NLS-1$
- this.schema = schema;
- }
-
- private void setup() {
- if (schema != null) {
- List usedNames = getUsedTypeNames();
- setUsedNames(usedNames);
- setDefaultName(XSDCommonUIUtils.createUniqueElementName(name, schema.getTypeDefinitions()));
- }
- }
-
- public int createAndOpen()
- {
- setup();
- int returnCode = super.createAndOpen();
- if (returnCode == 0)
- {
- if (setObject instanceof Adapter)
- {
- //Command command = new AddComplexTypeDefinitionCommand(getName(), schema);
- }
- }
- return returnCode;
- }
-
- public ComponentSpecification getSelectedComponent()
- {
- ComponentSpecification componentSpecification;
- if ( anonymousType )
- componentSpecification = new ComponentSpecification(null, null, null);
- else
- componentSpecification = new ComponentSpecification(null, getName(), null);
- componentSpecification.setMetaName(typeKind == COMPLEX_TYPE ? IXSDSearchConstants.COMPLEX_TYPE_META_NAME : IXSDSearchConstants.SIMPLE_TYPE_META_NAME);
- componentSpecification.setNew(true);
- //componentSpecification.
- return componentSpecification;
- }
-
- public void setInitialSelection(ComponentSpecification componentSpecification)
- {
- // TODO Auto-generated method stub
- }
-
- protected void createHeaderContent(Composite parent)
- {
- complexTypeButton = new Button(parent, SWT.RADIO);
- complexTypeButton.setText(Messages._UI_LABEL_COMPLEX_TYPE);
- complexTypeButton.setEnabled(allowComplexType);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(complexTypeButton, XSDEditorCSHelpIds.NEWTYPE_COMPLEXTYPE);
-
- simpleTypeButton = new Button(parent, SWT.RADIO);
- simpleTypeButton.setText(Messages._UI_LABEL_SIMPLE_TYPE);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(simpleTypeButton, XSDEditorCSHelpIds.NEWTYPE_SIMPLETYPE);
-
- SelectionAdapter listener = new SelectionAdapter()
- {
- public void widgetSelected(SelectionEvent e)
- {
- if (e.widget == simpleTypeButton)
- {
- typeKind = SIMPLE_TYPE;
- }
- else if (e.widget == complexTypeButton)
- {
- typeKind = COMPLEX_TYPE;
- }
- else if (allowAnonymousType && e.widget == anonymousTypeCheckBox)
- {
- if (anonymousTypeCheckBox.getSelection() == true)
- {
- nameField.setEnabled(false);
- anonymousType = true;
- }
- else
- {
- nameField.setEnabled(true);
- anonymousType = false;
- }
- }
- }
- };
- if (allowComplexType)
- {
- complexTypeButton.setSelection(true);
- typeKind = COMPLEX_TYPE;
- }
- else
- {
- simpleTypeButton.setSelection(true);
- typeKind = SIMPLE_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);
-
- if (allowAnonymousType )
- {
- anonymousTypeCheckBox = new Button(parent, SWT.CHECK);
- anonymousTypeCheckBox.setText(Messages._UI_LABEL_CREATE_ANON_TYPE);
- }
-
- if (anonymousTypeCheckBox != null)
- anonymousTypeCheckBox.addSelectionListener(listener);
- }
-
- /**
- * This method will be removed in the next WTP release.
- * @deprecated
- */
- protected String getNormalizedLocation(String location)
- {
- try
- {
- URL url = new URL(location);
- URL resolvedURL = FileLocator.resolve(url);
- location = resolvedURL.getPath();
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- return location;
- }
-
- public void allowComplexType(boolean value)
- {
- this.allowComplexType= value;
- }
-
- public void allowAnonymousType(boolean value)
- {
- this.allowAnonymousType = value;
- }
-
- private List getUsedTypeNames() {
- List usedNames = new ArrayList();
-
- if (schema != null) {
- List typesList = schema.getTypeDefinitions();
- Iterator types = typesList.iterator();
- while (types.hasNext()) {
- usedNames.add(((XSDTypeDefinition) types.next()).getName());
- }
- }
-
- return usedNames;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/dialogs/SelectBuiltInTypesForFilteringDialog.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/dialogs/SelectBuiltInTypesForFilteringDialog.java
deleted file mode 100644
index a437d6cdab..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/dialogs/SelectBuiltInTypesForFilteringDialog.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*******************************************************************************
- * 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.ui.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.ui.internal.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.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);
-
- setTitle(Messages._UI_LABEL_SET_COMMON_BUILT_IN_TYPES);
- setMessage(Messages._UI_LABEL_SELECT_TYPES_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 = ""; //$NON-NLS-1$
- 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 = 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/ui/internal/dialogs/XSDEditSchemaNS.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/dialogs/XSDEditSchemaNS.java
deleted file mode 100644
index 43e520d2a1..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/dialogs/XSDEditSchemaNS.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.dialogs;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.wst.xml.ui.internal.XMLUIMessages;
-import org.eclipse.wst.xml.ui.internal.dialogs.EditSchemaInfoDialog;
-import org.eclipse.wst.xml.ui.internal.nsedit.CommonEditNamespacesDialog;
-
-public class XSDEditSchemaNS extends EditSchemaInfoDialog
-{
- CommonEditNamespacesDialog editNamespacesControl;
-
- public XSDEditSchemaNS(Shell parentShell, IPath resourceLocation)
- {
- super(parentShell, resourceLocation);
- }
-
- protected Control createDialogArea(Composite parent)
- {
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- editNamespacesControl = new CommonEditNamespacesDialog(composite, resourceLocation, XMLUIMessages._UI_NAMESPACE_DECLARATIONS);
-
- editNamespacesControl.setNamespaceInfoList(namespaceInfoList);
- editNamespacesControl.updateErrorMessage(namespaceInfoList);
-
- return composite;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/dialogs/XSDGraphViewerDialog.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/dialogs/XSDGraphViewerDialog.java
deleted file mode 100644
index 33adbdeff4..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/dialogs/XSDGraphViewerDialog.java
+++ /dev/null
@@ -1,416 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.dialogs;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.gef.EditPartFactory;
-import org.eclipse.gef.ui.parts.ScrollingGraphicalViewer;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.dialogs.PopupDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ControlEvent;
-import org.eclipse.swt.events.ControlListener;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.FillLayout;
-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.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.forms.events.HyperlinkEvent;
-import org.eclipse.ui.forms.events.IHyperlinkListener;
-import org.eclipse.ui.forms.widgets.Hyperlink;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDAdapterFactory;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.RootContentEditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.RootEditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.typeviz.design.figures.TypeVizFigureFactory;
-import org.eclipse.wst.xsd.ui.internal.common.actions.OpenInNewEditor;
-import org.eclipse.wst.xsd.ui.internal.common.util.Messages;
-import org.eclipse.wst.xsd.ui.internal.design.editparts.XSDEditPartFactory;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDSchema;
-
-public class XSDGraphViewerDialog extends PopupDialog
-{
- protected Object model;
- protected ScrollingGraphicalViewer viewer;
- protected IOpenInNewEditor openInNewEditorHelper;
- private OpenEditorLinkListener linkListener;
- private Label nsInfoLabel;
- private Hyperlink link;
- private String infoText;
- private Font infoFont;
- private String uniqueID;
- private PreviewControlListener moveListener;
-
- private static String X_ORIGIN = "DIALOG_X_ORIGIN"; //$NON-NLS-1$
- private static String Y_ORIGIN = "DIALOG_Y_ORIGIN"; //$NON-NLS-1$
- private boolean isHighContrast = false;
-
- public XSDGraphViewerDialog(Shell parentShell, String titleText, String infoText, Object model, String ID)
- {
- // INFOPOPUP_SHELLSTYLE works properly on both Windows and Linux.
- super(parentShell, INFOPOPUP_SHELLSTYLE, true, true, true, true, false, titleText, infoText);
- setModel(model);
- linkListener = new OpenEditorLinkListener();
- this.infoText = infoText;
- this.uniqueID = ID;
- Assert.isTrue(ID != null && ID.length() > 0);
- moveListener = new PreviewControlListener();
- try
- {
- isHighContrast = Display.getDefault().getHighContrast();
- }
- catch (Exception e) {
- // ignore
- }
- create();
- }
-
- public void setOpenExternalEditor(IOpenInNewEditor helper)
- {
- this.openInNewEditorHelper = helper;
- }
-
- protected void fillDialogMenu(IMenuManager dialogMenu)
- {
- super.fillDialogMenu(dialogMenu);
- dialogMenu.add(new Separator());
- dialogMenu.add(new ClosePopup());
- dialogMenu.add(new Separator());
- dialogMenu.add(new SetOpenInEditor());
- }
-
- protected Control createDialogArea(Composite parent)
- {
- viewer = new ScrollingGraphicalViewer();
- Composite c = (Composite)super.createDialogArea(parent);
-
- if (isHighContrast)
- {
- c.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
- }
- else
- {
- c.setBackground(ColorConstants.white);
- }
- c.setLayout(new FillLayout());
-
- RootEditPart root = new RootEditPart();
- viewer.setRootEditPart(root);
-
- viewer.createControl(c);
-
- // The graphical viewer tool tip processing creates an extra shell which
- // interferes with the PopupDialog's deactivation logic.
- removeMouseListeners(viewer.getControl());
-
- if (isHighContrast)
- {
- viewer.getControl().setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
- }
- else
- {
- viewer.getControl().setBackground(ColorConstants.white);
- }
- EditPartFactory editPartFactory = new XSDEditPartFactory(new TypeVizFigureFactory());
- viewer.setEditPartFactory(editPartFactory);
-
- RootContentEditPart rootContentEditPart = new RootContentEditPart();
- rootContentEditPart.setModel(model);
- viewer.setContents(rootContentEditPart);
-
- getShell().addControlListener(moveListener);
- return c;
- }
-
- private void removeMouseListeners(Control control)
- {
- Listener[] listeners = control.getListeners(SWT.MouseEnter);
- control.removeListener(SWT.MouseEnter, listeners[0]);
-
- listeners = control.getListeners(SWT.MouseExit);
- control.removeListener(SWT.MouseExit, listeners[0]);
-
- listeners = control.getListeners(SWT.MouseHover);
- control.removeListener(SWT.MouseHover, listeners[0]);
-
- listeners = control.getListeners(SWT.MouseMove);
- control.removeListener(SWT.MouseMove, listeners[0]);
-
- listeners = control.getListeners(SWT.MouseDown);
- control.removeListener(SWT.MouseDown, listeners[0]);
-
- listeners = control.getListeners(SWT.MouseUp);
- control.removeListener(SWT.MouseUp, listeners[0]);
-
- listeners = control.getListeners(SWT.MouseDoubleClick);
- control.removeListener(SWT.MouseDoubleClick, listeners[0]);
- }
-
- protected Control createInfoTextArea(Composite parent)
- {
- Composite infoComposite = new Composite(parent, SWT.NONE);
- GridLayout gridLayout = new GridLayout(2, false);
- gridLayout.marginHeight = 0;
- gridLayout.marginWidth = 0;
- infoComposite.setLayout(gridLayout);
- GridData gd = new GridData(GridData.FILL_BOTH);
- infoComposite.setLayoutData(gd);
-
- nsInfoLabel = new Label(infoComposite, SWT.LEFT);
- nsInfoLabel.setText(infoText);
-
- Font font = nsInfoLabel.getFont();
- FontData[] fontDatas = font.getFontData();
- for (int i = 0; i < fontDatas.length; i++)
- {
- fontDatas[i].setHeight(fontDatas[i].getHeight() * 9 / 10);
- }
- infoFont = new Font(nsInfoLabel.getDisplay(), fontDatas);
- nsInfoLabel.setFont(infoFont);
- gd = new GridData(GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING);
- nsInfoLabel.setLayoutData(gd);
- nsInfoLabel.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW));
-
- link = new Hyperlink(infoComposite, SWT.RIGHT);
- // Remove mnemonic ampersand. It would be better to have a separate string in the future.
- String label = Messages._UI_ACTION_OPEN_IN_NEW_EDITOR.replaceAll("&", "");
- link.setText(label);
- link.setFont(infoFont);
- link.addHyperlinkListener(linkListener);
- return infoComposite;
- }
-
- private void setModel(Object model)
- {
- Assert.isTrue(model instanceof XSDConcreteComponent);
- this.model = XSDAdapterFactory.getInstance().adapt((XSDConcreteComponent) model);
- }
-
- protected class SetOpenInEditor extends Action
- {
- public SetOpenInEditor()
- {
- super(Messages._UI_ACTION_OPEN_IN_NEW_EDITOR);
- }
-
- public void run()
- {
- if (openInNewEditorHelper != null)
- {
- try
- {
- openInNewEditorHelper.openXSDEditor();
- }
- catch (Exception e)
- {
-
- }
- }
- }
- }
-
- private class ClosePopup extends Action {
- public ClosePopup()
- {
- super(Messages._UI_ACTION_CLOSE_SCHEMA_PREVIEW_POPUP);
- }
-
- public void run()
- {
- close();
- }
- }
-
- protected IDialogSettings getDialogSettings()
- {
- IDialogSettings settings= XSDEditorPlugin.getDefault().getDialogSettings().getSection(uniqueID);
- if (settings == null)
- settings= XSDEditorPlugin.getDefault().getDialogSettings().addNewSection(uniqueID);
-
- return settings;
- }
-
- protected Point getInitialLocation(Point initialSize)
- {
- Point result = super.getInitialLocation(initialSize);
-
- IDialogSettings settings = getDialogSettings();
- if (settings != null)
- {
- try
- {
-
- String prefix = uniqueID == null ? getClass().getName() : uniqueID;
- int x = settings.getInt(prefix + X_ORIGIN);
- int y = settings.getInt(prefix + Y_ORIGIN);
- result = new Point(x, y);
- Shell parent = getParentShell();
- if (parent != null)
- {
- Point parentLocation = parent.getLocation();
- result.x += parentLocation.x;
- result.y += parentLocation.y;
- }
- }
- catch (NumberFormatException e)
- {
- }
- }
- return result;
- }
-
- protected void saveDialogBounds(Shell shell)
- {
- IDialogSettings settings = getDialogSettings();
- if (settings != null)
- {
- Point shellLocation = shell.getLocation();
- Shell parent = getParentShell();
- if (parent != null)
- {
- Point parentLocation = parent.getLocation();
- shellLocation.x -= parentLocation.x;
- shellLocation.y -= parentLocation.y;
- }
- String prefix = uniqueID == null ? getClass().getName() : uniqueID;
- settings.put(prefix + X_ORIGIN, shellLocation.x);
- settings.put(prefix + Y_ORIGIN, shellLocation.y);
- }
- }
-
-
- public boolean close()
- {
- if (getShell() == null || getShell().isDisposed())
- {
- return true;
- }
-
- getShell().removeControlListener(moveListener);
- if (link != null)
- link.removeHyperlinkListener(linkListener);
- if (infoFont != null)
- infoFont.dispose();
- infoFont = null;
- return super.close();
- }
-
- private final class OpenEditorLinkListener implements IHyperlinkListener
- {
-
- public void linkActivated(HyperlinkEvent e)
- {
- new SetOpenInEditor().run();
- close();
- }
-
- public void linkEntered(HyperlinkEvent e)
- {
- link.setForeground(ColorConstants.lightBlue);
- }
-
- public void linkExited(HyperlinkEvent e)
- {
- link.setForeground(link.getParent().getForeground());
- }
-
- }
-
- protected class PreviewControlListener implements ControlListener
- {
-
- public void controlMoved(ControlEvent e)
- {
- saveDialogBounds(getShell());
- }
-
- public void controlResized(ControlEvent e)
- {
- }
- }
-
- /**
- * @deprecated since 1.2.101
- * @param xsdComponent
- * @param schema
- * @param editorName
- */
- public static void openNonXSDResourceSchema(XSDConcreteComponent xsdComponent, XSDSchema schema, String editorName)
- {
- openInlineSchema(getCurrentEditorInput(), xsdComponent, schema, editorName);
- }
-
- public static void openInlineSchema(IEditorInput editorInput, XSDConcreteComponent xsdComponent, XSDSchema schema, String editorName)
- {
- OpenInNewEditor.openInlineSchema(editorInput, xsdComponent, schema, editorName);
- }
-
- /**
- * @deprecated
- */
- public static void openXSDEditor(XSDConcreteComponent xsdComponent)
- {
- openXSDEditor(getCurrentEditorInput(), xsdComponent.getSchema(), xsdComponent);
- }
-
- public static void openXSDEditor(IEditorInput editorInput, XSDSchema schema, XSDConcreteComponent xsdComponent)
- {
- OpenInNewEditor.openXSDEditor(editorInput, schema, xsdComponent);
- }
-
- private static IEditorInput getCurrentEditorInput()
- {
- try
- {
- IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- IWorkbenchPage page = null;
- if (workbenchWindow != null)
- {
- page = workbenchWindow.getActivePage();
- if (page != null)
- {
- IEditorPart editorPart = page.getActiveEditor();
- if (editorPart != null)
- {
- return editorPart.getEditorInput();
- }
- }
- }
- }
- catch (Exception e)
- {
-
- }
- return null;
- }
-
- protected Control getFocusControl()
- {
- return link;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/BaseHyperlinkDetector.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/BaseHyperlinkDetector.java
deleted file mode 100644
index 5d431615c5..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/BaseHyperlinkDetector.java
+++ /dev/null
@@ -1,267 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *******************************************************************************/
-
-package org.eclipse.wst.xsd.ui.internal.editor;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.Region;
-import org.eclipse.jface.text.hyperlink.AbstractHyperlinkDetector;
-import org.eclipse.jface.text.hyperlink.IHyperlink;
-import org.eclipse.wst.sse.core.StructuredModelManager;
-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.text.ITextRegion;
-import org.eclipse.wst.sse.core.utils.StringUtils;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-
-/**
- * Base class for hyperlinks detectors. Provides a framework and common code for
- * hyperlink detectors. TODO: Can we pull this class further up the inheritance
- * hierarchy?
- */
-public abstract class BaseHyperlinkDetector extends AbstractHyperlinkDetector
-{
- /*
- * (non-Javadoc)
- */
- public IHyperlink[] detectHyperlinks(ITextViewer textViewer, IRegion region, boolean canShowMultipleHyperlinks)
- {
- if (region == null || textViewer == null)
- {
- return null;
- }
-
- List hyperlinks = new ArrayList(0);
- IDocument document = textViewer.getDocument();
- int offset = region.getOffset();
-
- IDOMNode node = getCurrentNode(document, offset);
-
- // This call allows us to determine whether an attribute is linkable,
- // without incurring the cost of asking for the target component.
-
- if (!isLinkable(node))
- {
- return null;
- }
-
- IRegion hyperlinkRegion = getHyperlinkRegion(node);
-
- // createHyperlink is a template method. Derived classes, should override.
-
- IHyperlink hyperlink = createHyperlink(document, node, hyperlinkRegion);
-
- if (hyperlink != null)
- {
- hyperlinks.add(hyperlink);
- }
-
- if (hyperlinks.size() == 0)
- {
- return null;
- }
-
- return (IHyperlink[]) hyperlinks.toArray(new IHyperlink[0]);
- }
-
- /**
- * Determines whether a node is "linkable" that is, the component it refers to
- * can be the target of a "go to definition" navigation.
- *
- * @param node the node to test, must not be null;
- * @return true if the node is linkable, false otherwise.
- */
- private boolean isLinkable(IDOMNode node)
- {
- if (node == null)
- {
- return false;
- }
-
- short nodeType = node.getNodeType();
-
- boolean isLinkable = false;
-
- if (nodeType == Node.ATTRIBUTE_NODE)
- {
- IDOMAttr attr = (IDOMAttr) node;
- String name = attr.getName();
-
- // isLinkableAttribute is a template method. Derived classes should
- // override.
-
- isLinkable = isLinkableAttribute(name);
- }
-
- return isLinkable;
- }
-
- /**
- * Determines whether an attribute is "linkable" that is, the component it
- * points to can be the target of a "go to definition" navigation. Derived
- * classes should override.
- *
- * @param name the attribute name. Must not be null.
- * @return true if the attribute is linkable, false otherwise.
- */
- protected abstract boolean isLinkableAttribute(String name);
-
- /**
- * Creates a hyperlink based on the selected node. Derived classes should
- * override.
- *
- * @param document the source document.
- * @param node the node under the cursor.
- * @param region the text region to use to create the hyperlink.
- * @return a new IHyperlink for the node or null if one cannot be created.
- */
- protected abstract IHyperlink createHyperlink(IDocument document, IDOMNode node, IRegion region);
-
- /**
- * Locates the attribute node under the cursor.
- *
- * @param offset the cursor offset.
- * @param parent the parent node
- * @return an IDOMNode representing the attribute if one is found at the
- * offset or null otherwise.
- */
- protected IDOMNode getAttributeNode(int offset, IDOMNode parent)
- {
- IDOMAttr attrNode = null;
- NamedNodeMap map = parent.getAttributes();
-
- for (int index = 0; index < map.getLength(); index++)
- {
- attrNode = (IDOMAttr) map.item(index);
- boolean located = attrNode.contains(offset);
- if (located)
- {
- if (attrNode.hasNameOnly())
- {
- attrNode = null;
- }
- break;
- }
- }
-
- if (attrNode == null)
- {
- return parent;
- }
- return attrNode;
- }
-
- /**
- * Returns the node the cursor is currently on in the document or null if no
- * node is selected
- *
- * @param offset the current cursor offset.
- * @return IDOMNode either element, doctype, text, attribute or null
- */
- private IDOMNode getCurrentNode(IDocument document, int offset)
- {
- IndexedRegion inode = null;
- IStructuredModel sModel = null;
-
- try
- {
- sModel = StructuredModelManager.getModelManager().getExistingModelForRead(document);
- inode = sModel.getIndexedRegion(offset);
- if (inode == null)
- inode = sModel.getIndexedRegion(offset - 1);
- }
- finally
- {
- if (sModel != null)
- sModel.releaseFromRead();
- }
-
- if (inode instanceof IDOMNode)
- {
- IDOMNode node = (IDOMNode) inode;
-
- if (node.hasAttributes())
- {
- node = getAttributeNode(offset, node);
- }
- return node;
- }
-
- return null;
- }
-
- /**
- * Get the text region corresponding to an IDOMNode.
- *
- * @param node the node for which we want the text region. Must not be null.
- * @return an IRegion for the node, or null if the node is not recognized.
- */
- protected IRegion getHyperlinkRegion(IDOMNode node)
- {
- if (node == null)
- {
- return null;
- }
-
- IRegion hyperRegion = null;
- short nodeType = node.getNodeType();
-
- switch (nodeType)
- {
- case Node.ELEMENT_NODE :
- {
- hyperRegion = new Region(node.getStartOffset(), node.getEndOffset() - node.getStartOffset());
- }
- break;
- case Node.ATTRIBUTE_NODE :
- {
- IDOMAttr att = (IDOMAttr) node;
-
- int regOffset = att.getValueRegionStartOffset();
-
- // ISSUE: We are using a deprecated method here. Is there
- // a better way to get what we need?
-
- ITextRegion valueRegion = att.getValueRegion();
- if (valueRegion != null)
- {
- int regLength = valueRegion.getTextLength();
- String attValue = att.getValueRegionText();
-
- // Do not include quotes in attribute value region and only
- // underline the actual value, not the quotes.
-
- if (StringUtils.isQuoted(attValue))
- {
- regLength = regLength - 2;
- regOffset++;
- }
- hyperRegion = new Region(regOffset, regLength);
- }
- }
- break;
- default :
- // Do nothing.
- break;
- }
-
- return hyperRegion;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/ISelectionMapper.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/ISelectionMapper.java
deleted file mode 100644
index a51c0fd84d..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/ISelectionMapper.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/*******************************************************************************
- * 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.internal.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/ui/internal/editor/InternalXSDMultiPageEditor.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/InternalXSDMultiPageEditor.java
deleted file mode 100644
index 3343e55f29..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/InternalXSDMultiPageEditor.java
+++ /dev/null
@@ -1,1468 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.editor;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notifier;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPartFactory;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gef.KeyStroke;
-import org.eclipse.gef.RootEditPart;
-import org.eclipse.gef.ui.actions.ActionRegistry;
-import org.eclipse.gef.ui.actions.GEFActionConstants;
-import org.eclipse.gef.ui.actions.PrintAction;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IContentProvider;
-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.jface.viewers.TreeViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-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.IWorkbenchPage;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.ide.FileStoreEditorInput;
-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.StructuredModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.INodeAdapter;
-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.text.IStructuredDocument;
-import org.eclipse.wst.sse.ui.StructuredTextEditor;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
-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.internal.adapters.CategoryAdapter;
-import org.eclipse.wst.xsd.ui.internal.adapters.RedefineCategoryAdapter;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDAdapterFactory;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDRedefineAdapter;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.AddFieldAction;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.BaseDirectEditAction;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.BaseSelectionAction;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.DeleteAction;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.DesignSelectAll;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.SetInputToGraphView;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.ShowPropertiesViewAction;
-import org.eclipse.wst.xsd.ui.internal.adt.design.DesignViewGraphicalViewer;
-import org.eclipse.wst.xsd.ui.internal.adt.design.IKeyboardDrag;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.RootContentEditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.editor.ADTMultiPageEditor;
-import org.eclipse.wst.xsd.ui.internal.adt.editor.EditorMode;
-import org.eclipse.wst.xsd.ui.internal.adt.editor.EditorModeManager;
-import org.eclipse.wst.xsd.ui.internal.adt.editor.IADTEditorInput;
-import org.eclipse.wst.xsd.ui.internal.adt.editor.ProductCustomizationProvider;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IModel;
-import org.eclipse.wst.xsd.ui.internal.adt.outline.ADTContentOutlinePage;
-import org.eclipse.wst.xsd.ui.internal.adt.typeviz.TypeVizEditorMode;
-import org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDAnyAttributeAction;
-import org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDAnyElementAction;
-import org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDAttributeDeclarationAction;
-import org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDAttributeGroupDefinitionAction;
-import org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDComplexTypeDefinitionAction;
-import org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDElementAction;
-import org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDEnumerationFacetAction;
-import org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDModelGroupAction;
-import org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDModelGroupDefinitionAction;
-import org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDRedefinedAttributeGroupAction;
-import org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDRedefinedComplexTypeAction;
-import org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDRedefinedModelGroupAction;
-import org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDRedefinedSimpleTypeAction;
-import org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDSchemaDirectiveAction;
-import org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDSimpleTypeDefinitionAction;
-import org.eclipse.wst.xsd.ui.internal.common.actions.DeleteXSDConcreteComponentAction;
-import org.eclipse.wst.xsd.ui.internal.common.actions.SetBaseTypeAction;
-import org.eclipse.wst.xsd.ui.internal.common.actions.OpenInNewEditor;
-import org.eclipse.wst.xsd.ui.internal.common.actions.SetMultiplicityAction;
-import org.eclipse.wst.xsd.ui.internal.common.actions.SetTypeAction;
-import org.eclipse.wst.xsd.ui.internal.common.properties.sections.IDocumentChangedNotifier;
-import org.eclipse.wst.xsd.ui.internal.common.util.XSDDirectivesManager;
-import org.eclipse.wst.xsd.ui.internal.navigation.DesignViewNavigationLocation;
-import org.eclipse.wst.xsd.ui.internal.navigation.MultiPageEditorTextSelectionNavigationLocation;
-import org.eclipse.wst.xsd.ui.internal.text.XSDModelAdapter;
-import org.eclipse.wst.xsd.ui.internal.utils.OpenOnSelectionHelper;
-import org.eclipse.xsd.XSDComponent;
-import org.eclipse.xsd.XSDCompositor;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDSchema;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-public class InternalXSDMultiPageEditor extends ADTMultiPageEditor implements ITabbedPropertySheetPageContributor, INavigationLocationProvider
-{
- // IModel model;
- IStructuredModel structuredModel;
- XSDSchema xsdSchema;
- XSDModelAdapter schemaNodeAdapter;
- private OutlineTreeSelectionChangeListener fOutlineListener;
- private SourceEditorSelectionListener fSourceEditorSelectionListener;
- private XSDSelectionManagerSelectionListener fXSDSelectionListener;
- private InternalDocumentChangedNotifier internalDocumentChangedNotifier = new InternalDocumentChangedNotifier();
- private static final String XSD_EDITOR_MODE_EXTENSION_ID = "org.eclipse.wst.xsd.ui.editorModes"; //$NON-NLS-N$
- private XSDPreferenceStoreListener xsdPreferenceStoreListener;
-
- class InternalDocumentChangedNotifier implements IDocumentChangedNotifier
- {
- List list = new ArrayList();
-
- public void addListener(INodeAdapter adapter)
- {
- list.add(adapter);
- }
-
- public void removeListener(INodeAdapter adapter)
- {
- list.remove(adapter);
- }
-
- public void notifyListeners(INodeNotifier notifier, int eventType, Object changedFeature, Object oldValue, Object newValue, int pos)
- {
- List clone = new ArrayList(list.size());
- clone.addAll(list);
- for (Iterator i = clone.iterator(); i.hasNext(); )
- {
- INodeAdapter adapter = (INodeAdapter)i.next();
- adapter.notifyChanged(notifier, eventType, changedFeature, oldValue, newValue, pos);
- }
- }
- }
-
- protected void setInputToGraphicalViewer(IDocument newDocument)
- {
- IStructuredModel structuredModel = null;
- try
- {
- // only set input if structured model already exists
- // (meaning source editor is already managing the model)
- structuredModel = StructuredModelManager.getModelManager().getExistingModelForRead(newDocument);
- if ((structuredModel != null) && (structuredModel instanceof IDOMModel))
- {
- Document doc = ((IDOMModel) structuredModel).getDocument();
- if (doc != null)
- {
- XSDModelAdapter modelAdapter = XSDModelAdapter.lookupOrCreateModelAdapter(doc);
- if (modelAdapter != null) // Assert should not be null
- {
- modelAdapter.setSchema(xsdSchema);
- xsdSchema = modelAdapter.resetSchema(doc);
- model = (IModel) XSDAdapterFactory.getInstance().adapt(xsdSchema);
- }
- }
- }
- }
- catch (Exception e)
- {
- }
- finally
- {
- if (structuredModel != null)
- {
- structuredModel.releaseFromRead();
- }
- }
- }
-
-
- public IModel buildModel()
- {
- try
- {
- IEditorInput editorInput = getEditorInput();
-
- // If the input schema is from the WSDL Editor, then use that inline schema
- if (editorInput instanceof IADTEditorInput)
- {
- xsdSchema = ((IADTEditorInput) editorInput).getSchema();
- if (xsdSchema != null)
- model = (IModel) XSDAdapterFactory.getInstance().adapt(xsdSchema);
- }
-
- Document document = null;
- IDocument doc = structuredTextEditor.getDocumentProvider().getDocument(getEditorInput());
- if (doc instanceof IStructuredDocument)
- {
- IStructuredModel model = null;
- try
- {
- // TODO: for StorageEditorInputs, should be forRead
- model = StructuredModelManager.getModelManager().getExistingModelForEdit(doc);
- if (model == null)
- {
- model = StructuredModelManager.getModelManager().getModelForEdit((IStructuredDocument) doc);
- }
- document = ((IDOMModel) model).getDocument();
- }
- finally
- {
- if (model != null)
- {
- model.releaseFromEdit();
- }
- }
- }
- Assert.isNotNull(document);
-
- if (model != null)
- return model;
-
- xsdSchema = XSDModelAdapter.lookupOrCreateSchema(document);
- model = (IModel) XSDAdapterFactory.getInstance().adapt(xsdSchema);
- }
- catch (Exception e)
- {
-
- }
-
-// 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())
-// {
-// super.handleNotifyChange(notifier, eventType, feature, oldValue, newValue, index);
-// internalDocumentChangedNotifier.notifyListeners(notifier, eventType, feature, oldValue, newValue, index);
-// }
-// }
-// }
-// };
-// xsdResource.setModified(false);
-// }
-// }
-// catch (StackOverflowError e)
-// {
-// }
-// catch (Exception ex)
-// {
-// }
- return model;
- }
-
- public void dispose()
- {
- IStructuredModel structuredModel = null;
- XSDModelAdapter modelAdapter = null;
- IDOMDocument doc = null;
- IDocument idoc = structuredTextEditor.getDocumentProvider().getDocument(getEditorInput());
- if (idoc != null)
- {
- structuredModel = StructuredModelManager.getModelManager().getExistingModelForRead(idoc);
- if ((structuredModel != null) && (structuredModel instanceof IDOMModel))
- {
- try
- {
- if ((structuredModel != null) && (structuredModel instanceof IDOMModel))
- {
- doc = ((IDOMModel) structuredModel).getDocument();
- if (doc != null)
- {
- modelAdapter = (XSDModelAdapter) doc.getExistingAdapter(XSDModelAdapter.class);
- if (modelAdapter != null)
- {
- doc.getModel().removeModelStateListener(modelAdapter.getModelReconcileAdapter());
- doc.removeAdapter(modelAdapter.getModelReconcileAdapter());
- doc.removeAdapter(modelAdapter);
- modelAdapter.clear();
- modelAdapter = null;
- }
- }
- }
- }
- finally
- {
- structuredModel.releaseFromRead();
- }
- }
- }
-
-
-
- if (fOutlinePage != null)
- {
-// if (fOutlinePage instanceof ConfigurableContentOutlinePage && fOutlineListener != null)
-// {
-// ((ConfigurableContentOutlinePage) fOutlinePage).removeDoubleClickListener(fOutlineListener);
-// }
- if (fOutlineListener != null)
- {
- fOutlinePage.removeSelectionChangedListener(fOutlineListener);
- }
- }
- getSelectionManager().removeSelectionChangedListener(fXSDSelectionListener);
- XSDEditorPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(xsdPreferenceStoreListener);
- xsdPreferenceStoreListener = null;
- super.dispose();
- }
-
- protected void initializeGraphicalViewer()
- {
- RootContentEditPart root = new RootContentEditPart();
- if (!(getEditorInput() instanceof IADTEditorInput))
- {
- root.setModel(model);
- }
- graphicalViewer.setContents(root);
- }
-
- protected void configureGraphicalViewer()
- {
- super.configureGraphicalViewer();
- graphicalViewer.getKeyHandler().put(KeyStroke.getPressed(SWT.F2, 0), getActionRegistry().getAction(GEFActionConstants.DIRECT_EDIT));
- // get edit part factory from extension
- EditPartFactory editPartFactory = getEditorModeManager().getCurrentMode().getEditPartFactory();
- graphicalViewer.setEditPartFactory(editPartFactory);
- }
-
- 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 getSelectionManager();
- }
- else if (type == XSDSchema.class)
- {
- return xsdSchema;
- }
- else if (type == IKeyboardDrag.class)
- {
- return new KeyboardDragImpl();
- }
- 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 == XSDAttributeReferenceEditManager.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 XSDAttributeReferenceEditManager(fileEditorInput.getFile(), schemas);
- }
- }
- 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 == XSDComplexTypeBaseTypeEditManager.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 XSDComplexTypeBaseTypeEditManager(fileEditorInput.getFile(), schemas);
- }
- }
- else if (type == XSDSubstitutionGroupEditManager.class)
- {
- IEditorInput editorInput = getEditorInput();
- if (editorInput instanceof IFileEditorInput)
- {
- IFileEditorInput fileEditorInput = (IFileEditorInput) editorInput;
- XSDSchema[] schemas = {xsdSchema};
- return new XSDSubstitutionGroupEditManager(fileEditorInput.getFile(), schemas);
- }
- }
- else if (type == ITextEditor.class)
- {
- return getTextEditor();
- }
- else if (type == ISelectionMapper.class)
- {
- return new XSDSelectionMapper();
- }
- else if (type == IDocumentChangedNotifier.class)
- {
- return internalDocumentChangedNotifier;
- }
- else if (type == ProductCustomizationProvider.class)
- {
- return XSDEditorPlugin.getPlugin().getProductCustomizationProvider();
- }
- return super.getAdapter(type);
- }
-
- public String getContributorId()
- {
- return "org.eclipse.wst.xsd.ui.internal.editor"; //$NON-NLS-1$
- }
-
- public XSDSchema getXSDSchema()
- {
- return xsdSchema;
- }
-
- /**
- * 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)
- {
- XSDConcreteComponent namedComponent = openOnSelectionHelper.openOnGlobalReference(comp);
-
- if (namedComponent == null)
- {
- namedComponent = getXSDSchema();
- }
- 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()
- {
- super.createPages();
-
-// selectionProvider = getSelectionManager();
-// getEditorSite().setSelectionProvider(selectionProvider);
-//
-// structuredTextEditor = new StructuredTextEditor();
-// model = buildModel((IFileEditorInput) getEditorInput());
-// 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);
-
- xsdPreferenceStoreListener = new XSDPreferenceStoreListener();
- XSDEditorPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(xsdPreferenceStoreListener);
- }
-
- protected class XSDPreferenceStoreListener implements IPropertyChangeListener
- {
- public void propertyChange(PropertyChangeEvent evt)
- {
- String property = evt.getProperty();
- if (XSDEditorPlugin.CONST_SHOW_EXTERNALS.equals(property))
- {
- ((GraphicalEditPart) graphicalViewer.getContents()).getFigure().invalidateTree();
- graphicalViewer.getContents().refresh();
- }
- }
- }
-
- public boolean isReadOnly()
- {
- IEditorInput editorInput = getEditorInput();
- return !(editorInput instanceof IFileEditorInput || editorInput instanceof FileStoreEditorInput);
- }
-
- protected void createActions()
- {
- super.createActions();
-
- ActionRegistry registry = getActionRegistry();
-
- // add an isReadOnly method to the editorPart instead
- if (!isReadOnly())
- {
- BaseSelectionAction action = new AddFieldAction(this);
- action.setSelectionProvider(getSelectionManager());
- registry.registerAction(action);
- action = new DeleteAction(this);
- action.setSelectionProvider(getSelectionManager());
- registry.registerAction(action);
-
- action = new DesignSelectAll(this);
- action.setSelectionProvider(getSelectionManager());
- registry.registerAction(action);
-
- action = new AddXSDRedefinedComplexTypeAction(this);
- action.setSelectionProvider(getSelectionManager());
- action.setImageDescriptor(ImageDescriptor.createFromFile(XSDEditorPlugin.class, Messages._UI_IMAGE_COMPLEX_TYPE));
- registry.registerAction(action);
-
- action = new AddXSDRedefinedSimpleTypeAction(this);
- action.setSelectionProvider(getSelectionManager());
- action.setImageDescriptor(ImageDescriptor.createFromFile(XSDEditorPlugin.class, Messages._UI_IMAGE_SIMPLE_TYPE));
- registry.registerAction(action);
-
- action = new AddXSDRedefinedAttributeGroupAction(this);
- action.setSelectionProvider(getSelectionManager());
- action.setImageDescriptor(ImageDescriptor.createFromFile(XSDEditorPlugin.class, Messages._UI_IMAGE_ATTRIBUTE_GROUP));
- registry.registerAction(action);
-
- action = new AddXSDRedefinedModelGroupAction(this);
- action.setSelectionProvider(getSelectionManager());
- action.setImageDescriptor(ImageDescriptor.createFromFile(XSDEditorPlugin.class, Messages._UI_IMAGE_MODEL_GROUP));
- registry.registerAction(action);
-
- action = new SetBaseTypeAction(this);
- action.setSelectionProvider(getSelectionManager());
- registry.registerAction(action);
-
- action = new AddXSDElementAction(this, AddXSDElementAction.ID, Messages._UI_ACTION_ADD_ELEMENT, false);
- action.setSelectionProvider(getSelectionManager());
- action.setImageDescriptor(ImageDescriptor.createFromFile(XSDEditorPlugin.class, "icons/XSDElement.gif"));
- registry.registerAction(action);
-
- action = new AddXSDElementAction(this, AddXSDElementAction.BEFORE_SELECTED_ID, Messages._UI_ACTION_BEFORE, false);
- action.setSelectionProvider(getSelectionManager());
- action.setImageDescriptor(ImageDescriptor.createFromFile(XSDEditorPlugin.class, "icons/XSDElement.gif"));
- registry.registerAction(action);
-
- action = new AddXSDElementAction(this, AddXSDElementAction.AFTER_SELECTED_ID, Messages._UI_ACTION_AFTER, false);
- action.setSelectionProvider(getSelectionManager());
- action.setImageDescriptor(ImageDescriptor.createFromFile(XSDEditorPlugin.class, "icons/XSDElement.gif"));
- registry.registerAction(action);
-
- action = new AddXSDElementAction(this, AddXSDElementAction.REF_ID, Messages._UI_ACTION_ADD_ELEMENT_REF, true);
- action.setSelectionProvider(getSelectionManager());
- action.setImageDescriptor(ImageDescriptor.createFromFile(XSDEditorPlugin.class, "icons/XSDElementRef.gif"));
- registry.registerAction(action);
-
- action = new AddXSDModelGroupAction(this, XSDCompositor.SEQUENCE_LITERAL, AddXSDModelGroupAction.SEQUENCE_ID);
- action.setSelectionProvider(getSelectionManager());
- action.setImageDescriptor(ImageDescriptor.createFromFile(XSDEditorPlugin.class, "icons/XSDSequence.gif"));
- registry.registerAction(action);
-
- action = new AddXSDModelGroupAction(this, XSDCompositor.CHOICE_LITERAL, AddXSDModelGroupAction.CHOICE_ID);
- action.setSelectionProvider(getSelectionManager());
- action.setImageDescriptor(ImageDescriptor.createFromFile(XSDEditorPlugin.class, "icons/XSDChoice.gif"));
- registry.registerAction(action);
-
- action = new AddXSDModelGroupAction(this, XSDCompositor.ALL_LITERAL, AddXSDModelGroupAction.ALL_ID);
- action.setSelectionProvider(getSelectionManager());
- action.setImageDescriptor(ImageDescriptor.createFromFile(XSDEditorPlugin.class, "icons/XSDAll.gif"));
- registry.registerAction(action);
-
- action = new AddXSDModelGroupDefinitionAction(this, false);
- action.setId(AddXSDModelGroupDefinitionAction.MODELGROUPDEFINITION_ID);
- action.setSelectionProvider(getSelectionManager());
- action.setImageDescriptor(ImageDescriptor.createFromFile(XSDEditorPlugin.class, "icons/XSDGroup.gif"));
- registry.registerAction(action);
-
- action = new AddXSDModelGroupDefinitionAction(this, true);
- action.setId(AddXSDModelGroupDefinitionAction.MODELGROUPDEFINITIONREF_ID);
- action.setSelectionProvider(getSelectionManager());
- action.setImageDescriptor(XSDEditorPlugin.getImageDescriptor("icons/obj16/XSDGroupRef.gif"));
- registry.registerAction(action);
-
- action = new AddXSDComplexTypeDefinitionAction(this);
- action.setSelectionProvider(getSelectionManager());
- action.setImageDescriptor(ImageDescriptor.createFromFile(XSDEditorPlugin.class, "icons/XSDComplexType.gif"));
- registry.registerAction(action);
-
- action = new AddXSDSimpleTypeDefinitionAction(this);
- action.setSelectionProvider(getSelectionManager());
- action.setImageDescriptor(ImageDescriptor.createFromFile(XSDEditorPlugin.class, "icons/XSDSimpleType.gif"));
- registry.registerAction(action);
-
- action = new AddXSDAttributeDeclarationAction(this);
- action.setSelectionProvider(getSelectionManager());
- action.setImageDescriptor(ImageDescriptor.createFromFile(XSDEditorPlugin.class, "icons/XSDAttribute.gif"));
- registry.registerAction(action);
-
- action = new AddXSDAttributeDeclarationAction(this, AddXSDAttributeDeclarationAction.BEFORE_SELECTED_ID, Messages._UI_ACTION_BEFORE, false);
- action.setSelectionProvider(getSelectionManager());
- action.setImageDescriptor(ImageDescriptor.createFromFile(XSDEditorPlugin.class, "icons/XSDAttribute.gif"));
- registry.registerAction(action);
-
- action = new AddXSDAttributeDeclarationAction(this, AddXSDAttributeDeclarationAction.AFTER_SELECTED_ID, Messages._UI_ACTION_AFTER, false);
- action.setSelectionProvider(getSelectionManager());
- action.setImageDescriptor(ImageDescriptor.createFromFile(XSDEditorPlugin.class, "icons/XSDAttribute.gif"));
- registry.registerAction(action);
-
- action = new AddXSDAttributeDeclarationAction(this, AddXSDAttributeDeclarationAction.REF_ID, Messages._UI_ACTION_ADD_ATTRIBUTE_REF, true);
- action.setSelectionProvider(getSelectionManager());
- action.setImageDescriptor(ImageDescriptor.createFromFile(XSDEditorPlugin.class, "icons/XSDAttributeRef.gif"));
- 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());
- action.setImageDescriptor(ImageDescriptor.createFromFile(XSDEditorPlugin.class, "icons/XSDAttributeGroup.gif"));
- registry.registerAction(action);
-
- action = new AddXSDAttributeGroupDefinitionAction(this, AddXSDAttributeGroupDefinitionAction.REF_ID);
- action.setSelectionProvider(getSelectionManager());
- action.setImageDescriptor(ImageDescriptor.createFromFile(XSDEditorPlugin.class, "icons/XSDAttributeGroupRef.gif"));
- registry.registerAction(action);
-
- action = new DeleteXSDConcreteComponentAction(this);
- action.setSelectionProvider(getSelectionManager());
- registry.registerAction(action);
-
- action = new AddXSDAnyElementAction(this);
- action.setSelectionProvider(getSelectionManager());
- action.setImageDescriptor(ImageDescriptor.createFromFile(XSDEditorPlugin.class, "icons/XSDAny.gif"));
- registry.registerAction(action);
-
- action = new AddXSDAnyAttributeAction(this);
- action.setSelectionProvider(getSelectionManager());
- action.setImageDescriptor(ImageDescriptor.createFromFile(XSDEditorPlugin.class, "icons/XSDAnyAttribute.gif"));
- registry.registerAction(action);
-
- action = new AddXSDSchemaDirectiveAction(this, AddXSDSchemaDirectiveAction.INCLUDE_ID, Messages._UI_ACTION_ADD_INCLUDE);
- action.setSelectionProvider(getSelectionManager());
- action.setImageDescriptor(ImageDescriptor.createFromFile(XSDEditorPlugin.class, "icons/XSDInclude.gif"));
- registry.registerAction(action);
-
- action = new AddXSDEnumerationFacetAction(this);
- action.setSelectionProvider(getSelectionManager());
- action.setImageDescriptor(ImageDescriptor.createFromFile(XSDEditorPlugin.class, "icons/XSDSimpleEnum.gif"));
- registry.registerAction(action);
-
- action = new AddXSDEnumerationFacetAction(this, AddXSDEnumerationFacetAction.BEFORE_SELECTED_ID, Messages._UI_ACTION_BEFORE);
- action.setSelectionProvider(getSelectionManager());
- action.setImageDescriptor(ImageDescriptor.createFromFile(XSDEditorPlugin.class, "icons/XSDSimpleEnum.gif"));
- registry.registerAction(action);
-
- action = new AddXSDEnumerationFacetAction(this, AddXSDEnumerationFacetAction.AFTER_SELECTED_ID, Messages._UI_ACTION_AFTER);
- action.setSelectionProvider(getSelectionManager());
- action.setImageDescriptor(ImageDescriptor.createFromFile(XSDEditorPlugin.class, "icons/XSDSimpleEnum.gif"));
- registry.registerAction(action);
-
- action = new AddXSDSchemaDirectiveAction(this, AddXSDSchemaDirectiveAction.IMPORT_ID, Messages._UI_ACTION_ADD_IMPORT);
- action.setSelectionProvider(getSelectionManager());
- action.setImageDescriptor(ImageDescriptor.createFromFile(XSDEditorPlugin.class, "icons/XSDImport.gif"));
- registry.registerAction(action);
-
- action = new AddXSDSchemaDirectiveAction(this, AddXSDSchemaDirectiveAction.REDEFINE_ID, Messages._UI_ACTION_ADD_REDEFINE);
- action.setSelectionProvider(getSelectionManager());
- action.setImageDescriptor(ImageDescriptor.createFromFile(XSDEditorPlugin.class, "icons/XSDRedefine.gif"));
- registry.registerAction(action);
-
- SetTypeAction setNewComplexTypeAction = new SetTypeAction(Messages._UI_ACTION_NEW, SetTypeAction.SET_NEW_TYPE_ID, this);
- setNewComplexTypeAction.setSelectionProvider(getSelectionManager());
-
- registry.registerAction(setNewComplexTypeAction);
-
- SetTypeAction setExistingTypeAction = new SetTypeAction(Messages._UI_ACTION_BROWSE, SetTypeAction.SELECT_EXISTING_TYPE_ID, this);
- setExistingTypeAction.setSelectionProvider(getSelectionManager());
- registry.registerAction(setExistingTypeAction);
-
- addMultiplicityMenu(registry);
-
- PrintAction printAction = new PrintAction(this);
- registry.registerAction(printAction);
-
- BaseDirectEditAction directEditAction = new BaseDirectEditAction(this);
- directEditAction.setSelectionProvider(getSelectionManager());
- registry.registerAction(directEditAction);
-
- }
- else
- {
- BaseSelectionAction action = new OpenInNewEditor(this);
- action.setSelectionProvider(getSelectionManager());
- registry.registerAction(action);
-
- action = new ShowPropertiesViewAction(this);
- registry.registerAction(action);
-
- PrintAction printAction = new PrintAction(this);
- registry.registerAction(printAction);
- }
- }
-
- protected void addMultiplicityMenu(ActionRegistry registry)
- {
- SetMultiplicityAction oneMultiplicity = new SetMultiplicityAction(this, "1..1 (" + Messages._UI_LABEL_REQUIRED + ")", SetMultiplicityAction.REQUIRED_ID); //$NON-NLS-1$ //$NON-NLS-2$
- oneMultiplicity.setMaxOccurs(1);
- oneMultiplicity.setMinOccurs(1);
- oneMultiplicity.setSelectionProvider(getSelectionManager());
- registry.registerAction(oneMultiplicity);
-
- SetMultiplicityAction zeroOrMoreMultiplicity = new SetMultiplicityAction(this, "0..* (" + Messages._UI_LABEL_ZERO_OR_MORE + ")", SetMultiplicityAction.ZERO_OR_MORE_ID); //$NON-NLS-1$ //$NON-NLS-2$
- zeroOrMoreMultiplicity.setMaxOccurs(-1);
- zeroOrMoreMultiplicity.setMinOccurs(0);
- zeroOrMoreMultiplicity.setSelectionProvider(getSelectionManager());
- registry.registerAction(zeroOrMoreMultiplicity);
-
- SetMultiplicityAction zeroOrOneMultiplicity = new SetMultiplicityAction(this, "0..1 (" + Messages._UI_LABEL_OPTIONAL + ")", SetMultiplicityAction.ZERO_OR_ONE_ID); //$NON-NLS-1$ //$NON-NLS-2$
- zeroOrOneMultiplicity.setMaxOccurs(1);
- zeroOrOneMultiplicity.setMinOccurs(0);
- zeroOrOneMultiplicity.setSelectionProvider(getSelectionManager());
- registry.registerAction(zeroOrOneMultiplicity);
-
- SetMultiplicityAction oneOrMoreMultiplicity = new SetMultiplicityAction(this, "1..* (" + Messages._UI_LABEL_ONE_OR_MORE + ")", SetMultiplicityAction.ONE_OR_MORE_ID); //$NON-NLS-1$ //$NON-NLS-2$
- oneOrMoreMultiplicity.setMaxOccurs(-1);
- oneOrMoreMultiplicity.setMinOccurs(1);
- oneOrMoreMultiplicity.setSelectionProvider(getSelectionManager());
- registry.registerAction(oneOrMoreMultiplicity);
-
- }
-
- /**
- * 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 RedefineCategoryAdapter)
- {
- node = ((RedefineCategoryAdapter) object).getXSDRedefine().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();
- }
- else if (node.getNodeType() == Node.PROCESSING_INSTRUCTION_NODE)
- {
- return model;
- }
- }
- }
- 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 (xsdNode instanceof XSDRedefineAdapter)
- return;
- }
- 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 RedefineCategoryAdapter)
- {
- RedefineCategoryAdapter category = (RedefineCategoryAdapter)object;
- node = category.getXSDRedefine().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();
- }
- }
- else if (object instanceof String)
- {
- // This case was added to make the F3/hyperlink navigation work when an
- // inline schema from a WSDL document is opened in the schema editor.
- // The string is expected to be a URI fragment used to identify an XSD
- // component in the context of the enclosing WSDL resource.
-
- String uriFragment = (String) object;
- Resource resource = xsdSchema.eResource();
- EObject modelObject = resource.getEObject(uriFragment);
-
- if (modelObject != null && modelObject instanceof XSDComponent)
- {
- XSDComponent component = (XSDComponent) modelObject;
- node = component.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 the current active page is the InternalXSDMultiPageEditor (source)
- // We only want to make source selections if the active page is either the outline or properties (a modify
- // has been done via the outline or properties and not the source view). We don't want to be selecting
- // and unselecting things in the source when editing in the source!!
- boolean makeSelection = true;
- if (PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() != null) {
- IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- if (page.getActivePart() instanceof InternalXSDMultiPageEditor) {
- if (getActiveEditor() instanceof StructuredTextEditor) {
- makeSelection = false;
- }
- }
- }
-
- // do not fire selection in source editor if selection event came
- // from source editor
- if (event.getSource() != getTextEditor().getSelectionProvider() && makeSelection)
- {
- 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() == SOURCE_PAGE_INDEX)
- {
- StructuredSelection nodeSelection = new StructuredSelection(otherModelObjectList);
- getTextEditor().getSelectionProvider().setSelection(nodeSelection);
- }
- }
- }
- }
- }
-
- public void doSetSelection()
- {
- ISelection iSelection = getSelectionManager().getSelection();
- if (iSelection != null)
- {
- Object firstElement = ((StructuredSelection)iSelection).getFirstElement();
- Object otherModelObject = getObjectForOtherModel(firstElement);
- if (otherModelObject != null)
- {
- StructuredSelection nodeSelection = new StructuredSelection(otherModelObject);
- getTextEditor().getSelectionProvider().setSelection(nodeSelection);
- }
- }
- }
- }
-
- // Bug 145590. Workaround to update source position when flipping to the source page.
- // Unfortunately, this will still add an entry to the navigation history, but this
- // behaviour is an improvement than without this change
- boolean doUpdateSourceLocation = false;
- protected void pageChange(int newPageIndex)
- {
- super.pageChange(newPageIndex);
- doUpdateSourceLocation = newPageIndex == SOURCE_PAGE_INDEX;
- if (doUpdateSourceLocation && fXSDSelectionListener != null)
- fXSDSelectionListener.doSetSelection();
-
- }
-
- public void propertyChanged(Object source, int propId)
- {
- switch (propId)
- {
- // when refactor rename while file is open in editor, need to reset
- // editor contents to reflect new document
- case IEditorPart.PROP_INPUT:
- {
- if (source == structuredTextEditor && xsdSchema != null)
- {
- IStructuredModel structuredModel = StructuredModelManager.getModelManager().getExistingModelForRead(getDocument());
- try
- {
- if (structuredModel instanceof IDOMModel)
- {
- Document schemaDocument = xsdSchema.getDocument();
- Document domModelDocument = ((IDOMModel)structuredModel).getDocument();
- // if dom documents are not the same, they need to be reset
- if (schemaDocument != domModelDocument)
- {
- XSDModelAdapter modelAdapter = null;
- if (schemaDocument instanceof IDOMDocument)
- {
- // save this model adapter for cleanup later
- modelAdapter = (XSDModelAdapter) ((IDOMDocument)schemaDocument).getExistingAdapter(XSDModelAdapter.class);
- }
-
- // update multipage editor with new editor input
- IEditorInput editorInput = structuredTextEditor.getEditorInput();
- setInput(editorInput);
- setPartName(editorInput.getName());
- getCommandStack().markSaveLocation();
-
- // Now do the clean up model adapter
- if (modelAdapter != null)
- {
- modelAdapter.clear();
- modelAdapter = null;
- }
- }
- }
- }
- finally
- {
- if (structuredModel != null)
- structuredModel.releaseFromRead();
- }
- }
- break;
- }
- }
- super.propertyChanged(source, propId);
- }
-
- public INavigationLocation createEmptyNavigationLocation()
- {
- if (getActivePage() == 0)
- {
- return new DesignViewNavigationLocation(this);
- }
- else
- {
- return new MultiPageEditorTextSelectionNavigationLocation(getTextEditor(), false);
- }
- }
-
- public INavigationLocation createNavigationLocation()
- {
- if (getActivePage() == DESIGN_PAGE_INDEX)
- {
- 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();
-
- Object object = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor().getAdapter(ProductCustomizationProvider.class);
- if (object instanceof ProductCustomizationProvider)
- {
- ProductCustomizationProvider productCustomizationProvider = (ProductCustomizationProvider)object;
- if (productCustomizationProvider != null)
- {
- return productCustomizationProvider.getNavigationLocation(this, concreteComponent, rootContentEditPart);
- }
- }
- return new DesignViewNavigationLocation(this, concreteComponent);
- }
- }
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- return null;
- }
- else
- {
- return new MultiPageEditorTextSelectionNavigationLocation(getTextEditor(), true);
- }
- }
-
-
- public void editorModeChanged(EditorMode newEditorMode)
- {
- //if (isInitializing)
- // return;
-
- EditPartFactory editPartFactory = newEditorMode.getEditPartFactory();
- if (editPartFactory != null)
- {
- graphicalViewer.setEditPartFactory(editPartFactory);
- if (graphicalViewer instanceof DesignViewGraphicalViewer)
- {
- DesignViewGraphicalViewer viewer = (DesignViewGraphicalViewer)graphicalViewer;
- IADTObject input = viewer.getInput();
- viewer.setInput(null);
- //viewer.getRootEditPart().refresh();
- // viewer.getRootEditPart().getContents().refresh();
- viewer.setInput(input);
-
- floatingToolbar.setEditPartFactory(editPartFactory);
- floatingToolbar.setModel(getModel());
- floatingToolbar.refresh(!(input instanceof IModel));
-
- Control control = graphicalViewer.getControl();
- if (control instanceof Composite)
- {
- Composite parent = ((Composite)control).getParent();
- parent.layout();
- }
- }
- }
- IContentProvider provider = newEditorMode.getOutlineProvider();
- if (provider != null)
- {
- ADTContentOutlinePage outline = (ADTContentOutlinePage)getContentOutlinePage();
- if (outline != null)
- {
- TreeViewer treeViewer = outline.getTreeViewer();
- if (treeViewer != null)
- {
- outline.getTreeViewer().setContentProvider(provider);
- outline.getTreeViewer().refresh();
- }
- }
- }
- }
-
- private static final String DEFAULT_EDITOR_MODE_ID = "org.eclipse.wst.xsd.ui.defaultEditorModeId"; //$NON-NLS-1$
- //private boolean isInitializing = false;
- protected EditorModeManager createEditorModeManager()
- {
- final ProductCustomizationProvider productCustomizationProvider = (ProductCustomizationProvider)getAdapter(ProductCustomizationProvider.class);
- EditorModeManager manager = new EditorModeManager(XSD_EDITOR_MODE_EXTENSION_ID)
- {
- public void init()
- {
- if (productCustomizationProvider == null ||
- productCustomizationProvider.isEditorModeApplicable(TypeVizEditorMode.ID))
- {
- addMode(new TypeVizEditorMode());
- }
- super.init();
- }
-
- protected EditorMode getDefaultMode()
- {
- String defaultModeId = XSDEditorPlugin.getPlugin().getPreferenceStore().getString(DEFAULT_EDITOR_MODE_ID);
- if (defaultModeId != null)
- {
- EditorMode editorMode = getEditorMode(defaultModeId);
- if (editorMode != null)
- {
- return editorMode;
- }
- }
- return super.getDefaultMode();
- }
- };
- manager.setProductCustomizationProvider(productCustomizationProvider);
- return manager;
- }
-
- protected void storeCurrentModePreference(String id)
- {
- XSDEditorPlugin.getPlugin().getPreferenceStore().setValue(DEFAULT_EDITOR_MODE_ID, id);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.EditorPart#doSave(org.eclipse.core.runtime.IProgressMonitor)
- */
- public void doSave(IProgressMonitor monitor)
- {
- XSDDirectivesManager.removeUnusedXSDImports(((XSDSchema)getAdapter(XSDSchema.class)));
- super.doSave(monitor);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.EditorPart#doSaveAs()
- */
- public void doSaveAs()
- {
- // When performing a save as, the document changes. Our model state listeners should listen
- // to the new document.
-
- // First get the current document
- IDocument currentDocument = getDocument();
- XSDModelAdapter modelAdapter = null;
- IDOMDocument doc = null;
- if (currentDocument != null)
- {
- IStructuredModel structuredModel = StructuredModelManager.getModelManager().getExistingModelForRead(currentDocument);
- if (structuredModel != null)
- {
- try
- {
- if ((structuredModel != null) && (structuredModel instanceof IDOMModel))
- {
- // Get the associated IDOMDocument model
- doc = ((IDOMModel) structuredModel).getDocument();
- // and now get our adapter that listens to DOM changes
- if (doc != null)
- {
- modelAdapter = (XSDModelAdapter) doc.getExistingAdapter(XSDModelAdapter.class);
- }
- }
- }
- finally
- {
- structuredModel.releaseFromRead();
- }
- }
- }
-
- IEditorInput editorInput = structuredTextEditor.getEditorInput();
- // perform save as
- structuredTextEditor.doSaveAs();
- // if saveAs cancelled then don't setInput because the input hasn't change
- // See AbstractDecoratedTextEditor's performSaveAs
- if (editorInput != structuredTextEditor.getEditorInput())
- {
- setInput(structuredTextEditor.getEditorInput());
- setPartName(structuredTextEditor.getEditorInput().getName());
-
- getCommandStack().markSaveLocation();
-
- // Now do the clean up on the old document
- if (modelAdapter != null)
- {
- // clear out model adapter
- modelAdapter.clear();
- modelAdapter = null;
- }
- }
- }
-
- protected void doPostEditorOpenTasks()
- {
- // Bug 204868: do the selection after the editor part is created, so that
- // AbstractTextEditor.markInNavigationHistory() won't cause the creation
- // of its own editor part.
- // Select the schema to show the properties
- getSelectionManager().setSelection(new StructuredSelection(getModel()));
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/KeyboardDragImpl.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/KeyboardDragImpl.java
deleted file mode 100644
index c0fc8e3290..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/KeyboardDragImpl.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.editor;
-
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDAttributeDeclarationAdapter;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDElementDeclarationAdapter;
-import org.eclipse.wst.xsd.ui.internal.adt.design.IKeyboardDrag;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.KeyBoardAccessibilityEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.commands.BaseDragAndDropCommand;
-import org.eclipse.wst.xsd.ui.internal.commands.XSDAttributeDragAndDropCommand;
-import org.eclipse.wst.xsd.ui.internal.commands.XSDElementDragAndDropCommand;
-import org.eclipse.wst.xsd.ui.internal.design.editparts.XSDBaseFieldEditPart;
-import org.eclipse.xsd.XSDWildcard;
-
-public class KeyboardDragImpl implements IKeyboardDrag
-{
- public void performKeyboardDrag(GraphicalEditPart movingElement, int direction)
- {
- KeyBoardAccessibilityEditPolicy policy = (KeyBoardAccessibilityEditPolicy) movingElement.getEditPolicy(KeyBoardAccessibilityEditPolicy.KEY);
-
- EditPart rightElement = policy.getRelativeEditPart(movingElement, direction);
- policy = (KeyBoardAccessibilityEditPolicy) rightElement.getEditPolicy(KeyBoardAccessibilityEditPolicy.KEY);
- EditPart leftElement = (policy != null) ? policy.getRelativeEditPart(rightElement, direction) : null;
-
- // TODO: add support for extenders
- if (!(movingElement instanceof XSDBaseFieldEditPart)) return;
-
- XSDBaseFieldEditPart movingField = (XSDBaseFieldEditPart) movingElement;
- XSDBaseFieldEditPart leftField = (XSDBaseFieldEditPart) leftElement;
- XSDBaseFieldEditPart rightField = (XSDBaseFieldEditPart) rightElement;
-
- Object movingObject = movingField.getModel();
-
- BaseDragAndDropCommand command = null;
- if (movingObject instanceof XSDElementDeclarationAdapter || movingObject instanceof XSDWildcard)
- {
- command = new XSDElementDragAndDropCommand(movingField, leftField, rightField, direction);
- }
- else if (movingObject instanceof XSDAttributeDeclarationAdapter)
- {
- command = new XSDAttributeDragAndDropCommand(movingField, leftField, rightField, direction);
- }
-
- if (command != null && command.canExecute())
- {
- command.execute();
- // This is to reselect the moved item
- try
- {
- IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
- if (editor != null && editor.getAdapter(ISelectionProvider.class) != null)
- {
- ISelectionProvider provider = (ISelectionProvider) editor.getAdapter(ISelectionProvider.class);
- if (provider != null)
- {
- provider.setSelection(new StructuredSelection(movingElement.getModel()));
- }
- }
- }
- catch (Exception e)
- {
-
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/Logger.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/Logger.java
deleted file mode 100644
index 41274520a4..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/Logger.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*******************************************************************************
- * 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.editor;
-
-import com.ibm.icu.util.StringTokenizer;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.osgi.framework.Bundle;
-
-/**
- * Small convenience class to log messages to plugin's log file and also, if
- * desired, the console. This class should only be used by classes in this
- * plugin. Other plugins should make their own copy, with appropriate ID.
- */
-public class Logger {
- private static final String PLUGIN_ID = "org.eclipse.wst.xsd.ui"; //$NON-NLS-1$
-
- public static final int ERROR = IStatus.ERROR; // 4
- public static final int ERROR_DEBUG = 200 + ERROR;
- public static final int INFO = IStatus.INFO; // 1
- public static final int INFO_DEBUG = 200 + INFO;
-
- public static final int OK = IStatus.OK; // 0
-
- public static final int OK_DEBUG = 200 + OK;
-
- private static final String TRACEFILTER_LOCATION = "/debug/tracefilter"; //$NON-NLS-1$
- public static final int WARNING = IStatus.WARNING; // 2
- public static final int WARNING_DEBUG = 200 + WARNING;
-
- /**
- * Adds message to log.
- *
- * @param level
- * severity level of the message (OK, INFO, WARNING, ERROR,
- * OK_DEBUG, INFO_DEBUG, WARNING_DEBUG, ERROR_DEBUG)
- * @param message
- * text to add to the log
- * @param exception
- * exception thrown
- */
- protected static void _log(int level, String message, Throwable exception) {
- if (level == OK_DEBUG || level == INFO_DEBUG || level == WARNING_DEBUG || level == ERROR_DEBUG) {
- if (!isDebugging())
- return;
- }
-
- int severity = IStatus.OK;
- switch (level) {
- case INFO_DEBUG :
- case INFO :
- severity = IStatus.INFO;
- break;
- case WARNING_DEBUG :
- case WARNING :
- severity = IStatus.WARNING;
- break;
- case ERROR_DEBUG :
- case ERROR :
- severity = IStatus.ERROR;
- }
- message = (message != null) ? message : "null"; //$NON-NLS-1$
- Status statusObj = new Status(severity, PLUGIN_ID, severity, message, exception);
- Bundle bundle = Platform.getBundle(PLUGIN_ID);
- if (bundle != null)
- Platform.getLog(bundle).log(statusObj);
- }
-
- /**
- * Prints message to log if category matches /debug/tracefilter option.
- *
- * @param message
- * text to print
- * @param category
- * category of the message, to be compared with
- * /debug/tracefilter
- */
- protected static void _trace(String category, String message, Throwable exception) {
- if (isTracing(category)) {
- message = (message != null) ? message : "null"; //$NON-NLS-1$
- Status statusObj = new Status(IStatus.OK, PLUGIN_ID, IStatus.OK, message, exception);
- Bundle bundle = Platform.getBundle(PLUGIN_ID);
- if (bundle != null)
- Platform.getLog(bundle).log(statusObj);
- }
- }
-
- /**
- * @return true if the platform is debugging
- */
- public static boolean isDebugging() {
- return Platform.inDebugMode();
- }
-
- /**
- * Determines if currently tracing a category
- *
- * @param category
- * @return true if tracing category, false otherwise
- */
- public static boolean isTracing(String category) {
- if (!isDebugging())
- return false;
-
- String traceFilter = Platform.getDebugOption(PLUGIN_ID + TRACEFILTER_LOCATION);
- if (traceFilter != null) {
- StringTokenizer tokenizer = new StringTokenizer(traceFilter, ","); //$NON-NLS-1$
- while (tokenizer.hasMoreTokens()) {
- String cat = tokenizer.nextToken().trim();
- if (category.equals(cat)) {
- return true;
- }
- }
- }
- return false;
- }
-
- public static void log(int level, String message) {
- _log(level, message, null);
- }
-
- public static void log(int level, String message, Throwable exception) {
- _log(level, message, exception);
- }
-
- public static void logException(String message, Throwable exception) {
- _log(ERROR, message, exception);
- }
-
- public static void logException(Throwable exception) {
- _log(ERROR, exception.getMessage(), exception);
- }
-
- public static void trace(String category, String message) {
- _trace(category, message, null);
- }
-
- public static void traceException(String category, String message, Throwable exception) {
- _trace(category, message, exception);
- }
-
- public static void traceException(String category, Throwable exception) {
- _trace(category, exception.getMessage(), exception);
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/Messages.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/Messages.java
deleted file mode 100644
index c013f7414a..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/Messages.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * David Carver, Standards for Technology in Automotive Retail, bug 1147033
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.editor;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS
-{
- static
- {
- NLS.initializeMessages("org.eclipse.wst.xsd.ui.internal.editor.messages", Messages.class); //$NON-NLS-1$
- }
-
- 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_NAME;
- public static String UI_LABEL_KIND;
- 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;
-
- public static String _UI_GRAPH_TYPES;
- public static String _UI_GRAPH_REDEFINE_TYPES;
- public static String _UI_GRAPH_ELEMENTS;
- public static String _UI_GRAPH_ATTRIBUTES;
- public static String _UI_GRAPH_ATTRIBUTE_GROUPS;
- public static String _UI_GRAPH_REDEFINE_ATTRIBUTE_GROUPS;
- public static String _UI_GRAPH_NOTATIONS;
- public static String _UI_GRAPH_IDENTITY_CONSTRAINTS;
- public static String _UI_GRAPH_ANNOTATIONS;
- public static String _UI_GRAPH_DIRECTIVES;
- public static String _UI_GRAPH_GROUPS;
- public static String _UI_GRAPH_REDEFINE_GROUPS;
-
- public static String _UI_LABEL_NO_LOCATION_SPECIFIED;
- public static String _UI_NO_TYPE_DEFINED;
- public static String _UI_ACTION_UPDATE_NAME;
- public static String _UI_LABEL_ABSENT;
- public static String _UI_ACTION_ADD_FIELD;
- public static String _UI_ACTION_SET_MULTIPLICITY;
- public static String _UI_LABEL_OPTIONAL;
- public static String _UI_LABEL_ZERO_OR_MORE;
- public static String _UI_LABEL_ONE_OR_MORE;
- public static String _UI_LABEL_REQUIRED;
- public static String _UI_LABEL_ARRAY;
- public static String _UI_ACTION_SET_TYPE;
- public static String _UI_LABEL_LOCAL_TYPE;
-
- public static String _UI_GRAPH_UNKNOWN_OBJECT;
- public static String _UI_GRAPH_XSDSCHEMA;
- public static String _UI_GRAPH_XSDSCHEMA_NO_NAMESPACE;
- public static String _UI_LABEL_SET_COMMON_BUILT_IN_TYPES;
- public static String _UI_LABEL_SELECT_TYPES_FILTER_OUT;
- public static String _UI_LABEL_NEW_TYPE;
- public static String _UI_VALUE_NEW_TYPE;
- public static String _UI_LABEL_COMPLEX_TYPE;
- public static String _UI_LABEL_SIMPLE_TYPE;
- public static String _UI_LABEL_NEW_ELEMENT;
- public static String _UI_LABEL_NEW_ATTRIBUTE;
- public static String _UI_MENU_XSD_EDITOR;
- public static String _UI_LABEL_SOURCE;
- public static String _UI_ACTION_BEFORE;
- public static String _UI_ACTION_AFTER;
- public static String _UI_ACTION_ADD_ELEMENT;
- public static String _UI_ACTION_INSERT_ELEMENT;
- public static String _UI_ACTION_ADD_ELEMENT_REF;
- public static String _UI_ACTION_NEW;
- public static String _UI_ACTION_BROWSE;
- public static String _UI_ACTION_UPDATE_ELEMENT_REFERENCE;
- public static String _UI_ACTION_UPDATE_ATTRIBUTE_REFERENCE;
- public static String _UI_LABEL_TARGET_NAMESPACE;
- public static String _UI_LABEL_NO_NAMESPACE;
- public static String _UI_ACTION_ADD_COMPLEX_TYPE;
- public static String _UI_ACTION_ADD_SIMPLE_TYPE;
- public static String _UI_LABEL_NAME_SEARCH_FILTER_TEXT;
- public static String _UI_LABEL_ELEMENTS_COLON;
- public static String _UI_LABEL_ATTRIBUTES_COLON;
- public static String _UI_LABEL_ATTRIBUTES_PROCESSCONTENTS;
- public static String _UI_LABEL_ATTRIBUTES_NAMESPACE;
- public static String _UI_LABEL_SET_ELEMENT_REFERENCE;
- public static String _UI_LABEL_SET_ATTRIBUTE_REFERENCE;
- public static String _UI_LABEL_REDEFINE_COMPONENT;
- public static String _UI_LABEL_TYPES_COLON;
- public static String _UI_LABEL_SET_TYPE;
-
- public static String _UI_TEXT_INDENT_LABEL;
- public static String _UI_TEXT_INDENT_SPACES_LABEL;
- public static String _UI_TEXT_XSD_NAMESPACE_PREFIX;
- public static String _UI_TEXT_XSD_DEFAULT_PREFIX;
- public static String _UI_QUALIFY_XSD;
- public static String _UI_TEXT_XSD_DEFAULT_TARGET_NAMESPACE;
- public static String _UI_VALIDATING_FILES;
- public static String _UI_FULL_CONFORMANCE;
- public static String _UI_TEXT_HONOUR_ALL_SCHEMA_LOCATIONS;
-
- public static String _ERROR_LABEL_INVALID_PREFIX;
- public static String _UI_ACTION_ADD_INCLUDE;
- public static String _UI_ACTION_ADD_IMPORT;
- public static String _UI_ACTION_ADD_REDEFINE;
- public static String _UI_ACTION_ADD_ATTRIBUTE;
- public static String _UI_ACTION_INSERT_ATTRIBUTE;
- public static String _UI_ACTION_ADD_ATTRIBUTE_REF;
- public static String _UI_ACTION_DRAG_DROP_ELEMENT;
- public static String _UI_ACTION_DRAG_DROP_ATTRIBUTE;
- public static String _UI_ACTION_REDEFINE_COMPLEX_TYPE;
- public static String _UI_ACTION_REDEFINE_SIMPLE_TYPE;
- public static String _UI_ACTION_REDEFINE_ATTRIBUTE_GROUP;
- public static String _UI_ACTION_REDEFINE_MODEL_GROUP;
- public static String _UI_ACTION_RENAME;
-
- public static String _UI_IMAGE_COMPLEX_TYPE;
- public static String _UI_IMAGE_SIMPLE_TYPE;
- public static String _UI_IMAGE_MODEL_GROUP;
- public static String _UI_IMAGE_ATTRIBUTE_GROUP;
-
- // TODO: TO REMOVE
- public static String _UI_LABEL_ELEMENTFORMDEFAULT;
- // TODO: TO REMOVE
- public static String _UI_LABEL_ATTRIBUTEFORMDEFAULT;
- public static String _UI_LABEL_CREATE_ANON_TYPE;
- public static String _UI_XML_TEXT_EDITOR_PREFS_LINK;
- public static String _UI_XML_VALIDATOR_PREFS_LINK;
-
- public static String _UI_TEXT_ENABLE_AUTO_IMPORT_CLEANUP;
- public static String _UI_TEXT_ENABLE_AUTO_OPEN_SCHEMA_DIALOG;
- public static String _UI_GRAPH_REDEFINE_SCHEMA;
-
- public static String _UI_COMBO_NEW;
- public static String _UI_COMBO_BROWSE;
-
- public static String _UI_ERROR_INVALID_NAME;
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/SourcePageActionContributor.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/SourcePageActionContributor.java
deleted file mode 100644
index d85ed36ce7..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/SourcePageActionContributor.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * 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.internal.editor;
-
-import org.eclipse.ui.IActionBars;
-import org.eclipse.wst.xml.ui.internal.actions.ActionContributorXML;
-
-
-/**
- * SourcePageActionContributor
- *
- * This class is for multi page editor's source page contributor.
- *
- *
- */
-public class SourcePageActionContributor extends ActionContributorXML {
-
- private IActionBars fBars;
-
- /**
- * This method calls:
- * <ul>
- * <li><code>contributeToMenu</code> with <code>bars</code>' menu manager</li>
- * <li><code>contributeToToolBar</code> with <code>bars</code>' tool bar
- * manager</li>
- * <li><code>contributeToStatusLine</code> with <code>bars</code>' status line
- * manager</li>
- * </ul>
- * The given action bars are also remembered and made accessible via
- * <code>getActionBars</code>.
- *
- * @param bars the action bars
- *
- */
- public void init(IActionBars bars) {
- fBars = bars;
- contributeToMenu(bars.getMenuManager());
- contributeToToolBar(bars.getToolBarManager());
- contributeToStatusLine(bars.getStatusLineManager());
- }
-
- /**
- * Returns this contributor's action bars.
- *
- * @return the action bars
- */
- public IActionBars getActionBars() {
- return fBars;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/StructuredTextViewerConfigurationXSD.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/StructuredTextViewerConfigurationXSD.java
deleted file mode 100644
index 62ac66bbc9..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/StructuredTextViewerConfigurationXSD.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.editor;
-
-import java.util.Map;
-
-import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.wst.xml.ui.StructuredTextViewerConfigurationXML;
-
-/**
- * Configuration for editing XSD content type
- */
-public class StructuredTextViewerConfigurationXSD extends StructuredTextViewerConfigurationXML {
- protected Map getHyperlinkDetectorTargets(ISourceViewer sourceViewer) {
- Map targets = super.getHyperlinkDetectorTargets(sourceViewer);
- targets.put("org.eclipse.wst.xsd.core.xsdsource", null); //$NON-NLS-1$
- return targets;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDAttributeReferenceEditManager.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDAttributeReferenceEditManager.java
deleted file mode 100644
index df4cab657d..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDAttributeReferenceEditManager.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.editor;
-
-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.xsd.ui.internal.adt.edit.ComponentReferenceEditManager;
-import org.eclipse.wst.xsd.ui.internal.adt.edit.IComponentDialog;
-import org.eclipse.wst.xsd.ui.internal.common.commands.AddXSDAttributeDeclarationCommand;
-import org.eclipse.wst.xsd.ui.internal.common.commands.UpdateAttributeReferenceAndManagerDirectivesCommand;
-import org.eclipse.wst.xsd.ui.internal.common.commands.UpdateAttributeReferenceCommand;
-import org.eclipse.wst.xsd.ui.internal.common.util.XSDDirectivesManager;
-import org.eclipse.wst.xsd.ui.internal.dialogs.NewAttributeDialog;
-import org.eclipse.wst.xsd.ui.internal.editor.search.XSDSearchListDialogDelegate;
-import org.eclipse.wst.xsd.ui.internal.search.IXSDSearchConstants;
-import org.eclipse.xsd.XSDAttributeDeclaration;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDSchema;
-
-public class XSDAttributeReferenceEditManager extends XSDElementReferenceEditManager implements ComponentReferenceEditManager
-{
- public XSDAttributeReferenceEditManager(IFile currentFile, XSDSchema[] schemas)
- {
- super(currentFile, schemas);
- }
-
- public IComponentDialog getBrowseDialog()
- {
- XSDSearchListDialogDelegate dialogDelegate =
- new XSDSearchListDialogDelegate(XSDSearchListDialogDelegate.ATTRIBUTE_META_NAME, currentFile, schemas);
- return dialogDelegate;
- }
-
- public IComponentDialog getNewDialog()
- {
- if (schemas.length > 0) {
- return new NewAttributeDialog(schemas[0]);
- }
- else {
- return new NewAttributeDialog();
- }
- }
-
- public void modifyComponentReference(Object referencingObject, ComponentSpecification referencedComponent)
- {
- XSDAttributeDeclaration concreteComponent = null;
- if (referencingObject instanceof Adapter)
- {
- Adapter adapter = (Adapter)referencingObject;
- if (adapter.getTarget() instanceof XSDAttributeDeclaration)
- {
- concreteComponent = (XSDAttributeDeclaration)adapter.getTarget();
- }
- }
- else if (referencingObject instanceof XSDConcreteComponent)
- {
- concreteComponent = (XSDAttributeDeclaration) referencingObject;
- }
- if (concreteComponent != null)
- {
- if (referencedComponent.isNew())
- {
- XSDAttributeDeclaration attributeDec = null;
- if (referencedComponent.getMetaName() == IXSDSearchConstants.ATTRIBUTE_META_NAME)
- {
- AddXSDAttributeDeclarationCommand command = new AddXSDAttributeDeclarationCommand(Messages._UI_ACTION_ADD_ATTRIBUTE, concreteComponent.getSchema());
- command.setNameToAdd(referencedComponent.getName());
- command.execute();
- attributeDec = (XSDAttributeDeclaration) command.getAddedComponent();
- }
- if (attributeDec != null)
- {
- Command command = new UpdateAttributeReferenceCommand(Messages._UI_ACTION_UPDATE_ATTRIBUTE_REFERENCE, concreteComponent, attributeDec);
- command.execute();
- }
- XSDDirectivesManager.removeUnusedXSDImports(concreteComponent.getSchema());
- }
- else
- {
- Command command = new UpdateAttributeReferenceAndManagerDirectivesCommand(concreteComponent, referencedComponent.getName(), referencedComponent.getQualifier(), referencedComponent.getFile());
- command.setLabel(Messages._UI_ACTION_UPDATE_ATTRIBUTE_REFERENCE);
- command.execute();
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDComplexTypeBaseTypeEditManager.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDComplexTypeBaseTypeEditManager.java
deleted file mode 100644
index 002aa768aa..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDComplexTypeBaseTypeEditManager.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.editor;
-
-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.xsd.ui.internal.adt.edit.IComponentDialog;
-import org.eclipse.wst.xsd.ui.internal.common.commands.AddXSDComplexTypeDefinitionCommand;
-import org.eclipse.wst.xsd.ui.internal.common.commands.AddXSDSimpleTypeDefinitionCommand;
-import org.eclipse.wst.xsd.ui.internal.common.commands.SetBaseTypeAndManagerDirectivesCommand;
-import org.eclipse.wst.xsd.ui.internal.common.commands.SetBaseTypeCommand;
-import org.eclipse.wst.xsd.ui.internal.common.util.Messages;
-import org.eclipse.wst.xsd.ui.internal.common.util.XSDDirectivesManager;
-import org.eclipse.wst.xsd.ui.internal.editor.search.XSDSearchListDialogDelegate;
-import org.eclipse.wst.xsd.ui.internal.search.IXSDSearchConstants;
-import org.eclipse.xsd.XSDComplexTypeDefinition;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.XSDSimpleTypeDefinition;
-import org.eclipse.xsd.XSDTypeDefinition;
-
-public class XSDComplexTypeBaseTypeEditManager extends XSDTypeReferenceEditManager
-{
- public XSDComplexTypeBaseTypeEditManager(IFile currentFile, XSDSchema[] schemas)
- {
- super(currentFile, schemas);
- }
-
- public ComponentSpecification[] getQuickPicks()
- {
- return super.getQuickPicks();
- }
-
- public IComponentDialog getBrowseDialog()
- {
- XSDSearchListDialogDelegate dialogDelegate = new XSDSearchListDialogDelegate(XSDSearchListDialogDelegate.TYPE_META_NAME, currentFile, schemas);
- return dialogDelegate;
- }
-
- // TODO common this up
- 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 instanceof XSDComplexTypeDefinition)
- {
- if (component.isNew())
- {
- XSDTypeDefinition td = null;
- if (component.getMetaName() == IXSDSearchConstants.COMPLEX_TYPE_META_NAME)
- {
- AddXSDComplexTypeDefinitionCommand command = new AddXSDComplexTypeDefinitionCommand(Messages._UI_ACTION_ADD_COMPLEX_TYPE, concreteComponent.getSchema());
- command.setNameToAdd(component.getName());
- command.execute();
- td = command.getCreatedComplexType();
- }
- else
- {
- AddXSDSimpleTypeDefinitionCommand command = new AddXSDSimpleTypeDefinitionCommand(Messages._UI_ACTION_ADD_SIMPLE_TYPE, concreteComponent.getSchema());
- command.setNameToAdd(component.getName());
- command.execute();
- td = command.getCreatedSimpleType();
- }
- if (td != null)
- {
- Command command = new SetBaseTypeCommand(concreteComponent, td);
- command.execute();
- }
- XSDDirectivesManager.removeUnusedXSDImports(concreteComponent.getSchema());
- }
- else
- {
- Command command = new SetBaseTypeAndManagerDirectivesCommand(concreteComponent, component.getName(), component.getQualifier(), component.getFile());
- command.setLabel(Messages._UI_ACTION_SET_BASE_TYPE);
- command.execute();
- }
- }
- else if (concreteComponent instanceof XSDSimpleTypeDefinition)
- {
- if (component.isNew())
- {
- XSDTypeDefinition td = null;
- if (component.getMetaName() == IXSDSearchConstants.SIMPLE_TYPE_META_NAME)
- {
- AddXSDSimpleTypeDefinitionCommand command = new AddXSDSimpleTypeDefinitionCommand(Messages._UI_ACTION_ADD_SIMPLE_TYPE, concreteComponent.getSchema());
- command.setNameToAdd(component.getName());
- command.execute();
- td = command.getCreatedSimpleType();
- }
- if (td != null)
- {
- Command command = new SetBaseTypeCommand(concreteComponent, td);
- command.execute();
- }
- XSDDirectivesManager.removeUnusedXSDImports(concreteComponent.getSchema());
- }
- else
- {
- Command command = new SetBaseTypeAndManagerDirectivesCommand(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/ui/internal/editor/XSDEditorCSHelpIds.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDEditorCSHelpIds.java
deleted file mode 100644
index 332e199b31..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDEditorCSHelpIds.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.editor;
-
-/**
- *
- * Context Sensitive Help IDs
- *
- */
-public class XSDEditorCSHelpIds
-{
- public static final String PLUGIN_NAME = "org.eclipse.wst.xsd.ui";
-
- public static final String REGEX_WIZARD_PAGE = PLUGIN_NAME + ".xsduw0010";
- public static final String REGEX_TOKEN_CONTENTS = PLUGIN_NAME + ".xsduw0020";
- public static final String REGEX_JUST_ONCE = PLUGIN_NAME + ".xsduw0030";
- public static final String REGEX_ZERO_OR_MORE = PLUGIN_NAME + ".xsduw0040";
- public static final String REGEX_ONE_OR_MORE = PLUGIN_NAME + ".xsduw0050";
- public static final String REGEX_OPTIONAL = PLUGIN_NAME + ".xsduw0060";
- public static final String REGEX_REPEAT_RADIO = PLUGIN_NAME + ".xsduw0070";
- public static final String REGEX_RANGE_RADIO = PLUGIN_NAME + ".xsduw0080";
- public static final String REGEX_REPEAT_FIELD = PLUGIN_NAME + ".xsduw0090";
- public static final String REGEX_RANGE_MINIMUM_FIELD = PLUGIN_NAME + ".xsduw0100";
- public static final String REGEX_RANGE_MAXIMUM_FIELD = PLUGIN_NAME + ".xsduw0110";
- public static final String REGEX_ADD_BUTTON = PLUGIN_NAME + ".xsduw0120";
- public static final String REGEX_CURRENT_VALUE = PLUGIN_NAME + ".xsduw0130";
-
- public static final String REGEX_TEST_PAGE = PLUGIN_NAME + ".xsduw0200";
- public static final String REGEX_SAMPLE_TEXT = PLUGIN_NAME + ".xsduw0210";
-
- public static final String RENAME_NEW_NAME = PLUGIN_NAME + ".xsduw0300";
- public static final String RENAME_UPDATE_REFERENCES = PLUGIN_NAME + ".xsduw0310";
-
- public static final String NEWTYPE_COMPLEXTYPE = PLUGIN_NAME + ".xsdud0010";
- public static final String NEWTYPE_SIMPLETYPE = PLUGIN_NAME + ".xsdud0020";
- public static final String NEWTYPE_NAME = PLUGIN_NAME + ".xsdud0030";
-
- public static final String SETTYPE_NAME = PLUGIN_NAME + ".xsdud0050"; // these 3 are in common.ui
- public static final String SETTYPE_TYPES = PLUGIN_NAME + ".xsdud0060";
- public static final String SETTYPE_SEARCHSCOPES = PLUGIN_NAME + ".xsdud0070";
-
- public static final String ADD_ENUMERATIONS__NO_NAME = PLUGIN_NAME + ".xsdud0090";
- public static final String ADD_ENUMERATIONS__DELIMITER_CHARS = PLUGIN_NAME + ".xsdud0100";
- public static final String ADD_ENUMERATIONS__PRESERVE_LEAD_AND_TRAIL_WHITESPACES = PLUGIN_NAME + ".xsdud0110";
-
- public static final String ADD_EXTENSIONS_COMPONENTS__EXTENSION_CATEGORIES = PLUGIN_NAME + ".xsdud0130";
- public static final String ADD_EXTENSIONS_COMPONENTS__AVAILABLE_COMPONENTS_TO_ADD = PLUGIN_NAME + ".xsdud0140";
- public static final String ADD_EXTENSIONS_COMPONENTS__ADD = PLUGIN_NAME + ".xsdud0150";
- public static final String ADD_EXTENSIONS_COMPONENTS__DELETE = PLUGIN_NAME + ".xsdud0160";
- public static final String ADD_EXTENSIONS_COMPONENTS__EDIT = PLUGIN_NAME + ".xsdud0170";
-
- public static final String ADD_CATEGORY__NAME = PLUGIN_NAME + ".xsdud0190";
- public static final String ADD_CATEGORY__SCHEMA = PLUGIN_NAME + ".xsdud0200"; // can't invoke help, this is a CLabel, not text Field
-
- public static final String XML_CATALOG_ENTRIES__ENTRIES_TREELIST = PLUGIN_NAME + ".xsdud0220";
- public static final String XML_CATALOG_ENTRIES__DETAILS = PLUGIN_NAME + ".xsdud0230";
-
- public static final String XMLSCHEMAFILES_PREFERENCES__QUALIFY_XMLSCHEMA_LANGUAGE_CONSTRUCTS = PLUGIN_NAME + ".xsduf0010";
- public static final String XMLSCHEMAFILES_PREFERENCES__XML_SCHEMA_LANGUAGE_CONSTRUCTS_PREFIX = PLUGIN_NAME + ".xsduf0020";
- public static final String XMLSCHEMAFILES_PREFERENCES__DEFAULT_TARGETNAMESPACE = PLUGIN_NAME + ".xsduf0030";
- public static final String XMLSCHEMAFILES_PREFERENCES__HONOUR_ALL_SCHEMA_LOCATIONS = PLUGIN_NAME + ".xsduf0040";
- public static final String XMLSCHEMAFILES_PREFERENCES__IMPORT_CLEANUP = PLUGIN_NAME + ".xsduf0050";
-
- public static final String DOCUMENTATION_TAB__NO_LABEL = PLUGIN_NAME + ".xsdup0010";
-
- public static final String EXTENSIONS_TAB__EXTENSIONS = PLUGIN_NAME + ".xsdup0030";
- public static final String EXTENSIONS_TAB__ADD = PLUGIN_NAME + ".xsdup0040";
- public static final String EXTENSIONS_TAB__DELETE = PLUGIN_NAME + ".xsdup0050";
- public static final String EXTENSIONS_TAB__EXTENSIONS_DETAILS = PLUGIN_NAME + ".xsdup0060";
-
- public static final String CONSTRAINTS_TAB__MINIMUM_LENGTH = PLUGIN_NAME + ".xsdup0080";
- public static final String CONSTRAINTS_TAB__MAXIMUM_LENGTH = PLUGIN_NAME + ".xsdup0090";
- public static final String CONSTRAINTS_TAB__COLLAPSE_WHITESPACE = PLUGIN_NAME + ".xsdup0100";
- public static final String CONSTRAINTS_TAB__ENUMERATIONS = PLUGIN_NAME + ".xsdup0110";
- public static final String CONSTRAINTS_TAB__PATTERNS = PLUGIN_NAME + ".xsdup0120";
- public static final String CONSTRAINTS_TAB__NO_LABEL = PLUGIN_NAME + ".xsdup0130";
-
- public static final String GENERAL_TAB__SCHEMA__PREFIX = PLUGIN_NAME + ".xsdup0200";
- public static final String GENERAL_TAB__SCHEMA__TARGETNAMESPACE = PLUGIN_NAME + ".xsdup0210";
- public static final String GENERAL_TAB__SCHEMA__ADVANCED = PLUGIN_NAME + ".xsdup0220";
-
- public static final String ADVANCE_TAB__SCHEMA_ELEMENT_FORM_DEFAULT = PLUGIN_NAME + ".xsdup0450";
- public static final String ADVANCE_TAB__SCHEMA_ATTRIBUTE_FORM_DEFAULT = PLUGIN_NAME + ".xsdup0460";
- public static final String ADVANCE_TAB__SCHEMA_BLOCK_DEFAULT = PLUGIN_NAME + ".xsdup0470";
- public static final String ADVANCE_TAB__SCHEMA_FINAL_DEFAULT = PLUGIN_NAME + ".xsdup0480";
-
- public static final String GENERAL_TAB__ELEMENT__NAME = PLUGIN_NAME + ".xsdup0230";
- public static final String GENERAL_TAB__ELEMENT__TYPE = PLUGIN_NAME + ".xsdup0240";
- public static final String GENERAL_TAB__ELEMENT__REFERENCE = PLUGIN_NAME + ".xsdup0250";
- public static final String GENERAL_TAB__ELEMENT__MIN_OCCURENCE = PLUGIN_NAME + ".xsdup0180";
- public static final String GENERAL_TAB__ELEMENT__MAX_OCCURENCE = PLUGIN_NAME + ".xsdup0190";
-
- public static final String GENERAL_TAB__COMPLEX_TYPE__NAME = PLUGIN_NAME + ".xsdup0260";
- public static final String GENERAL_TAB__COMPLEX_TYPE__INHERIT_FROM = PLUGIN_NAME + ".xsdup0270";
- public static final String GENERAL_TAB__COMPLEX_TYPE__INHERIT_BY = PLUGIN_NAME + ".xsdup0280";
-
- public static final String GENERAL_TAB__SIMPLE_TYPE__NAME = PLUGIN_NAME + ".xsdup0290";
- public static final String GENERAL_TAB__SIMPLE_TYPE__VARIETY = PLUGIN_NAME + ".xsdup0300";
- public static final String GENERAL_TAB__SIMPLE_TYPE__BASE_TYPE = PLUGIN_NAME + ".xsdup0310";
-
- public static final String GENERAL_TAB__ATTRIBUTE__NAME = PLUGIN_NAME + ".xsdup0320";
- public static final String GENERAL_TAB__ATTRIBUTE__TYPE = PLUGIN_NAME + ".xsdup0330";
-
- public static final String GENERAL_TAB__ATTRIBUTEGROUP__NAME = PLUGIN_NAME + ".xsdup0340";
-
- public static final String GENERAL_TAB__MODELGROUP_DEFINITION__NAME = PLUGIN_NAME + ".xsdup0350";
-
- public static final String GENERAL_TAB__INCLUDE_REDEFINE__SCHEMALOCATION = PLUGIN_NAME + ".xsdup0360";
-
- public static final String GENERAL_TAB__IMPORT__SCHEMALOCATION = PLUGIN_NAME + ".xsdup0370";
- public static final String GENERAL_TAB__IMPORT__NAMESPACE = PLUGIN_NAME + ".xsdup0380";
- public static final String GENERAL_TAB__IMPORT__PREFIX = PLUGIN_NAME + ".xsdup0390";
-
- public static final String GENERAL_TAB__ANYELEMENT__NAMESPACE = PLUGIN_NAME + ".xsdup0400";
- public static final String GENERAL_TAB__ANYELEMENT__PROCESSCONTENTS = PLUGIN_NAME + ".xsdup0410";
- public static final String GENERAL_TAB__ANYELEMENT__MIN_OCCURENCE = PLUGIN_NAME + ".xsdup0180";
- public static final String GENERAL_TAB__ANYELEMENT__MAX_OCCURENCE = PLUGIN_NAME + ".xsdup0190";
-
- public static final String GENERAL_TAB__ANYATTRIBUTE__NAMESPACE = PLUGIN_NAME + ".xsdup0400"; // these 4 are not used, same as anyelement above
- public static final String GENERAL_TAB__ANYATTRIBUTE__PROCESSCONTENTS = PLUGIN_NAME + ".xsdup0410";
- public static final String GENERAL_TAB__ANYATTRIBUTE__MIN_OCCURENCE = PLUGIN_NAME + ".xsdup0180";
- public static final String GENERAL_TAB__ANYATTRIBUTE__MAX_OCCURENCE = PLUGIN_NAME + ".xsdup0190";
-
- public static final String GENERAL_TAB__MODELGROUP__KIND = PLUGIN_NAME + ".xsdup0420";
- public static final String GENERAL_TAB__MODELGROUP__MIN_OCCURENCE = PLUGIN_NAME + ".xsdup0180"; //can't invoke help
- public static final String GENERAL_TAB__MODELGROUP__MAX_OCCURENCE = PLUGIN_NAME + ".xsdup0190"; // can't invoke help
-
- public static final String GENERAL_TAB__MODELGROUP_REFS__REF = PLUGIN_NAME + ".xsdup0430";
-
- public static final String GENERAL_TAB__ATTRIBUTEGROUP_REFS__REF = PLUGIN_NAME + ".xsdup0440";
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDEditorConfiguration.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDEditorConfiguration.java
deleted file mode 100644
index 89e5800fdd..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDEditorConfiguration.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*******************************************************************************
- * 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.internal.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.ui.internal.actions.IXSDToolbarAction;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDAdapterFactory;
-import org.eclipse.wst.xsd.ui.internal.design.figures.IExtendedFigureFactory;
-
-public class XSDEditorConfiguration
-{
- public static final String XSDEDITORCONFIGURATIONEXTENSIONID = "org.eclipse.wst.xsd.ui.XSDEditorExtensionConfiguration"; //$NON-NLS-1$
- public static final String INTERNALEDITORCONFIGURATION_EXTENSIONID = "org.eclipse.wst.xsd.ui.internalEditorConfiguration"; //$NON-NLS-1$
- public static final String CLASSNAME = "class"; //$NON-NLS-1$
- public static final String ADAPTERFACTORY = "adapterFactory"; //$NON-NLS-1$
- public static final String TOOLBARACTION = "toolbarAction"; //$NON-NLS-1$
- public static final String FIGUREFACTORY = "figureFactory"; //$NON-NLS-1$
- public static final String EDITPARTFACTORY = "editPartFactory"; //$NON-NLS-1$
-
- 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()
- {
- definedExtensionsList = new ArrayList();
- updateList(INTERNALEDITORCONFIGURATION_EXTENSIONID);
- updateList(XSDEDITORCONFIGURATIONEXTENSIONID);
- }
-
- private void updateList(String ID)
- {
- IConfigurationElement[] xsdEditorExtensionList = Platform.getExtensionRegistry().getConfigurationElementsFor(ID);
- boolean definedExtensionsExist = (xsdEditorExtensionList != null && xsdEditorExtensionList.length > 0);
-
- 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/ui/internal/editor/XSDEditorContextIds.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDEditorContextIds.java
deleted file mode 100644
index 2f1bc757af..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDEditorContextIds.java
+++ /dev/null
@@ -1,464 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.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";
- /* CONTEXT_ID xsdp0020 for XML Schema Editor Preferences Page */
- public static final String XSDP_EDITOR_PREFERENCE_PAGE = PLUGIN_NAME + ".xsdp0020";
- /* CONTEXT_ID xsdp0030 for XML Schema Validator Preferences Page */
- public static final String XSDP_VALIDATOR_PREFERENCE_PAGE = PLUGIN_NAME + ".xsdp0030";
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDEditorExtensionProperties.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDEditorExtensionProperties.java
deleted file mode 100644
index f87139aeaf..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDEditorExtensionProperties.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * 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.internal.editor;
-
-import java.util.List;
-
-import org.eclipse.gef.EditPartFactory;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDAdapterFactory;
-import org.eclipse.wst.xsd.ui.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/ui/internal/editor/XSDEditorPlugin.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDEditorPlugin.java
deleted file mode 100644
index 010b4193b5..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDEditorPlugin.java
+++ /dev/null
@@ -1,389 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.editor;
-
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.plugin.*;
-import org.eclipse.wst.xsd.ui.internal.adt.editor.ProductCustomizationProvider;
-import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.ExtensionsSchemasRegistry;
-import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.custom.NodeCustomizationRegistry;
-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.Bundle;
-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"; //$NON-NLS-1$
- public static final String EDITOR_ID = "org.eclipse.wst.xsd.ui.internal.editor.InternalXSDMultiPageEditor"; //$NON-NLS-1$
- public static final String CONST_XSD_DEFAULT_PREFIX_TEXT = "org.eclipse.wst.xmlschema.xsdDefaultPrefixText"; //$NON-NLS-1$
- public static final String CONST_PREFERED_BUILT_IN_TYPES = "org.eclipse.wst.xmlschema.preferedBuiltInTypes"; //$NON-NLS-1$
- public static final String CUSTOM_LIST_SEPARATOR = "\n"; //$NON-NLS-1$
- public static final String EXTENSIONS_SCHEMAS_EXTENSIONID = "org.eclipse.wst.xsd.ui.extensionCategories"; //$NON-NLS-1$
- private static final String DEPRECATED_EXTENSIONS_SCHEMAS_EXTENSIONID = "org.eclipse.wst.xsd.ui.ExtensionsSchemasDescription"; //$NON-NLS-1$
- public final static String DEFAULT_TARGET_NAMESPACE = "http://www.example.org"; //$NON-NLS-1$
- public final static String XSD_CONTENT_TYPE_ID = "org.eclipse.wst.xsd.core.xsdsource"; //$NON-NLS-1$
-
- //The shared instance.
- private static XSDEditorPlugin plugin;
- //Resource bundle.
- private ResourceBundle resourceBundle;
- private ExtensionsSchemasRegistry registry;
- private NodeCustomizationRegistry nodeCustomizationRegistry;
- private XSDEditorConfiguration xsdEditorConfiguration = null;
- private static Bundle bundle;
-
- public static final String CONST_USE_SIMPLE_EDIT_MODE = PLUGIN_ID + ".useSimpleEditMode"; //$NON-NLS-1$
- public static final String CONST_SHOW_INHERITED_CONTENT = PLUGIN_ID + ".showInheritedContent"; //$NON-NLS-1$
-
- public static final String CONST_XSD_LANGUAGE_QUALIFY = "org.eclipse.wst.xmlschema.xsdQualify"; //$NON-NLS-1$
- public static final String CONST_DEFAULT_TARGET_NAMESPACE = "org.eclipse.wst.xmlschema.defaultTargetnamespaceText"; //$NON-NLS-1$
- public static final String CONST_SHOW_EXTERNALS = PLUGIN_ID + ".showExternals"; //$NON-NLS-1$
- public static final String CONST_XSD_IMPORT_CLEANUP = PLUGIN_ID + ".autoImportCleanup"; //$NON-NLS-1$
- public static final String CONST_XSD_AUTO_OPEN_SCHEMA_LOCATION_DIALOG = PLUGIN_ID + ".autoOpenSchemaLocationDialog"; //$NON-NLS-1$
-
- public static String DEFAULT_PAGE = "org.eclipse.wst.xsd.ui.internal.defaultPage";
- public static String DESIGN_PAGE = "org.eclipse.wst.xsd.ui.internal.designPage";
- public static String SOURCE_PAGE = "org.eclipse.wst.xsd.ui.internal.sourcePage";
-
- /**
- * 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);
- bundle = context.getBundle();
- }
-
- /**
- * 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.ui.internal.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); //$NON-NLS-1$
- }
-
- public static ImageDescriptor getImageDescriptor(String name, boolean getBaseURL) {
- try {
- URL installURL = getDefault().getBundle().getEntry("/"); //$NON-NLS-1$
- String imageString = getBaseURL ? "icons/" + name : name; //$NON-NLS-1$
-
- URL imageURL = new URL(installURL, imageString);
- return ImageDescriptor.createFromURL(imageURL);
- } catch (MalformedURLException e) {
- return null;
- }
- }
-
- public Image getIcon(String name)
- {
- try {
- ImageRegistry imageRegistry = getImageRegistry();
-
- if (imageRegistry.get(name) != null) {
- return imageRegistry.get(name);
- }
- else {
- URL installURL = getDefault().getBundle().getEntry("/"); //$NON-NLS-1$
- String imageString = "icons/" + name; //$NON-NLS-1$
-
- URL imageURL = new URL(installURL, imageString);
- imageRegistry.put(name, ImageDescriptor.createFromURL(imageURL));
- return imageRegistry.get(name);
- }
-
- } catch (Exception 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(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 bundle.getEntry("/"); //$NON-NLS-1$
- }
-
- public Image getIconImage(String object) {
- try {
- return ExtendedImageRegistry.getInstance().getImage(new URL(getBaseURL() + "icons/" + object + ".gif")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- catch (MalformedURLException exception) {
-
- }
- 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"); //$NON-NLS-1$
- store.setDefault(CONST_XSD_LANGUAGE_QUALIFY, false);
- store.setDefault(DEFAULT_PAGE, DESIGN_PAGE);
- store.setDefault(CONST_DEFAULT_TARGET_NAMESPACE, DEFAULT_TARGET_NAMESPACE);
- store.setDefault(CONST_SHOW_EXTERNALS, false);
- store.setDefault(CONST_XSD_IMPORT_CLEANUP, false);
- store.setDefault(CONST_XSD_AUTO_OPEN_SCHEMA_LOCATION_DIALOG, true);
-
- //Even the last item in the list must contain a trailing List separator
- store.setDefault(CONST_PREFERED_BUILT_IN_TYPES,
- "boolean"+ CUSTOM_LIST_SEPARATOR + //$NON-NLS-1$
- "date" + CUSTOM_LIST_SEPARATOR + //$NON-NLS-1$
- "dateTime" + CUSTOM_LIST_SEPARATOR + //$NON-NLS-1$
- "double" + CUSTOM_LIST_SEPARATOR + //$NON-NLS-1$
- "float" + CUSTOM_LIST_SEPARATOR + //$NON-NLS-1$
- "hexBinary" + CUSTOM_LIST_SEPARATOR + //$NON-NLS-1$
- "int" + CUSTOM_LIST_SEPARATOR + //$NON-NLS-1$
- "string" + CUSTOM_LIST_SEPARATOR + //$NON-NLS-1$
- "time" + CUSTOM_LIST_SEPARATOR); //$NON-NLS-1$
- }
-
- public ExtensionsSchemasRegistry getExtensionsSchemasRegistry()
- {
- if (registry == null)
- {
- registry = new ExtensionsSchemasRegistry(EXTENSIONS_SCHEMAS_EXTENSIONID);
- registry.__internalSetDeprecatedExtensionId(DEPRECATED_EXTENSIONS_SCHEMAS_EXTENSIONID);
- registry.setPrefStore(XSDEditorPlugin.getPlugin().getPreferenceStore() );
- }
- 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);
- }
-
- public boolean getShowExternals()
- {
- return getPreferenceStore().getBoolean(CONST_SHOW_EXTERNALS);
- }
-
- public void setShowExternals(boolean doShow)
- {
- getPreferenceStore().setValue(CONST_SHOW_EXTERNALS, doShow);
- }
-
- public boolean getRemoveImportSetting()
- {
- return getPreferenceStore().getBoolean(CONST_XSD_IMPORT_CLEANUP);
- }
-
- public boolean getAutomaticallyOpenSchemaLocationDialogSetting()
- {
- return getPreferenceStore().getBoolean(CONST_XSD_AUTO_OPEN_SCHEMA_LOCATION_DIALOG);
- }
-
- /**
- * Get the xml schema default target namespace
- */
- public String getXMLSchemaTargetNamespace() {
- String targetNamespace = getPreferenceStore().getString(CONST_DEFAULT_TARGET_NAMESPACE);
- if (!targetNamespace.endsWith("/")) { //$NON-NLS-1$
- targetNamespace = targetNamespace + "/"; //$NON-NLS-1$
- }
- 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();
- }
-
- public void setSourcePageAsDefault()
- {
- getPreferenceStore().setValue(DEFAULT_PAGE, SOURCE_PAGE);
- }
-
- public void setDesignPageAsDefault()
- {
- getPreferenceStore().setValue(DEFAULT_PAGE, DESIGN_PAGE);
- }
-
- /**
- * Method getDefaultPage.
- *
- * @return String value of the string constant that is the default page
- * the editor should turn to when first opened. Changes to the
- * last visible page when the editor was closed
- */
- public String getDefaultPage() {
- return getPreferenceStore().getString(DEFAULT_PAGE);
- }
-
- public NodeCustomizationRegistry getNodeCustomizationRegistry()
- {
- if (nodeCustomizationRegistry == null)
- {
- nodeCustomizationRegistry = new NodeCustomizationRegistry("foo");
- }
- return nodeCustomizationRegistry;
- }
-
- private static final String PRODUCT_CUSTOMIZATION_PROVIDER_PLUGIN_ID = "org.eclipse.wst.xsd.ui.productCustomizationProviderPluginId"; //$NON-NLS-1$
- private static final String PRODUCT_CUSTOMIZATION_PROVIDER_CLASS_NAME = "org.eclipse.wst.xsd.ui.productCustomizationProviderClassName"; //$NON-NLS-1$
-
- private static ProductCustomizationProvider productCustomizationProvider;
- private static boolean productCustomizationProviderInitialized = false;
-
- public ProductCustomizationProvider getProductCustomizationProvider()
- {
- if (!productCustomizationProviderInitialized)
- {
- productCustomizationProviderInitialized = true;
- String pluginName = getPreferenceStore().getString(PRODUCT_CUSTOMIZATION_PROVIDER_PLUGIN_ID);
- String className = getPreferenceStore().getString(PRODUCT_CUSTOMIZATION_PROVIDER_CLASS_NAME);
- if (pluginName != null && pluginName.length() > 0 &&
- className != null && className.length() > 0)
- {
- try
- {
- Bundle bundle = Platform.getBundle(pluginName);
- Class clazz = bundle.loadClass(className);
- productCustomizationProvider = (ProductCustomizationProvider)clazz.newInstance();
- }
- catch (Exception e)
- {
- }
- }
- }
- return productCustomizationProvider;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDElementReferenceEditManager.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDElementReferenceEditManager.java
deleted file mode 100644
index 6d03aec02a..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDElementReferenceEditManager.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.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.ui.internal.adt.edit.ComponentReferenceEditManager;
-import org.eclipse.wst.xsd.ui.internal.adt.edit.IComponentDialog;
-import org.eclipse.wst.xsd.ui.internal.common.commands.AddXSDElementCommand;
-import org.eclipse.wst.xsd.ui.internal.common.commands.UpdateElementReferenceAndManageDirectivesCommand;
-import org.eclipse.wst.xsd.ui.internal.common.commands.UpdateElementReferenceCommand;
-import org.eclipse.wst.xsd.ui.internal.common.util.XSDDirectivesManager;
-import org.eclipse.wst.xsd.ui.internal.dialogs.NewElementDialog;
-import org.eclipse.wst.xsd.ui.internal.editor.search.XSDSearchListDialogDelegate;
-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()
- {
- if (schemas.length > 0) {
- return new NewElementDialog(schemas[0]);
- }
- else {
- return new NewElementDialog();
- }
- }
-
- 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)
- {
- XSDElementDeclaration concreteComponent = null;
- if (referencingObject instanceof Adapter)
- {
- Adapter adapter = (Adapter)referencingObject;
- if (adapter.getTarget() instanceof XSDElementDeclaration)
- {
- concreteComponent = (XSDElementDeclaration)adapter.getTarget();
- }
- }
- else if (referencingObject instanceof XSDConcreteComponent)
- {
- concreteComponent = (XSDElementDeclaration) referencingObject;
- }
- if (concreteComponent != null)
- {
- if (component.isNew())
- {
- XSDElementDeclaration elementDec = null;
- if (component.getMetaName() == IXSDSearchConstants.ELEMENT_META_NAME)
- {
- AddXSDElementCommand command = new AddXSDElementCommand(Messages._UI_ACTION_ADD_ELEMENT, concreteComponent.getSchema());
- command.setNameToAdd(component.getName());
- command.execute();
- elementDec = (XSDElementDeclaration) command.getAddedComponent();
- }
- if (elementDec != null)
- {
- Command command = new UpdateElementReferenceCommand(Messages._UI_ACTION_UPDATE_ELEMENT_REFERENCE, concreteComponent, elementDec);
- command.execute();
- }
- XSDDirectivesManager.removeUnusedXSDImports(concreteComponent.getSchema());
- }
- else
- {
- Command command = new UpdateElementReferenceAndManageDirectivesCommand(concreteComponent, component.getName(), component.getQualifier(), component.getFile());
- command.setLabel(Messages._UI_ACTION_UPDATE_ELEMENT_REFERENCE);
- command.execute();
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDFileEditorInput.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDFileEditorInput.java
deleted file mode 100644
index 62f283f02c..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDFileEditorInput.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.editor;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.ui.part.FileEditorInput;
-import org.eclipse.wst.xsd.ui.internal.adt.editor.IADTEditorInput;
-import org.eclipse.xsd.XSDSchema;
-
-public class XSDFileEditorInput extends FileEditorInput implements IADTEditorInput
-{
- 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 Messages._UI_LABEL_TARGET_NAMESPACE + ns;
- else
- return Messages._UI_LABEL_NO_NAMESPACE;
- }
- return super.getToolTipText();
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDHyperlink.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDHyperlink.java
deleted file mode 100644
index 5bb7f4cf94..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDHyperlink.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- * Jesper Steen Moller - added support for lookups out of workspace
- *******************************************************************************/
-
-package org.eclipse.wst.xsd.ui.internal.editor;
-
-import java.net.URI;
-
-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.text.IRegion;
-import org.eclipse.jface.text.hyperlink.IHyperlink;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.ide.IDE;
-import org.eclipse.wst.common.uriresolver.internal.util.URIHelper;
-import org.eclipse.wst.xml.ui.internal.Logger;
-import org.eclipse.wst.xsd.ui.internal.adt.editor.ADTReadOnlyFileEditorInput;
-import org.eclipse.wst.xsd.ui.internal.adt.editor.Messages;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDSchema;
-
-/**
- * XSDHyperlink knows how to open links from XSD files.
- *
- * @see XSDHyperlinkDetector
- */
-public class XSDHyperlink implements IHyperlink
-{
- private IRegion fRegion;
- private XSDConcreteComponent fComponent;
-
- public XSDHyperlink(IRegion region, XSDConcreteComponent component)
- {
- fRegion = region;
- fComponent = component;
- }
-
- public IRegion getHyperlinkRegion()
- {
- return fRegion;
- }
-
- public String getTypeLabel()
- {
- return null;
- }
-
- public String getHyperlinkText()
- {
- return NLS.bind(Messages._UI_HYPERLINK_TEXT, fComponent.getElement().getLocalName());
- }
-
- public void open()
- {
- XSDSchema schema = fComponent.getSchema();
-
- if (schema == null)
- {
- return;
- }
-
- String schemaLocation = schema.getSchemaLocation();
-
- IFile schemaFile = null;
- URI schemaUri = null;
-
- if (URIHelper.isPlatformResourceProtocol(schemaLocation))
- {
- IPath schemaPath = new Path(URIHelper.removePlatformResourceProtocol(schemaLocation));
- schemaFile = ResourcesPlugin.getWorkspace().getRoot().getFile(schemaPath);
- if (! schemaFile.exists())
- {
- return;
- }
- }
- else
- {
- try {
- schemaUri = new URI(schemaLocation);
- } catch (Exception exception) {}
- }
-
- IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (workbenchWindow != null)
- {
- IWorkbenchPage workbenchPage = workbenchWindow.getActivePage();
- IEditorPart editorPart = workbenchPage.getActiveEditor();
-
- workbenchPage.getNavigationHistory().markLocation(editorPart);
-
- try
- {
- if (schemaFile != null)
- {
- editorPart = IDE.openEditor(workbenchPage, schemaFile, true);
- }
- else if (schemaUri != null && "file".equals(schemaUri.getScheme())) //$NON-NLS-1$
- {
- editorPart = IDE.openEditor(workbenchPage, schemaUri, XSDEditorPlugin.EDITOR_ID, true);
- }
- else
- {
- IEditorInput input = new ADTReadOnlyFileEditorInput(schemaLocation);
- editorPart = IDE.openEditor(workbenchPage, input, XSDEditorPlugin.EDITOR_ID, true);
- }
- if (editorPart instanceof InternalXSDMultiPageEditor)
- {
- ((InternalXSDMultiPageEditor) editorPart).openOnGlobalReference(fComponent);
- }
- }
- catch (PartInitException pie)
- {
- Logger.log(Logger.WARNING_DEBUG, pie.getMessage(), pie);
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDHyperlinkDetector.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDHyperlinkDetector.java
deleted file mode 100644
index 8e27f1484e..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDHyperlinkDetector.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *******************************************************************************/
-
-package org.eclipse.wst.xsd.ui.internal.editor;
-
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.hyperlink.IHyperlink;
-import org.eclipse.wst.sse.core.StructuredModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
-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.internal.text.XSDModelAdapter;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.util.XSDConstants;
-import org.w3c.dom.Attr;
-
-/**
- * Detects hyperlinks for XSD files. Used by the XSD text editor to provide a
- * "Go to declaration" functionality similar with the one provided by the Java
- * editor.
- */
-public class XSDHyperlinkDetector extends BaseHyperlinkDetector
-{
- /**
- * Determines whether an attribute is "linkable" that is, the component it
- * points to can be the target of a "go to definition" navigation. Derived
- * classes should override.
- *
- * @param name the attribute name. Must not be null.
- * @return true if the attribute is linkable, false otherwise.
- */
- protected boolean isLinkableAttribute(String name)
- {
- boolean isLinkable = name.equals(XSDConstants.TYPE_ATTRIBUTE) ||
- name.equals(XSDConstants.REFER_ATTRIBUTE) ||
- name.equals(XSDConstants.REF_ATTRIBUTE) ||
- name.equals(XSDConstants.BASE_ATTRIBUTE) ||
- name.equals(XSDConstants.SCHEMALOCATION_ATTRIBUTE) ||
- name.equals(XSDConstants.SUBSTITUTIONGROUP_ATTRIBUTE) ||
- name.equals(XSDConstants.ITEMTYPE_ATTRIBUTE) ||
- name.equals(XSDConstants.MEMBERTYPES_ATTRIBUTE)
- ;
-
- return isLinkable;
- }
-
- /**
- * Creates a hyperlink based on the selected node. Derived classes should
- * override.
- *
- * @param document the source document.
- * @param node the node under the cursor.
- * @param region the text region to use to create the hyperlink.
- * @return a new IHyperlink for the node or null if one cannot be created.
- */
- protected IHyperlink createHyperlink(IDocument document, IDOMNode node, IRegion region)
- {
- XSDSchema xsdSchema = getXSDSchema(document);
-
- if (xsdSchema == null)
- {
- return null;
- }
-
- XSDConcreteComponent targetComponent = getTargetXSDComponent(xsdSchema, node);
-
- if (targetComponent != null)
- {
- IRegion nodeRegion = getHyperlinkRegion(node);
-
- return new XSDHyperlink(nodeRegion, targetComponent);
- }
-
- return null;
- }
-
- /**
- * Finds the XSD component for the given node.
- *
- * @param xsdSchema cannot be null
- * @param node cannot be null
- * @return XSDConcreteComponent
- */
- private XSDConcreteComponent getTargetXSDComponent(XSDSchema xsdSchema, IDOMNode node)
- {
- XSDConcreteComponent xsdComponent = xsdSchema.getCorrespondingComponent(node);
-
- String attributeName = null;
-
- if (node instanceof Attr)
- {
- Attr attribute = (Attr)node;
- attributeName = attribute != null ? attribute.getName(): null;
- }
-
- XSDHyperlinkTargetLocator xsdHyperlinkTargetLocator = new XSDHyperlinkTargetLocator();
- XSDConcreteComponent component = xsdHyperlinkTargetLocator.locate(xsdComponent, attributeName);
-
- return component;
- }
-
- /**
- * Gets the xsd schema from document
- *
- * @param document
- * @return XSDSchema or null of one does not exist yet for document
- */
- private XSDSchema getXSDSchema(IDocument document)
- {
- XSDSchema schema = null;
- IStructuredModel model = StructuredModelManager.getModelManager().getExistingModelForRead(document);
- if (model != null)
- {
- try
- {
- if (model instanceof IDOMModel)
- {
- IDOMDocument domDoc = ((IDOMModel) model).getDocument();
- if (domDoc != null)
- {
- XSDModelAdapter modelAdapter = (XSDModelAdapter) domDoc.getExistingAdapter(XSDModelAdapter.class);
- /*
- * ISSUE: Didn't want to go through initializing schema if it does
- * not already exist, so just attempted to get existing adapter. If
- * doesn't exist, just don't bother working.
- */
- if (modelAdapter != null)
- schema = modelAdapter.getSchema();
- }
- }
- }
- finally
- {
- model.releaseFromRead();
- }
- }
- return schema;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDHyperlinkTargetLocator.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDHyperlinkTargetLocator.java
deleted file mode 100644
index c04aebd595..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDHyperlinkTargetLocator.java
+++ /dev/null
@@ -1,301 +0,0 @@
-/*******************************************************************************
- * 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.internal.editor;
-
-import java.util.List;
-
-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.XSDSchema;
-import org.eclipse.xsd.XSDSchemaDirective;
-import org.eclipse.xsd.XSDSimpleTypeDefinition;
-import org.eclipse.xsd.XSDTypeDefinition;
-import org.eclipse.xsd.XSDVariety;
-import org.eclipse.xsd.util.XSDConstants;
-import org.eclipse.xsd.util.XSDSwitch;
-
-/**
- * A custom XSDSwitch used to locate the "referenced" component. Used by the
- * hyperlink/F3 navigation mechanism. Made a separate class because it is used
- * from the WSDL editor as well.
- */
-public class XSDHyperlinkTargetLocator extends XSDSwitch
-{
- /**
- * Holds the attribute name if the cursor/mouse is over an attribute.
- */
- private String attributeName;
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.xsd.util.XSDSwitch#caseXSDAttributeDeclaration(org.eclipse.xsd.XSDAttributeDeclaration)
- */
- public Object caseXSDAttributeDeclaration(XSDAttributeDeclaration attributeDeclaration)
- {
- XSDConcreteComponent target = null;
-
- if (attributeDeclaration.isAttributeDeclarationReference())
- {
- target = attributeDeclaration.getResolvedAttributeDeclaration();
- }
- else if (attributeDeclaration.getAnonymousTypeDefinition() == null)
- {
- target = attributeDeclaration.getTypeDefinition();
-
- // Avoid navigating to built in data types.
-
- if (isFromSchemaForSchema(target))
- {
- target = null;
- }
- }
- return target;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.xsd.util.XSDSwitch#caseXSDAttributeGroupDefinition(org.eclipse.xsd.XSDAttributeGroupDefinition)
- */
- public Object caseXSDAttributeGroupDefinition(XSDAttributeGroupDefinition attributeGroupDefinition)
- {
- XSDConcreteComponent target = null;
-
- if (attributeGroupDefinition.isAttributeGroupDefinitionReference())
- {
- target = attributeGroupDefinition.getResolvedAttributeGroupDefinition();
- }
-
- return target;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.xsd.util.XSDSwitch#caseXSDElementDeclaration(org.eclipse.xsd.XSDElementDeclaration)
- */
- public Object caseXSDElementDeclaration(XSDElementDeclaration elementDeclaration)
- {
- XSDConcreteComponent target = null;
-
- if (elementDeclaration.isElementDeclarationReference())
- {
- target = elementDeclaration.getResolvedElementDeclaration();
- }
- else
- {
- XSDConcreteComponent typeDefinition = null;
-
- if (elementDeclaration.getAnonymousTypeDefinition() == null)
- {
- typeDefinition = elementDeclaration.getTypeDefinition();
- }
-
- XSDConcreteComponent substitutionGroupAffiliation = elementDeclaration.getSubstitutionGroupAffiliation();
-
- if (typeDefinition != null && substitutionGroupAffiliation != null)
- {
- // There are 2 things we can navigate to: if the cursor is anywhere on
- // the
- // substitution attribute then jump to that, otherwise just go to the
- // base type.
-
- if (XSDConstants.SUBSTITUTIONGROUP_ATTRIBUTE.equals(attributeName))
- {
- target = substitutionGroupAffiliation;
- }
- else
- {
- target = typeDefinition;
- }
- }
- else
- {
- target = typeDefinition != null ? typeDefinition : substitutionGroupAffiliation;
- }
-
- if (isFromSchemaForSchema(target))
- {
- target = null;
- }
- }
-
- return target;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.xsd.util.XSDSwitch#caseXSDIdentityConstraintDefinition(org.eclipse.xsd.XSDIdentityConstraintDefinition)
- */
- public Object caseXSDIdentityConstraintDefinition(XSDIdentityConstraintDefinition idConstraintDefinition)
- {
- Object target = null;
-
- XSDIdentityConstraintDefinition referencedKey = idConstraintDefinition.getReferencedKey();
-
- if (referencedKey != null)
- {
- target = referencedKey;
- }
-
- return target;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.xsd.util.XSDSwitch#caseXSDModelGroupDefinition(org.eclipse.xsd.XSDModelGroupDefinition)
- */
- public Object caseXSDModelGroupDefinition(XSDModelGroupDefinition modelGroupDefinition)
- {
- XSDConcreteComponent target = null;
-
- if (modelGroupDefinition.isModelGroupDefinitionReference())
- {
- target = modelGroupDefinition.getResolvedModelGroupDefinition();
- }
-
- return target;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.xsd.util.XSDSwitch#caseXSDSchemaDirective(org.eclipse.xsd.XSDSchemaDirective)
- */
- public Object caseXSDSchemaDirective(XSDSchemaDirective directive)
- {
- XSDSchema schema = directive.getResolvedSchema();
-
- return schema;
- }
-
- public Object caseXSDSimpleTypeDefinition(XSDSimpleTypeDefinition typeDefinition)
- {
- XSDConcreteComponent target = null;
-
- // Simple types can be one of: atomic, list or union.
-
- XSDVariety variety = typeDefinition.getVariety();
- int varietyType = variety.getValue();
-
- switch (varietyType)
- {
- case XSDVariety.ATOMIC:
- {
- target = typeDefinition.getBaseTypeDefinition();
- }
- break;
- case XSDVariety.LIST:
- {
- target = typeDefinition.getItemTypeDefinition();
- }
- break;
- case XSDVariety.UNION:
- {
- List memberTypes = typeDefinition.getMemberTypeDefinitions();
- if (memberTypes != null && memberTypes.size() > 0)
- {
- // ISSUE: What if there are more than one type?
- // This could be a case for multiple hyperlinks at the same
- // location.
- target = (XSDConcreteComponent) memberTypes.get(0);
- }
- }
- break;
- }
-
- // Avoid navigating to built in data types.
-
- if (isFromSchemaForSchema(target))
- {
- target = null;
- }
-
- return target;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.xsd.util.XSDSwitch#caseXSDTypeDefinition(org.eclipse.xsd.XSDTypeDefinition)
- */
- public Object caseXSDTypeDefinition(XSDTypeDefinition typeDefinition)
- {
- XSDConcreteComponent target = null;
-
- XSDTypeDefinition baseType = typeDefinition.getBaseType();
-
- if (baseType != null)
- {
- target = baseType;
- }
-
- // Avoid navigating to built in data types.
-
- if (isFromSchemaForSchema(target))
- {
- target = null;
- }
-
- return target;
- }
-
- /**
- * Detects if a given schema component is from the schema for schema (built in
- * data types). Used to avoid navigating to this type of components as they
- * don't have an accessible physical location.
- *
- * @param component the component to check.
- * @return true if the component is from the schema for schema namespace,
- * false otherwise.
- */
- public boolean isFromSchemaForSchema(XSDConcreteComponent component)
- {
- if (component == null)
- {
- return false;
- }
-
- XSDSchema schema = component.getSchema();
-
- if (schema != null && schema.equals(schema.getSchemaForSchema()))
- {
- return true;
- }
-
- return false;
- }
-
- /**
- * Locates the target component - for example the element declaration pointed
- * to by an element reference, etc.
- *
- * @param component the current component.
- * @param attributeName the attribute name if the cursor/mouse is over an
- * attribute. This is used to provide fine grained navigation for
- * components with more than one "active" attribute.
- * @return the referenced XSD concrete component or null if none is found.
- */
- public XSDConcreteComponent locate(XSDConcreteComponent component, String attributeName)
- {
- this.attributeName = attributeName;
-
- return (XSDConcreteComponent) doSwitch(component);
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDMultiPageEditorContributor.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDMultiPageEditorContributor.java
deleted file mode 100644
index 5d62af8d21..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDMultiPageEditorContributor.java
+++ /dev/null
@@ -1,269 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.editor;
-
-import java.util.ArrayList;
-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.GEFActionConstants;
-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.Action;
-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.IEditorActionBarContributor;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPartSite;
-import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.actions.RetargetAction;
-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.sse.ui.internal.ISourceViewerActionBarContributor;
-import org.eclipse.wst.xsd.ui.internal.actions.IXSDToolbarAction;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.CaptureScreenAction;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.DeleteAction;
-
-/**
- * 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;
- private InternalXSDMultiPageEditor xsdEditor;
- protected ITextEditor textEditor;
- protected IEditorActionBarContributor sourceViewerActionContributor = null;
- protected List fPartListeners= new ArrayList();
- ZoomInRetargetAction zoomInRetargetAction;
- ZoomOutRetargetAction zoomOutRetargetAction;
- Action captureScreenAction;
- ZoomComboContributionItem zoomComboContributionItem;
- /**
- * Creates a multi-page contributor.
- */
- public XSDMultiPageEditorContributor()
- {
- super();
- sourceViewerActionContributor = new SourcePageActionContributor();
- zoomInRetargetAction = new ZoomInRetargetAction();
- zoomInRetargetAction.setImageDescriptor(XSDEditorPlugin.getImageDescriptor("icons/etool16/zoomplus.gif"));
- zoomOutRetargetAction = new ZoomOutRetargetAction();
- zoomOutRetargetAction.setImageDescriptor(XSDEditorPlugin.getImageDescriptor("icons/etool16/zoomminus.gif"));
- captureScreenAction = new CaptureScreenAction();
- fPartListeners.add(zoomInRetargetAction);
- fPartListeners.add(zoomOutRetargetAction);
- }
-
- /**
- * 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();
- boolean isSource = false;
-
- if (activeEditorPart != null && activeEditorPart instanceof ITextEditor)
- {
- isSource = true;
- zoomInRetargetAction.setEnabled(false);
- zoomOutRetargetAction.setEnabled(false);
- captureScreenAction.setEnabled(false);
- activateSourcePage(activeEditorPart, true);
- }
- else
- {
- activateSourcePage(xsdEditor, false);
- if (part instanceof InternalXSDMultiPageEditor)
- {
- xsdEditor = (InternalXSDMultiPageEditor) part;
- }
- if (xsdEditor != null)
- {
- // cs: here's we ensure the UNDO and REDO actions are available when
- // the design view is active
- IWorkbenchPartSite site = xsdEditor.getSite();
- if (site instanceof IEditorSite)
- {
- ITextEditor textEditor = xsdEditor.getTextEditor();
- IActionBars siteActionBars = ((IEditorSite) site).getActionBars();
- siteActionBars.setGlobalActionHandler(ITextEditorActionConstants.UNDO, getAction(textEditor, ITextEditorActionConstants.UNDO));
- siteActionBars.setGlobalActionHandler(ITextEditorActionConstants.REDO, getAction(textEditor, ITextEditorActionConstants.REDO));
- siteActionBars.updateActionBars();
- }
-
- Object adapter = xsdEditor.getAdapter(ActionRegistry.class);
- if (adapter instanceof ActionRegistry)
- {
- ActionRegistry registry = (ActionRegistry) adapter;
- actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), registry.getAction(DeleteAction.ID));
- actionBars.setGlobalActionHandler(GEFActionConstants.ZOOM_IN, registry.getAction(GEFActionConstants.ZOOM_IN));
- actionBars.setGlobalActionHandler(GEFActionConstants.ZOOM_OUT, registry.getAction(GEFActionConstants.ZOOM_OUT));
- actionBars.setGlobalActionHandler(ActionFactory.PRINT.getId(), registry.getAction(ActionFactory.PRINT.getId()));
- actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), registry.getAction(ActionFactory.SELECT_ALL.getId()));
- zoomInRetargetAction.setEnabled(true);
- zoomOutRetargetAction.setEnabled(true);
- captureScreenAction.setEnabled(true);
- }
- }
- }
-
- if (actionBars != null) {
- // update menu bar and tool bar
- actionBars.updateActionBars();
- }
-
- if (zoomComboContributionItem != null)
- {
- zoomComboContributionItem.setVisible(!isSource);
- zoomComboContributionItem.update();
- // Bug 254772 - parent contribution manager should not be null. We added this item already.
- // Force the ToolBarManager to update/redraw the items
- zoomComboContributionItem.getParent().update(true);
- }
- }
-
- protected void activateSourcePage(IEditorPart activeEditor, boolean state)
- {
- if (sourceViewerActionContributor != null && sourceViewerActionContributor instanceof ISourceViewerActionBarContributor)
- {
- sourceViewerActionContributor.setActiveEditor(activeEditor);
- ((ISourceViewerActionBarContributor) sourceViewerActionContributor).setViewerSpecificContributionsEnabled(state);
- }
- }
-
- public void setActiveEditor(IEditorPart part)
- {
- IEditorPart activeNestedEditor = null;
- if (part instanceof MultiPageEditorPart)
- {
- activeNestedEditor = part;
- }
- setActivePage(activeNestedEditor);
-
- if (part instanceof InternalXSDMultiPageEditor)
- {
- xsdEditor = (InternalXSDMultiPageEditor) part;
-
- textEditor = xsdEditor.getTextEditor();
- if (textEditor != null)
- {
-// updateActions();
- getActionBars().updateActionBars();
- }
- }
-
- List list = XSDEditorPlugin.getPlugin().getXSDEditorConfiguration().getToolbarActions();
- for (Iterator i = list.iterator(); i.hasNext(); )
- {
- ((IXSDToolbarAction)i.next()).setEditorPart(activeNestedEditor);
- }
-
- super.setActiveEditor(part);
- }
-
- public void contributeToMenu(IMenuManager manager)
- {
- IMenuManager menu = new MenuManager(Messages._UI_MENU_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(zoomInRetargetAction);
- menu.add(zoomOutRetargetAction);
- menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- menu.add(captureScreenAction);
-
- 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 };
- zoomComboContributionItem = new ZoomComboContributionItem(getPage(), zoomStrings);
- manager.add(zoomComboContributionItem);
- manager.add(captureScreenAction);
- }
-
-
- public void init(IActionBars bars, IWorkbenchPage page)
- {
- Iterator e = fPartListeners.iterator();
- while (e.hasNext())
- {
- page.addPartListener((RetargetAction) e.next());
- }
-
- initSourceViewerActionContributor(bars);
-
- super.init(bars, page);
- }
-
-
- protected void initSourceViewerActionContributor(IActionBars actionBars) {
- if (sourceViewerActionContributor != null)
- sourceViewerActionContributor.init(actionBars, getPage());
- }
-
- public void dispose()
- {
- fPartListeners = null;
- if (sourceViewerActionContributor != null)
- sourceViewerActionContributor.dispose();
- super.dispose();
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDSelectionMapper.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDSelectionMapper.java
deleted file mode 100644
index e5275999e0..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDSelectionMapper.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * 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.internal.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.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-
-public class XSDSelectionMapper implements ISelectionMapper
-{
- public ISelection mapSelection(ISelection selection)
- {
- List list = new ArrayList();
- if (selection instanceof IStructuredSelection)
- {
- IStructuredSelection structuredSelection = (IStructuredSelection)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/ui/internal/editor/XSDSubstitutionGroupEditManager.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDSubstitutionGroupEditManager.java
deleted file mode 100644
index 8bf2506b45..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDSubstitutionGroupEditManager.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.editor;
-
-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.xsd.ui.internal.common.commands.AddXSDElementCommand;
-import org.eclipse.wst.xsd.ui.internal.common.commands.UpdateAttributeValueCommand;
-import org.eclipse.wst.xsd.ui.internal.common.util.XSDDirectivesManager;
-import org.eclipse.wst.xsd.ui.internal.search.IXSDSearchConstants;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDElementDeclaration;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.util.XSDConstants;
-
-public class XSDSubstitutionGroupEditManager extends XSDElementReferenceEditManager
-{
-
- public XSDSubstitutionGroupEditManager(IFile currentFile, XSDSchema[] schemas)
- {
- super(currentFile, schemas);
- }
-
- public void modifyComponentReference(Object referencingObject, ComponentSpecification component)
- {
- XSDElementDeclaration concreteComponent = null;
- if (referencingObject instanceof Adapter)
- {
- Adapter adapter = (Adapter)referencingObject;
- if (adapter.getTarget() instanceof XSDElementDeclaration)
- {
- concreteComponent = (XSDElementDeclaration)adapter.getTarget();
- }
- }
- else if (referencingObject instanceof XSDConcreteComponent)
- {
- concreteComponent = (XSDElementDeclaration) referencingObject;
- }
- if (concreteComponent != null)
- {
- if (component.isNew())
- {
- XSDElementDeclaration elementDec = null;
- if (component.getMetaName() == IXSDSearchConstants.ELEMENT_META_NAME)
- {
- AddXSDElementCommand command = new AddXSDElementCommand(Messages._UI_ACTION_ADD_ELEMENT, concreteComponent.getSchema());
- command.setNameToAdd(component.getName());
- command.execute();
- elementDec = (XSDElementDeclaration) command.getAddedComponent();
- }
- if (elementDec != null)
- {
- Command command = new UpdateAttributeValueCommand(concreteComponent.getElement(), XSDConstants.SUBSTITUTIONGROUP_ATTRIBUTE, elementDec.getQName(concreteComponent.getSchema()), org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_LABEL_SUBSTITUTION_GROUP);
- command.execute();
- }
- }
- else
- {
- Command command = new UpdateAttributeValueCommand(concreteComponent.getElement(), XSDConstants.SUBSTITUTIONGROUP_ATTRIBUTE, ((XSDElementDeclaration)component.getObject()).getQName(concreteComponent.getSchema()), org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_LABEL_SUBSTITUTION_GROUP);
- command.execute();
- }
- XSDDirectivesManager.removeUnusedXSDImports(concreteComponent.getSchema());
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDTabbedPropertySheetPage.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDTabbedPropertySheetPage.java
deleted file mode 100644
index 9ba373fc7b..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDTabbedPropertySheetPage.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2011 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Eugene Ostroukhov, eugene@genuitec.com - [203291] XSD Editor Source State
- * not updated in Outline/Graph
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.editor;
-
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-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.sse.core.internal.provisional.INodeAdapter;
-import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDAdapterFactory;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDAttributeUseAdapter;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDElementDeclarationAdapter;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDParticleAdapter;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObjectListener;
-import org.eclipse.wst.xsd.ui.internal.text.XSDModelAdapter;
-import org.eclipse.xsd.XSDAttributeUse;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDElementDeclaration;
-import org.w3c.dom.Element;
-
-public class XSDTabbedPropertySheetPage extends TabbedPropertySheetPage implements IADTObjectListener
-{
- XSDBaseAdapter oldSelection;
- XSDModelAdapter xsdModelAdapter;
- 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 = ((IStructuredSelection)selection).getFirstElement();
- if (selected instanceof XSDBaseAdapter)
- {
- XSDBaseAdapter adapter = (XSDBaseAdapter)selected;
- if (oldSelection != null)
- {
- oldSelection.unregisterListener(this);
- if (oldSelection instanceof XSDElementDeclarationAdapter)
- {
- XSDElementDeclaration elem = (XSDElementDeclaration)((XSDElementDeclarationAdapter)oldSelection).getTarget();
- if (elem.getContainer() != null)
- {
- Adapter adap = XSDAdapterFactory.getInstance().adapt(elem.getContainer());
- if (adap instanceof XSDParticleAdapter)
- {
- XSDParticleAdapter particleAdapter = (XSDParticleAdapter)adap;
- particleAdapter.unregisterListener(this);
- }
- }
- if (elem.isElementDeclarationReference())
- {
- XSDElementDeclarationAdapter resolvedElementAdapter = (XSDElementDeclarationAdapter)XSDAdapterFactory.getInstance().adapt(elem.getResolvedElementDeclaration());
- resolvedElementAdapter.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);
- }
- }
- else if (adapter instanceof XSDAttributeUseAdapter)
- {
- XSDAttributeUseAdapter attributeUse = (XSDAttributeUseAdapter) adapter;
- XSDAttributeUse xsdAttrUse = (XSDAttributeUse) attributeUse.getTarget();
- adapter = (XSDBaseAdapter) XSDAdapterFactory.getInstance().adapt(xsdAttrUse.getAttributeDeclaration());
- }
- adapter.registerListener(this);
- oldSelection = adapter;
- Object model = adapter.getTarget();
-
- if (xsdModelAdapter != null && xsdModelAdapter.getModelReconcileAdapter() != null)
- {
- xsdModelAdapter.getModelReconcileAdapter().removeListener(internalNodeAdapter);
- }
-
- Element element = ((XSDConcreteComponent)adapter.getTarget()).getElement();
- if (element != null) {
- xsdModelAdapter = XSDModelAdapter.lookupOrCreateModelAdapter(element.getOwnerDocument());
- }
- if (xsdModelAdapter != null && xsdModelAdapter.getModelReconcileAdapter() != null)
- {
- xsdModelAdapter.getModelReconcileAdapter().addListener(internalNodeAdapter);
- }
-
- if (model instanceof XSDConcreteComponent)
- {
- selection = new StructuredSelection(model);
- }
- super.selectionChanged(part, selection);
- return;
- }
- super.selectionChanged(part, selection);
- }
-
- public void propertyChanged(Object object, String property)
- {
- if (getCurrentTab() != null)
- {
- refresh();
- }
- }
-
- public void dispose()
- {
- if (xsdModelAdapter != null && xsdModelAdapter.getModelReconcileAdapter() != null)
- {
- xsdModelAdapter.getModelReconcileAdapter().removeListener(internalNodeAdapter);
- xsdModelAdapter = null;
- }
- super.dispose();
- }
-
- protected INodeAdapter internalNodeAdapter = new InternalNodeAdapter();
- class InternalNodeAdapter implements INodeAdapter
- {
- public boolean isAdapterForType(Object type)
- {
- return false;
- }
-
- public void notifyChanged(INodeNotifier notifier, int eventType, Object changedFeature, Object oldValue, Object newValue, int pos)
- {
- refresh();
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDTypeReferenceEditManager.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDTypeReferenceEditManager.java
deleted file mode 100644
index 9e1e13be17..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDTypeReferenceEditManager.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.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.osgi.util.NLS;
-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.ui.internal.adt.edit.ComponentReferenceEditManager;
-import org.eclipse.wst.xsd.ui.internal.adt.edit.ComponentReferenceEditManager2;
-import org.eclipse.wst.xsd.ui.internal.adt.edit.IComponentDialog;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IField;
-import org.eclipse.wst.xsd.ui.internal.common.commands.AddXSDComplexTypeDefinitionCommand;
-import org.eclipse.wst.xsd.ui.internal.common.commands.AddXSDSimpleTypeDefinitionCommand;
-import org.eclipse.wst.xsd.ui.internal.common.commands.UpdateTypeReferenceAndManageDirectivesCommand;
-import org.eclipse.wst.xsd.ui.internal.common.commands.UpdateTypeReferenceCommand;
-import org.eclipse.wst.xsd.ui.internal.common.util.XSDDirectivesManager;
-import org.eclipse.wst.xsd.ui.internal.dialogs.NewTypeDialog;
-import org.eclipse.wst.xsd.ui.internal.editor.search.XSDSearchListDialogDelegate;
-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.XSDFactory;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.XSDSimpleTypeDefinition;
-import org.eclipse.xsd.XSDTypeDefinition;
-import org.eclipse.xsd.util.XSDConstants;
-import org.eclipse.xsd.util.XSDSchemaBuildingTools;
-
-public class XSDTypeReferenceEditManager implements ComponentReferenceEditManager, ComponentReferenceEditManager2
-{
- protected IFile currentFile;
- protected XSDSchema[] schemas;
- private static ComponentSpecification result[];
- private IADTObject referencer;
-
- public XSDTypeReferenceEditManager(IFile currentFile, XSDSchema[] schemas)
- {
- this.currentFile = currentFile;
- this.schemas = schemas;
- }
-
- public void addToHistory(ComponentSpecification component)
- {
- // TODO (cs) implement me!
- }
-
- public IADTObject getReferencer()
- {
- return referencer;
- }
-
- public void setReferencer(IADTObject referencer)
- {
- this.referencer = referencer;
- }
-
- 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()
- {
- NewTypeDialog result = null;
- if (schemas.length > 0)
- {
- result = new NewTypeDialog(schemas[0]);
- }
- else
- {
- result = new NewTypeDialog();
- }
- if (referencer instanceof IField)
- {
- IField field = (IField)referencer;
- if (XSDConstants.ATTRIBUTE_ELEMENT_TAG.equals(field.getKind()))
- {
- result.allowComplexType(false);
- }
- String fieldName = field.getName();
- if (fieldName != null)
- {
- fieldName = fieldName.trim();
- if (fieldName.length() > 0)
- {
- result.setDefaultName(NLS.bind(Messages._UI_VALUE_NEW_TYPE, fieldName));
- }
- }
- }
- return result;
- }
-
- public ComponentSpecification[] getQuickPicks()
- {
- if (result != null)
- return result;
-
- // 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)); //$NON-NLS-1$
- list.add(new ComponentSpecification(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, "date", null)); //$NON-NLS-1$
- list.add(new ComponentSpecification(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, "dateTime", null)); //$NON-NLS-1$
- list.add(new ComponentSpecification(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, "double", null)); //$NON-NLS-1$
- list.add(new ComponentSpecification(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, "float", null)); //$NON-NLS-1$
- list.add(new ComponentSpecification(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, "hexBinary", null)); //$NON-NLS-1$
- list.add(new ComponentSpecification(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, "int", null)); //$NON-NLS-1$
- list.add(new ComponentSpecification(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, "string", null)); //$NON-NLS-1$
- list.add(new ComponentSpecification(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, "time", null)); //$NON-NLS-1$
- 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.getName() == null // This means we set to anonymous type
- && concreteComponent instanceof XSDElementDeclaration)
- {
- XSDFactory factory = XSDSchemaBuildingTools.getXSDFactory();
- XSDElementDeclaration elementDeclaration = (XSDElementDeclaration) concreteComponent;
- // TODO (cs) we should use actions here so that UNDO/REDO can work nicely
- // with the proper undo descriptions
- if (component.getMetaName() == IXSDSearchConstants.COMPLEX_TYPE_META_NAME)
- {
- XSDComplexTypeDefinition complexType = factory.createXSDComplexTypeDefinition();
- elementDeclaration.setAnonymousTypeDefinition(complexType);
- }
- else
- {
- XSDSimpleTypeDefinition simpleType = factory.createXSDSimpleTypeDefinition();
- simpleType.setBaseTypeDefinition(
- elementDeclaration.getSchema().getSchemaForSchema().resolveSimpleTypeDefinition(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, "string") ); //$NON-NLS-1$
- elementDeclaration.setAnonymousTypeDefinition(simpleType);
- }
- elementDeclaration.getElement().removeAttribute("type"); //TODO use external literal string
- }
- else if (component.getMetaName() == IXSDSearchConstants.COMPLEX_TYPE_META_NAME)
- {
- AddXSDComplexTypeDefinitionCommand command = new AddXSDComplexTypeDefinitionCommand(Messages._UI_ACTION_ADD_COMPLEX_TYPE, concreteComponent.getSchema());
- command.setNameToAdd(component.getName());
- command.execute();
- td = command.getCreatedComplexType();
- }
- else
- {
- AddXSDSimpleTypeDefinitionCommand command = new AddXSDSimpleTypeDefinitionCommand(Messages._UI_ACTION_ADD_SIMPLE_TYPE, concreteComponent.getSchema());
- command.setNameToAdd(component.getName());
- command.execute();
- td = command.getCreatedSimpleType();
- }
- if (td != null)
- {
- Command command = new UpdateTypeReferenceCommand(concreteComponent, td);
- command.setLabel(Messages._UI_ACTION_SET_TYPE);
- command.execute();
- }
- XSDDirectivesManager.removeUnusedXSDImports(concreteComponent.getSchema());
- }
- else
- {
- Command command = new UpdateTypeReferenceAndManageDirectivesCommand(concreteComponent, component.getName(), component.getQualifier(), component.getFile());
- command.setLabel(Messages._UI_ACTION_SET_TYPE);
- command.execute();
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/Dot.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/Dot.gif
deleted file mode 100644
index 210bb24ce0..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/Dot.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/GenerateDtd.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/GenerateDtd.gif
deleted file mode 100644
index ac58c1e8ab..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/GenerateDtd.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/GenerateJava.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/GenerateJava.gif
deleted file mode 100644
index 2375c655d8..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/GenerateJava.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/GraphViewElementRef.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/GraphViewElementRef.gif
deleted file mode 100644
index d535dac36d..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/GraphViewElementRef.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/NewXSD.png b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/NewXSD.png
deleted file mode 100644
index 0c4caf1cc2..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/NewXSD.png
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/RegexWizardArrow.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/RegexWizardArrow.gif
deleted file mode 100644
index 3d550a30e8..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/RegexWizardArrow.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/TriangleToolBar.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/TriangleToolBar.gif
deleted file mode 100644
index bd37eb50b5..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/TriangleToolBar.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/ValidateXSD.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/ValidateXSD.gif
deleted file mode 100644
index 2b347ac458..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/ValidateXSD.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDAll.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDAll.gif
deleted file mode 100644
index 6d74e802b5..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDAll.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDAnnotate.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDAnnotate.gif
deleted file mode 100644
index d2108c0368..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDAnnotate.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDAny.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDAny.gif
deleted file mode 100644
index a39f93cdce..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDAny.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDAnyAttribute.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDAnyAttribute.gif
deleted file mode 100644
index 5280cc2904..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDAnyAttribute.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDAppInfo.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDAppInfo.gif
deleted file mode 100644
index 2da001e3e9..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDAppInfo.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDAttribute.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDAttribute.gif
deleted file mode 100644
index 79d49d037b..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDAttribute.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDAttributeGroup.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDAttributeGroup.gif
deleted file mode 100644
index 648462ff67..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDAttributeGroup.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDAttributeGroupRef.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDAttributeGroupRef.gif
deleted file mode 100644
index a89fa8f187..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDAttributeGroupRef.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDAttributeRef.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDAttributeRef.gif
deleted file mode 100644
index 8365af2f3c..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDAttributeRef.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDChoice.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDChoice.gif
deleted file mode 100644
index 89ba825253..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDChoice.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDComplexContent.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDComplexContent.gif
deleted file mode 100644
index 41c68dda8c..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDComplexContent.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDComplexType.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDComplexType.gif
deleted file mode 100644
index 007f8522af..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDComplexType.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDDateAndTimeTypes.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDDateAndTimeTypes.gif
deleted file mode 100644
index 4fc84e4c3a..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDDateAndTimeTypes.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDDoc.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDDoc.gif
deleted file mode 100644
index d349a05f2b..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDDoc.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDElement.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDElement.gif
deleted file mode 100644
index dd45f08fb1..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDElement.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDElementRef.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDElementRef.gif
deleted file mode 100644
index 749acfc9c9..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDElementRef.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDExtension.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDExtension.gif
deleted file mode 100644
index 0cfb8076dd..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDExtension.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDField.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDField.gif
deleted file mode 100644
index 378e43e14d..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDField.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDFile.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDFile.gif
deleted file mode 100644
index 3900f1b55d..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDFile.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDGlobalAttribute.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDGlobalAttribute.gif
deleted file mode 100644
index 79d49d037b..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDGlobalAttribute.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDGlobalElement.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDGlobalElement.gif
deleted file mode 100644
index dd45f08fb1..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDGlobalElement.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDGroup.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDGroup.gif
deleted file mode 100644
index 555ef53306..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDGroup.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDGroupRef.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDGroupRef.gif
deleted file mode 100644
index 34a7fb3f23..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDGroupRef.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDImport.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDImport.gif
deleted file mode 100644
index 9e44ce52a9..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDImport.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDInclude.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDInclude.gif
deleted file mode 100644
index b26c527f5e..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDInclude.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDKey.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDKey.gif
deleted file mode 100644
index 04032a915a..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDKey.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDKeyRef.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDKeyRef.gif
deleted file mode 100644
index ee5829d693..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDKeyRef.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDNotation.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDNotation.gif
deleted file mode 100644
index ce9df985b8..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDNotation.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDNumberTypes.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDNumberTypes.gif
deleted file mode 100644
index 7134210d0a..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDNumberTypes.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDRedefine.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDRedefine.gif
deleted file mode 100644
index 56964c13a5..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDRedefine.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDSelector.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDSelector.gif
deleted file mode 100644
index 2399a58204..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDSelector.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDSequence.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDSequence.gif
deleted file mode 100644
index 8bf3f972d2..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDSequence.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDSimpleContent.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDSimpleContent.gif
deleted file mode 100644
index 7ef38df720..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDSimpleContent.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDSimpleEnum.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDSimpleEnum.gif
deleted file mode 100644
index 11d7958525..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDSimpleEnum.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDSimpleList.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDSimpleList.gif
deleted file mode 100644
index d08e78f891..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDSimpleList.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDSimplePattern.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDSimplePattern.gif
deleted file mode 100644
index a113cf45a0..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDSimplePattern.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDSimpleRestrict.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDSimpleRestrict.gif
deleted file mode 100644
index 38bc12e32f..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDSimpleRestrict.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDSimpleType.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDSimpleType.gif
deleted file mode 100644
index 75f33c24fa..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDSimpleType.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDSimpleTypeForEditPart.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDSimpleTypeForEditPart.gif
deleted file mode 100644
index 9aefeb27b6..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDSimpleTypeForEditPart.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDSimpleUnion.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDSimpleUnion.gif
deleted file mode 100644
index 292adafc8e..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDSimpleUnion.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDUnique.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDUnique.gif
deleted file mode 100644
index 5a8a650f3d..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/XSDUnique.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/appinfo_browse.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/appinfo_browse.gif
deleted file mode 100644
index 85f9baaf44..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/appinfo_browse.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/appinfo_category.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/appinfo_category.gif
deleted file mode 100644
index 9e665d5c78..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/appinfo_category.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/back.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/back.gif
deleted file mode 100644
index 24d1a279e5..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/back.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/browsebutton.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/browsebutton.gif
deleted file mode 100644
index 13dae59bea..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/browsebutton.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/error_st_obj.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/error_st_obj.gif
deleted file mode 100644
index 0bc60689c6..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/error_st_obj.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/forward.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/forward.gif
deleted file mode 100644
index eab699e385..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/forward.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/generate_xml.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/generate_xml.gif
deleted file mode 100644
index f2e363564f..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/generate_xml.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/quickassist.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/quickassist.gif
deleted file mode 100644
index 94ae2a0ee2..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/quickassist.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/regx_wiz.png b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/regx_wiz.png
deleted file mode 100644
index 2b1477a3f6..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/regx_wiz.png
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/reloadgrammar.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/reloadgrammar.gif
deleted file mode 100644
index c705db0c1e..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/reloadgrammar.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/sort.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/sort.gif
deleted file mode 100644
index 3c65dc4ba1..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/sort.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/xmlcatalog_obj.gif b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/xmlcatalog_obj.gif
deleted file mode 100644
index a61441f2a8..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/icons/xmlcatalog_obj.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/messages.properties b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/messages.properties
deleted file mode 100644
index bb90770654..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/messages.properties
+++ /dev/null
@@ -1,153 +0,0 @@
-###############################################################################
-# Copyright (c) 2001, 2010 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.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_NAME = &Name:
-
-UI_LABEL_KIND = Kind:
-
-UI_LABEL_MINOCCURS = &Minimum Occurrence:
-UI_LABEL_MAXOCCURS = Ma&ximum Occurrence:
-
-UI_PAGE_HEADING_REFERENCE = Reference
-UI_LABEL_READ_ONLY = read-only
-
-UI_NO_TYPE = No Type
-
-UI_LABEL_COMPONENTS = Components:
-
-! 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
-_UI_GRAPH_GROUPS = Groups
-_UI_GRAPH_REDEFINE_SCHEMA = Redefine Schema
-_UI_GRAPH_REDEFINE_TYPES = Types
-_UI_GRAPH_REDEFINE_ATTRIBUTE_GROUPS = Attribute Groups
-_UI_GRAPH_REDEFINE_GROUPS = Groups
-
-_UI_LABEL_NO_LOCATION_SPECIFIED = No Location Specified
-_UI_ACTION_SET_MULTIPLICITY = Set &Multiplicity
-_UI_LABEL_ABSENT = absent
-_UI_GRAPH_UNKNOWN_OBJECT = Unknown object
-_UI_GRAPH_XSDSCHEMA_NO_NAMESPACE = (no target namespace specified)
-_UI_GRAPH_XSDSCHEMA = Schema
-_UI_MENU_XSD_EDITOR = &XSD
-_UI_LABEL_SET_TYPE = Set Type
-
-!
-! Preference Page
-!
-_UI_TEXT_INDENT_LABEL = Indentation
-_UI_TEXT_INDENT_SPACES_LABEL = &Number of spaces:
-_UI_TEXT_XSD_NAMESPACE_PREFIX = Creating files
-_UI_XML_TEXT_EDITOR_PREFS_LINK = XML Schema editing preferences. Note that some preferences may be set on the XML <a>{0}</a> preference page.
-_UI_XML_VALIDATOR_PREFS_LINK = Note that some preferences may be set on the XML <a>{0}</a> preference page.
-_UI_TEXT_XSD_DEFAULT_PREFIX = XML schema language constructs &prefix:
-_UI_QUALIFY_XSD = &Qualify XML schema language constructs
-_UI_TEXT_XSD_DEFAULT_TARGET_NAMESPACE = Default &target namespace:
-_UI_VALIDATING_FILES = Validating files
-_UI_TEXT_HONOUR_ALL_SCHEMA_LOCATIONS = Honour all schema locations
-_UI_FULL_CONFORMANCE = &Check full XML Schema conformance
-_UI_TEXT_ENABLE_AUTO_IMPORT_CLEANUP = &Automatically remove unused XSD imports and XML Namespace entries
-_UI_TEXT_ENABLE_AUTO_OPEN_SCHEMA_DIALOG = &Prompt for schema location when adding a directive
-
-_ERROR_LABEL_INVALID_PREFIX = IWAX1004E Invalid prefix. A prefix must not be empty or contain any space.
-
-_UI_NO_TYPE_DEFINED=(no type defined)
-_UI_ACTION_UPDATE_NAME=Update Name
-_UI_ACTION_UPDATE_ELEMENT_REFERENCE=Update Element reference
-_UI_ACTION_UPDATE_ATTRIBUTE_REFERENCE=Update Attribute reference
-_UI_ACTION_ADD_FIELD=Add Field
-_UI_ACTION_ADD_ELEMENT=Add &Element
-_UI_ACTION_INSERT_ELEMENT=I&nsert Element
-_UI_ACTION_BEFORE=&Before
-_UI_ACTION_AFTER=&After
-_UI_ACTION_ADD_INCLUDE=Add In&clude
-_UI_ACTION_ADD_IMPORT=Add I&mport
-_UI_ACTION_ADD_REDEFINE=Add &Redefine
-_UI_ACTION_ADD_ELEMENT_REF=Add E&lement Ref
-_UI_ACTION_ADD_COMPLEX_TYPE=Add &Complex Type
-_UI_ACTION_ADD_SIMPLE_TYPE=Add &Simple Type
-_UI_ACTION_SET_TYPE=Set &Type
-_UI_ACTION_ADD_ATTRIBUTE=Add &Attribute
-_UI_ACTION_INSERT_ATTRIBUTE=I&nsert Attribute
-_UI_ACTION_ADD_ATTRIBUTE_REF=Add Attribute &Ref
-_UI_ACTION_NEW=&New...
-_UI_ACTION_BROWSE=&Browse...
-_UI_ACTION_DRAG_DROP_ELEMENT=Reorder Elements
-_UI_ACTION_DRAG_DROP_ATTRIBUTE=Reorder Attributes
-_UI_ACTION_REDEFINE_COMPLEX_TYPE=Redefine &Complex Type
-_UI_ACTION_REDEFINE_SIMPLE_TYPE=Redefine &Simple Type
-_UI_ACTION_REDEFINE_ATTRIBUTE_GROUP=Redefine &Attribute Group
-_UI_ACTION_REDEFINE_MODEL_GROUP=Redefine &Model Group
-_UI_ACTION_RENAME=Rename
-
-_UI_LABEL_OPTIONAL=Optional
-_UI_LABEL_ZERO_OR_MORE=Zero or more
-_UI_LABEL_ONE_OR_MORE=One or more
-_UI_LABEL_LOCAL_TYPE=local type
-_UI_LABEL_REQUIRED=Required
-_UI_LABEL_ARRAY=array
-
-_UI_LABEL_SET_COMMON_BUILT_IN_TYPES=Set common Built-In types
-_UI_LABEL_SELECT_TYPES_FILTER_OUT=Select the types that you do not want to filter out:
-_UI_LABEL_NAME_SEARCH_FILTER_TEXT=Name (? = any character, * = any string):
-_UI_LABEL_SET_ELEMENT_REFERENCE=Set element reference
-_UI_LABEL_SET_ATTRIBUTE_REFERENCE=Set attribute reference
-_UI_LABEL_REDEFINE_COMPONENT=Redefine component
-
-_UI_LABEL_NEW_TYPE=New Type
-_UI_VALUE_NEW_TYPE={0}Type
-_UI_LABEL_NEW_ELEMENT=New Element
-_UI_LABEL_NEW_ATTRIBUTE=New Attribute
-_UI_LABEL_COMPLEX_TYPE=&Complex Type
-_UI_LABEL_TARGET_NAMESPACE=Target Namespace:
-_UI_LABEL_NO_NAMESPACE=No Namespace
-_UI_LABEL_ELEMENTS_COLON=Elements:
-_UI_LABEL_ATTRIBUTES_COLON=Attributes:
-_UI_LABEL_SIMPLE_TYPE=&Simple Type
-_UI_LABEL_TYPES_COLON=Types:
-
-_UI_LABEL_SOURCE=Source
-
-_UI_LABEL_ELEMENTFORMDEFAULT=Prefix qualification of local elements:
-_UI_LABEL_ATTRIBUTEFORMDEFAULT=Prefix qualification of attributes:
-_UI_LABEL_CREATE_ANON_TYPE=Create as local &anonymous type
-
-_UI_LABEL_ATTRIBUTES_PROCESSCONTENTS=Process Contents:
-_UI_LABEL_ATTRIBUTES_NAMESPACE=Namespace:
-
-_UI_IMAGE_COMPLEX_TYPE=icons/XSDComplexType.gif
-_UI_IMAGE_SIMPLE_TYPE=icons/XSDSimpleType.gif
-_UI_IMAGE_MODEL_GROUP=icons/XSDGroup.gif
-_UI_IMAGE_ATTRIBUTE_GROUP=icons/XSDAttributeGroup.gif
-
-_UI_COMBO_NEW=New...
-_UI_COMBO_BROWSE=Browse...
-
-_UI_ERROR_INVALID_NAME=Invalid name \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/search/IXSDTypesFilter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/search/IXSDTypesFilter.java
deleted file mode 100644
index 4e3c62acfb..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/search/IXSDTypesFilter.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * 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.internal.editor.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/ui/internal/editor/search/XSDAttributeSearchListProvider.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/search/XSDAttributeSearchListProvider.java
deleted file mode 100644
index e74fa122f0..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/search/XSDAttributeSearchListProvider.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.editor.search;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.wst.common.core.search.SearchEngine;
-import org.eclipse.wst.common.core.search.scope.SearchScope;
-import org.eclipse.wst.common.ui.internal.search.dialogs.IComponentList;
-import org.eclipse.wst.xsd.ui.internal.search.IXSDSearchConstants;
-import org.eclipse.xsd.XSDSchema;
-
-public class XSDAttributeSearchListProvider extends XSDSearchListProvider
-{
-
- public XSDAttributeSearchListProvider(IFile currentFile, XSDSchema[] schemas)
- {
- super(currentFile, schemas);
- }
-
- public void populateComponentList(IComponentList list, SearchScope scope, IProgressMonitor pm)
- {
- // 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
- //
- List visitedSchemas = new ArrayList();
- for (int i = 0; i < schemas.length; i++)
- {
- XSDSchema schema = schemas[i];
- ComponentCollectingXSDVisitor visitor = new ComponentCollectingXSDVisitor(list, IXSDSearchConstants.ATTRIBUTE_META_NAME);
- visitor.visitSchema(schema, true);
- visitedSchemas.addAll(visitor.getVisitedSchemas());
- }
- // finally we call the search API's to do a potentially slow search
- if (scope != null)
- {
- populateComponentListUsingSearch(list, scope, pm, createFileMap(visitedSchemas));
- }
- }
-
- private void populateComponentListUsingSearch(IComponentList list, SearchScope scope, IProgressMonitor pm, HashMap files)
- {
- SearchEngine searchEngine = new SearchEngine();
- InternalSearchRequestor requestor = new InternalSearchRequestor(list, files);
- findMatches(searchEngine, requestor, scope, IXSDSearchConstants.ATTRIBUTE_META_NAME);
- }
-
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/search/XSDComponentDescriptionProvider.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/search/XSDComponentDescriptionProvider.java
deleted file mode 100644
index 1ecd32718f..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/search/XSDComponentDescriptionProvider.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.editor.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.ui.internal.editor.XSDEditorPlugin;
-import org.eclipse.wst.xsd.ui.internal.search.IXSDSearchConstants;
-import org.eclipse.xsd.XSDAttributeDeclaration;
-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 static final Image ATTRIBUTE_IMAGE = XSDEditorPlugin.getXSDImage("icons/XSDAttribute.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 ( qualifiedName.equals(IXSDSearchConstants.ATTRIBUTE_META_NAME))
- result = ATTRIBUTE_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;
- else if (component instanceof XSDAttributeDeclaration)
- result = ATTRIBUTE_IMAGE;
- return result;
- }
-
- public Image getFileIcon(Object component) {
- return XSDEditorPlugin.getXSDImage("icons/XSDFile.gif");
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/search/XSDElementsSearchListProvider.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/search/XSDElementsSearchListProvider.java
deleted file mode 100644
index a94042b5bc..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/search/XSDElementsSearchListProvider.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * 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.internal.editor.search;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.wst.common.core.search.SearchEngine;
-import org.eclipse.wst.common.core.search.scope.SearchScope;
-import org.eclipse.wst.common.ui.internal.search.dialogs.IComponentList;
-import org.eclipse.wst.xsd.ui.internal.search.IXSDSearchConstants;
-import org.eclipse.xsd.XSDSchema;
-
-public class XSDElementsSearchListProvider extends XSDSearchListProvider
-{
- public XSDElementsSearchListProvider(IFile currentFile, XSDSchema[] schemas)
- {
- super(currentFile, schemas);
- }
-
- public void populateComponentList(IComponentList list, SearchScope scope, IProgressMonitor pm)
- {
- // 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
- //
- List visitedSchemas = new ArrayList();
- for (int i = 0; i < schemas.length; i++)
- {
- XSDSchema schema = schemas[i];
- ComponentCollectingXSDVisitor visitor = new ComponentCollectingXSDVisitor(list, IXSDSearchConstants.ELEMENT_META_NAME);
- visitor.visitSchema(schema, true);
- visitedSchemas.addAll(visitor.getVisitedSchemas());
- }
- // finally we call the search API's to do a potentially slow search
- if (scope != null)
- {
- populateComponentListUsingSearch(list, scope, pm, createFileMap(visitedSchemas));
- }
- }
-
- private void populateComponentListUsingSearch(IComponentList list, SearchScope scope, IProgressMonitor pm, HashMap files)
- {
- SearchEngine searchEngine = new SearchEngine();
- InternalSearchRequestor requestor = new InternalSearchRequestor(list, files);
- findMatches(searchEngine, requestor, scope, IXSDSearchConstants.ELEMENT_META_NAME);
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/search/XSDSearchListDialogDelegate.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/search/XSDSearchListDialogDelegate.java
deleted file mode 100644
index 7f62dabee1..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/search/XSDSearchListDialogDelegate.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.editor.search;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.wst.common.core.search.pattern.QualifiedName;
-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.ui.internal.adt.edit.IComponentDialog;
-import org.eclipse.wst.xsd.ui.internal.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-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"); //$NON-NLS-1$
- public final static QualifiedName ELEMENT_META_NAME = new QualifiedName(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, "element"); //$NON-NLS-1$
- public final static QualifiedName ATTRIBUTE_META_NAME = new QualifiedName(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, "attribute"); //$NON-NLS-1$
- // protected Object setObject;
- protected ComponentSpecification selection;
- protected IFile currentFile;
- protected XSDSchema[] schemas;
- protected QualifiedName metaName;
- protected boolean showComplexTypes = true;
-
- 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
- }
-
- /**
- * Whether to show complex types in the Dialog's List, has no effect if the
- * dialog populates list of elements instead of type
- * @param value
- */
- public void showComplexTypes(boolean value)
- {
- showComplexTypes = value;
- }
-
- public int createAndOpen()
- {
- Shell shell = XSDEditorPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell();
- int returnValue = Window.CANCEL;
- ScopedComponentSearchListDialog dialog = null;
-
- // TODO (cs) lot's of code is common to both these blocks. Can we re-org it a bit
- // so it's easier to see the difference between how we config for an element vs type?
- 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(Messages._UI_LABEL_NAME_SEARCH_FILTER_TEXT);
- configuration.setListLabelText(Messages._UI_LABEL_ELEMENTS_COLON);
-// configuration.setNewComponentHandler(new NewElementButtonHandler());
- //TODO externalize string
- dialog = new ScopedComponentSearchListDialog(shell, Messages._UI_LABEL_SET_ELEMENT_REFERENCE, configuration);
- }
- else if ( metaName == ATTRIBUTE_META_NAME)
- {
- XSDComponentDescriptionProvider descriptionProvider = new XSDComponentDescriptionProvider();
- final XSDAttributeSearchListProvider searchListProvider = new XSDAttributeSearchListProvider(currentFile, schemas);
- ComponentSearchListDialogConfiguration configuration = new ComponentSearchListDialogConfiguration();
-
- configuration.setDescriptionProvider(descriptionProvider);
- configuration.setSearchListProvider(searchListProvider);
- configuration.setFilterLabelText(Messages._UI_LABEL_NAME_SEARCH_FILTER_TEXT);
- configuration.setListLabelText(Messages._UI_LABEL_ATTRIBUTES_COLON);
- dialog = new ScopedComponentSearchListDialog(shell, Messages._UI_LABEL_SET_ATTRIBUTE_REFERENCE, configuration);
- }
- else if (metaName == TYPE_META_NAME)
- {
- XSDComponentDescriptionProvider descriptionProvider = new XSDComponentDescriptionProvider();
- final XSDTypesSearchListProvider searchListProvider = new XSDTypesSearchListProvider(currentFile, schemas);
- if (!showComplexTypes)
- searchListProvider.showComplexTypes(false);
-
- ComponentSearchListDialogConfiguration configuration = new ComponentSearchListDialogConfiguration();
- configuration.setDescriptionProvider(descriptionProvider);
- configuration.setSearchListProvider(searchListProvider);
-// configuration.setNewComponentHandler(new NewTypeButtonHandler());
- configuration.setFilterLabelText(Messages._UI_LABEL_NAME_SEARCH_FILTER_TEXT);
- configuration.setListLabelText(Messages._UI_LABEL_TYPES_COLON);
- dialog = new ScopedComponentSearchListDialog(shell, Messages._UI_LABEL_SET_TYPE, configuration); //$NON-NLS-1$
- }
-
- if (dialog != null)
- {
- dialog.setCurrentResource(currentFile);
- 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/ui/internal/editor/search/XSDSearchListProvider.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/search/XSDSearchListProvider.java
deleted file mode 100644
index 6f53f9146a..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/search/XSDSearchListProvider.java
+++ /dev/null
@@ -1,285 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.editor.search;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.ui.progress.UIJob;
-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.editor.XSDEditorPlugin;
-import org.eclipse.wst.xsd.ui.internal.search.IXSDSearchConstants;
-import org.eclipse.xsd.XSDAttributeDeclaration;
-import org.eclipse.xsd.XSDElementDeclaration;
-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.XSDSimpleTypeDefinition;
-import org.eclipse.xsd.XSDTypeDefinition;
-
-
-public abstract class XSDSearchListProvider 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 XSDSearchListProvider(IFile currentFile, XSDSchema[] schemas)
- {
- this.schemas = schemas;
- this.currentFile = currentFile;
-
- try
- {
- IProject[] refs = currentFile.getProject().getReferencedProjects();
-
- for (int i=0; i < refs.length; i++)
- {
- System.out.println("dep " + refs[i].getName());
- }
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
-
- }
-
-
- class ComponentCollectingXSDVisitor
- {
- protected List visitedSchemas = new ArrayList();
- IComponentList list;
- QualifiedName searchKind;
-
- ComponentCollectingXSDVisitor(IComponentList list, QualifiedName searchKind)
- {
- this.list = list;
- this.searchKind = searchKind;
- }
-
- public void visitSchema(final XSDSchema schema, boolean visitImportedSchema)
- {
- visitedSchemas.add(schema);
- for (Iterator contents = schema.getContents().iterator(); contents.hasNext();)
- {
- XSDSchemaContent content = (XSDSchemaContent) contents.next();
- if (content instanceof XSDSchemaDirective)
- {
- final XSDSchemaDirective schemaDirective = (XSDSchemaDirective) content;
- XSDSchema extSchema = schemaDirective.getResolvedSchema();
- if (extSchema == null && schemaDirective instanceof XSDImport && visitImportedSchema)
- {
- // Force the import declaration to resolve. The work must be done in the UI thread
- // because there are UI components listening to changes in the schema content.
-
- UIJob loadImportJob = new UIJob(XSDEditorPlugin.getResourceString("_UI_LABEL_LOADING_XML_SCHEMA")) //$NON-NLS-1$
- {
- public IStatus runInUIThread(IProgressMonitor monitor)
- {
- // The schema model will load the import when trying to resolve any component
- // in the imported schema's namespace.
-
- XSDImport xsdImport = (XSDImport)schemaDirective;
- String importNamespace = xsdImport.getNamespace();
- schema.resolveAttributeDeclaration(importNamespace, ""); //$NON-NLS-1$
- return Status.OK_STATUS;
- }
- };
- loadImportJob.setSystem(true);
- loadImportJob.schedule();
- try
- {
- loadImportJob.join();
- }
- catch (InterruptedException e)
- {
- // Nothing to do about it.
- }
- 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 XSDElementDeclaration && searchKind == IXSDSearchConstants.ELEMENT_META_NAME)
- {
- list.add(content);
- }
- else if (content instanceof XSDAttributeDeclaration && searchKind == IXSDSearchConstants.ATTRIBUTE_META_NAME)
- {
- list.add(content);
- }
- else if (content instanceof XSDSimpleTypeDefinition && searchKind == IXSDSearchConstants.SIMPLE_TYPE_META_NAME)
- {
- // in this case we only want to show simple types
- list.add(content);
- }
- else if (content instanceof XSDTypeDefinition && searchKind == IXSDSearchConstants.TYPE_META_NAME)
- {
- // in this case we want to show all types
- list.add(content);
- }
- }
- }
-
- public List getVisitedSchemas()
- {
- return visitedSchemas;
- }
- }
-
-
- class InternalSearchRequestor extends SearchRequestor
- {
- IComponentList componentList;
- HashMap files;
-
- InternalSearchRequestor(IComponentList componentList, HashMap files)
- {
- this.componentList = componentList;
- this.files = files;
- }
-
- 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 (files.get(match.getFile()) == null)
- {
- // 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 findMatches(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();
- }
- }
-
-
- protected HashMap createFileMap(List visitedSchemas)
- {
- HashMap fileMap = new HashMap();
- for (Iterator i = visitedSchemas.iterator(); i.hasNext(); )
- {
- XSDSchema theSchema = (XSDSchema)i.next();
- String location = theSchema.getSchemaLocation();
- IFile file = computeFile(location);
- if (file != null)
- {
- fileMap.put(file, Boolean.TRUE);
- }
- }
- return fileMap;
- }
-
- private IFile computeFile(String baseLocation)
- {
- IFile file = null;
- if (baseLocation != null)
- {
- String fileScheme = "file:"; //$NON-NLS-1$
- String platformResourceScheme = "platform:/resource";
- if (baseLocation.startsWith(fileScheme))
- {
- baseLocation = baseLocation.substring(fileScheme.length());
- baseLocation = removeLeading(baseLocation, "/");
- IPath path = new Path(baseLocation);
- file = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(path);
- }
- else if (baseLocation.startsWith(platformResourceScheme))
- {
- baseLocation = baseLocation.substring(platformResourceScheme.length());
- baseLocation = removeLeading(baseLocation, "/");
- IPath path = new Path(baseLocation);
- file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
- }
- }
- return file;
- }
-
- private String removeLeading(String path, String pattern)
- {
- while (path.startsWith(pattern))
- {
- path = path.substring(pattern.length());
- }
- return path;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/search/XSDTypesSearchListProvider.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/search/XSDTypesSearchListProvider.java
deleted file mode 100644
index 9d80faeaab..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/search/XSDTypesSearchListProvider.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*******************************************************************************
- * 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.internal.editor.search;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.wst.common.core.search.SearchEngine;
-import org.eclipse.wst.common.core.search.pattern.QualifiedName;
-import org.eclipse.wst.common.core.search.scope.SearchScope;
-import org.eclipse.wst.common.ui.internal.search.dialogs.IComponentList;
-import org.eclipse.wst.xsd.ui.internal.search.IXSDSearchConstants;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.XSDTypeDefinition;
-import org.eclipse.xsd.impl.XSDSchemaImpl;
-import org.eclipse.xsd.util.XSDConstants;
-public class XSDTypesSearchListProvider extends XSDSearchListProvider
-{
- 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)
- {
- super(currentFile, schemas);
- }
-
- 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
- //
- List visitedSchemas = new ArrayList();
- for (int i = 0; i < schemas.length; i++)
- {
- XSDSchema schema = schemas[i];
- QualifiedName kind = showComplexTypes ? IXSDSearchConstants.TYPE_META_NAME : IXSDSearchConstants.SIMPLE_TYPE_META_NAME;
- ComponentCollectingXSDVisitor visitor = new ComponentCollectingXSDVisitor(list, kind);
- visitor.visitSchema(schema, true);
- visitedSchemas.addAll(visitor.getVisitedSchemas());
- }
- // finally we call the search API's to do a potentially slow search
- //
- if (scope != null)
- {
- populateComponentListUsingSearch(list, scope, pm, createFileMap(visitedSchemas));
- }
- }
-
- private void populateComponentListUsingSearch(IComponentList list, SearchScope scope, IProgressMonitor pm, HashMap files)
- {
- SearchEngine searchEngine = new SearchEngine();
- InternalSearchRequestor requestor = new InternalSearchRequestor(list, files);
- if (showComplexTypes)
- {
- findMatches(searchEngine, requestor, scope, IXSDSearchConstants.COMPLEX_TYPE_META_NAME);
- }
- findMatches(searchEngine, requestor, scope, IXSDSearchConstants.SIMPLE_TYPE_META_NAME);
- }
-
-
- 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/ui/internal/navigation/DesignViewNavigationLocation.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/navigation/DesignViewNavigationLocation.java
deleted file mode 100644
index 6f256a1437..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/navigation/DesignViewNavigationLocation.java
+++ /dev/null
@@ -1,468 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.navigation;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.GraphicalViewer;
-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.ui.internal.adapters.XSDAdapterFactory;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDVisitor;
-import org.eclipse.wst.xsd.ui.internal.adt.design.DesignViewGraphicalViewer;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-import org.eclipse.xsd.XSDAttributeGroupDefinition;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDElementDeclaration;
-import org.eclipse.xsd.XSDModelGroupDefinition;
-import org.eclipse.xsd.XSDRedefine;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.XSDTypeDefinition;
-import com.ibm.icu.util.StringTokenizer;
-
-/**
- * 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;
-
- private static final String PATH_TAG = "path"; //$NON-NLS-1$
-
- 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());
- }
- else
- {
- }
- return result;
- }
-
- public void restoreLocation()
- {
- XSDSchema schema = (XSDSchema) getEditorPart().getAdapter(XSDSchema.class);
- Object viewer = getEditorPart().getAdapter(GraphicalViewer.class);
- if (viewer instanceof DesignViewGraphicalViewer)
- {
- DesignViewGraphicalViewer graphicalViewer = (DesignViewGraphicalViewer) viewer;
- XSDConcreteComponent component = Path.computeComponent(schema, path);
- if (component != null)
- {
- Adapter adapter = XSDAdapterFactory.getInstance().adapt(component);
- if (adapter instanceof IADTObject)
- {
- graphicalViewer.setInput((IADTObject)adapter);
- }
- }
- else if (path.segments.isEmpty())
- {
- Adapter adapter = XSDAdapterFactory.getInstance().adapt(schema);
- if (adapter instanceof IADTObject)
- {
- graphicalViewer.setInput((IADTObject)adapter);
- }
- }
- }
- }
-
- public void restoreState(IMemento memento)
- {
- String string = memento.getString(PATH_TAG);
- path = Path.createPath(string);
- }
-
- public void saveState(IMemento memento)
- {
- memento.putString(PATH_TAG, 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;
- final static int MODEL_GROUP = 3;
- final static int ATTRIBUTE_GROUP = 4;
- final static int REDEFINE = 5;
- int kind;
- String name;
-
- PathSegment()
- {
- }
-
- PathSegment(int kind, String name)
- {
- this.kind = kind;
- this.name = name;
- }
- }
- protected static class Path
- {
- private static final String REDEFINE_TOKEN = "redefine"; //$NON-NLS-1$
- private static final String MODEL_GROUP_TOKEN = "modelGroup"; //$NON-NLS-1$
- private static final String ATTRIBUTE_GROUP_TOKEN = "attributeGroup"; //$NON-NLS-1$
- private static final String TYPE_TOKEN = "type"; //$NON-NLS-1$
- private static final String ELEMENT_TOKEN = "element"; //$NON-NLS-1$
-
- List segments = new ArrayList();
-
- public 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 pathString)
- {
- Path path = new Path();
- PathSegment segment = null;
- for (StringTokenizer st = new StringTokenizer(pathString, "/"); st.hasMoreTokens();)
- {
- String token = st.nextToken();
- int kind = -1;
- if (token.startsWith(ELEMENT_TOKEN))
- {
- kind = PathSegment.ELEMENT;
- }
- else if (token.startsWith(TYPE_TOKEN))
- {
- kind = PathSegment.TYPE;
- }
- else if (token.startsWith(ATTRIBUTE_GROUP_TOKEN))
- {
- kind = PathSegment.ATTRIBUTE_GROUP;
- }
- else if (token.startsWith(MODEL_GROUP_TOKEN))
- {
- kind = PathSegment.MODEL_GROUP;
- }
- else if (token.startsWith(REDEFINE_TOKEN))
- {
- kind = PathSegment.REDEFINE;
- }
- 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;
- }
-
- public 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 component)
- {
- PathSegment pathSegment = null;
- if (component instanceof XSDElementDeclaration)
- {
- XSDElementDeclaration elementDeclaration = (XSDElementDeclaration) component;
- pathSegment = new PathSegment(PathSegment.ELEMENT, elementDeclaration.getResolvedElementDeclaration().getName());
- }
- else if (component instanceof XSDTypeDefinition)
- {
- XSDTypeDefinition typeDefinition = (XSDTypeDefinition) component;
- pathSegment = new PathSegment(PathSegment.TYPE, typeDefinition.getName());
- }
- else if (component instanceof XSDModelGroupDefinition)
- {
- XSDModelGroupDefinition modelGroupDefinition = (XSDModelGroupDefinition) component;
- pathSegment = new PathSegment(PathSegment.MODEL_GROUP, modelGroupDefinition.getName());
- }
- else if (component instanceof XSDAttributeGroupDefinition)
- {
- XSDAttributeGroupDefinition attributeGroupDefinition = (XSDAttributeGroupDefinition) component;
- pathSegment = new PathSegment(PathSegment.ATTRIBUTE_GROUP, attributeGroupDefinition.getResolvedAttributeGroupDefinition().getName());
- }
- else if (component instanceof XSDRedefine)
- {
- XSDRedefine redefine = (XSDRedefine) component;
- pathSegment = new PathSegment(PathSegment.REDEFINE, redefine.getSchemaLocation());
- }
- return pathSegment;
- }
-
- 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_TOKEN;
- }
- else if (segment.kind == PathSegment.TYPE)
- {
- kind = TYPE_TOKEN;
- }
- else if (segment.kind == PathSegment.MODEL_GROUP)
- {
- kind = MODEL_GROUP_TOKEN;
- }
- else if (segment.kind == PathSegment.ATTRIBUTE_GROUP)
- {
- kind = ATTRIBUTE_GROUP_TOKEN;
- }
- else if (segment.kind == PathSegment.REDEFINE)
- {
- kind = REDEFINE_TOKEN;
- }
- 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 elementDeclaration = schema.resolveElementDeclaration(segment.name);
- if (elementDeclaration != null)
- {
- visitElementDeclaration(elementDeclaration);
- }
- }
- else if (segment.kind == PathSegment.TYPE)
- {
- XSDTypeDefinition typeDefinition = schema.resolveTypeDefinition(segment.name);
- if (typeDefinition != null)
- {
- visitTypeDefinition(typeDefinition);
- }
- }
- else if (segment.kind == PathSegment.MODEL_GROUP)
- {
- XSDModelGroupDefinition modelGroupDefinition = schema.resolveModelGroupDefinition(segment.name);
- if (modelGroupDefinition != null)
- {
- visitModelGroupDefinition(modelGroupDefinition);
- }
- }
- else if (segment.kind == PathSegment.ATTRIBUTE_GROUP)
- {
- XSDAttributeGroupDefinition attributeGroupDefinition = schema.resolveAttributeGroupDefinition(segment.name);
- if (attributeGroupDefinition != null)
- {
- visitAttributeGroupDefinition(attributeGroupDefinition);
- }
- }
- else if (segment.kind == PathSegment.REDEFINE)
- {
- Iterator iterator = schema.getContents().iterator();
- while (iterator.hasNext())
- {
- Object object = iterator.next();
- if (object instanceof XSDRedefine)
- {
- XSDRedefine redefine = (XSDRedefine)object;
- visitRedefine(redefine);
- }
- }
- }
- }
- }
-
- 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);
- }
- }
- }
- }
-
- public void visitModelGroupDefinition(XSDModelGroupDefinition modelGroup)
- {
- if (segment != null)
- {
- String name = modelGroup.getName();
- if (segment.kind == PathSegment.MODEL_GROUP && isMatch(segment.name, name))
- {
- result = modelGroup;
- incrementSegment();
- if (!isDone())
- {
- super.visitModelGroupDefinition(modelGroup);
- }
- }
- }
- }
-
- public void visitAttributeGroupDefinition(XSDAttributeGroupDefinition attributeGroup)
- {
- if (segment != null)
- {
- String name = attributeGroup.getName();
- if (segment.kind == PathSegment.ATTRIBUTE_GROUP && isMatch(segment.name, name))
- {
- result = attributeGroup;
- incrementSegment();
- if (!isDone())
- {
- super.visitAttributeGroupDefinition(attributeGroup);
- }
- }
- }
- }
-
- public void visitRedefine(XSDRedefine redefine)
- {
- if (segment != null)
- {
- String name = redefine.getSchemaLocation();
- if (segment.kind == PathSegment.REDEFINE && isMatch(segment.name, name))
- {
- result = redefine;
- incrementSegment();
- if (!isDone())
- {
- visitSchema(redefine.getSchema());
- }
- }
- }
-
- }
- 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/ui/internal/navigation/MultiPageEditorTextSelectionNavigationLocation.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/navigation/MultiPageEditorTextSelectionNavigationLocation.java
deleted file mode 100644
index e0f65945c0..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/navigation/MultiPageEditorTextSelectionNavigationLocation.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * 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.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();
- if (part != null)
- return (ITextEditor) part.getAdapter(ITextEditor.class);
- return null;
- }
-
- 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/ui/internal/nsedit/SchemaPrefixChangeHandler.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/nsedit/SchemaPrefixChangeHandler.java
deleted file mode 100644
index 3ce74a83c2..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/nsedit/SchemaPrefixChangeHandler.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * 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;
- String namespace;
-
- public SchemaPrefixChangeHandler(XSDSchema xsdSchema, String newPrefix)
- {
- this.xsdSchema = xsdSchema;
- this.newPrefix= newPrefix;
- namespace = XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001;
- }
-
- public SchemaPrefixChangeHandler(XSDSchema xsdSchema, String newPrefix, String namespace)
- {
- this.xsdSchema = xsdSchema;
- this.newPrefix= newPrefix;
- this.namespace = namespace;
- }
-
- 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(namespace))
- {
- 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(namespace))
- {
- 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(namespace))
- {
- 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(namespace))
- {
- 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(namespace))
- {
- 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
deleted file mode 100644
index d26c9df33f..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/nsedit/TargetNamespaceChangeHandler.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*******************************************************************************
- * 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.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);
- }
- }
- }
- }
- }
- }
- }
-}
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
deleted file mode 100644
index 115511a09e..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/nsedit/XSDVisitor.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * 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)
- {
- XSDComplexTypeContent complexContent = type.getContent();
- if (complexContent != null)
- {
- 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/preferences/XSDEditorPreferencePage.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/preferences/XSDEditorPreferencePage.java
deleted file mode 100644
index e56ffe88e3..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/preferences/XSDEditorPreferencePage.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.preferences;
-
-
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.PreferenceLinkArea;
-import org.eclipse.ui.help.IWorkbenchHelpSystem;
-import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
-import org.eclipse.wst.sse.ui.internal.preferences.ui.AbstractPreferencePage;
-import org.eclipse.wst.xsd.ui.internal.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorCSHelpIds;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorContextIds;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-
-
-public class XSDEditorPreferencePage extends AbstractPreferencePage
-{
- private static final String XML_EDITOR_PREFERENCE_PAGE_ID = "org.eclipse.wst.sse.ui.preferences.xml.source"; //$NON-NLS-1$
-
- private Button removeUnusedImports;
-
- private Button automaticallyOpenSchemaLocationDialog;
-
- protected Control createContents(Composite parent)
- {
- final Composite composite = super.createComposite(parent, 1);
- IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
- helpSystem.setHelp(parent, XSDEditorContextIds.XSDP_EDITOR_PREFERENCE_PAGE);
-
- new PreferenceLinkArea(composite, SWT.WRAP | SWT.MULTI, XML_EDITOR_PREFERENCE_PAGE_ID, Messages._UI_XML_TEXT_EDITOR_PREFS_LINK,
- (IWorkbenchPreferenceContainer)getContainer(), null).getControl().setLayoutData(GridDataFactory.fillDefaults().hint(150, SWT.DEFAULT).create());
- new Label(composite, SWT.NONE).setLayoutData(GridDataFactory.swtDefaults().create());
-
- createContentsForImportCleanup(composite);
-
- setSize(composite);
- loadPreferences();
-
- return composite;
- }
-
- private boolean getRemoveImportSetting()
- {
- return removeUnusedImports.getSelection();
- }
-
- private boolean getAutomaticallyOpenSchemaLocationDialogSetting()
- {
- return automaticallyOpenSchemaLocationDialog.getSelection();
- }
-
- protected void initializeValues()
- {
- IPreferenceStore store = getPreferenceStore();
- removeUnusedImports.setSelection(store.getBoolean(XSDEditorPlugin.CONST_XSD_IMPORT_CLEANUP));
- automaticallyOpenSchemaLocationDialog.setSelection(store.getBoolean(XSDEditorPlugin.CONST_XSD_AUTO_OPEN_SCHEMA_LOCATION_DIALOG));
- }
-
- protected void performDefaults()
- {
- IPreferenceStore preferenceStore = getPreferenceStore();
- removeUnusedImports.setSelection(preferenceStore.getDefaultBoolean(XSDEditorPlugin.CONST_XSD_IMPORT_CLEANUP));
- automaticallyOpenSchemaLocationDialog.setSelection(preferenceStore.getDefaultBoolean(XSDEditorPlugin.CONST_XSD_AUTO_OPEN_SCHEMA_LOCATION_DIALOG));
- super.performDefaults();
- }
-
- protected void storeValues()
- {
- saveValuesForImportsCleanup();
- }
-
- /**
- * Stores the values of the controls back to the preference store.
- */
- private void saveValuesForImportsCleanup()
- {
- IPreferenceStore store = getPreferenceStore();
-
- store.setValue(XSDEditorPlugin.CONST_XSD_IMPORT_CLEANUP, getRemoveImportSetting());
- store.setValue(XSDEditorPlugin.CONST_XSD_AUTO_OPEN_SCHEMA_LOCATION_DIALOG, getAutomaticallyOpenSchemaLocationDialogSetting());
- }
-
- /**
- * The indent is stored in the preference store associated with the XML Schema Model
- */
- public IPreferenceStore getPreferenceStore()
- {
- return XSDEditorPlugin.getPlugin().getPreferenceStore();
- }
-
- private void createContentsForImportCleanup(Composite parent)
- {
- Group unusedImportGroup = createGroup(parent, 1);
- unusedImportGroup.setText(Messages._UI_GRAPH_DIRECTIVES);
-
- //GridData
- GridData data = new GridData(SWT.FILL);
- data.verticalAlignment = SWT.CENTER;
- data.horizontalAlignment = SWT.FILL;
-
- if (removeUnusedImports == null)
- {
- removeUnusedImports = new Button(unusedImportGroup, SWT.CHECK | SWT.LEFT);
- removeUnusedImports.setText(Messages._UI_TEXT_ENABLE_AUTO_IMPORT_CLEANUP);
- removeUnusedImports.setLayoutData(data);
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(removeUnusedImports, XSDEditorCSHelpIds.XMLSCHEMAFILES_PREFERENCES__IMPORT_CLEANUP);
-
- automaticallyOpenSchemaLocationDialog = new Button(unusedImportGroup, SWT.CHECK | SWT.LEFT);
- automaticallyOpenSchemaLocationDialog.setText(Messages._UI_TEXT_ENABLE_AUTO_OPEN_SCHEMA_DIALOG);
- automaticallyOpenSchemaLocationDialog.setLayoutData(GridDataFactory.copyData(data));
- }
- }
-
- protected void doSavePreferenceStore()
- {
- XSDEditorPlugin.getDefault().savePluginPreferences(); // model
- }
-
- public boolean performOk()
- {
- boolean result = super.performOk();
-
- doSavePreferenceStore();
-
- return result;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/preferences/XSDPreferencePage.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/preferences/XSDPreferencePage.java
deleted file mode 100644
index 61f7d91e48..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/preferences/XSDPreferencePage.java
+++ /dev/null
@@ -1,267 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2011 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
-David Carver, Standards for Technology in Automotive Retail, bug 1147033
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.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.PlatformUI;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.wst.xsd.ui.internal.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorCSHelpIds;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorContextIds;
-import org.eclipse.wst.xsd.ui.internal.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(final Composite parent)
- {
- WorkbenchHelp.setHelp(parent, XSDEditorContextIds.XSDP_PREFERENCE_PAGE);
-
- Group group = createGroup(parent, 2);
- group.setText(Messages._UI_TEXT_XSD_NAMESPACE_PREFIX);
-
- qualifyXSDLanguage = ViewUtility.createCheckBox(group, Messages._UI_QUALIFY_XSD);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(qualifyXSDLanguage,
- XSDEditorCSHelpIds.XMLSCHEMAFILES_PREFERENCES__QUALIFY_XMLSCHEMA_LANGUAGE_CONSTRUCTS);
- ViewUtility.createLabel(group, " ");
-
- createLabel(group, Messages._UI_TEXT_XSD_DEFAULT_PREFIX);
- schemaNsPrefixField = createTextField(group);
- schemaNsPrefixField.addKeyListener(new KeyAdapter()
- {
- public void keyPressed(KeyEvent e)
- {
- setValid(true);
- }
- });
- PlatformUI.getWorkbench().getHelpSystem().setHelp(schemaNsPrefixField,
- XSDEditorCSHelpIds.XMLSCHEMAFILES_PREFERENCES__XML_SCHEMA_LANGUAGE_CONSTRUCTS_PREFIX);
-
- createLabel(group, Messages._UI_TEXT_XSD_DEFAULT_TARGET_NAMESPACE);
- defaultTargetNamespaceText = createTextField(group);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(defaultTargetNamespaceText,
- XSDEditorCSHelpIds.XMLSCHEMAFILES_PREFERENCES__DEFAULT_TARGETNAMESPACE);
-
-
- initializeValues();
-
- applyDialogFont(parent);
-
- 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().getDefaultString(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(Messages._ERROR_LABEL_INVALID_PREFIX);
- setValid(false);
- return false;
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/preferences/XSDValidatorPreferencePage.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/preferences/XSDValidatorPreferencePage.java
deleted file mode 100644
index 957ae11e33..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/preferences/XSDValidatorPreferencePage.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.preferences;
-
-
-import org.eclipse.core.runtime.Preferences;
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.PreferenceLinkArea;
-import org.eclipse.ui.help.IWorkbenchHelpSystem;
-import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
-import org.eclipse.wst.sse.ui.internal.preferences.ui.AbstractPreferencePage;
-import org.eclipse.wst.xsd.core.internal.XSDCorePlugin;
-import org.eclipse.wst.xsd.core.internal.preferences.XSDCorePreferenceNames;
-import org.eclipse.wst.xsd.ui.internal.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorContextIds;
-
-
-public class XSDValidatorPreferencePage extends AbstractPreferencePage
-{
- private static final String XML_VALIDATOR_PREFERENCE_PAGE_ID = "org.eclipse.wst.sse.ui.preferences.xml.validation"; //$NON-NLS-1$
-
- private Button fullSchemaConformance = null;
-
- protected Control createContents(Composite parent)
- {
- final Composite composite = super.createComposite(parent, 1);
- IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
-
- helpSystem.setHelp(parent, XSDEditorContextIds.XSDP_VALIDATOR_PREFERENCE_PAGE);
-
- new PreferenceLinkArea(composite, SWT.WRAP | SWT.MULTI, XML_VALIDATOR_PREFERENCE_PAGE_ID, Messages._UI_XML_VALIDATOR_PREFS_LINK,
- (IWorkbenchPreferenceContainer)getContainer(), null).getControl().setLayoutData(GridDataFactory.fillDefaults().hint(150, SWT.DEFAULT).create());
- new Label(composite, SWT.NONE).setLayoutData(GridDataFactory.swtDefaults().create());
-
- createContentsForValidatingGroup(composite);
-
- setSize(composite);
- loadPreferences();
-
- return composite;
- }
-
- private void createContentsForValidatingGroup(Composite parent)
- {
- Group validatingGroup = createGroup(parent, 1);
- validatingGroup.setText(Messages._UI_VALIDATING_FILES);
-
- GridData data = new GridData(SWT.FILL);
- data.verticalAlignment = SWT.CENTER;
- data.horizontalAlignment = SWT.FILL;
-
- if (fullSchemaConformance == null)
- {
- fullSchemaConformance = new Button(validatingGroup, SWT.CHECK | SWT.LEFT);
- fullSchemaConformance.setLayoutData(GridDataFactory.copyData(data));
- fullSchemaConformance.setText(Messages._UI_FULL_CONFORMANCE);
- }
- }
-
- protected void performDefaults()
- {
- fullSchemaConformance.setSelection(getModelPreferences().getDefaultBoolean(XSDCorePreferenceNames.FULL_SCHEMA_CONFORMANCE));
- super.performDefaults();
- }
-
- protected void initializeValues()
- {
- initializeValuesForValidatingGroup();
- super.initializeValues();
- }
-
- protected void initializeValuesForValidatingGroup()
- {
- fullSchemaConformance.setSelection(getModelPreferences().getBoolean(XSDCorePreferenceNames.FULL_SCHEMA_CONFORMANCE));
- }
-
- protected Preferences getModelPreferences()
- {
- return XSDCorePlugin.getDefault().getPluginPreferences();
- }
-
- protected void storeValuesForValidatingGroup()
- {
- if (fullSchemaConformance != null)
- {
- boolean fullSchemaConformanceSelected = fullSchemaConformance.getSelection();
- getModelPreferences().setValue(XSDCorePreferenceNames.FULL_SCHEMA_CONFORMANCE, fullSchemaConformanceSelected);
- }
- }
-
- protected void storeValues()
- {
- storeValuesForValidatingGroup();
- }
-
- protected void doSavePreferenceStore()
- {
- XSDCorePlugin.getDefault().savePluginPreferences(); // model
- }
-
- public boolean performOk()
- {
- boolean result = super.performOk();
-
- doSavePreferenceStore();
-
- return result;
- }
-}
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
deleted file mode 100644
index 3b250a2ccf..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/text/XSDModelAdapter.java
+++ /dev/null
@@ -1,240 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- * Jesper Steen Moller - broader recognition of URIs
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.text;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.progress.IProgressService;
-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.IDOMDocument;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
-import org.eclipse.wst.xsd.ui.internal.util.ModelReconcileAdapter;
-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.Document;
-import org.w3c.dom.Element;
-
-public class XSDModelAdapter implements INodeAdapter
-{
- protected ResourceSet resourceSet;
- protected XSDSchema schema;
- private ModelReconcileAdapter modelReconcileAdapter;
-
- public XSDSchema getSchema()
- {
- return schema;
- }
-
- public void setSchema(XSDSchema schema)
- {
- this.schema = schema;
- }
-
- public void clear()
- {
- if (schema != null) {
- Document doc = schema.getDocument();
- if (doc instanceof IDOMDocument) {
- IDOMDocument domDocument = (IDOMDocument)doc;
- domDocument.getModel().removeModelStateListener(getModelReconcileAdapter());
- domDocument.removeAdapter(getModelReconcileAdapter());
- domDocument.removeAdapter(this);
- }
- 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 ModelReconcileAdapter getModelReconcileAdapter()
- {
- return modelReconcileAdapter;
- }
-
- public XSDSchema createSchema(Document document)
- {
- try
- {
- // (cs) note that we always want to ensure that a
- // schema model object get's returned
- schema = XSDFactory.eINSTANCE.createXSDSchema();
- resourceSet = XSDSchemaImpl.createResourceSet();
- resourceSet.getAdapterFactories().add(new XSDSchemaLocationResolverAdapterFactory());
-
- IDOMNode domNode = (IDOMNode)document;
- String baseLocation = domNode.getModel().getBaseLocation();
-
- // TODO... gotta pester SSE folks to provide 'useful' baseLocations
- //
- URI uri = getURI(baseLocation);
-
- Resource resource = new XSDResourceImpl();
- resource.setURI(uri);
- schema = XSDFactory.eINSTANCE.createXSDSchema();
- resource.getContents().add(schema);
- resourceSet.getResources().add(resource);
-
- schema.setDocument(document);
- final Element element = document.getDocumentElement();
- if (element != null)
- {
- // Force the loading of the "meta" schema for schema instance instance.
- //
- String schemaForSchemaNamespace = element.getNamespaceURI();
- XSDSchemaImpl.getSchemaForSchema(schemaForSchemaNamespace);
- }
-
- IRunnableWithProgress setElementOperation = new IRunnableWithProgress()
- {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException
- {
- // Use the animated flavour as we don't know beforehand how many ticks we need.
- // The task name will be displayed by the code in XSDResourceImpl.
-
- monitor.beginTask("", IProgressMonitor.UNKNOWN); //$NON-NLS-1$
- Map loadOptions = resourceSet.getLoadOptions();
- loadOptions.put(XSDResourceImpl.XSD_PROGRESS_MONITOR, monitor);
-
- schema.setElement(element);
-
- loadOptions.remove(XSDResourceImpl.XSD_PROGRESS_MONITOR);
- }
- };
-
- IProgressService progressService = PlatformUI.getWorkbench().getProgressService();
- try
- {
- progressService.busyCursorWhile(setElementOperation);
- }
- catch (InvocationTargetException e)
- {
- e.printStackTrace();
- }
- catch (InterruptedException e)
- {
- e.printStackTrace();
- }
-
- // attach an adapter to keep the XSD model and DOM in sync
- //
- modelReconcileAdapter = new XSDModelReconcileAdapter(document, schema);
- domNode.getModel().addModelStateListener(modelReconcileAdapter);
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
- return schema;
- }
-
- /**
- * @deprecated
- */
- public XSDSchema createSchema(Element element)
- {
- return createSchema(element.getOwnerDocument());
- }
-
- public XSDSchema resetSchema(Document document)
- {
- // The document has changed so the schema should be updated as well.
- try
- {
- IDOMNode domNode = (IDOMNode)document;
- schema.setDocument(document);
- schema.setElement(document.getDocumentElement());
-
- resourceSet = schema.eResource().getResourceSet();
-
- String baseLocation = domNode.getModel().getBaseLocation();
- URI uri = getURI(baseLocation);
- schema.eResource().setURI(uri);
-
- modelReconcileAdapter = new XSDModelReconcileAdapter(document, schema);
- domNode.getModel().addModelStateListener(modelReconcileAdapter);
- }
- catch (Exception ex)
- {
- }
- return schema;
- }
-
- public static XSDModelAdapter lookupOrCreateModelAdapter(Document document)
- {
- XSDModelAdapter adapter = null;
- if (document instanceof INodeNotifier)
- {
- INodeNotifier notifier = (INodeNotifier)document;
- adapter = (XSDModelAdapter)notifier.getAdapterFor(XSDModelAdapter.class);
- if (adapter == null)
- {
- adapter = new XSDModelAdapter();
- notifier.addAdapter(adapter);
- }
- }
- return adapter;
- }
-
- public static XSDSchema lookupOrCreateSchema(final Document document)
- {
- XSDSchema result = null;
- XSDModelAdapter adapter = lookupOrCreateModelAdapter(document);
- if (adapter.getSchema() == null)
- {
-
- adapter.createSchema(document);
- }
- result = adapter.getSchema();
- return result;
- }
-
- private URI getURI(String baseLocation)
- {
- URI uri = null;
- if (baseLocation.startsWith("/")) //$NON-NLS-1$
- {
- uri = URI.createPlatformResourceURI(baseLocation);
- }
- else if (baseLocation.indexOf(':') > 1)
- {
- // Looks like an URL
- uri = URI.createURI(baseLocation);
- }
- else
- {
- // Supposedly a file, then
- uri = URI.createFileURI(baseLocation);
- }
- return uri;
- }
-}
-
-
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/text/XSDModelDelayedReconciler.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/text/XSDModelDelayedReconciler.java
deleted file mode 100644
index 02b7b6d76b..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/text/XSDModelDelayedReconciler.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.progress.UIJob;
-import org.eclipse.wst.xsd.ui.internal.editor.InternalXSDMultiPageEditor;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDSchema;
-import org.w3c.dom.Element;
-
-
-/**
- * Provides delayed reconciliation between the SSE DOM and the XSD EMF model.
- * Changes in the DOM are queued and processed by a UI job. When a new request
- * comes in, the current run is cancelled, the new request is added to the queue,
- * then the job is re-scheduled.
- */
-public class XSDModelDelayedReconciler
-{
- /**
- * The model reconciler job.
- */
- private ReconcilerJob reconcilerJob;
-
- /**
- * The time in milliseconds to delay updating the EMF model.
- */
- private static final int DELAY = 300;
-
- /**
- * The elements to reconcile.
- */
- private List elementsToReconcile = new ArrayList();
-
- /**
- * Determines if the delayed reconciler should kick in.
- */
- public boolean shouldDelay(XSDSchema schema)
- {
- boolean shouldDelay = false;
-
- // The delayed reconciler should not be used when the editor is in graphical editing mode.
-
- IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- IWorkbenchPage workbenchPage = workbenchWindow.getActivePage();
- IEditorPart editorPart = workbenchPage != null ? workbenchPage.getActiveEditor() : null;
- if (editorPart != null && editorPart instanceof InternalXSDMultiPageEditor)
- {
- InternalXSDMultiPageEditor xsdEditor = (InternalXSDMultiPageEditor)editorPart;
- shouldDelay = xsdEditor.isSourcePageActive();
- }
-
- return shouldDelay;
- }
-
- /**
- * Updates the XSD EMF component corresponding to the DOM element.
- *
- * @param element the changed element.
- * @param schema the containing schema.
- */
- public void elementChanged(Element element, XSDSchema schema)
- {
- synchronized (elementsToReconcile)
- {
- // The number of elements should be small so a linear search should be fine.
-
- if (!elementsToReconcile.contains(element))
- {
- elementsToReconcile.add(element);
- }
-
- if (reconcilerJob == null)
- {
- reconcilerJob = new ReconcilerJob(schema);
- }
-
- reconcilerJob.schedule(DELAY);
- }
- }
-
- /**
- * A UI job used to reconcile the XSD EMF model with the associated SSE DOM.
- */
- class ReconcilerJob extends UIJob
- {
- /**
- * The target schema.
- */
- private XSDSchema schema;
-
- /**
- * The number of times allowed to wake up and do nothing.
- */
- private static final int MAX_INACTIVE_COUNT = 10;
-
- /**
- * The job will terminate once this counter reaches MAX_INACTIVE_COUNT.
- */
- private int timesAwakeAndIdle = 0;
-
- /**
- * Constructs the reconciler job and configures some of its properties.
- */
- public ReconcilerJob(XSDSchema schema)
- {
- super("Reconciling the XSD EMF model"); //$NON-NLS-1$
- setSystem(true);
- setPriority(Job.LONG);
- this.schema = schema;
- }
-
- public IStatus runInUIThread(IProgressMonitor monitor)
- {
- if (monitor.isCanceled())
- {
- return Status.CANCEL_STATUS;
- }
-
- Element[] elements = null;
-
- synchronized (elementsToReconcile)
- {
- if (!elementsToReconcile.isEmpty())
- {
- elements = new Element[elementsToReconcile.size()];
- elementsToReconcile.toArray(elements);
- elementsToReconcile.clear();
- }
- else
- {
- if (shouldTerminate())
- {
- reconcilerJob = null;
- return Status.CANCEL_STATUS;
- }
- }
- }
-
- reconcile(elements);
-
- schedule(DELAY);
-
- return Status.OK_STATUS;
- }
-
- private void reconcile(Element[] modifiedElements)
- {
- if (modifiedElements != null)
- {
- for (int index = 0; index < modifiedElements.length; index++)
- {
- Element modifiedElement = modifiedElements[index];
-
- reconcile(modifiedElement);
- }
- }
- }
-
- private void reconcile(Element modifiedElement)
- {
- if (modifiedElement != null)
- {
- XSDConcreteComponent concreteComponent = schema.getCorrespondingComponent(modifiedElement);
- concreteComponent.elementChanged(modifiedElement);
- }
- }
-
- private boolean shouldTerminate()
- {
- return timesAwakeAndIdle++ == MAX_INACTIVE_COUNT;
- }
- }
-} \ 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
deleted file mode 100644
index c111aadbdb..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/text/XSDModelQueryExtension.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.text;
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.wst.xml.core.internal.contentmodel.modelquery.extension.ModelQueryExtension;
-import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.custom.NodeFilter;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-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"))
- {
- if (checkName(currentElementName, "attribute"))
- {
- list = getTypesHelper(e).getBuiltInTypeNamesList2();
- 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, "minOccurs"))
- {
- list.add("0");
- }
- 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;
- }
-
- public boolean isApplicableChildElement(Node parentNode, String namespace, String name)
- {
- if (XSDConstants.APPINFO_ELEMENT_TAG.equals(parentNode.getNodeName()) &&
- XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001.equals(namespace))
- {
- return false;
- }
-
- // we assume that other nodes don't want schema nodes as extension elements
- // TODO... cs: we really need to define custimizations for filtering based on parent/child
- // namespace pairs to accurately handle this
- String parentElementNamespaceURI = parentNode.getNamespaceURI();
- if (!XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001.equals(parentElementNamespaceURI) &&
- XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001.equals(namespace))
- {
- return false;
- }
-
- if (!XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001.equals(namespace))
- {
- NodeFilter filter = XSDEditorPlugin.getPlugin().getNodeCustomizationRegistry().getNodeFilter(namespace);
- if (filter != null)
- {
- return filter.isApplicableContext(parentNode, Node.ELEMENT_NODE, namespace, name);
- }
- }
-
- return true;
- }
-
- protected XSDSchema lookupOrCreateSchema(Document document)
- {
- return XSDModelAdapter.lookupOrCreateSchema(document);
- }
-
- /**
- * @deprecated
- */
- protected XSDSchema lookupOrCreateSchemaForElement(Element element)
- {
- return lookupOrCreateSchema(element.getOwnerDocument());
- }
-
- protected TypesHelper getTypesHelper(Element element)
- {
- XSDSchema schema = lookupOrCreateSchema(element.getOwnerDocument());
- 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
deleted file mode 100644
index 44b0626f8b..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/text/XSDModelReconcileAdapter.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- * Eugene Ostroukhov, eugene@genuitec.com - [203291] XSD Editor Source State
- * not updated in Outline/Graph
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.text;
-
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.xsd.ui.internal.util.ModelReconcileAdapter;
-import org.eclipse.xsd.XSDConcreteComponent;
-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 XSDModelReconcileAdapter extends ModelReconcileAdapter
-{
- protected XSDSchema schema;
- protected XSDModelDelayedReconciler delayedReconciler;
-
- public XSDModelReconcileAdapter(Document document, XSDSchema schema)
- {
- super(document);
- this.schema = schema;
- this.delayedReconciler = new XSDModelDelayedReconciler();
- }
-
- protected void handleNodeChanged(Node node)
- {
- // Make sure that the node is in the XSD Schema namespace. We don't need to
- // reconcile the model for other nodes like text or nodes in other namespaces
- // like the ones normally occurring in annotations.
-
- try
- {
- if (!shouldReconcileModelFor(node))
- {
- return;
- }
- }
- catch (Exception e)
- {
- }
-
- if (node instanceof Element)
- {
- Element element = (Element) node;
- if (delayedReconciler.shouldDelay(schema))
- {
- delayedReconciler.elementChanged(element, schema);
- }
- else
- {
- XSDConcreteComponent concreteComponent = schema.getCorrespondingComponent(node);
- concreteComponent.elementChanged(element);
- }
- }
- else if (node instanceof Document)
- {
- // The document changed so we may need to fix up the
- // definition's root element
- Document document = (Document)node;
- Element schemaElement = document.getDocumentElement();
- if (schemaElement != null && schemaElement != schema.getElement())
- {
- // here we handle the case where a new 'schema' element was added
- //(e.g. the file was totally blank and then we type in the root element)
- //
- if (schemaElement.getLocalName().equals(XSDConstants.SCHEMA_ELEMENT_TAG))
- {
- //System.out.println("****** Setting new schema");
- schema.setElement(schemaElement);
- }
- }
- else if (schemaElement != null)
- {
- // handle the case where the definition element's content has changed
- // TODO (cs) do we really need to handle this case?
- schema.elementChanged(schemaElement);
- }
- else if (schemaElement == null)
- {
- // if there's no root element clear out the schema
- //
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=203291
- // Add try-catch to work-around problem at
- // XSDConcreteComponentImpl.forceNiceRemoveChild(XSDConcreteComponentImpl.java:1696)
- // otherwise the statements below don't get run
- try
- {
- schema.getContents().clear();
- }
- catch (NullPointerException e)
- {
- // workaround
- }
-
- // TODO (cs) I'm not sure why the above isn't enough
- // to clear out all of the component lists
- // for now I've just added a few more lines to do additional clearing
- //
- // See comment above for https://bugs.eclipse.org/bugs/show_bug.cgi?id=203291
- try { schema.getIncorporatedVersions().clear(); } catch (Exception e) { }
- try { schema.getElementDeclarations().clear(); } catch (Exception e) {}
- try { schema.getTypeDefinitions().clear(); } catch (Exception e) {}
- try { schema.getAttributeDeclarations().clear(); } catch (Exception e) {}
- try { schema.getModelGroupDefinitions().clear(); } catch (Exception e) {}
- try { schema.getAttributeGroupDefinitions().clear(); } catch (Exception e) {}
- try { schema.setTargetNamespace(null); } catch (Exception e) {}
- try { schema.reset(); } catch (Exception e) {}
-
- schema.setElement(null);
- }
- }
- }
-
- /**
- * Checks if a change to the given node should trigger a model update.
- *
- * @param changedNode
- * the DOM node to test.
- * @return true if the change to the given node should trigger a model update.
- */
- protected boolean shouldReconcileModelFor(Node changedNode)
- {
- // No need to reconcile if the node is in a different namespace as it is the
- // case for nodes deeply nested in appinfo or documentation elements.
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=203291
- if (changedNode instanceof Document)
- {
- return true;
- }
-
- String nodeNamespace = changedNode.getNamespaceURI();
- String schemaNamespace = schema.getSchemaForSchemaNamespace();
- // If the document node changes, then the nodeNamespace is null
- // so we do want to reconcile. This change is needed for
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=148842 and
- // read only file support.
- if (!schemaNamespace.equals(nodeNamespace) && nodeNamespace != null)
- {
- return false;
- }
-
- // When a child node is added to an appinfo or documentation element
- // No need to reconcile if the node is the first child of appinfo or documentation
- // elements.
-
- Node parentNode = changedNode.getParentNode();
-
- if (parentNode != null)
- {
- String nodeName = changedNode.getLocalName();
-
- if (XSDConstants.APPINFO_ELEMENT_TAG.equals(nodeName) || XSDConstants.DOCUMENTATION_ELEMENT_TAG.equals(nodeName))
- {
- return false;
- }
- }
- return true;
- }
-
- public void modelDirtyStateChanged(IStructuredModel model, boolean isDirty)
- {
- if (!isDirty)
- {
- // TODO need a way to tell the views to stop refreshing (temporarily)
- //
- /*
- schema.reset();
-
- // For some reason type references don't get fixed up when an import is removed
- // even if we call schema.reset() explictly. To work around this we iterate thru
- // the type references and recompute them incase a schema did infact change
- //
- for (Iterator i = schema.getElementDeclarations().iterator(); i.hasNext(); )
- {
- XSDElementDeclarationImpl ed = (XSDElementDeclarationImpl)i.next();
- //ed.elementAttributesChanged(ed.getElement());
- XSDTypeDefinition td = ed.getTypeDefinition();
- td = ed.resolveTypeDefinition(td.getSchema().getTargetNamespace(), td.getName());
- ed.setTypeDefinition(td);
- }*/
- }
- }
-} \ 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/DocumentAdapter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/util/DocumentAdapter.java
deleted file mode 100644
index 03133c50ab..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/util/DocumentAdapter.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * 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.internal.util;
-
-import org.eclipse.wst.sse.core.internal.provisional.INodeAdapter;
-import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-abstract class DocumentAdapter implements INodeAdapter
-{
- Document document;
-
- public DocumentAdapter(Document document)
- {
- this.document = document;
- ((INodeNotifier) document).addAdapter(this);
- adaptChildElements(document);
- }
-
- private void adaptChildElements(Node parentNode)
- {
- for (Node child = parentNode.getFirstChild(); child != null; child = child.getNextSibling())
- {
- if (child.getNodeType() == Node.ELEMENT_NODE)
- {
- adapt((Element) child);
- }
- }
- }
-
- public void adapt(Element element)
- {
- if (((INodeNotifier) element).getExistingAdapter(this) == null)
- {
- ((INodeNotifier) element).addAdapter(this);
- adaptChildElements(element);
- }
- }
-
- public boolean isAdapterForType(Object type)
- {
- return type == this;
- }
-
- abstract public void notifyChanged(INodeNotifier notifier, int eventType, Object feature, Object oldValue, Object newValue, int index);
- {
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/util/ModelReconcileAdapter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/util/ModelReconcileAdapter.java
deleted file mode 100644
index 9f8567747b..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/util/ModelReconcileAdapter.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * 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.wst.sse.core.internal.provisional.IModelStateListener;
-import org.eclipse.wst.sse.core.internal.provisional.INodeAdapter;
-import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.Text;
-
-public abstract class ModelReconcileAdapter extends DocumentAdapter implements IModelStateListener
-{
- protected boolean handlingNotifyChanged = false;
- protected List listeners = new ArrayList();
-
- public ModelReconcileAdapter(Document document)
- {
- super(document);
- }
-
- public void addListener(INodeAdapter listener)
- {
- if (!listeners.contains(listener))
- {
- listeners.add(listener);
- }
- }
-
- public void removeListener(INodeAdapter listener)
- {
- listeners.remove(listener);
- }
-
- protected void notifyListeners(INodeNotifier notifier, int eventType, Object changedFeature, Object oldValue, Object newValue, int pos)
- {
- List list = new ArrayList(listeners);
- for (Iterator i = list.iterator(); i.hasNext(); )
- {
- INodeAdapter adapter = (INodeAdapter)i.next();
- adapter.notifyChanged(notifier, eventType, changedFeature, oldValue, newValue, pos);
- }
- }
-
- public void notifyChanged(INodeNotifier notifier, int eventType, Object feature, Object oldValue, Object newValue, int index)
- {
- if (!handlingNotifyChanged)
- {
- handlingNotifyChanged = true;
- try
- {
- handleNotifyChange(notifier, eventType, feature, oldValue, newValue, index);
- notifyListeners(notifier, eventType, feature, oldValue, newValue, index);
- }
- catch (Exception e)
- {
-// XSDEditorPlugin.getPlugin().getMsgLogger().write(e);
- }
- finally
- {
- handlingNotifyChanged = false;
- }
- }
- }
-
- protected void handleNodeChanged(Node node)
- {
- }
-
- public void handleNotifyChange(INodeNotifier notifier, int eventType, Object feature, Object oldValue, Object newValue, int index)
- {
- Node node = (Node)notifier;
- switch (eventType)
- {
- case INodeNotifier.ADD:
- {
- if (newValue instanceof Element)
- {
- Element element = (Element)newValue;
- adapt(element);
- }
- break;
- }
- case INodeNotifier.REMOVE:
- {
- break;
- }
- case INodeNotifier.CHANGE:
- case INodeNotifier.STRUCTURE_CHANGED:
- {
- handleNodeChanged(node);
- break;
- }
- case INodeNotifier.CONTENT_CHANGED:
- {
- // If the only thing changed was the content of a text node
- // then we don't want to reconcile.
-
- if (feature instanceof Text)
- {
- break;
- }
-
- handleNodeChanged(node);
- break;
- }
- }
- }
-
- public void modelAboutToBeChanged(IStructuredModel model)
- {
- }
-
- public void modelAboutToBeReinitialized(IStructuredModel structuredModel)
- {
- }
-
- public void modelChanged(IStructuredModel model)
- {
- }
-
- public void modelDirtyStateChanged(IStructuredModel model, boolean isDirty)
- {
- }
-
- public void modelReinitialized(IStructuredModel structuredModel)
- {
- }
-
- public void modelResourceDeleted(IStructuredModel model)
- {
- }
-
- public void modelResourceMoved(IStructuredModel oldModel, IStructuredModel newModel)
- {
- }
-}
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
deleted file mode 100644
index 730784b6ce..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/util/SelectionAdapter.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * 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.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
deleted file mode 100644
index 4536f9c5ba..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/util/TypesHelper.java
+++ /dev/null
@@ -1,404 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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)
- {
-
- }
- }
- }
- }
- }
-
-
- // TODO This method and it's very similar getBuiltInTypeNamesList2 should
- // be reviewed and combined if possible. Both seem to be used from
- // XSDModelQueryExtension for content assist purposes.
-
- public java.util.List getBuiltInTypeNamesList()
- {
- List items = new ArrayList();
- if (xsdSchema != null)
- {
- String prefix = xsdSchema.getSchemaForSchemaQNamePrefix();
- 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;
- items.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()));
- }
- }
- 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);
- //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
deleted file mode 100644
index cd5ac33904..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/util/ViewUtility.java
+++ /dev/null
@@ -1,246 +0,0 @@
-/*******************************************************************************
- * 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.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
deleted file mode 100644
index cb8c84c320..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/util/XSDDOMHelper.java
+++ /dev/null
@@ -1,477 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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;
- }
-
-
- public Element getDerivedByElementFromSimpleType(Element element)
- {
- Node atomic = getChildNode(element, "restriction");
- Node list = getChildNode(element, "list");
- Node union = getChildNode(element, "union");
- if (atomic instanceof Element)
- {
- return (Element)atomic;
- }
- if (list instanceof Element)
- {
- return (Element)list;
- }
- if (union instanceof Element)
- {
- return (Element)union;
- }
- 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 boolean hasOnlyWhitespace(Node node)
- {
- NodeList list = node.getChildNodes();
- int length = list.getLength();
- boolean hasOnlyWhitespace = true;
- for (int i = 0; i < length; i++)
- {
- Node child = list.item(i);
- if (child.getNodeType() != Node.TEXT_NODE)
- {
- hasOnlyWhitespace = false;
- break;
- }
- else
- {
- String value = child.getNodeValue();
- String trimmedValue = value.trim();
- if (trimmedValue.length() != 0)
- {
- hasOnlyWhitespace = false;
- }
- }
- }
-
- return hasOnlyWhitespace;
- }
-
- 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
deleted file mode 100644
index af3d91b06e..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/util/XSDSchemaLocationResolverAdapterFactory.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * 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.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
deleted file mode 100644
index cd985b5985..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/util/XSDSchemaLocationResolverImpl.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * 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.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/utils/OpenOnSelectionHelper.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/utils/OpenOnSelectionHelper.java
deleted file mode 100644
index be1aa78b54..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/utils/OpenOnSelectionHelper.java
+++ /dev/null
@@ -1,369 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.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.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-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.sse.core.internal.provisional.IndexedRegion;
-import org.eclipse.wst.sse.ui.StructuredTextEditor;
-import org.eclipse.wst.xsd.ui.internal.common.actions.OpenInNewEditor;
-import org.eclipse.wst.xsd.ui.internal.editor.InternalXSDMultiPageEditor;
-import org.eclipse.wst.xsd.ui.internal.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(XSDSchema schema)
- {
- IEditorInput editorInput = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor().getEditorInput();
-
- OpenInNewEditor.openXSDEditor(editorInput, schema, schema);
-
- }
-
- public static void openXSDEditor(String schemaLocation)
- {
- IPath schemaPath = new Path(schemaLocation);
- final IFile schemaFile = ResourcesPlugin.getWorkspace().getRoot().getFile(schemaPath);
-
- Display.getDefault().asyncExec(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.EDITOR_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.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 (name == null)
- {
- // For Anonymous types, just show the element
- if (comp instanceof XSDTypeDefinition)
- {
- XSDTypeDefinition type = (XSDTypeDefinition) comp;
- comp = type.getContainer();
- 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();
- }
- else if (comp instanceof XSDAttributeGroupDefinition)
- {
- objects = schema.getAttributeGroupDefinitions();
- }
- else if (comp instanceof XSDIdentityConstraintDefinition)
- {
- objects = schema.getIdentityConstraintDefinitions();
- }
- else if (comp instanceof XSDModelGroupDefinition)
- {
- objects = schema.getModelGroupDefinitions();
- }
- else if (comp instanceof XSDAttributeDeclaration)
- {
- objects = schema.getAttributeDeclarations();
- }
-
- 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/validation/DelegatingSourceValidatorForXSD.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/validation/DelegatingSourceValidatorForXSD.java
deleted file mode 100644
index b90cce80c8..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/validation/DelegatingSourceValidatorForXSD.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.validation;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.wst.validation.ValidationFramework;
-import org.eclipse.wst.validation.Validator;
-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 for schema files
- *
- */
-public class DelegatingSourceValidatorForXSD extends DelegatingSourceValidator {
- private final static String Id = "org.eclipse.wst.xsd.core.xsd";
-
- private Validator _validator;
-
- public DelegatingSourceValidatorForXSD() {
- }
-
- private Validator getValidator(){
- if (_validator == null)_validator = ValidationFramework.getDefault().getValidator(Id);
- return _validator;
- }
-
- protected IValidator getDelegateValidator() {
- Validator v = getValidator();
- if (v == null)return null;
- return v.asIValidator();
- }
-
- protected boolean isDelegateValidatorEnabled(IFile file) {
- Validator v = getValidator();
- if (v == null)return false;
- if (!v.shouldValidate(file, false, false))return false;
- return v.isBuildValidation() || v.isManualValidation();
- }
-}
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
deleted file mode 100644
index 1af19fa903..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/widgets/EnumerationsDialog.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * 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.internal.widgets;
-
-import org.eclipse.jface.window.Window;
-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.ui.PlatformUI;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorCSHelpIds;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-import org.eclipse.wst.xsd.ui.internal.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 == Window.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;
- PlatformUI.getWorkbench().getHelpSystem().setHelp(textField, XSDEditorCSHelpIds.ADD_ENUMERATIONS__NO_NAME);
-
- 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;
- PlatformUI.getWorkbench().getHelpSystem().setHelp(delimiterField, XSDEditorCSHelpIds.ADD_ENUMERATIONS__DELIMITER_CHARS);
-
- // 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;
- PlatformUI.getWorkbench().getHelpSystem().setHelp(preserveWhitespace, XSDEditorCSHelpIds.ADD_ENUMERATIONS__PRESERVE_LEAD_AND_TRAIL_WHITESPACES);
-
- 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
deleted file mode 100644
index ee29fee2d3..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/widgets/TypeSection.java
+++ /dev/null
@@ -1,335 +0,0 @@
-/*******************************************************************************
- * 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.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.ui.internal.editor.XSDEditorContextIds;
-import org.eclipse.wst.xsd.ui.internal.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
deleted file mode 100644
index abd0167c44..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/widgets/XSDEditSchemaInfoDialog.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * David Schneider, david.schneider@unisys.com - [142500] WTP properties pages fonts don't follow Eclipse preferences
- *******************************************************************************/
-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.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.Combo;
-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 implements SelectionListener {
- String targetNamespace;
- CommonEditNamespacesTargetFieldDialog editNamespacesControl;
- /**
- * @deprecated - These have been moved to the Advanced Properties Tab
- */
- Combo elementFormCombo, attributeFormCombo;
- /**
- * @deprecated
- */
- String elementFormQualified = "", attributeFormQualified = ""; //$NON-NLS-1$ //$NON-NLS-2$
-
- public XSDEditSchemaInfoDialog(Shell parentShell, IPath resourceLocation, String targetNamespace) {
- super(parentShell, resourceLocation);
- this.targetNamespace = targetNamespace;
- }
-
- // 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));
- 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);
-
- applyDialogFont(parent);
- return dialogArea;
- }
-
- public String getTargetNamespace() {
- return editNamespacesControl.getTargetNamespace();
- }
-
- /**
- * @deprecated
- */
- public void setIsElementQualified(String state)
- {
- elementFormCombo.setText(state);
- elementFormQualified = state;
- }
-
- /**
- * @deprecated
- */
- public void setIsAttributeQualified(String state)
- {
- attributeFormCombo.setText(state);
- attributeFormQualified = state;
- }
-
- /**
- * @deprecated
- */
- public String getElementFormQualified()
- {
- return elementFormQualified;
- }
-
- /**
- * @deprecated
- */
- public String getAttributeFormQualified()
- {
- return attributeFormQualified;
- }
-
- /**
- * @deprecated
- */
- public void widgetDefaultSelected(SelectionEvent e)
- {
-
- }
-
- /**
- * @deprecated
- */
- public void widgetSelected(SelectionEvent e)
- {
- if (e.widget == attributeFormCombo)
- {
- attributeFormQualified = attributeFormCombo.getText();
- }
- else if (e.widget == elementFormCombo)
- {
- elementFormQualified = elementFormCombo.getText();
- }
-
- }
-
-}
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
deleted file mode 100644
index 41cd29db42..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/wizards/NewXSDWizard.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.ui.internal.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.png"));
- 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 + "\" elementFormDefault=\"qualified\">\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
deleted file mode 100644
index 1a1712d35b..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/wizards/RegexCompositionPage.java
+++ /dev/null
@@ -1,947 +0,0 @@
-/*******************************************************************************
- * 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
- *******************************************************************************/
-// 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.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.PlatformUI;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorCSHelpIds;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-import org.eclipse.wst.xsd.ui.internal.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);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, XSDEditorCSHelpIds.REGEX_WIZARD_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);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(terms, XSDEditorCSHelpIds.REGEX_TOKEN_CONTENTS);
- 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;
-
-
- // 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"));
- PlatformUI.getWorkbench().getHelpSystem().setHelp(occurrenceSelectionArea, XSDEditorCSHelpIds.REGEX_WIZARD_PAGE);
- GridLayout selectionAreaLayout = new GridLayout();
- selectionAreaLayout.numColumns = 2;
- occurrenceSelectionArea.setLayout(selectionAreaLayout);
-
- occurrenceSelectionArea.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- // 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);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(singleRadio, XSDEditorCSHelpIds.REGEX_JUST_ONCE);
- ViewUtility.createHorizontalFiller(occurrenceSelectionArea, 1);
-
- starRadio = addOccurenceRadioButton(RegexNode.STAR, occurrenceSelectionArea, radioSelectListener);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(starRadio, XSDEditorCSHelpIds.REGEX_ZERO_OR_MORE);
- ViewUtility.createHorizontalFiller(occurrenceSelectionArea, 1);
-
- plusRadio = addOccurenceRadioButton(RegexNode.PLUS, occurrenceSelectionArea, radioSelectListener);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(plusRadio, XSDEditorCSHelpIds.REGEX_ONE_OR_MORE);
- ViewUtility.createHorizontalFiller(occurrenceSelectionArea, 1);
-
- optionalRadio = addOccurenceRadioButton(RegexNode.OPTIONAL, occurrenceSelectionArea, radioSelectListener);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(optionalRadio, XSDEditorCSHelpIds.REGEX_OPTIONAL);
- ViewUtility.createHorizontalFiller(occurrenceSelectionArea, 1);
-
- repeatRadio = addOccurenceRadioButton(RegexNode.REPEAT, occurrenceSelectionArea, radioSelectListener);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(repeatRadio, XSDEditorCSHelpIds.REGEX_REPEAT_RADIO);
-
- repeatValue = new Text(occurrenceSelectionArea, SWT.SINGLE | SWT.BORDER);
- repeatValue.addListener(SWT.Modify, textListener);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(repeatValue, XSDEditorCSHelpIds.REGEX_REPEAT_FIELD);
- repeatValue.setToolTipText(XSDEditorPlugin.getXSDString("_UI_TOOLTIP_REGEX_WIZARD_REPEAT"));
- repeatValue.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- setEnabledStatus(RegexNode.REPEAT, false);
-
- rangeRadio = addOccurenceRadioButton(RegexNode.RANGE, occurrenceSelectionArea, radioSelectListener);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(rangeRadio, XSDEditorCSHelpIds.REGEX_RANGE_RADIO);
-
- // Add text fields and labels for specifying the range
- Composite rangeWidgets = new Composite(occurrenceSelectionArea, SWT.NONE);
- GridLayout gridLayout = new GridLayout(3, false);
- gridLayout.marginHeight = 0;
- gridLayout.marginWidth = 0;
- rangeWidgets.setLayout(gridLayout);
- rangeWidgets.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- rangeMinValue = new Text(rangeWidgets, SWT.SINGLE | SWT.BORDER);
- rangeMinValue.addListener(SWT.Modify, textListener);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(rangeMinValue, XSDEditorCSHelpIds.REGEX_RANGE_MINIMUM_FIELD);
- rangeMinValue.setToolTipText(XSDEditorPlugin.getXSDString("_UI_TOOLTIP_REGEX_WIZARD_MIN"));
- rangeMinValue.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- 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"));
- PlatformUI.getWorkbench().getHelpSystem().setHelp(rangeMaxValue, XSDEditorCSHelpIds.REGEX_RANGE_MAXIMUM_FIELD);
- rangeMaxValue.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- setEnabledStatus(RegexNode.RANGE, false);
-
- singleRadio.setSelection(true);
-
- // The add button
- add = new Button(composite, SWT.PUSH);
- add.addSelectionListener(new ButtonSelectListener());
- add.setText(XSDEditorPlugin.getXSDString("_UI_REGEX_WIZARD_ADD_BUTTON_LABEL"));
- PlatformUI.getWorkbench().getHelpSystem().setHelp(add, XSDEditorCSHelpIds.REGEX_ADD_BUTTON);
- 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);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(value, XSDEditorCSHelpIds.REGEX_CURRENT_VALUE);
- 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); //$NON-NLS-1$
- }
-
- 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()); //$NON-NLS-1$
- System.out.println("currentError.start: " + currentError.start); //$NON-NLS-1$
- }
-
- 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
- {
- 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"); //$NON-NLS-1$
- 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()); //$NON-NLS-1$
- }
- }
-
- }
-
-
- /* 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;
- }
- }
- }
-
- public String getValue()
- {
- return value.getText();
- }
-}
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
deleted file mode 100644
index 64bbebcc07..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/wizards/RegexNode.java
+++ /dev/null
@@ -1,421 +0,0 @@
-/*******************************************************************************
- * 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.internal.wizards;
-
-import org.eclipse.wst.xsd.ui.internal.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
deleted file mode 100644
index 488c6ea155..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/wizards/RegexTestingPage.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * 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.osgi.util.TextProcessor;
-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.PlatformUI;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorCSHelpIds;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-import org.eclipse.wst.xsd.ui.internal.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);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, XSDEditorCSHelpIds.REGEX_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);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(testString, XSDEditorCSHelpIds.REGEX_SAMPLE_TEXT);
- 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 = 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);
-
- getFlags();
- value.setText(TextProcessor.process(getPatternValue()));
- 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
deleted file mode 100644
index d341f661dc..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/wizards/RegexWizard.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.ui.internal.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.png"));
-
- 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 canFinish()
- {
- return (compositionPage.getValue().length() > 0);
- }
-
- 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
deleted file mode 100644
index f709f10b7b..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/wizards/XSDLocationChoicePage.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * 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.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.ui.internal.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
deleted file mode 100644
index f1c1e0b287..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/wizards/XSDNewFilePage.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*******************************************************************************
- * 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.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.ui.internal.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
deleted file mode 100644
index 40c1bef077..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/wizards/XSDSelectIncludeFileWizard.java
+++ /dev/null
@@ -1,371 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * 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.ui.internal.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.png"));
-
- 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.getLocationURI().toString();
- 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/ui/internal/adt/actions/AddFieldAction.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/AddFieldAction.java
deleted file mode 100644
index d41124077a..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/AddFieldAction.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * 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.internal.adt.actions;
-
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.views.contentoutline.ContentOutline;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDAdapterFactory;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.BaseFieldEditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IComplexType;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IField;
-import org.eclipse.wst.xsd.ui.internal.common.commands.BaseCommand;
-
-
-public class AddFieldAction extends BaseSelectionAction
-{
- public static String ID = "AddFieldAction"; //$NON-NLS-1$
-
- public AddFieldAction(IWorkbenchPart part)
- {
- super(part);
- setId(ID);
- setText(Messages._UI_ACTION_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 = type.getAddNewFieldCommand(""); //$NON-NLS-1$
- if (command != null)
- {
- getCommandStack().execute(command);
- Adapter adapter = XSDAdapterFactory.getInstance().adapt(((BaseCommand)command).getAddedComponent());
- selectAddedComponent(adapter);
- }
- else
- {
- //TODO ... pop up a command not implemented message
- }
- }
- }
- }
-
- protected void doEdit(Object obj, IWorkbenchPart part)
- {
- if (obj instanceof BaseFieldEditPart)
- {
- BaseFieldEditPart editPart = (BaseFieldEditPart)obj;
- editPart.doEditName(!(part instanceof ContentOutline));
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/BaseDirectEditAction.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/BaseDirectEditAction.java
deleted file mode 100644
index 70141bec15..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/BaseDirectEditAction.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * 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.internal.adt.actions;
-
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.GraphicalViewer;
-import org.eclipse.gef.ui.actions.DirectEditAction;
-import org.eclipse.gef.ui.parts.AbstractEditPartViewer;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter;
-
-
-public class BaseDirectEditAction extends DirectEditAction {
- protected ISelectionProvider provider;
-
- /**
- * Same as {@link #DirectEditAction(IWorkbenchPart)}.
- * @param editor the editor
- */
- public BaseDirectEditAction(IEditorPart editor) {
- super((IWorkbenchPart)editor);
- }
-
- /**
- * Constructs a DirectEditAction using the specified part.
- * @param part the workbench part
- */
- public BaseDirectEditAction(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) {
- Object selection = provider.getSelection();
- if (selection instanceof StructuredSelection) {
- Object object = ((StructuredSelection) selection).getFirstElement();
- if (object instanceof XSDBaseAdapter) {
- // We need to return an EditPart as the selection.
- IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
- Object graphicalViewer = editor.getAdapter(GraphicalViewer.class);
- if (graphicalViewer instanceof AbstractEditPartViewer) {
- AbstractEditPartViewer viewer = (AbstractEditPartViewer) graphicalViewer;
- EditPart editPart = (EditPart)viewer.getEditPartRegistry().get(object);
- return new StructuredSelection(editPart);
- }
- }
- }
- }
-
- return super.getSelection();
- }
-
- protected boolean calculateEnabled() {
- Object selection = ((IStructuredSelection) getSelection()).getFirstElement();
-
- if (selection instanceof XSDBaseAdapter) {
- return !((XSDBaseAdapter) selection).isReadOnly();
- }
-
- return true;
- }
-
- /* (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;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/BaseSelectionAction.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/BaseSelectionAction.java
deleted file mode 100644
index e52ea3a1a5..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/BaseSelectionAction.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.adt.actions;
-
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.gef.GraphicalViewer;
-import org.eclipse.gef.ui.actions.SelectionAction;
-import org.eclipse.gef.ui.parts.AbstractEditPartViewer;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IGraphElement;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IComplexType;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IField;
-
-public abstract class BaseSelectionAction extends SelectionAction
-{
- public static final String SEPARATOR_ID = "org.eclipse.jface.action.Separator"; //$NON-NLS-1$
- public static final String SUBMENU_START_ID = "SUBMENU_START_ID: "; //$NON-NLS-1$
- public static final String SUBMENU_END_ID = "SUBMENU_END_ID: "; //$NON-NLS-1$
-
- protected ISelectionProvider provider;
- protected boolean doDirectEdit = true;
-
- 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.ui.internal.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();
- }
- else if (o instanceof IGraphElement)
- {
- return !((IGraphElement)o).isReadOnly();
- }
- }
- return true;
- }
-
- protected void selectAddedComponent(final Adapter adapter)
- {
- Runnable runnable = new Runnable()
- {
- public void run()
- {
- if (adapter != null)
- {
- provider.setSelection(new StructuredSelection(adapter));
- if (doDirectEdit)
- activateDirectEdit();
- }
- }
- };
- Display.getCurrent().asyncExec(runnable);
- }
-
- protected void activateDirectEdit()
- {
- if (getWorkbenchPart() instanceof IEditorPart)
- {
- try
- {
- IEditorPart owningEditor = (IEditorPart)getWorkbenchPart();
- IWorkbench workbench = PlatformUI.getWorkbench();
- IWorkbenchPart part = workbench.getActiveWorkbenchWindow().getActivePage().getActivePart();
- Object object = owningEditor.getAdapter(GraphicalViewer.class);
- if (object instanceof AbstractEditPartViewer)
- {
- AbstractEditPartViewer viewer = (AbstractEditPartViewer)object;
- Object obj = viewer.getSelectedEditParts().get(0);
- doEdit(obj, part);
- }
- }
- catch (Exception e)
- {
-
- }
- }
- }
-
- protected void doEdit(Object obj, IWorkbenchPart part)
- {
-
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/CaptureScreenAction.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/CaptureScreenAction.java
deleted file mode 100644
index c0d0430814..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/CaptureScreenAction.java
+++ /dev/null
@@ -1,263 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.adt.actions;
-
-import java.io.File;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.LayoutManager;
-import org.eclipse.draw2d.SWTGraphics;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.GraphicalViewer;
-import org.eclipse.gef.LayerConstants;
-import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
-import org.eclipse.gef.editparts.LayerManager;
-import org.eclipse.gef.editparts.ScalableRootEditPart;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.ImageData;
-import org.eclipse.swt.graphics.ImageLoader;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.xsd.ui.internal.adt.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.design.layouts.FillLayout;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-
-public class CaptureScreenAction extends Action
-{
-
- private static String LAST_SCREEN_CAPTURE_PATH = System.getProperty("user.home"); //$NON-NLS-1$
- private static String LAST_SCREEN_CAPTURE_FILE_NAME = Messages._UI_ACTION_CAPTURE_SCREEN_DEFAULT_FILE_NAME;
- private static String LAST_SCREEN_CAPTURE_FILE_EXTENSION = ".jpg"; //$NON-NLS-1$
-
- public CaptureScreenAction()
- {
- setText(Messages._UI_CAPTURE_SCREEN_ACTION_TEXT);
- setToolTipText(Messages._UI_CAPTURE_SCREEN_ACTION_TOOLTIPTEXT);
- setImageDescriptor(XSDEditorPlugin.getImageDescriptor("icons/etool16/capturescreen.gif")); //$NON-NLS-1$
- setDisabledImageDescriptor(XSDEditorPlugin.getImageDescriptor("icons/dtool16/capturescreen.gif")); //$NON-NLS-1$
- setAccelerator(SWT.CTRL | SWT.SHIFT | 'X'); //$NON-NLS-1$
- }
-
- public void run()
- {
- ImageExporter imageExporter = new ImageExporter();
- imageExporter.save(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(), (GraphicalViewer) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor().getAdapter(GraphicalViewer.class));
- }
-
- public class ImageExporter
- {
- private static final String FILE_FORMATS = "*.jpeg;*.jfif;*.jpg;*.jpe;*.png;*.bmp;*.ico"; //$NON-NLS-1$
- private static final String FILE_SEPARATOR = "file.separator"; //$NON-NLS-1$
-
- public boolean save(IEditorPart editorPart, GraphicalViewer viewer, String saveFilePath, int format)
- {
- Assert.isNotNull(editorPart, "null editorPart passed to ImageExporter.save"); //$NON-NLS-1$
- Assert.isNotNull(viewer, "null viewer passed to ImageExporter.save"); //$NON-NLS-1$
- Assert.isNotNull(saveFilePath, "null saveFilePath passed to ImageExporter.save"); //$NON-NLS-1$
-
- if (format != SWT.IMAGE_BMP && format != SWT.IMAGE_JPEG && format != SWT.IMAGE_ICO && format != SWT.IMAGE_PNG)
- throw new IllegalArgumentException(Messages._UI_ACTION_CAPTURE_SCREEN_FORMAT_NOT_SUPPORTED);
-
- try
- {
- saveEditorContentsAsImage(editorPart, viewer, saveFilePath, format);
- }
- catch (Exception ex)
- {
- MessageDialog.openError(editorPart.getEditorSite().getShell(), Messages._UI_ACTION_CAPTURE_SCREEN_ERROR_TITLE, Messages._UI_ACTION_CAPTURE_SCREEN_ERROR_DESCRIPTION);
- return false;
- }
-
- return true;
- }
-
- public boolean save(IEditorPart editorPart, GraphicalViewer viewer)
- {
- Assert.isNotNull(editorPart, "null editorPart passed to ImageExporter.save"); //$NON-NLS-1$
- Assert.isNotNull(viewer, "null viewer passed to ImageExporter.save"); //$NON-NLS-1$
-
- String saveFilePath = getSaveFilePath(editorPart, viewer);
- if (saveFilePath == null)
- return false;
-
- File file = new File(saveFilePath);
- if (file.exists() && file.isFile())
- {
- if (!MessageDialog.openQuestion(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), Messages._UI_ACTION_CAPTURE_SCREEN_OVERWRITE_CONFIRMATION_QUESTION, Messages._UI_ACTION_CAPTURE_SCREEN_OVERWRITE_CONFIRMATION.replace("{0}", saveFilePath))) //$NON-NLS-1$
- {
- return false;
- }
- }
-
- int format = -1;
- String saveFilePathLowerCase = saveFilePath.toLowerCase();
- if (saveFilePathLowerCase.endsWith(".jpeg") || saveFilePathLowerCase.endsWith(".jpg") || saveFilePathLowerCase.endsWith(".jpe") || saveFilePathLowerCase.endsWith(".jfif")) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- format = SWT.IMAGE_JPEG;
- else if (saveFilePathLowerCase.endsWith(".bmp")) //$NON-NLS-1$
- format = SWT.IMAGE_BMP;
- else if (saveFilePathLowerCase.endsWith(".ico")) //$NON-NLS-1$
- format = SWT.IMAGE_ICO;
- else if (saveFilePathLowerCase.endsWith(".png")) //$NON-NLS-1$
- format = SWT.IMAGE_PNG;
- else if (saveFilePathLowerCase.endsWith(".gif")) //$NON-NLS-1$
- format = SWT.IMAGE_GIF;
-
- if(format != -1) {
- return save(editorPart, viewer, saveFilePath, format);
- } else {
- return false;
- }
-
- }
-
- private String getSaveFilePath(IEditorPart editorPart, GraphicalViewer viewer)
- {
- String filePath;
-
- FileDialog fileDialog = new FileDialog(editorPart.getEditorSite().getShell(), SWT.SAVE);
-
- String[] filterExtensions = new String[] {FILE_FORMATS}; //$NON-NLS-1$
-
- fileDialog.setFileName(obtainNextFileName());
- fileDialog.setFilterExtensions(filterExtensions);
- fileDialog.setFilterNames(new String[] {FILE_FORMATS});
- fileDialog.setText(Messages._UI_ACTION_CAPTURE_SCREEN_FILE_SAVE_DIALOG_TITLE);
-
- filePath = fileDialog.open();
-
- if (filePath != null)
- {
- LAST_SCREEN_CAPTURE_PATH = fileDialog.getFilterPath();
- String fileName = fileDialog.getFileName();
- if (fileName.indexOf('.') > 0) {
- LAST_SCREEN_CAPTURE_FILE_NAME = fileName.substring(0, fileName.indexOf('.'));
- LAST_SCREEN_CAPTURE_FILE_EXTENSION = fileName.substring(fileName.indexOf('.'));
- }
- else
- {
- LAST_SCREEN_CAPTURE_FILE_NAME = fileName;
- LAST_SCREEN_CAPTURE_FILE_EXTENSION = ""; //$NON-NLS-1$
- }
- }
- return filePath;
- }
-
- private void saveEditorContentsAsImage(IEditorPart editorPart, GraphicalViewer viewer, String saveFilePath, int format)
- {
- /*
- * 1. First get the figure whose visuals we want to save as image. So we
- * would like to save the rooteditpart which actually hosts all the
- * printable layers.
- *
- * NOTE: ScalableRootEditPart manages layers and is registered
- * graphicalviewer's editpartregistry with the key LayerManager.ID ...
- * well that is because ScalableRootEditPart manages all layers that are
- * hosted on a FigureCanvas. Many layers exist for doing different things
- */
- ScalableRootEditPart rootEditPart = (ScalableRootEditPart) viewer.getEditPartRegistry().get(LayerManager.ID);
- IFigure rootFigure = ((LayerManager) rootEditPart).getLayer(LayerConstants.PRINTABLE_LAYERS);// rootEditPart.getFigure();
-
- Rectangle rootFigureBounds = new Rectangle(new Point(0,0),rootFigure.getPreferredSize());
- List rootEditPartChildren = rootEditPart.getChildren();
- Iterator rootEditPartChildrenIterator = rootEditPartChildren.iterator();
- while(rootEditPartChildrenIterator.hasNext()) {
- Object object = rootEditPartChildrenIterator.next();
- if(object instanceof AbstractGraphicalEditPart) {
- AbstractGraphicalEditPart childAbstractGraphicalEditPart = (AbstractGraphicalEditPart)object;
- List grandChildren = childAbstractGraphicalEditPart.getChildren();
- Iterator grandChildrenIterator = grandChildren.iterator();
- while(grandChildrenIterator.hasNext()) {
- AbstractGraphicalEditPart grandChildAbstractGraphicalEditPart = (AbstractGraphicalEditPart)grandChildrenIterator.next();
- IFigure figure = grandChildAbstractGraphicalEditPart.getFigure();
- LayoutManager layoutManager = figure.getLayoutManager();
- if(layoutManager instanceof FillLayout) {
- rootFigureBounds = rootFigure.getBounds();
- }
- }
- }
- }
-
- /*
- * 2. Now we want to get the GC associated with the control on which all
- * figures are painted by SWTGraphics. For that first get the SWT Control
- * associated with the viewer on which the rooteditpart is set as contents
- */
- Control figureCanvas = viewer.getControl();
- GC figureCanvasGC = new GC(figureCanvas);
-
- /*
- * 3. Create a new Graphics for an Image onto which we want to paint
- * rootFigure
- */
- Image img = new Image(null, rootFigureBounds.width, rootFigureBounds.height);
- GC imageGC = new GC(img);
- imageGC.setBackground(figureCanvasGC.getBackground());
- imageGC.setForeground(figureCanvasGC.getForeground());
- imageGC.setFont(figureCanvasGC.getFont());
- imageGC.setLineStyle(figureCanvasGC.getLineStyle());
- imageGC.setLineWidth(figureCanvasGC.getLineWidth());
- imageGC.setXORMode(figureCanvasGC.getXORMode());
- Graphics imgGraphics = new SWTGraphics(imageGC);
-
- /* 4. Draw rootFigure onto image. After that image will be ready for save */
- rootFigure.paint(imgGraphics);
-
- /* 5. Save image */
- ImageData[] imgData = new ImageData[1];
- imgData[0] = img.getImageData();
-
- ImageLoader imgLoader = new ImageLoader();
- imgLoader.data = imgData;
- imgLoader.save(saveFilePath, format);
-
- /* release OS resources */
- figureCanvasGC.dispose();
- imageGC.dispose();
- img.dispose();
-
- }
-
- String obtainNextFileName()
- {
-
- int aux = LAST_SCREEN_CAPTURE_FILE_NAME.length() - 1;
- while (Character.isDigit(LAST_SCREEN_CAPTURE_FILE_NAME.charAt(aux)))
- {
- aux--;
- }
-
- String nonNumeratedfileName = LAST_SCREEN_CAPTURE_FILE_NAME.substring(0, aux + 1);
- String filePath = LAST_SCREEN_CAPTURE_PATH + System.getProperty(FILE_SEPARATOR) + nonNumeratedfileName + LAST_SCREEN_CAPTURE_FILE_EXTENSION; //$NON-NLS-1$
-
- int counter = 1;
- File file = new File(filePath);
- while (file.exists())
- {
- filePath = LAST_SCREEN_CAPTURE_PATH + System.getProperty(FILE_SEPARATOR) + nonNumeratedfileName + counter++ + LAST_SCREEN_CAPTURE_FILE_EXTENSION; //$NON-NLS-1$
- file = new File(filePath);
- }
-
- return filePath;
- }
-
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/DeleteAction.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/DeleteAction.java
deleted file mode 100644
index 9a634c1775..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/DeleteAction.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.adt.actions;
-
-import java.util.Iterator;
-
-import org.eclipse.gef.GraphicalViewer;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter;
-import org.eclipse.wst.xsd.ui.internal.adt.design.DesignViewGraphicalViewer;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IGraphElement;
-import org.eclipse.wst.xsd.ui.internal.adt.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IModel;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-
-public class DeleteAction extends BaseSelectionAction
-{
- public final static String ID = "org.eclipse.wst.xsd.ui.internal.editor.DeleteAction"; //$NON-NLS-1$
- public DeleteAction(IWorkbenchPart part)
- {
- super(part);
- setText(Messages._UI_ACTION_DELETE);
- setId(ID);
- setImageDescriptor(XSDEditorPlugin.getImageDescriptor("icons/delete_obj.gif") ); //$NON-NLS-1$
- }
-
- public void run()
- {
- for (Iterator i = ((IStructuredSelection) getSelection()).iterator(); i.hasNext(); )
- {
- Object selection = i.next();
- Command command = null;
- boolean doSetInput = false;
- boolean doSetModelAsInput = false;
- IADTObject topLevelContainer = null;
- IModel model = null;
-
- if (selection instanceof IGraphElement)
- {
- IGraphElement xsdObj = (IGraphElement)selection;
-
- if (xsdObj instanceof XSDBaseAdapter)
- {
- XSDBaseAdapter baseAdapter = (XSDBaseAdapter)xsdObj;
-
- // Do not delete selected item if it is read-only, or if the item selected
- // is null and the read only check cannot be completed
- if (baseAdapter == null || baseAdapter.isReadOnly())
- {
- continue;
- }
-
- topLevelContainer = xsdObj.getTopContainer();
- if (topLevelContainer == selection)
- {
- doSetInput = true;
- doSetModelAsInput = true;
- }
- command = xsdObj.getDeleteCommand();
- model = xsdObj.getModel();
- }
- }
-
- if (command != null)
- {
- IWorkbench workbench = PlatformUI.getWorkbench();
- if (workbench != null)
- {
- IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
- if (workbenchWindow != null && workbenchWindow.getActivePage() != null)
- {
- IEditorPart editorPart = workbenchWindow.getActivePage().getActiveEditor();
- if (editorPart != null)
- {
- Object viewer = editorPart.getAdapter(GraphicalViewer.class);
- if (viewer instanceof DesignViewGraphicalViewer)
- {
- Object input = ((DesignViewGraphicalViewer)viewer).getInput();
- if (input != selection)
- {
- // Bug 86218 : Don't switch to top level view if the object we're deleting
- // is not the input to the viewer
- doSetInput = false;
- }
- }
- }
- }
- }
- command.execute();
- if (doSetInput)
- {
- if (model != null && doSetModelAsInput)
- provider.setSelection(new StructuredSelection(model));
- else if (topLevelContainer != null && !doSetModelAsInput)
- provider.setSelection(new StructuredSelection(topLevelContainer));
- }
- }
- }
-
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/DesignSelectAll.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/DesignSelectAll.java
deleted file mode 100644
index 61da6b4ac7..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/DesignSelectAll.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.adt.actions;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gef.GraphicalViewer;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.wst.xsd.ui.internal.adt.editor.CommonMultiPageEditor;
-import org.eclipse.wst.xsd.ui.internal.adt.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.design.editparts.CategoryEditPart;
-import org.eclipse.wst.xsd.ui.internal.design.editparts.XSDSchemaEditPart;
-
-public class DesignSelectAll extends BaseSelectionAction
-{
- private GraphicalViewer graphicalViewer;
- private List selected;
-
- public DesignSelectAll(IWorkbenchPart part)
- {
- super(part);
- setId(ActionFactory.SELECT_ALL.getId());
- setText(Messages._UI_ACTION_SELECT_ALL);
- }
-
- public void run()
- {
- super.run();
-
- IWorkbenchPart part = getWorkbenchPart();
- selected = new ArrayList();
- if (part instanceof CommonMultiPageEditor)
- {
- graphicalViewer = (GraphicalViewer) ((CommonMultiPageEditor) part).getAdapter(GraphicalViewer.class);
- if (graphicalViewer != null)
- {
- EditPart editPart = graphicalViewer.getContents();
- doSelectChildren(editPart);
-
- graphicalViewer.setSelection(new StructuredSelection(selected));
- }
- }
- }
-
- private void doSelectChildren(EditPart editPart)
- {
- List list = editPart.getChildren();
- for (Iterator i = list.iterator(); i.hasNext();)
- {
- Object o = i.next();
- if (o instanceof GraphicalEditPart)
- {
- if (!(o instanceof XSDSchemaEditPart) && !(o instanceof CategoryEditPart))
- {
- selected.add(o);
- }
- doSelectChildren((GraphicalEditPart) o);
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/SetInputToGraphView.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/SetInputToGraphView.java
deleted file mode 100644
index c5f9301298..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/SetInputToGraphView.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.adt.actions;
-
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.GraphicalViewer;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.wst.xsd.ui.internal.adt.design.DesignViewGraphicalViewer;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.RootContentEditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-
-public class SetInputToGraphView extends BaseSelectionAction
-{
- public static String ID = "SetAsFocus"; //$NON-NLS-1$
- protected IEditorPart editorPart;
- protected Object input;
-
- public SetInputToGraphView(IWorkbenchPart part)
- {
- this(part, null);
- }
-
- public SetInputToGraphView(IWorkbenchPart part, Object input)
- {
- super(part);
- this.input = input;
- setId(ID);
- setText(Messages._UI_ACTION_SET_AS_FOCUS);
- if (part instanceof IEditorPart)
- {
- editorPart = (IEditorPart)part;
- }
- }
-
- protected boolean calculateEnabled()
- {
- return true;
- }
-
- public void run()
- {
- Object selection = input;
- if (selection == null)
- {
- selection = ((IStructuredSelection) getSelection()).getFirstElement();
- }
- Object adapter = getWorkbenchPart().getAdapter(GraphicalViewer.class);
-
- if (selection instanceof IADTObject)
- {
- IADTObject obj = (IADTObject) selection;
- if (adapter instanceof DesignViewGraphicalViewer)
- {
- DesignViewGraphicalViewer graphicalViewer = (DesignViewGraphicalViewer) adapter;
- EditPart editPart = graphicalViewer.getInputEditPart();
- if (editPart instanceof RootContentEditPart)
- {
- graphicalViewer.setInputAndMarkLocation(obj);
- }
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/ShowPropertiesViewAction.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/ShowPropertiesViewAction.java
deleted file mode 100644
index e3d232f072..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/ShowPropertiesViewAction.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * 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.internal.adt.actions;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.wst.xsd.ui.internal.adt.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-
-
-/**
- * Show the properties view in the current perspective.
- */
-public class ShowPropertiesViewAction extends BaseSelectionAction
-{
- public static final String ID = "org.eclipse.wst.xsd.ui.internal.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(Messages._UI_ACTION_SHOW_PROPERTIES);
- setToolTipText(getText());
- setImageDescriptor(XSDEditorPlugin.getImageDescriptor("icons/elcl16/showproperties_obj.gif") ); //$NON-NLS-1$
- setDisabledImageDescriptor(XSDEditorPlugin.getImageDescriptor("icons/dlcl16/showproperties_obj.gif") ); //$NON-NLS-1$
- }
-
- 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/ui/internal/adt/design/ADTFloatingToolbar.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/ADTFloatingToolbar.java
deleted file mode 100644
index b827ca52e7..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/ADTFloatingToolbar.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.adt.design;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.ui.parts.GraphicalViewerImpl;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Canvas;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.ADTFloatingToolbarEditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IModel;
-
-public class ADTFloatingToolbar extends GraphicalViewerImpl
-{
- protected IModel model;
- protected boolean isDrilledDown;
- protected ADTFloatingToolbarEditPart editPart;
-
- public ADTFloatingToolbar(IModel model)
- {
- this.model = model;
- }
-
- public void setModel(IModel model)
- {
- this.model = model;
- editPart = (ADTFloatingToolbarEditPart)getEditPartFactory().createEditPart(null, new ADTFloatingToolbarModel(model));
- if (editPart == null)
- {
- editPart = new ADTFloatingToolbarEditPart(model);
- }
- editPart.setModel(model);
- setContents(editPart);
- }
-
- public Control createControl(Composite composite)
- {
- Canvas canvas = new Canvas(composite, SWT.NONE);
- canvas.setBackground(ColorConstants.white);
- setControl(canvas);
- return getControl();
- }
-
- public void refresh(boolean isDrilledDown)
- {
- this.isDrilledDown = isDrilledDown;
- if (editPart != null) {
- editPart.setIsDrilledDown(isDrilledDown);
- }
- EditPart contents = getContents();
- if (contents != null) {
- contents.refresh();
- }
- }
-
- public class ADTFloatingToolbarModel
- {
- IModel model;
- public ADTFloatingToolbarModel(IModel model)
- {
- this.model = model;
- }
-
- public IModel getModel()
- {
- return model;
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/BaseGraphicalViewerKeyHandler.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/BaseGraphicalViewerKeyHandler.java
deleted file mode 100644
index dfc4e82478..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/BaseGraphicalViewerKeyHandler.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.adt.design;
-
-import org.eclipse.draw2d.FigureCanvas;
-import org.eclipse.draw2d.PositionConstants;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gef.GraphicalViewer;
-import org.eclipse.gef.ui.actions.ActionRegistry;
-import org.eclipse.gef.ui.parts.GraphicalViewerKeyHandler;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyEvent;
-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.ui.internal.adt.design.editpolicies.KeyBoardAccessibilityEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.common.actions.OpenInNewEditor;
-
-/**
- * This key handler is designed to be re-used by both the WSDL and XSD editor
- */
-public class BaseGraphicalViewerKeyHandler extends GraphicalViewerKeyHandler
-{
- public BaseGraphicalViewerKeyHandler(GraphicalViewer viewer)
- {
- super(viewer);
- }
-
- public boolean keyPressed(KeyEvent event)
- {
- int direction = -1;
- boolean isAltDown = (event.stateMask & SWT.ALT) != 0;
- boolean isCtrlDown = (event.stateMask & SWT.CTRL) != 0;
- switch (event.keyCode)
- {
- case SWT.ARROW_LEFT : {
- direction = PositionConstants.WEST;
- break;
- }
- case SWT.ARROW_RIGHT : {
- direction = PositionConstants.EAST;
- break;
- }
- case SWT.ARROW_UP : {
- direction = isAltDown ? KeyBoardAccessibilityEditPolicy.OUT_TO_PARENT : PositionConstants.NORTH;
- break;
- }
- case SWT.ARROW_DOWN : {
- direction = isAltDown ? KeyBoardAccessibilityEditPolicy.IN_TO_FIRST_CHILD : PositionConstants.SOUTH;
- break;
- }
- }
-
- if (direction != -1)
- {
- GraphicalEditPart focusEditPart = getFocusEditPart();
- KeyBoardAccessibilityEditPolicy policy = (KeyBoardAccessibilityEditPolicy)focusEditPart.getEditPolicy(KeyBoardAccessibilityEditPolicy.KEY);
-
- if (policy != null)
- {
- EditPart target = policy.getRelativeEditPart(focusEditPart, direction);
- if (target != null)
- {
- if(isCtrlDown) {
-
- IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
- Object keyboardDrag = editor.getAdapter(IKeyboardDrag.class);
- if (keyboardDrag instanceof IKeyboardDrag) {
- ((IKeyboardDrag) keyboardDrag).performKeyboardDrag(focusEditPart, direction);
- return true;
- }
- }
- else {
- navigateTo(target, event);
- return true;
- }
- }
- }
- }
-
- switch (event.keyCode)
- {
- case SWT.PAGE_DOWN :
- {
- if (scrollPage(event, PositionConstants.SOUTH))
- return true;
- }
- case SWT.PAGE_UP :
- {
- if (scrollPage(event, PositionConstants.NORTH))
- return true;
- }
- case SWT.F3 :
- case SWT.CR :
- {
- IWorkbench workbench = PlatformUI.getWorkbench();
- IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
- IEditorPart editorPart = workbenchWindow.getActivePage().getActiveEditor();
- ActionRegistry registry = (ActionRegistry) editorPart.getAdapter(ActionRegistry.class);
- if (registry != null)
- {
- IAction action = registry.getAction(OpenInNewEditor.ID);
- if (action != null)
- action.run();
- }
- }
- /*
- case SWT.F5 :
- {
- IEditorPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
- if (part != null)
- {
- EditorModeManager manager = (EditorModeManager)part.getAdapter(EditorModeManager.class);
- EditorMode[] modes = manager.getModes();
- EditorMode mode = manager.getCurrentMode();
- List list = Arrays.asList(modes);
- int index = list.indexOf(mode);
- int nextIndex = index + 1;
- if (nextIndex < modes.length)
- {
- mode = (EditorMode)list.get(nextIndex);
- }
- else
- {
- mode = (EditorMode)list.get(0);
- }
- if (mode != manager.getCurrentMode())
- {
- manager.setCurrentMode(mode);
- }
- }
- return true;
- }*/
- }
- return super.keyPressed(event);
- }
-
- private boolean scrollPage(KeyEvent event, int direction)
- {
- if (!(getViewer().getControl() instanceof FigureCanvas))
- return false;
- FigureCanvas figCanvas = (FigureCanvas) getViewer().getControl();
- Point loc = figCanvas.getViewport().getViewLocation();
- Rectangle area = figCanvas.getViewport().getClientArea(Rectangle.SINGLETON).scale(.8);
- if (direction == PositionConstants.NORTH)
- {
- figCanvas.scrollToY(loc.y - area.height);
- }
- else
- {
- figCanvas.scrollToY(loc.y + area.height);
- }
- return true;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/DesignViewContextMenuProvider.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/DesignViewContextMenuProvider.java
deleted file mode 100644
index a13e440666..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/DesignViewContextMenuProvider.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.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.ui.internal.adt.actions.BaseSelectionAction;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IActionProvider;
-import org.eclipse.wst.xsd.ui.internal.adt.editor.ContextMenuParticipant;
-import org.eclipse.wst.xsd.ui.internal.adt.editor.EditorModeManager;
-import org.eclipse.wst.xsd.ui.internal.adt.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.refactor.IXSDRefactorConstants;
-
-
-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;
-
- EditorModeManager manager = (EditorModeManager)editor.getAdapter(EditorModeManager.class);
- ContextMenuParticipant contextMenuParticipant = manager != null ? manager.getCurrentMode().getContextMenuParticipant() : null;
-
- 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 (contextMenuParticipant == null || contextMenuParticipant.isApplicable(selectedObject, id))
- {
- 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());
- IMenuManager subMenu = new MenuManager(Messages._UI_REFACTOR_CONTEXT_MENU, IXSDRefactorConstants.REFACTOR_CONTEXT_MENU_ID); //$NON-NLS-1$
- menu.add(subMenu);
- menu.add(new Separator());
- menu.add(new Separator("search-slot")); //$NON-NLS-1$
- menu.add(new Separator());
- menu.add(new Separator("endDesignMenu-slot")); // $NON-NLS-1$
- menu.add(new Separator());
- }
- }
- menu.add(new Separator());
- }
-
- 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/ui/internal/adt/design/DesignViewGraphicalViewer.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/DesignViewGraphicalViewer.java
deleted file mode 100644
index 381415ca8c..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/DesignViewGraphicalViewer.java
+++ /dev/null
@@ -1,449 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.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.ui.INavigationHistory;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.xsd.ui.internal.adapters.RedefineCategoryAdapter;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDRedefineAdapter;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.IHolderEditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.RootContentEditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.StructureEditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IGraphElement;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IModelProxy;
-import org.eclipse.wst.xsd.ui.internal.adt.editor.CommonSelectionManager;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IField;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IModel;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IStructure;
-import org.eclipse.wst.xsd.ui.internal.adt.outline.ADTContentOutlinePage;
-
-public class DesignViewGraphicalViewer extends ScrollingGraphicalViewer implements ISelectionChangedListener
-{
- protected ADTSelectionChangedListener internalSelectionProvider = new ADTSelectionChangedListener();
- protected InputChangeManager inputChangeManager = new InputChangeManager();
- private IEditorPart editorPart;
-
- public DesignViewGraphicalViewer(IEditorPart editor, CommonSelectionManager manager)
- {
- super();
- this.editorPart = editor;
- setContextMenu(new DesignViewContextMenuProvider(editor, this, this));
- editor.getEditorSite().registerContextMenu("org.eclipse.wst.xsd.ui.popup.graph", getContextMenu(), internalSelectionProvider, false); //$NON-NLS-1$
-
- // make the internalSelectionProvider listen to graph view selection changes
- addSelectionChangedListener(internalSelectionProvider);
- internalSelectionProvider.addSelectionChangedListener(manager);
- manager.addSelectionChangedListener(this);
-
- setKeyHandler(new BaseGraphicalViewerKeyHandler(this));
- }
-
-
- // 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 = null;
- ISelection eventSelection = event.getSelection();
- if (eventSelection instanceof StructuredSelection)
- {
- selectedObject = ((StructuredSelection) eventSelection).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 (selectedObject != null)
- {
- if (event.getSource() != internalSelectionProvider)
- {
- if (selectedObject instanceof IStructure)
- {
- if (((getInput() instanceof IModel) && (event.getSource() instanceof ADTContentOutlinePage)) ||
- (!(getInput() instanceof IModel)))
- {
- if ((selectedObject instanceof IGraphElement) && ((IGraphElement)selectedObject).isFocusAllowed())
- {
- if (!(event.getSource() instanceof org.eclipse.jface.viewers.IPostSelectionProvider))
- {
- setInputAndMarkLocation((IStructure)selectedObject);
- }
- }
- }
- }
- else if (selectedObject instanceof IGraphElement)
- {
- if (((IGraphElement)selectedObject).isFocusAllowed() && ((event.getSource() instanceof ADTContentOutlinePage)))
- {
- setInputAndMarkLocation((IADTObject)selectedObject);
- }
- else if (!((IGraphElement)selectedObject).isFocusAllowed())
- {
- // We encountered an object that is not a valid input to the graph viewer
- // Now find the top container that can be a valid input
- IADTObject obj = ((IGraphElement)selectedObject).getTopContainer();
- if (event.getSource() instanceof ADTContentOutlinePage)
- {
- // In this case, if the selection is originated from the outline, we should
- // change the inputs
- if (obj != null && getInput() != obj) // Don't change inputs if the obj is already the input
- setInputAndMarkLocation(obj);
- }
- else if (event.getSource() instanceof CommonSelectionManager)
- {
- // In this case, if the selection is originated from some action, ie. adding
- // a new element, we should change the input only if the current input is the model
- // otherwise, inputs will change unexpectedly!!
- if (getInput() instanceof IModel)
- {
- if (obj != null)
- setInput (obj);
- }
- }
- else if (event.getSource() instanceof org.eclipse.jface.viewers.IPostSelectionProvider )
- {
- // In this case, if the selection is originated from the source viewer
- // we should change the input regardless. Test is for multiple levels
- // of anonymous types
- if (obj != null)
- setInput (obj);
- }
- else
- {
- if (obj != null && getInput() instanceof IModel)
- setInputAndMarkLocation(obj);
- }
- }
- if (selectedObject instanceof IField)
- {
- IField field = (IField)selectedObject;
- if ( (!field.isGlobal() && getInput() instanceof IModel) ||
- (!field.isGlobal() && !(event.getSource() instanceof CommonSelectionManager)))
- {
- IADTObject obj = ((IGraphElement)selectedObject).getTopContainer();
- if (obj != null)
- setInputAndMarkLocation(obj);
- }
- else if (field.isGlobal() && !(getInput() instanceof IModel))
- {
- if (event.getSource() instanceof org.eclipse.jface.viewers.IPostSelectionProvider )
- setInput(field);
- else
- setInputAndMarkLocation(field);
- }
- }
- }
- else if (selectedObject instanceof IField)
- {
- IField field = (IField)selectedObject;
- if ( (field.isGlobal() && (getInput() instanceof IModel) && (event.getSource() instanceof ADTContentOutlinePage)) ||
- ( (field.isGlobal() && !(getInput() instanceof IModel))))
- {
- setInputAndMarkLocation(field);
- }
- }
- else if (selectedObject instanceof IModelProxy)
- {
- IModelProxy adapter = (IModelProxy)selectedObject;
- if (selectedObject instanceof RedefineCategoryAdapter)
- {
- RedefineCategoryAdapter selectionAdapter = (RedefineCategoryAdapter)selectedObject;
- XSDRedefineAdapter selectionParentAdapter = selectionAdapter.getXsdRedefineAdapter();
- setInputAndMarkLocation(selectionParentAdapter);
- }
- else if (getInput() != adapter.getModel())
- setInput(adapter.getModel());
- }
- else if (selectedObject instanceof IModel)
- {
- if (getInput() != selectedObject)
- setInput((IModel)selectedObject);
- }
-
- EditPart editPart = getEditPart(getRootEditPart(), selectedObject);
- if (editPart != null)
- {
- setSelection(new StructuredSelection(editPart));
- setFocus(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 && !(editPart instanceof IHolderEditPart) && !(editPart instanceof RootContentEditPart))
- {
- result = editPart;
- break;
- }
- }
-
- if (result == null)
- {
- for (Iterator i = parent.getChildren().iterator(); i.hasNext(); )
- {
- EditPart editPart = getEditPart((EditPart)i.next(), object);
- if (editPart != null)
- {
- // First check to see if there is a selection
- ISelection currentSelection = getSelection();
-
- // If there is a selection then we will try to select
- // the target edit part that is one of its children
- // This is handy when you add an element to a structured edit part
- // then you want to select the element immediately and put it in
- // direct edit mode
- if (currentSelection != null)
- {
- if (currentSelection instanceof StructuredSelection)
- {
- EditPart targetStructureEditPart = (EditPart)((StructuredSelection)currentSelection).getFirstElement();
- if (targetStructureEditPart != null)
- {
- while (targetStructureEditPart != null)
- {
- if (targetStructureEditPart instanceof StructureEditPart)
- {
- break;
- }
- targetStructureEditPart = targetStructureEditPart.getParent();
- }
- }
- EditPart potentialEditPartToSelect = editPart;
-
- while (potentialEditPartToSelect != null)
- {
- if (potentialEditPartToSelect instanceof StructureEditPart)
- {
- break;
- }
- potentialEditPartToSelect = potentialEditPartToSelect.getParent();
- }
-
- // If we found a potential edit part to select then return it
- // OR, if there is no target found, then we should just return
- // the edit part we found
- if (potentialEditPartToSelect == targetStructureEditPart || potentialEditPartToSelect == null || targetStructureEditPart == null)
- {
- result = editPart;
- break;
- }
- }
- }
- else // Otherwise just find the first one and return
- {
- result = editPart;
- break;
- }
- }
- }
- }
-
- return result;
- }
-
- public void setInputAndMarkLocation(IADTObject object)
- {
- IADTObject oldInput = getInput();
- INavigationHistory navigationHistory = null;
- IWorkbench workbench = PlatformUI.getWorkbench();
- if(workbench != null)
- {
- IWorkbenchWindow activeWorkbenchWindow = workbench.getActiveWorkbenchWindow();
- if(activeWorkbenchWindow != null)
- {
- IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
- if(activePage != null)
- {
- navigationHistory = activePage.getNavigationHistory();
- }
- }
- }
-
- setInput(object);
-
- if (editorPart != null && oldInput != object)
- {
- navigationHistory.markLocation(editorPart);
- }
- }
-
- public void setInput(IADTObject object)
- {
- RootContentEditPart rootContentEditPart = (RootContentEditPart)getRootEditPart().getContents();
- rootContentEditPart.setModel(object);
- rootContentEditPart.refresh();
-
- if (object != null)
- {
- inputChangeManager.setSelection(new StructuredSelection(object));
- }
- // Select the editpart when it is set as input
- EditPart editPart = getEditPart(rootContentEditPart, object);
- if (editPart != null)
- select(editPart);
- }
-
- public IADTObject getInput()
- {
- RootContentEditPart rootContentEditPart = (RootContentEditPart)getRootEditPart().getContents();
- return (IADTObject)rootContentEditPart.getModel();
- }
-
- public EditPart getInputEditPart()
- {
- return getRootEditPart().getContents();
- }
-
- public void addInputChangdListener(ISelectionChangedListener listener)
- {
- inputChangeManager.addSelectionChangedListener(listener);
- }
-
- public void removeInputChangdListener(ISelectionChangedListener listener)
- {
- inputChangeManager.removeSelectionChangedListener(listener);
- }
-
-
- private class InputChangeManager implements ISelectionProvider
- {
- List listeners = new ArrayList();
-
- public void addSelectionChangedListener(ISelectionChangedListener listener)
- {
- if (!listeners.contains(listener))
- {
- listeners.add(listener);
- }
- }
-
- public ISelection getSelection()
- {
- // no one should be calling this method
- return null;
- }
-
- public void removeSelectionChangedListener(ISelectionChangedListener listener)
- {
- listeners.remove(listener);
- }
-
- public void setSelection(ISelection selection)
- {
- notifyListeners(selection);
- }
-
- void notifyListeners(ISelection selection)
- {
- List list = new ArrayList(listeners);
- for (Iterator i = list.iterator(); i.hasNext(); )
- {
- ISelectionChangedListener listener = (ISelectionChangedListener)i.next();
- listener.selectionChanged(new SelectionChangedEvent(this, selection));
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/DesignViewerGraphicConstants.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/DesignViewerGraphicConstants.java
deleted file mode 100644
index 434e0d7f75..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/DesignViewerGraphicConstants.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * 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.internal.adt.design;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.widgets.Display;
-
-public interface DesignViewerGraphicConstants
-{
- public static final String SCALED_HANDLE_LAYER = "Scaled Handle Layer"; //$NON-NLS-1$
- public final static Font smallFont = new Font(Display.getCurrent(), "Tahoma", 6, SWT.NONE); //$NON-NLS-1$
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/FlatCCombo.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/FlatCCombo.java
deleted file mode 100644
index 4959363983..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/FlatCCombo.java
+++ /dev/null
@@ -1,1488 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.adt.design;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.ACC;
-import org.eclipse.swt.accessibility.AccessibleAdapter;
-import org.eclipse.swt.accessibility.AccessibleControlAdapter;
-import org.eclipse.swt.accessibility.AccessibleControlEvent;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.accessibility.AccessibleTextAdapter;
-import org.eclipse.swt.accessibility.AccessibleTextEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-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.Label;
-import org.eclipse.swt.widgets.Layout;
-import org.eclipse.swt.widgets.List;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.TypedListener;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-
-/**
- * The CCombo class represents a selectable user interface object
- * that combines a text field and a list and issues notification
- * when an item is selected from the list.
- * <p>
- * Note that although this class is a subclass of <code>Composite</code>,
- * it does not make sense to add children to it, or set a layout on it.
- * </p>
- * <dl>
- * <dt><b>Styles:</b>
- * <dd>BORDER, READ_ONLY, FLAT</dd>
- * <dt><b>Events:</b>
- * <dd>Selection</dd>
- * </dl>
- */
-public final class FlatCCombo extends Composite {
-
- Text text;
- List list;
- int visibleItemCount = 5;
- Shell popup;
- Label arrow;
- boolean hasFocus;
- Listener listener, filter;
- Color foreground, background;
- Font font;
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * lists the style constants that are applicable to the class.
- * Style bits are also inherited from superclasses.
- * </p>
- *
- * @param parent a widget which will be the parent of the new instance (cannot be null)
- * @param style the style of widget to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * </ul>
- *
- * @see SWT#BORDER
- * @see SWT#READ_ONLY
- * @see SWT#FLAT
- * @see org.eclipse.swt.widgets.Widget#getStyle()
- */
-public FlatCCombo (Composite parent, int style) {
- super (parent, style = checkStyle (style));
-
- int textStyle = SWT.SINGLE;
- if ((style & SWT.READ_ONLY) != 0) textStyle |= SWT.READ_ONLY;
- if ((style & SWT.FLAT) != 0) textStyle |= SWT.FLAT;
- text = new Text (this, textStyle);
- arrow = new Label(this, SWT.FLAT);
- arrow.setImage(XSDEditorPlugin.getXSDImage("icons/TriangleToolBar.gif")); //$NON-NLS-1$
-
- listener = new Listener () {
- public void handleEvent (Event event) {
- if (popup == event.widget) {
- popupEvent (event);
- return;
- }
- if (text == event.widget) {
- textEvent (event);
- return;
- }
- if (list == event.widget) {
- listEvent (event);
- return;
- }
- if (arrow == event.widget) {
- arrowEvent (event);
- return;
- }
- if (FlatCCombo.this == event.widget) {
- comboEvent (event);
- return;
- }
- if (getShell () == event.widget) {
- handleFocus (SWT.FocusOut);
- }
- }
- };
- filter = new Listener() {
- public void handleEvent(Event event) {
- Shell shell = ((Control)event.widget).getShell ();
- if (shell == FlatCCombo.this.getShell ()) {
- handleFocus (SWT.FocusOut);
- }
- }
- };
-
- int [] comboEvents = {SWT.Dispose, SWT.Move, SWT.Resize};
- for (int i=0; i<comboEvents.length; i++) this.addListener (comboEvents [i], listener);
-
- int [] textEvents = {SWT.KeyDown, SWT.KeyUp, SWT.MenuDetect, SWT.Modify, SWT.MouseDown, SWT.MouseUp, SWT.Traverse, SWT.FocusIn};
- for (int i=0; i<textEvents.length; i++) text.addListener (textEvents [i], listener);
-
- int [] arrowEvents = {SWT.MouseDown, SWT.Selection, SWT.FocusIn};
- for (int i=0; i<arrowEvents.length; i++) arrow.addListener (arrowEvents [i], listener);
-
- createPopup(null, -1);
- initAccessible();
-}
-static int checkStyle (int style) {
- int mask = SWT.BORDER | SWT.READ_ONLY | SWT.FLAT | SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT;
- return style & mask;
-}
-/**
- * Adds the argument to the end of the receiver's list.
- *
- * @param string the new item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #add(String,int)
- */
-public void add (String string) {
- checkWidget();
- if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- list.add (string);
-}
-/**
- * Adds the argument to the receiver's list at the given
- * zero-relative index.
- * <p>
- * Note: To add an item at the end of the list, use the
- * result of calling <code>getItemCount()</code> as the
- * index or use <code>add(String)</code>.
- * </p>
- *
- * @param string the new item
- * @param index the index for the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list (inclusive)</li>
- * </ul>
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #add(String)
- */
-public void add (String string, int index) {
- checkWidget();
- if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- list.add (string, index);
-}
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's text is modified, by sending
- * it one of the messages defined in the <code>ModifyListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ModifyListener
- * @see #removeModifyListener
- */
-public void addModifyListener (ModifyListener listener) {
- checkWidget();
- if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Modify, typedListener);
-}
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's selection changes, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * <code>widgetSelected</code> is called when the combo's list selection changes.
- * <code>widgetDefaultSelected</code> is typically called when ENTER is pressed the combo's text area.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see org.eclipse.swt.events.SelectionEvent
- */
-public void addSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Selection,typedListener);
- addListener (SWT.DefaultSelection,typedListener);
-}
-void arrowEvent (Event event) {
- switch (event.type) {
- case SWT.FocusIn: {
- handleFocus (SWT.FocusIn);
- break;
- }
- case SWT.Selection: {
- dropDown (!isDropped ());
- break;
- }
- case SWT.MouseDown: {
- dropDown (!isDropped ());
- break;
- }
- }
-}
-/**
- * Sets the selection in the receiver's text field to an empty
- * selection starting just before the first character. If the
- * text field is editable, this has the effect of placing the
- * i-beam at the start of the text.
- * <p>
- * Note: To clear the selected items in the receiver's list,
- * use <code>deselectAll()</code>.
- * </p>
- *
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #deselectAll
- */
-public void clearSelection () {
- checkWidget ();
- text.clearSelection ();
- list.deselectAll ();
-}
-void comboEvent (Event event) {
- switch (event.type) {
- case SWT.Dispose:
- if (popup != null && !popup.isDisposed ()) {
- list.removeListener (SWT.Dispose, listener);
- popup.dispose ();
- }
- Shell shell = getShell ();
- shell.removeListener (SWT.Deactivate, listener);
- Display display = getDisplay ();
- display.removeFilter (SWT.FocusIn, filter);
- popup = null;
- text = null;
- list = null;
- arrow = null;
- break;
- case SWT.Move:
- dropDown (false);
- break;
- case SWT.Resize:
- internalLayout (false);
- break;
- }
-}
-
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget ();
- int width = 0, height = 0;
- String[] items = list.getItems ();
- int textWidth = 0;
- GC gc = new GC (text);
- int spacer = gc.stringExtent (" ").x; //$NON-NLS-1$
- for (int i = 0; i < items.length; i++) {
- textWidth = Math.max (gc.stringExtent (items[i]).x, textWidth);
- }
- gc.dispose();
- Point textSize = text.computeSize (SWT.DEFAULT, SWT.DEFAULT, changed);
- // Point arrowSize = arrow.computeSize (SWT.DEFAULT, SWT.DEFAULT, changed);
- Point arrowSize = new Point(16, 16);
- Point listSize = list.computeSize (SWT.DEFAULT, SWT.DEFAULT, changed);
- int borderWidth = getBorderWidth ();
-
- height = Math.max (textSize.y, arrowSize.y);
- width = Math.max (textWidth + 2*spacer + arrowSize.x + 2*borderWidth, listSize.x);
- if (wHint != SWT.DEFAULT) width = wHint;
- if (hHint != SWT.DEFAULT) height = hHint;
- return new Point (width + 2*borderWidth, height + 2*borderWidth);
-}
-void createPopup(String[] items, int selectionIndex) {
- // create shell and list
- popup = new Shell (getShell (), SWT.NO_TRIM | SWT.ON_TOP);
- int style = getStyle ();
- int listStyle = SWT.SINGLE | SWT.V_SCROLL;
- if ((style & SWT.FLAT) != 0) listStyle |= SWT.FLAT;
- if ((style & SWT.RIGHT_TO_LEFT) != 0) listStyle |= SWT.RIGHT_TO_LEFT;
- if ((style & SWT.LEFT_TO_RIGHT) != 0) listStyle |= SWT.LEFT_TO_RIGHT;
- list = new List (popup, listStyle);
- if (font != null) list.setFont (font);
- if (foreground != null) list.setForeground (foreground);
- if (background != null) list.setBackground (background);
-
- int [] popupEvents = {SWT.Close, SWT.Paint, SWT.Deactivate};
- for (int i=0; i<popupEvents.length; i++) popup.addListener (popupEvents [i], listener);
- int [] listEvents = {SWT.MouseUp, SWT.Selection, SWT.Traverse, SWT.KeyDown, SWT.KeyUp, SWT.FocusIn, SWT.Dispose};
- for (int i=0; i<listEvents.length; i++) list.addListener (listEvents [i], listener);
-
- if (items != null) list.setItems (items);
- if (selectionIndex != -1) list.setSelection (selectionIndex);
-}
-/**
- * Deselects the item at the given zero-relative index in the receiver's
- * list. If the item at the index was already deselected, it remains
- * deselected. Indices that are out of range are ignored.
- *
- * @param index the index of the item to deselect
- *
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void deselect (int index) {
- checkWidget ();
- list.deselect (index);
-}
-/**
- * Deselects all selected items in the receiver's list.
- * <p>
- * Note: To clear the selection in the receiver's text field,
- * use <code>clearSelection()</code>.
- * </p>
- *
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #clearSelection
- */
-public void deselectAll () {
- checkWidget ();
- list.deselectAll ();
-}
-void dropDown (boolean drop) {
- if (drop == isDropped ()) return;
- if (!drop) {
- popup.setVisible (false);
- if (!isDisposed ()&& arrow.isFocusControl()) {
- text.setFocus();
- }
- return;
- }
-
- if (getShell() != popup.getParent ()) {
- String[] items = list.getItems ();
- int selectionIndex = list.getSelectionIndex ();
- list.removeListener (SWT.Dispose, listener);
- popup.dispose();
- popup = null;
- list = null;
- createPopup (items, selectionIndex);
- }
-
- Point size = getSize ();
- int itemCount = list.getItemCount ();
- itemCount = (itemCount == 0) ? visibleItemCount : Math.min(visibleItemCount, itemCount);
- int itemHeight = list.getItemHeight () * itemCount;
- Point listSize = list.computeSize (SWT.DEFAULT, itemHeight, false);
- list.setBounds (1, 1, Math.max (size.x - 2, listSize.x), listSize.y);
-
- int index = list.getSelectionIndex ();
- if (index != -1) list.setTopIndex (index);
- Display display = getDisplay ();
- Rectangle listRect = list.getBounds ();
- Rectangle parentRect = display.map (getParent (), null, getBounds ());
- Point comboSize = getSize ();
- Rectangle displayRect = getMonitor ().getClientArea ();
- int width = Math.max (comboSize.x, listRect.width + 2);
- int height = listRect.height + 2;
- int x = parentRect.x;
- int y = parentRect.y + comboSize.y;
- if (y + height > displayRect.y + displayRect.height) y = parentRect.y - height;
- if (x + width > displayRect.x + displayRect.width) x = displayRect.x + displayRect.width - listRect.width;
- popup.setBounds (x, y, width, height);
- popup.setVisible (true);
- list.setFocus ();
-}
-/*
- * Return the lowercase of the first non-'&' character following
- * an '&' character in the given string. If there are no '&'
- * characters in the given string, return '\0'.
- */
-char _findMnemonic (String string) {
- if (string == null) return '\0';
- int index = 0;
- int length = string.length ();
- do {
- while (index < length && string.charAt (index) != '&') index++;
- if (++index >= length) return '\0';
- if (string.charAt (index) != '&') return Character.toLowerCase (string.charAt (index));
- index++;
- } while (index < length);
- return '\0';
-}
-/*
- * Return the Label immediately preceding the receiver in the z-order,
- * or null if none.
- */
-Label getAssociatedLabel () {
- Control[] siblings = getParent ().getChildren ();
- for (int i = 0; i < siblings.length; i++) {
- if (siblings [i] == this) {
- if (i > 0 && siblings [i-1] instanceof Label) {
- return (Label) siblings [i-1];
- }
- }
- }
- return null;
-}
-public Control [] getChildren () {
- return super.getChildren();
-}
-/**
- * Gets the editable state.
- *
- * @return whether or not the receiver is editable
- *
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @since 3.0
- */
-public boolean getEditable () {
- checkWidget ();
- return text.getEditable();
-}
-/**
- * Returns the item at the given, zero-relative index in the
- * receiver's list. Throws an exception if the index is out
- * of range.
- *
- * @param index the index of the item to return
- * @return the item at the given index
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getItem (int index) {
- checkWidget();
- return list.getItem (index);
-}
-/**
- * Returns the number of items contained in the receiver's list.
- *
- * @return the number of items
- *
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getItemCount () {
- checkWidget ();
- return list.getItemCount ();
-}
-/**
- * Returns the height of the area which would be used to
- * display <em>one</em> of the items in the receiver's list.
- *
- * @return the height of one item
- *
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getItemHeight () {
- checkWidget ();
- return list.getItemHeight ();
-}
-/**
- * Returns an array of <code>String</code>s which are the items
- * in the receiver's list.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its list of items, so modifying the array will
- * not affect the receiver.
- * </p>
- *
- * @return the items in the receiver's list
- *
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String [] getItems () {
- checkWidget ();
- return list.getItems ();
-}
-public Menu getMenu() {
- return text.getMenu();
-}
-/**
- * Returns a <code>Point</code> whose x coordinate is the start
- * of the selection in the receiver's text field, and whose y
- * coordinate is the end of the selection. The returned values
- * are zero-relative. An "empty" selection as indicated by
- * the the x and y coordinates having the same value.
- *
- * @return a point representing the selection start and end
- *
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point getSelection () {
- checkWidget ();
- return text.getSelection ();
-}
-/**
- * Returns the zero-relative index of the item which is currently
- * selected in the receiver's list, or -1 if no item is selected.
- *
- * @return the index of the selected item
- *
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getSelectionIndex () {
- checkWidget ();
- return list.getSelectionIndex ();
-}
-public int getStyle () {
- int style = super.getStyle ();
- style &= ~SWT.READ_ONLY;
- if (!text.getEditable()) style |= SWT.READ_ONLY;
- return style;
-}
-/**
- * Returns a string containing a copy of the contents of the
- * receiver's text field.
- *
- * @return the receiver's text
- *
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getText () {
- checkWidget ();
- return text.getText ();
-}
-/**
- * Returns the height of the receivers's text field.
- *
- * @return the text height
- *
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getTextHeight () {
- checkWidget ();
- return text.getLineHeight ();
-}
-/**
- * Returns the maximum number of characters that the receiver's
- * text field is capable of holding. If this has not been changed
- * by <code>setTextLimit()</code>, it will be the constant
- * <code>Combo.LIMIT</code>.
- *
- * @return the text limit
- *
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getTextLimit () {
- checkWidget ();
- return text.getTextLimit ();
-}
-/**
- * Gets the number of items that are visible in the drop
- * down portion of the receiver's list.
- *
- * @return the number of items that are visible
- *
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @since 3.0
- */
-public int getVisibleItemCount () {
- checkWidget ();
- return visibleItemCount;
-}
-void handleFocus (int type) {
- if (isDisposed ()) return;
- switch (type) {
- case SWT.FocusIn: {
- if (hasFocus) return;
- if (getEditable ()) text.selectAll ();
- hasFocus = true;
- Shell shell = getShell ();
- shell.removeListener (SWT.Deactivate, listener);
- shell.addListener (SWT.Deactivate, listener);
- Display display = getDisplay ();
- display.removeFilter (SWT.FocusIn, filter);
- display.addFilter (SWT.FocusIn, filter);
- Event e = new Event ();
- notifyListeners (SWT.FocusIn, e);
- break;
- }
- case SWT.FocusOut: {
- if (!hasFocus) return;
- Control focusControl = getDisplay ().getFocusControl ();
- if (focusControl == arrow || focusControl == list || focusControl == text) return;
- hasFocus = false;
- Shell shell = getShell ();
- shell.removeListener(SWT.Deactivate, listener);
- Display display = getDisplay ();
- display.removeFilter (SWT.FocusIn, filter);
- Event e = new Event ();
- notifyListeners (SWT.FocusOut, e);
- break;
- }
- }
-}
-/**
- * Searches the receiver's list starting at the first item
- * (index 0) until an item is found that is equal to the
- * argument, and returns the index of that item. If no item
- * is found, returns -1.
- *
- * @param string the search item
- * @return the index of the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int indexOf (String string) {
- checkWidget ();
- if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- return list.indexOf (string);
-}
-/**
- * Searches the receiver's list starting at the given,
- * zero-relative index until an item is found that is equal
- * to the argument, and returns the index of that item. If
- * no item is found or the starting index is out of range,
- * returns -1.
- *
- * @param string the search item
- * @param start the zero-relative index at which to begin the search
- * @return the index of the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int indexOf (String string, int start) {
- checkWidget ();
- if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- return list.indexOf (string, start);
-}
-
-void initAccessible() {
- AccessibleAdapter accessibleAdapter = new AccessibleAdapter () {
- public void getName (AccessibleEvent e) {
- String name = null;
- Label label = getAssociatedLabel ();
- if (label != null) {
- name = stripMnemonic (label.getText());
- }
- e.result = name;
- }
- public void getKeyboardShortcut(AccessibleEvent e) {
- String shortcut = null;
- Label label = getAssociatedLabel ();
- if (label != null) {
- String text = label.getText ();
- if (text != null) {
- char mnemonic = _findMnemonic (text);
- if (mnemonic != '\0') {
- shortcut = "Alt+"+mnemonic; //$NON-NLS-1$
- }
- }
- }
- e.result = shortcut;
- }
- public void getHelp (AccessibleEvent e) {
- e.result = getToolTipText ();
- }
- };
- getAccessible ().addAccessibleListener (accessibleAdapter);
- text.getAccessible ().addAccessibleListener (accessibleAdapter);
- list.getAccessible ().addAccessibleListener (accessibleAdapter);
-
- arrow.getAccessible ().addAccessibleListener (new AccessibleAdapter() {
- public void getName (AccessibleEvent e) {
- e.result = isDropped () ? SWT.getMessage ("SWT_Close") : SWT.getMessage ("SWT_Open"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- public void getKeyboardShortcut (AccessibleEvent e) {
- e.result = "Alt+Down Arrow"; //$NON-NLS-1$
- }
- public void getHelp (AccessibleEvent e) {
- e.result = getToolTipText ();
- }
- });
-
- getAccessible().addAccessibleTextListener (new AccessibleTextAdapter() {
- public void getCaretOffset (AccessibleTextEvent e) {
- e.offset = text.getCaretPosition ();
- }
- public void getSelectionRange(AccessibleTextEvent e) {
- Point sel = text.getSelection();
- e.offset = sel.x;
- e.length = sel.y - sel.x;
- }
- });
-
- getAccessible().addAccessibleControlListener (new AccessibleControlAdapter() {
- public void getChildAtPoint (AccessibleControlEvent e) {
- Point testPoint = toControl (e.x, e.y);
- if (getBounds ().contains (testPoint)) {
- e.childID = ACC.CHILDID_SELF;
- }
- }
-
- public void getLocation (AccessibleControlEvent e) {
- Rectangle location = getBounds ();
- Point pt = toDisplay (location.x, location.y);
- e.x = pt.x;
- e.y = pt.y;
- e.width = location.width;
- e.height = location.height;
- }
-
- public void getChildCount (AccessibleControlEvent e) {
- e.detail = 0;
- }
-
- public void getRole (AccessibleControlEvent e) {
- e.detail = ACC.ROLE_COMBOBOX;
- }
-
- public void getState (AccessibleControlEvent e) {
- e.detail = ACC.STATE_NORMAL;
- }
-
- public void getValue (AccessibleControlEvent e) {
- e.result = getText ();
- }
- });
-
- text.getAccessible ().addAccessibleControlListener (new AccessibleControlAdapter () {
- public void getRole (AccessibleControlEvent e) {
- e.detail = text.getEditable () ? ACC.ROLE_TEXT : ACC.ROLE_LABEL;
- }
- });
-
- arrow.getAccessible ().addAccessibleControlListener (new AccessibleControlAdapter() {
- public void getDefaultAction (AccessibleControlEvent e) {
- e.result = isDropped () ? SWT.getMessage ("SWT_Close") : SWT.getMessage ("SWT_Open"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- });
-}
-boolean isDropped () {
- return popup.getVisible ();
-}
-public boolean isFocusControl () {
- checkWidget();
- if (text.isFocusControl () || arrow.isFocusControl () || list.isFocusControl () || popup.isFocusControl ()) {
- return true;
- }
- return super.isFocusControl ();
-}
-void internalLayout (boolean changed) {
- if (isDropped ()) dropDown (false);
- Rectangle rect = getClientArea ();
- int width = rect.width;
- int height = rect.height;
- // Point arrowSize = arrow.computeSize (SWT.DEFAULT, height, changed);
- // text.setBounds (0, 0, width - arrowSize.x, height);
- text.setBounds (0, 0, width - 16, height);
- // arrow.setBounds (width - arrowSize.x, 0, arrowSize.x, arrowSize.y);
- arrow.setBounds (width - 16, 0, 16, 16);
-}
-void listEvent (Event event) {
- switch (event.type) {
- case SWT.Dispose:
- if (getShell () != popup.getParent ()) {
- String[] items = list.getItems ();
- int selectionIndex = list.getSelectionIndex ();
- popup = null;
- list = null;
- createPopup (items, selectionIndex);
- }
- break;
- case SWT.FocusIn: {
- handleFocus (SWT.FocusIn);
- break;
- }
- case SWT.MouseUp: {
- if (event.button != 1) return;
- dropDown (false);
- break;
- }
- case SWT.Selection: {
- int index = list.getSelectionIndex ();
- if (index == -1) return;
- text.setText (list.getItem (index));
- text.selectAll ();
- list.setSelection (index);
- Event e = new Event ();
- e.time = event.time;
- e.stateMask = event.stateMask;
- e.doit = event.doit;
- notifyListeners (SWT.Selection, e);
- event.doit = e.doit;
- break;
- }
- case SWT.Traverse: {
- switch (event.detail) {
- case SWT.TRAVERSE_RETURN:
- case SWT.TRAVERSE_ESCAPE:
- case SWT.TRAVERSE_ARROW_PREVIOUS:
- case SWT.TRAVERSE_ARROW_NEXT:
- event.doit = false;
- break;
- }
- Event e = new Event ();
- e.time = event.time;
- e.detail = event.detail;
- e.doit = event.doit;
- e.character = event.character;
- e.keyCode = event.keyCode;
- notifyListeners (SWT.Traverse, e);
- event.doit = e.doit;
- event.detail = e.detail;
- break;
- }
- case SWT.KeyUp: {
- Event e = new Event ();
- e.time = event.time;
- e.character = event.character;
- e.keyCode = event.keyCode;
- e.stateMask = event.stateMask;
- notifyListeners (SWT.KeyUp, e);
- break;
- }
- case SWT.KeyDown: {
- if (event.character == SWT.ESC) {
- // Escape key cancels popup list
- dropDown (false);
- }
- if ((event.stateMask & SWT.ALT) != 0 && (event.keyCode == SWT.ARROW_UP || event.keyCode == SWT.ARROW_DOWN)) {
- dropDown (false);
- }
- if (event.character == SWT.CR) {
- // Enter causes default selection
- dropDown (false);
- Event e = new Event ();
- e.time = event.time;
- e.stateMask = event.stateMask;
- notifyListeners (SWT.DefaultSelection, e);
- }
- // At this point the widget may have been disposed.
- // If so, do not continue.
- if (isDisposed ()) break;
- Event e = new Event();
- e.time = event.time;
- e.character = event.character;
- e.keyCode = event.keyCode;
- e.stateMask = event.stateMask;
- notifyListeners(SWT.KeyDown, e);
- break;
-
- }
- }
-}
-
-void popupEvent(Event event) {
- switch (event.type) {
- case SWT.Paint:
- // draw black rectangle around list
- Rectangle listRect = list.getBounds();
- Color black = getDisplay().getSystemColor(SWT.COLOR_BLACK);
- event.gc.setForeground(black);
- event.gc.drawRectangle(0, 0, listRect.width + 1, listRect.height + 1);
- break;
- case SWT.Close:
- event.doit = false;
- dropDown (false);
- break;
- case SWT.Deactivate:
- dropDown (false);
- break;
- }
-}
-public void redraw () {
- super.redraw();
- text.redraw();
- arrow.redraw();
- if (popup.isVisible()) list.redraw();
-}
-public void redraw (int x, int y, int width, int height, boolean all) {
- super.redraw(x, y, width, height, true);
-}
-
-/**
- * Removes the item from the receiver's list at the given
- * zero-relative index.
- *
- * @param index the index for the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void remove (int index) {
- checkWidget();
- list.remove (index);
-}
-/**
- * Removes the items from the receiver's list which are
- * between the given zero-relative start and end
- * indices (inclusive).
- *
- * @param start the start of the range
- * @param end the end of the range
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if either the start or end are not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void remove (int start, int end) {
- checkWidget();
- list.remove (start, end);
-}
-/**
- * Searches the receiver's list starting at the first item
- * until an item is found that is equal to the argument,
- * and removes that item from the list.
- *
- * @param string the item to remove
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the string is not found in the list</li>
- * </ul>
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void remove (String string) {
- checkWidget();
- if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- list.remove (string);
-}
-/**
- * Removes all of the items from the receiver's list and clear the
- * contents of receiver's text field.
- * <p>
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void removeAll () {
- checkWidget();
- text.setText (""); //$NON-NLS-1$
- list.removeAll ();
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver's text is modified.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ModifyListener
- * @see #addModifyListener
- */
-public void removeModifyListener (ModifyListener listener) {
- checkWidget();
- if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- removeListener(SWT.Modify, listener);
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver's selection changes.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener (SelectionListener listener) {
- checkWidget();
- if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- removeListener(SWT.Selection, listener);
- removeListener(SWT.DefaultSelection,listener);
-}
-/**
- * Selects the item at the given zero-relative index in the receiver's
- * list. If the item at the index was already selected, it remains
- * selected. Indices that are out of range are ignored.
- *
- * @param index the index of the item to select
- *
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void select (int index) {
- checkWidget();
- if (index == -1) {
- list.deselectAll ();
- text.setText (""); //$NON-NLS-1$
- return;
- }
- if (0 <= index && index < list.getItemCount()) {
- if (index != getSelectionIndex()) {
- text.setText (list.getItem (index));
- text.selectAll ();
- list.select (index);
- list.showSelection ();
- }
- }
-}
-public void setBackground (Color color) {
- super.setBackground(color);
- background = color;
- if (text != null) text.setBackground(color);
- if (list != null) list.setBackground(color);
- if (arrow != null) arrow.setBackground(color);
-}
-/**
- * Sets the editable state.
- *
- * @param editable the new editable state
- *
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @since 3.0
- */
-public void setEditable (boolean editable) {
- checkWidget ();
- text.setEditable(editable);
-}
-public void setEnabled (boolean enabled) {
- super.setEnabled(enabled);
- if (popup != null) popup.setVisible (false);
- if (text != null) text.setEnabled(enabled);
- if (arrow != null) arrow.setEnabled(enabled);
-}
-public boolean setFocus () {
- checkWidget();
- return text.setFocus ();
-}
-public void setFont (Font font) {
- super.setFont (font);
- this.font = font;
- text.setFont (font);
- list.setFont (font);
- internalLayout (true);
-}
-public void setForeground (Color color) {
- super.setForeground(color);
- foreground = color;
- if (text != null) text.setForeground(color);
- if (list != null) list.setForeground(color);
- if (arrow != null) arrow.setForeground(color);
-}
-/**
- * Sets the text of the item in the receiver's list at the given
- * zero-relative index to the string argument. This is equivalent
- * to <code>remove</code>'ing the old item at the index, and then
- * <code>add</code>'ing the new item at that index.
- *
- * @param index the index for the item
- * @param string the new text for the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setItem (int index, String string) {
- checkWidget();
- list.setItem (index, string);
-}
-/**
- * Sets the receiver's list to be the given array of items.
- *
- * @param items the array of items
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the items array is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if an item in the items array is null</li>
- * </ul>
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setItems (String [] items) {
- checkWidget ();
- list.setItems (items);
- if (!text.getEditable ()) text.setText (""); //$NON-NLS-1$
-}
-/**
- * Sets the layout which is associated with the receiver to be
- * the argument which may be null.
- * <p>
- * Note: No Layout can be set on this Control because it already
- * manages the size and position of its children.
- * </p>
- *
- * @param layout the receiver's new layout or null
- *
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setLayout (Layout layout) {
- checkWidget ();
- return;
-}
-public void setMenu(Menu menu) {
- text.setMenu(menu);
-}
-/**
- * Sets the selection in the receiver's text field to the
- * range specified by the argument whose x coordinate is the
- * start of the selection and whose y coordinate is the end
- * of the selection.
- *
- * @param selection a point representing the new selection start and end
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the point is null</li>
- * </ul>
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (Point selection) {
- checkWidget();
- if (selection == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- text.setSelection (selection.x, selection.y);
-}
-
-/**
- * Sets the contents of the receiver's text field to the
- * given string.
- * <p>
- * Note: The text field in a <code>Combo</code> is typically
- * only capable of displaying a single line of text. Thus,
- * setting the text to a string containing line breaks or
- * other special characters will probably cause it to
- * display incorrectly.
- * </p>
- *
- * @param string the new text
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setText (String string) {
- checkWidget();
- if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- int index = list.indexOf (string);
- if (index == -1) {
- list.deselectAll ();
- text.setText (string);
- return;
- }
- text.setText (string);
- text.selectAll ();
- list.setSelection (index);
- list.showSelection ();
-}
-/**
- * Sets the maximum number of characters that the receiver's
- * text field is capable of holding to be the argument.
- *
- * @param limit new text limit
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_CANNOT_BE_ZERO - if the limit is zero</li>
- * </ul>
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setTextLimit (int limit) {
- checkWidget();
- text.setTextLimit (limit);
-}
-
-public void setToolTipText (String string) {
- checkWidget();
- super.setToolTipText(string);
- arrow.setToolTipText (string);
- text.setToolTipText (string);
-}
-
-public void setVisible (boolean visible) {
- super.setVisible(visible);
- if (!visible) popup.setVisible(false);
-}
-/**
- * Sets the number of items that are visible in the drop
- * down portion of the receiver's list.
- *
- * @param count the new number of items to be visible
- *
- * @exception org.eclipse.swt.SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @since 3.0
- */
-public void setVisibleItemCount (int count) {
- checkWidget ();
- if (count < 0) return;
- visibleItemCount = count;
-}
-String stripMnemonic (String string) {
- int index = 0;
- int length = string.length ();
- do {
- while ((index < length) && (string.charAt (index) != '&')) index++;
- if (++index >= length) return string;
- if (string.charAt (index) != '&') {
- return string.substring(0, index-1) + string.substring(index, length);
- }
- index++;
- } while (index < length);
- return string;
-}
-void textEvent (Event event) {
- switch (event.type) {
- case SWT.FocusIn: {
- handleFocus (SWT.FocusIn);
- break;
- }
- case SWT.KeyDown: {
- if (event.character == SWT.CR) {
- dropDown (false);
- Event e = new Event ();
- e.time = event.time;
- e.stateMask = event.stateMask;
- notifyListeners (SWT.DefaultSelection, e);
- }
- //At this point the widget may have been disposed.
- // If so, do not continue.
- if (isDisposed ()) break;
-
- if (event.keyCode == SWT.ARROW_UP || event.keyCode == SWT.ARROW_DOWN) {
- event.doit = false;
- if ((event.stateMask & SWT.ALT) != 0) {
- boolean dropped = isDropped ();
- text.selectAll ();
- if (!dropped) setFocus ();
- dropDown (!dropped);
- break;
- }
-
- int oldIndex = getSelectionIndex ();
- if (event.keyCode == SWT.ARROW_UP) {
- select (Math.max (oldIndex - 1, 0));
- } else {
- select (Math.min (oldIndex + 1, getItemCount () - 1));
- }
- if (oldIndex != getSelectionIndex ()) {
- Event e = new Event();
- e.time = event.time;
- e.stateMask = event.stateMask;
- notifyListeners (SWT.Selection, e);
- }
- //At this point the widget may have been disposed.
- // If so, do not continue.
- if (isDisposed ()) break;
- }
-
- // Further work : Need to add support for incremental search in
- // pop up list as characters typed in text widget
-
- Event e = new Event ();
- e.time = event.time;
- e.character = event.character;
- e.keyCode = event.keyCode;
- e.stateMask = event.stateMask;
- notifyListeners (SWT.KeyDown, e);
- break;
- }
- case SWT.KeyUp: {
- Event e = new Event ();
- e.time = event.time;
- e.character = event.character;
- e.keyCode = event.keyCode;
- e.stateMask = event.stateMask;
- notifyListeners (SWT.KeyUp, e);
- break;
- }
- case SWT.MenuDetect: {
- Event e = new Event ();
- e.time = event.time;
- notifyListeners (SWT.MenuDetect, e);
- break;
- }
- case SWT.Modify: {
- list.deselectAll ();
- Event e = new Event ();
- e.time = event.time;
- notifyListeners (SWT.Modify, e);
- break;
- }
- case SWT.MouseDown: {
- if (event.button != 1) return;
- if (text.getEditable ()) return;
- boolean dropped = isDropped ();
- text.selectAll ();
- if (!dropped) setFocus ();
- dropDown (!dropped);
- break;
- }
- case SWT.MouseUp: {
- if (event.button != 1) return;
- if (text.getEditable ()) return;
- text.selectAll ();
- break;
- }
- case SWT.Traverse: {
- switch (event.detail) {
- case SWT.TRAVERSE_RETURN:
- case SWT.TRAVERSE_ARROW_PREVIOUS:
- case SWT.TRAVERSE_ARROW_NEXT:
- // The enter causes default selection and
- // the arrow keys are used to manipulate the list contents so
- // do not use them for traversal.
- event.doit = false;
- break;
- }
-
- Event e = new Event ();
- e.time = event.time;
- e.detail = event.detail;
- e.doit = event.doit;
- e.character = event.character;
- e.keyCode = event.keyCode;
- notifyListeners (SWT.Traverse, e);
- event.doit = e.doit;
- event.detail = e.detail;
- break;
- }
- }
-}
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/IAnnotationProvider.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/IAnnotationProvider.java
deleted file mode 100644
index 226d4357d8..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/IAnnotationProvider.java
+++ /dev/null
@@ -1,17 +0,0 @@
-/*******************************************************************************
- * 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.internal.adt.design;
-
-public interface IAnnotationProvider
-{
- String getNameAnnotationString();
- String getNameAnnotationToolTipString();
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/IKeyboardDrag.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/IKeyboardDrag.java
deleted file mode 100644
index fe069207d2..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/IKeyboardDrag.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*******************************************************************************
- * 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.internal.adt.design;
-
-import org.eclipse.gef.GraphicalEditPart;
-
-public interface IKeyboardDrag {
-
- public void performKeyboardDrag (GraphicalEditPart source, int direction);
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/ImageOverlayDescriptor.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/ImageOverlayDescriptor.java
deleted file mode 100644
index 0f2a674073..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/ImageOverlayDescriptor.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.adt.design;
-
-import org.eclipse.jface.resource.CompositeImageDescriptor;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.ImageData;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-
-public class ImageOverlayDescriptor extends CompositeImageDescriptor
-{
- protected Image baseImage;
- protected Image extensionOverlay, disabledExtensionOverlay;
- protected Point imageSize;
- protected boolean isReadOnly;
-
- public ImageOverlayDescriptor(Image baseImage, boolean isReadOnly)
- {
- super();
- this.baseImage = baseImage;
- this.isReadOnly = isReadOnly;
- imageSize = new Point(baseImage.getBounds().width, baseImage.getBounds().height);
- extensionOverlay = XSDEditorPlugin.getPlugin().getIcon("ovr16/extnsn_ovr.gif"); //$NON-NLS-1$
- disabledExtensionOverlay = XSDEditorPlugin.getPlugin().getIcon("ovr16/extnsndis_ovr.gif"); //$NON-NLS-1$
- }
-
- public Image getImage()
- {
- return createImage();
- }
-
- protected void drawCompositeImage(int width, int height)
- {
- drawImage(baseImage.getImageData(), 0, 0);
- ImageData extensionImageData;
- if (isReadOnly)
- {
- extensionImageData = disabledExtensionOverlay.getImageData();
- }
- else
- {
- extensionImageData = extensionOverlay.getImageData();
- }
- drawImage (extensionImageData, imageSize.x - extensionImageData.width, 0); // Top Right corner
- }
-
- protected Point getSize()
- {
- return imageSize;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/ADTComboBoxCellEditor.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/ADTComboBoxCellEditor.java
deleted file mode 100644
index 717c7aec22..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/ADTComboBoxCellEditor.java
+++ /dev/null
@@ -1,268 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.adt.design.directedit;
-
-import java.text.MessageFormat;
-
-import org.eclipse.jface.viewers.ComboBoxCellEditor;
-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.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.TraverseEvent;
-import org.eclipse.swt.events.TraverseListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.TypedListener;
-import org.eclipse.wst.xsd.ui.internal.adt.edit.ComponentReferenceEditManager;
-import org.eclipse.wst.xsd.ui.internal.adt.edit.IComponentDialog;
-import org.eclipse.wst.xsd.ui.internal.editor.Messages;
-
-/*
- * This wraps the 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 ComboBoxCellEditor
-{
- private static final int adtDefaultStyle = SWT.NONE;
-
- /**
- * Used to determine if the value should be applied to the cell.
- */
- private boolean continueApply;
- private boolean isTraversing = false;
- private Object selectedValue;
- private ComponentReferenceEditManager componentReferenceEditManager;
-
- // This prevents the cell editor from being deactivated while handling the New or Browse selection.
- private boolean isHandlingSelection = false;
-
- /**
- * 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, items, adtDefaultStyle | SWT.READ_ONLY);
- setItems(items);
- componentReferenceEditManager = editManager;
- }
-
- private void removeListeners(CCombo comboBox, int event)
- {
- Listener [] listeners = comboBox.getListeners(event);
- int length = listeners.length;
- for (int i = 0; i < length; i++)
- {
- Listener l = listeners[i];
- if (l instanceof TypedListener)
- {
- TypedListener typedListener = (TypedListener)l;
- String className = typedListener.getEventListener().getClass().getCanonicalName();
- // It's possible that there are other typed listeners added to the CCombo.
- // Currently there are none, but as an extra check, I want to ensure
- // I'm removing the ones added from the inherited class.
- // I've tested this and I know it removes the following:
- // org.eclipse.jface.viewers.ComboBoxCellEditor$2
- // org.eclipse.jface.viewers.ComboBoxCellEditor$4
- // which are indeed the ones I'm customizing
- if (className != null && className.contains("org.eclipse.jface.viewers.ComboBoxCellEditor"))
- {
- comboBox.removeListener(event, l);
- }
- }
- }
- }
-
- /*
- * (non-Javadoc) Method declared on CellEditor.
- */
- protected Control createControl(Composite parent)
- {
- CCombo comboBox = (CCombo)super.createControl(parent);
-
- comboBox.setFont(parent.getFont());
-
- // Need to remove the listeners added from ComboBoxCellEditor
- removeListeners(comboBox, SWT.Selection);
- removeListeners(comboBox, SWT.DefaultSelection);
- removeListeners(comboBox, SWT.FocusIn);
- removeListeners(comboBox, SWT.FocusOut);
-
- // Now add our custom listeners
- comboBox.addSelectionListener(new SelectionAdapter()
- {
- public void widgetDefaultSelected(SelectionEvent event)
- {
- // Want the same behaviour since hitting return on Browse or New should launch the dialogs,
- // and not immediately apply the value
-// applyEditorValueAndDeactivate();
- widgetSelected(event);
- }
-
- public void widgetSelected(SelectionEvent event)
- {
- continueApply = true;
- CCombo comboBox = getCCombo();
- isHandlingSelection = true;
- Object newValue = null;
-
- try
- {
- int selection = comboBox.getSelectionIndex();
- if (isTraversing)
- {
- isTraversing = false;
- return;
- }
-
- String[] items = getItems();
- String stringSelection = items[selection];
-
- if (stringSelection.equals(Messages._UI_COMBO_BROWSE))
- {
- continueApply = true;
- newValue = invokeDialog(componentReferenceEditManager.getBrowseDialog());
- }
- else if (stringSelection.equals(Messages._UI_COMBO_NEW))
- {
- continueApply = true;
- newValue = invokeDialog(componentReferenceEditManager.getNewDialog());
- }
- }
- finally
- {
- isHandlingSelection = false;
- }
-
- if (continueApply)
- {
- if (newValue == null)
- {
- int index = comboBox.getSelectionIndex();
- if (index != -1)
- {
- selectedValue = comboBox.getItem(index);
- }
- }
- else
- {
- selectedValue = newValue;
- }
-
- applyEditorValueAndDeactivate();
- focusLost();
- }
- }
- });
-
- comboBox.addTraverseListener(new TraverseListener()
- {
- public void keyTraversed(TraverseEvent e)
- {
- if (e.detail == SWT.TRAVERSE_ARROW_NEXT || e.detail == SWT.TRAVERSE_ARROW_PREVIOUS)
- {
- isTraversing = true;
- }
- }
- });
-
- comboBox.addFocusListener(new FocusAdapter()
- {
- public void focusLost(FocusEvent e)
- {
- if (!isHandlingSelection)
- 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;
- focusLost();
- }
-
- return newValue;
- }
-
- public Object getSelectedValue()
- {
- return selectedValue;
- }
-
- protected CCombo getCCombo()
- {
- return (CCombo)getControl();
- }
-
-///////// ComboBox cell editor
-
- void applyEditorValueAndDeactivate()
- {
- // must set the selection before getting value
- CCombo comboBox = getCCombo();
- String[] items = getItems();
-
- int selection = comboBox.getSelectionIndex();
- Object newValue = doGetValue();
- markDirty();
- boolean isValid = isCorrect(newValue);
- setValueValid(isValid);
-
- if (!isValid)
- {
- // Only format if the 'index' is valid
- if (items.length > 0 && selection >= 0 && selection < items.length)
- {
- // try to insert the current value into the error message.
- setErrorMessage(MessageFormat.format(getErrorMessage(), new Object[] { items[selection] }));
- }
- else
- {
- // Since we don't have a valid index, assume we're using an
- // 'edit'
- // combo so format using its text value
- setErrorMessage(MessageFormat.format(getErrorMessage(), new Object[] { comboBox.getText() }));
- }
- }
-
- fireApplyEditorValue();
- deactivate();
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/AttributeReferenceDirectEditManager.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/AttributeReferenceDirectEditManager.java
deleted file mode 100644
index 2b5e2722b3..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/AttributeReferenceDirectEditManager.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.adt.design.directedit;
-
-import org.eclipse.draw2d.Label;
-import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.wst.xsd.ui.internal.adt.edit.ComponentReferenceEditManager;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IField;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDAttributeReferenceEditManager;
-
-public class AttributeReferenceDirectEditManager extends ReferenceDirectEditManager
-{
- public AttributeReferenceDirectEditManager(IField parameter, AbstractGraphicalEditPart source, Label label)
- {
- super(parameter, source, label);
- }
-
- protected ComponentReferenceEditManager getComponentReferenceEditManager()
- {
- ComponentReferenceEditManager result = null;
- IEditorPart editor = getActiveEditor();
- if (editor != null)
- {
- result = (ComponentReferenceEditManager)editor.getAdapter(XSDAttributeReferenceEditManager.class);
- }
- return result;
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/ComboBoxCellEditorManager.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/ComboBoxCellEditorManager.java
deleted file mode 100644
index c840f2199e..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/ComboBoxCellEditorManager.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/*******************************************************************************
- * 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.internal.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(":"); //$NON-NLS-1$
- return (index != -1) ? string.substring(index + 1) : string;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/ElementReferenceDirectEditManager.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/ElementReferenceDirectEditManager.java
deleted file mode 100644
index 54117a2b10..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/ElementReferenceDirectEditManager.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.adt.design.directedit;
-
-import org.eclipse.draw2d.Label;
-import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.wst.xsd.ui.internal.adt.edit.ComponentReferenceEditManager;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IField;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDElementReferenceEditManager;
-
-public class ElementReferenceDirectEditManager extends ReferenceDirectEditManager
-{
- public ElementReferenceDirectEditManager(IField parameter, AbstractGraphicalEditPart source, Label label)
- {
- super(parameter, source, label);
- }
-
- protected ComponentReferenceEditManager getComponentReferenceEditManager()
- {
- ComponentReferenceEditManager result = null;
- IEditorPart editor = getActiveEditor();
- if (editor != null)
- {
- result = (ComponentReferenceEditManager)editor.getAdapter(XSDElementReferenceEditManager.class);
- }
- return result;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/LabelCellEditorLocator.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/LabelCellEditorLocator.java
deleted file mode 100644
index 0b34f8e404..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/LabelCellEditorLocator.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * 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.internal.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.ui.internal.adt.design.editparts.BaseFieldEditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.INamedEditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.design.figures.IFieldFigure;
-
-public class LabelCellEditorLocator implements CellEditorLocator
-{
- protected INamedEditPart namedEditPart;
- protected Point cursorLocation;
-
- public LabelCellEditorLocator(INamedEditPart namedEditPart, Point cursorLocation)
- {
- this.namedEditPart = namedEditPart;
- this.cursorLocation = cursorLocation;
- }
-
- public void relocate(CellEditor celleditor)
- {
- Text text = (Text) celleditor.getControl();
-
- Label label = namedEditPart.getNameLabelFigure();
- if (text.getBounds().x <= 0)
- {
- 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
- if (cursorLocation != null) {
- 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/ui/internal/adt/design/directedit/LabelEditManager.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/LabelEditManager.java
deleted file mode 100644
index 884341acae..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/LabelEditManager.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.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.ui.internal.adt.actions.BaseSelectionAction;
-import org.eclipse.wst.xsd.ui.internal.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);
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=252509
- // Delete action (key) doesn't always work. The saved action could be the
- // CellEditorActionHandler's DeleteActionHandler...due to timing issues.
- // We'll only restore the delete action if it is indeed the one for the Design view.
- // We should update the other actions too, but currently, none are applicable.
- if (delete instanceof BaseSelectionAction)
- {
- 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());
- IAction currentDeleteAction = actionBars.getGlobalActionHandler(ActionFactory.DELETE.getId());
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=252509
- // Delete action (key) doesn't always work. The saved action could be the
- // CellEditorActionHandler's DeleteActionHandler...due to timing issues.
- // We'll only restore the delete action if it is indeed the one for the Design view.
- // We should update the other actions too, but currently, none are applicable.
- if (currentDeleteAction instanceof BaseSelectionAction)
- {
- delete = currentDeleteAction;
- }
- 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/ui/internal/adt/design/directedit/ReferenceDirectEditManager.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/ReferenceDirectEditManager.java
deleted file mode 100644
index 7ced90db3c..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/ReferenceDirectEditManager.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.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.ui.internal.adt.edit.ComponentReferenceEditManager;
-import org.eclipse.wst.xsd.ui.internal.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IField;
-
-public abstract class ReferenceDirectEditManager extends ComboBoxCellEditorManager
-{
- protected AbstractGraphicalEditPart editPart;
- protected IField setObject;
-
- public ReferenceDirectEditManager(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(Messages._UI_COMBO_BROWSE);
- list.add(Messages._UI_COMBO_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
- DelayedSetReferenceRunnable runnable = new DelayedSetReferenceRunnable(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 abstract ComponentReferenceEditManager getComponentReferenceEditManager();
-
- protected IEditorPart getActiveEditor()
- {
- IWorkbench workbench = PlatformUI.getWorkbench();
- IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
- IEditorPart editorPart = workbenchWindow.getActivePage().getActiveEditor();
- return editorPart;
- }
-
- protected class DelayedSetReferenceRunnable implements Runnable
- {
- protected ComponentReferenceEditManager componentReferenceEditManager;
- protected ComponentSpecification newValue;
- protected IField field;
-
- public DelayedSetReferenceRunnable(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/ui/internal/adt/design/directedit/TypeReferenceDirectEditManager.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/TypeReferenceDirectEditManager.java
deleted file mode 100644
index dbebae1ddb..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/directedit/TypeReferenceDirectEditManager.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.adt.design.directedit;
-
-import org.eclipse.draw2d.Label;
-import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.wst.xsd.ui.internal.adt.edit.ComponentReferenceEditManager;
-import org.eclipse.wst.xsd.ui.internal.adt.edit.ComponentReferenceEditManager2;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IField;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDTypeReferenceEditManager;
-
-public class TypeReferenceDirectEditManager extends ReferenceDirectEditManager //ComboBoxCellEditorManager
-{
- public TypeReferenceDirectEditManager(IField parameter, AbstractGraphicalEditPart source, Label label)
- {
- super(parameter, source, label);
- }
-
- protected ComponentReferenceEditManager getComponentReferenceEditManager()
- {
- ComponentReferenceEditManager result = null;
- IEditorPart editor = getActiveEditor();
- if (editor != null)
- {
- result = (ComponentReferenceEditManager)editor.getAdapter(XSDTypeReferenceEditManager.class);
- if (result instanceof ComponentReferenceEditManager2)
- {
- ComponentReferenceEditManager2 manager = (ComponentReferenceEditManager2)result;
- manager.setReferencer(setObject);
- }
- }
- return result;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/ADTEditPartFactory.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/ADTEditPartFactory.java
deleted file mode 100644
index 26426048ab..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/ADTEditPartFactory.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.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.ui.internal.adt.design.ADTFloatingToolbar.ADTFloatingToolbarModel;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.AbstractModelCollection;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.Compartment;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.FocusTypeColumn;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.RootHolder;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IComplexType;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IField;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IModel;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IStructure;
-
-public class ADTEditPartFactory implements EditPartFactory
-{
- public EditPart createEditPart(EditPart context, Object model)
- {
- EditPart child = doCreateEditPart(context, model);
- checkChild(child, model);
- return child;
- }
-
- protected EditPart doCreateEditPart(EditPart context, Object model)
- {
- EditPart child = null;
- if (model instanceof Compartment)
- {
- child = new CompartmentEditPart();
- }
- else if (model instanceof RootHolder)
- {
- child = new RootHolderEditPart();
- }
- else if (model instanceof ADTFloatingToolbarModel)
- {
- child = new ADTFloatingToolbarEditPart(((ADTFloatingToolbarModel)model).getModel());
- }
- 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();
- }
- 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/ui/internal/adt/design/editparts/ADTFloatingToolbarEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/ADTFloatingToolbarEditPart.java
deleted file mode 100644
index 46b8be98cd..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/ADTFloatingToolbarEditPart.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.adt.design.editparts;
-
-import java.awt.event.KeyEvent;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.Figure;
-import org.eclipse.draw2d.FocusEvent;
-import org.eclipse.draw2d.FocusListener;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.KeyListener;
-import org.eclipse.draw2d.MouseEvent;
-import org.eclipse.draw2d.MouseListener;
-import org.eclipse.draw2d.MouseMotionListener;
-import org.eclipse.draw2d.ToolbarLayout;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.swt.SWT;
-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.ui.internal.adt.actions.SetInputToGraphView;
-import org.eclipse.wst.xsd.ui.internal.adt.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IModel;
-import org.eclipse.wst.xsd.ui.internal.design.figures.CenteredIconFigure;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-
-public class ADTFloatingToolbarEditPart extends BaseEditPart
-{
- protected IModel model;
- protected boolean isDrilledDown;
- protected ADTToolbarButton backToSchema;
-
- public ADTFloatingToolbarEditPart(IModel model)
- {
- this.model = model;
- }
-
- protected IFigure createFigure()
- {
- Figure figure = new Figure();
- ToolbarLayout tb = new ToolbarLayout(true);
- tb.setStretchMinorAxis(false);
- tb.setSpacing(3);
- figure.setLayoutManager(tb);
-
- backToSchema = new ADTToolbarButton(XSDEditorPlugin.getPlugin().getIcon("elcl16/schemaview_co.gif"));
- backToSchema.setToolTipText(Messages._UI_HOVER_BACK_TO_SCHEMA);
- backToSchema.setBackgroundColor(ColorConstants.white);
- backToSchema.setFocusTraversable(true);
- figure.add(backToSchema);
- figure.setBounds(new Rectangle(0,0,24,24));
- addToToolbar(figure);
- return figure;
- }
-
- protected void addToToolbar(IFigure figure)
- {
-
- }
-
- public void setIsDrilledDown(boolean isDrilledDown)
- {
- this.isDrilledDown = isDrilledDown;
- }
-
- protected void refreshVisuals()
- {
- super.refreshVisuals();
- backToSchema.isEnabled = isDrilledDown;
- if (isDrilledDown)
- {
- backToSchema.image = XSDEditorPlugin.getPlugin().getIcon("elcl16/schemaview_co.gif");
- }
- else
- {
- backToSchema.image = XSDEditorPlugin.getPlugin().getIcon("dlcl16/schemaview_co.gif");
- }
- backToSchema.refresh();
- }
-
- protected void doAction(MouseEvent me)
- {
- IEditorPart editorPart = getActionEditorPart();
-
- if (backToSchema.getBounds().contains(me.getLocation()))
- {
- SetInputToGraphView action = new SetInputToGraphView(editorPart, model);
- action.run();
- }
- }
-
- protected void doAction(org.eclipse.draw2d.KeyEvent ke)
- {
- IEditorPart editorPart = getActionEditorPart();
- SetInputToGraphView action = new SetInputToGraphView(editorPart, model);
- action.run();
- }
-
- private IEditorPart getActionEditorPart()
- {
- IWorkbench workbench = PlatformUI.getWorkbench();
- IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
- IEditorPart editorPart = workbenchWindow.getActivePage().getActiveEditor();
- return editorPart;
- }
-
-
- protected class ADTToolbarButton extends CenteredIconFigure
- {
- protected MouseListener mouseListener;
- protected org.eclipse.draw2d.KeyListener keyListener;
- protected FocusListener focusListener;
- public boolean isEnabled;
-
- public ADTToolbarButton(Image img)
- {
- super();
- this.image = img;
-
- mouseListener = new MouseListener.Stub()
- {
- public void mousePressed(org.eclipse.draw2d.MouseEvent me)
- {
- if (isEnabled)
- {
- addFeedback();
- }
- }
-
- public void mouseReleased(org.eclipse.draw2d.MouseEvent me)
- {
- if (isEnabled)
- {
- removeFeedback();
- doAction(me);
- }
- }
- };
- addMouseListener(mouseListener);
- addMouseMotionListener(new MouseMotionListener.Stub()
- {
- public void mouseExited(MouseEvent me)
- {
- removeFeedback();
- }
- });
-
- keyListener = new KeyListener.Stub()
- {
- public void keyPressed(org.eclipse.draw2d.KeyEvent ke)
- {
- boolean isValidKey = (ke.keycode == KeyEvent.VK_SPACE);
- isValidKey = isValidKey || (ke.character == SWT.CR || ke.character == SWT.LF);
- if (isEnabled && isValidKey)
- {
- addFeedback();
- }
- }
-
- public void keyReleased(org.eclipse.draw2d.KeyEvent ke)
- {
- boolean isValidKey = (ke.keycode == KeyEvent.VK_SPACE);
- isValidKey = isValidKey || (ke.character == SWT.CR || ke.character == SWT.LF);
- if (isEnabled && isValidKey)
- {
- removeFeedback();
- doAction(ke);
- }
- }
- };
- addKeyListener(keyListener);
-
- focusListener = new FocusListener(){
-
- public void focusGained(FocusEvent fe) {
- setMode(CenteredIconFigure.HOVER);
- refresh();
- }
-
- public void focusLost(FocusEvent fe) {
- setMode(CenteredIconFigure.NORMAL);
- refresh();
- }
- };
-
- addFocusListener(focusListener);
- }
-
- public void addFeedback()
- {
- setMode(CenteredIconFigure.SELECTED);
- refresh();
- }
-
- public void removeFeedback()
- {
- setMode(CenteredIconFigure.NORMAL);
- refresh();
- }
-
- public Rectangle getBounds()
- {
- Rectangle r = super.getBounds();
- org.eclipse.swt.graphics.Rectangle rect = image.getBounds();
- return new Rectangle(r.x, r.y, rect.width + 8, rect.height + 8);
- }
-
- public Dimension getPreferredSize(int hint, int hint2)
- {
- org.eclipse.swt.graphics.Rectangle rect = image.getBounds();
- return new Dimension(rect.width + 8, rect.height + 8);
- }
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BackToSchemaEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BackToSchemaEditPart.java
deleted file mode 100644
index f79ed6ce9a..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BackToSchemaEditPart.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*******************************************************************************
- * 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.internal.adt.design.editparts;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.MouseListener;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.RequestConstants;
-import org.eclipse.ui.part.MultiPageEditorPart;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.SetInputToGraphView;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IFeedbackHandler;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.ADTDirectEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.ADTSelectionFeedbackEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.adt.editor.ADTMultiPageEditor;
-import org.eclipse.wst.xsd.ui.internal.design.figures.CenteredIconFigure;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-
-public class BackToSchemaEditPart extends BaseEditPart implements IFeedbackHandler
-{
- protected MultiPageEditorPart multipageEditor;
- protected ADTDirectEditPolicy adtDirectEditPolicy = new ADTDirectEditPolicy();
- protected boolean isEnabled;
- protected CenteredIconFigure backToSchema;
- protected MouseListener mouseListener;
-
- public BackToSchemaEditPart(ADTMultiPageEditor multipageEditor)
- {
- super();
- this.multipageEditor = multipageEditor;
- }
-
- protected IFigure createFigure()
- {
- backToSchema = new CenteredIconFigure();
- backToSchema.setBackgroundColor(ColorConstants.white);
- backToSchema.image = XSDEditorPlugin.getPlugin().getIcon("elcl16/schemaview_co.gif");
- // TODO, look at why the editpolicy doesn't work
- mouseListener = new MouseListener()
- {
- public void mouseDoubleClicked(org.eclipse.draw2d.MouseEvent me)
- {
-
- }
-
- public void mousePressed(org.eclipse.draw2d.MouseEvent me)
- {
- if (isEnabled)
- {
- addFeedback();
- }
- }
-
- public void mouseReleased(org.eclipse.draw2d.MouseEvent me)
- {
- if (isEnabled)
- {
- removeFeedback();
- SetInputToGraphView action = new SetInputToGraphView(multipageEditor, getModel());
- action.run();
- }
- }
- };
- backToSchema.addMouseListener(mouseListener);
- return backToSchema;
- }
-
-
- public void setEnabled(boolean isEnabled)
- {
- this.isEnabled = isEnabled;
- refreshVisuals();
- }
-
- protected void createEditPolicies()
- {
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, adtDirectEditPolicy);
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new ADTSelectionFeedbackEditPolicy());
- }
-
- public void performRequest(Request request)
- {
- if (request.getType() == RequestConstants.REQ_DIRECT_EDIT || request.getType() == RequestConstants.REQ_OPEN)
- {
- SetInputToGraphView action = new SetInputToGraphView(multipageEditor, getModel());
- action.run();
- }
- }
-
- protected void refreshVisuals()
- {
- super.refreshVisuals();
- CenteredIconFigure figure = (CenteredIconFigure) getFigure();
- if (isEnabled)
- {
- backToSchema.image = XSDEditorPlugin.getPlugin().getIcon("elcl16/schemaview_co.gif");
- }
- else
- {
- backToSchema.image = XSDEditorPlugin.getPlugin().getIcon("dlcl16/schemaview_co.gif");
- }
- figure.refresh();
- }
-
- public void addFeedback()
- {
- CenteredIconFigure figure = (CenteredIconFigure) getFigure();
- figure.setMode(CenteredIconFigure.SELECTED);
- figure.refresh();
- }
-
- public void removeFeedback()
- {
- CenteredIconFigure figure = (CenteredIconFigure) getFigure();
- figure.setMode(CenteredIconFigure.NORMAL);
- figure.refresh();
- }
-
- public void deactivate()
- {
- backToSchema.removeMouseListener(mouseListener);
- super.deactivate();
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BaseEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BaseEditPart.java
deleted file mode 100644
index 357e63489f..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BaseEditPart.java
+++ /dev/null
@@ -1,300 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.adt.design.editparts;
-
-import java.util.List;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPartFactory;
-import org.eclipse.gef.GraphicalViewer;
-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.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.FontData;
-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.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.ide.FileStoreEditorInput;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IActionProvider;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IFeedbackHandler;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.KeyBoardAccessibilityEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.adt.design.figures.IFigureFactory;
-import org.eclipse.wst.xsd.ui.internal.adt.editor.CommonMultiPageEditor;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObjectListener;
-
-public abstract class BaseEditPart extends AbstractGraphicalEditPart implements IActionProvider, IADTObjectListener, IFeedbackHandler
-{
- protected static final String[] EMPTY_ACTION_ARRAY = {};
- protected boolean isSelected = false;
- protected boolean hasFocus = false;
- protected static boolean isHighContrast = Display.getDefault().getHighContrast();
- protected AccessibleEditPart accessiblePart;
-
- public IFigureFactory getFigureFactory()
- {
- EditPartFactory factory = getViewer().getEditPartFactory();
- Assert.isTrue(factory instanceof IFigureFactory, "EditPartFactory must be an instanceof of IFigureFactory"); //$NON-NLS-1$
- 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() {
-
- boolean doUpdateDesign = doUpdateDesign();
- if (doUpdateDesign)
- {
- super.refresh();
- }
- }
-
- public void addFeedback()
- {
- isSelected = true;
- refreshVisuals();
- }
-
- public void removeFeedback()
- {
- isSelected = false;
- refreshVisuals();
- }
-
- 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();
- }
-
- public IEditorPart getEditorPart()
- {
- IEditorPart editorPart = null;
- IWorkbench workbench = PlatformUI.getWorkbench();
- if (workbench != null)
- {
- IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
- if (workbenchWindow != null)
- {
- if (workbenchWindow.getActivePage() != null)
- {
- editorPart = workbenchWindow.getActivePage().getActiveEditor();
- }
- }
- }
-// Assert.isNotNull(editorPart);
- return editorPart;
- }
-
- protected void createEditPolicies()
- {
- installEditPolicy(KeyBoardAccessibilityEditPolicy.KEY, new KeyBoardAccessibilityEditPolicy()
- {
- public EditPart getRelativeEditPart(EditPart editPart, int direction)
- {
- return doGetRelativeEditPart(editPart, direction);
- }
- });
- }
-
-
- public EditPart doGetRelativeEditPart(EditPart editPart, int direction)
- {
- return null;
- }
-
- protected boolean isFileReadOnly()
- {
- IWorkbench workbench = PlatformUI.getWorkbench();
- if (workbench != null)
- {
- IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
- if (workbenchWindow != null)
- {
- IWorkbenchPage page = workbenchWindow.getActivePage();
- if (page != null)
- {
- IEditorPart editor = page.getActiveEditor();
- if (editor != null)
- {
- IEditorInput editorInput = editor.getEditorInput();
- if (!(editorInput instanceof IFileEditorInput || editorInput instanceof FileStoreEditorInput))
- {
- return true;
- }
- }
- }
- }
- }
- return false;
- }
-
- // For https://bugs.eclipse.org/bugs/show_bug.cgi?id=218281
- // Don't want to refresh the design when changes are made in the source view.
- protected boolean doUpdateDesign()
- {
- IWorkbench workbench = PlatformUI.getWorkbench();
- if (workbench != null)
- {
- IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
- if (workbenchWindow != null)
- {
- IWorkbenchPage page = workbenchWindow.getActivePage();
- if (page != null)
- {
- IEditorPart editorPart = page.getActiveEditor();
- if (editorPart instanceof CommonMultiPageEditor)
- {
- CommonMultiPageEditor editor = (CommonMultiPageEditor) editorPart;
- GraphicalViewer viewer = (GraphicalViewer)editor.getAdapter(GraphicalViewer.class);
- // Need to ensure this is the same editor we are working with since the active editor may not be
- // the current, eg. at startup, there can be another XSD Editor open on the source page, so we could end
- // up not populating the design view initally
- if (getViewer() == viewer)
- {
- // If source page is active, don't update the design
- return !editor.isSourcePageActive();
- }
- }
- }
- }
- }
- return true;
- }
-
- /**
- * Try to get the italic font for the current font
- * @param font
- * @return
- */
- protected Font getItalicFont(Font font)
- {
- if (font != null && !font.isDisposed())
- {
- FontData[] fd = font.getFontData();
- if (fd.length > 0)
- {
- fd[0].setStyle(fd[0].getStyle() | SWT.ITALIC);
- return new Font(font.getDevice(), fd);
- }
- }
- return font;
- }
- protected AccessibleEditPart getAccessibleEditPart() {
-
- if (accessiblePart ==null)
- {
- accessiblePart = new AccessibleGraphicalEditPart(){
-
- public void getName(AccessibleEvent e) {
- e.result = getReaderText();
- }
- };
- }
- return accessiblePart;
- }
-public String getReaderText()
-{
- return "";
-}
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BaseFieldEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BaseFieldEditPart.java
deleted file mode 100644
index e40978037d..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BaseFieldEditPart.java
+++ /dev/null
@@ -1,535 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.adt.design.editparts;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.PositionConstants;
-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.swt.custom.CCombo;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter;
-import org.eclipse.wst.xsd.ui.internal.adt.design.directedit.ComboBoxCellEditorManager;
-import org.eclipse.wst.xsd.ui.internal.adt.design.directedit.ElementReferenceDirectEditManager;
-import org.eclipse.wst.xsd.ui.internal.adt.design.directedit.LabelCellEditorLocator;
-import org.eclipse.wst.xsd.ui.internal.adt.design.directedit.LabelEditManager;
-import org.eclipse.wst.xsd.ui.internal.adt.design.directedit.TypeReferenceDirectEditManager;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.FocusTypeColumn;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.ADTDirectEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.ADTSelectionFeedbackEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.IADTUpdateCommand;
-import org.eclipse.wst.xsd.ui.internal.adt.design.figures.IFieldFigure;
-import org.eclipse.wst.xsd.ui.internal.adt.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IField;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IType;
-import org.eclipse.wst.xsd.ui.internal.design.editparts.ConnectableEditPart;
-import org.eclipse.wst.xsd.ui.internal.design.editparts.TargetConnectionSpacingFigureEditPart;
-import org.eclipse.wst.xsd.ui.internal.design.editparts.model.TargetConnectionSpaceFiller;
-import org.eclipse.wst.xsd.ui.internal.design.editpolicies.GraphNodeDragTracker;
-import org.eclipse.xsd.XSDNamedComponent;
-
-public class BaseFieldEditPart extends BaseTypeConnectingEditPart implements INamedEditPart, IAutoDirectEdit
-{
- protected TypeReferenceConnection connectionFigure;
- protected ADTDirectEditPolicy adtDirectEditPolicy = new ADTDirectEditPolicy();
- protected TypeReferenceConnection connectionFeedbackFigure;
-
- protected IFigure createFigure()
- {
- IFieldFigure figure = getFigureFactory().createFieldFigure(getModel());
- figure.setForegroundColor(ColorConstants.black);
- return figure;
- }
-
- public IFieldFigure getFieldFigure()
- {
- return (IFieldFigure)figure;
- }
-
-
- 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;
- }
-
- private EditPart getTargetEditPart(IType type)
- {
- ColumnEditPart columnEditPart = null;
- for (EditPart editPart = this; editPart != null; editPart = editPart.getParent())
- {
- if (editPart instanceof ColumnEditPart)
- {
- columnEditPart = (ColumnEditPart)editPart;
- break;
- }
- }
- if (columnEditPart != null)
- {
- // get the next column
- EditPart parent = columnEditPart.getParent();
- List columns = parent.getChildren();
- int index = columns.indexOf(columnEditPart);
- if (index + 1 < columns.size())
- {
- EditPart nextColumn = (EditPart)columns.get(index + 1);
- for (Iterator i = nextColumn.getChildren().iterator(); i.hasNext(); )
- {
- EditPart child = (EditPart)i.next();
- if (child.getModel() == type)
- {
- return child;
- }
- }
- }
- }
- return null;
- }
-
- private EditPart getTargetConnectionEditPart()
- {
- EditPart result = null;
- IField field = (IField)getModel();
- IType type = field.getType();
- if (type != null)
- {
- result = getTargetEP(type); //getTargetEditPart(type);
- }
- return result;
- }
-
- /**
- * Do not override
- * @param type
- * @return
- */
- protected EditPart getTargetEP(IType type)
- {
- return getTargetEditPart(type);
- }
-
- public TypeReferenceConnection createConnectionFigure()
- {
- connectionFigure = null;
- AbstractGraphicalEditPart referenceTypePart = (AbstractGraphicalEditPart)getTargetConnectionEditPart();
- 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()
- {
- super.createEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, adtDirectEditPolicy);
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new ADTSelectionFeedbackEditPolicy());
- }
-
- public EditPart doGetRelativeEditPart(EditPart editPart, int direction)
- {
- EditPart result = null;
- if (direction == PositionConstants.EAST)
- {
- result = getTargetConnectionEditPart();
- }
- else if (direction == PositionConstants.WEST)
- {
- for (Iterator iter = getParent().getChildren().iterator(); iter.hasNext(); )
- {
- Object child = iter.next();
- if (child instanceof SectionEditPart)
- {
- SectionEditPart groups = (SectionEditPart) child;
- for (Iterator i = groups.getChildren().iterator(); i.hasNext(); )
- {
- Object groupChild = i.next();
- EditPart connectable = getParentConnectableEditPart((EditPart)groupChild);
- if (connectable != null)
- {
- result = connectable;
- }
- }
- }
- }
- if (result == null)
- {
- result = this;
- }
- }
- else
- {
- result = super.doGetRelativeEditPart(editPart, direction);
- if (result == null)
- {
- result = ((BaseEditPart)getParent()).doGetRelativeEditPart(editPart, direction);
- }
- }
- return result;
- }
-
- protected ConnectableEditPart getParentConnectableEditPart(EditPart connectable)
- {
- if (connectable instanceof TargetConnectionSpacingFigureEditPart)
- {
- TargetConnectionSpaceFiller space = (TargetConnectionSpaceFiller) ((TargetConnectionSpacingFigureEditPart)connectable).getModel();
- if (space.getAdapter() == this.getModel())
- {
- return (ConnectableEditPart)connectable;
- }
- }
-
- for (Iterator i = connectable.getChildren().iterator(); i.hasNext(); )
- {
- Object child = i.next();
- if (child instanceof ConnectableEditPart)
- {
- ConnectableEditPart r = getParentConnectableEditPart((EditPart)child);
- if (r != null) return r;
- }
- else if (child instanceof TargetConnectionSpacingFigureEditPart)
- {
- TargetConnectionSpaceFiller space = (TargetConnectionSpaceFiller) ((TargetConnectionSpacingFigureEditPart)child).getModel();
- if (space.getAdapter() == this.getModel() && connectable instanceof ConnectableEditPart)
- {
- return (ConnectableEditPart)connectable;
- }
- }
- }
- return null;
- }
-
- 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 new GraphNodeDragTracker(this);
- }
-
- /*
- 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 (((IADTObject)getModel()).isReadOnly() || isFileReadOnly())
- {
- return;
- }
- 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 typeUpdateCommand = new TypeUpdateCommand();
- typeUpdateCommand.setDelegate(manager);
- adtDirectEditPolicy.setUpdateCommand(typeUpdateCommand);
- manager.show();
- }
- else if (hitTest(fieldFigure.getNameLabel(), p))
- {
- directEditNameField();
- }
- }
- else {
- directEditNameField();
- }
- }
- }
-
- protected void directEditNameField()
- {
- if (isFileReadOnly()) return;
- Object model = getModel();
- IFieldFigure fieldFigure = getFieldFigure();
- if ( model instanceof IField)
- {
- IField field = (IField) model;
- if (field.isReference())
- {
- ElementReferenceDirectEditManager manager = new ElementReferenceDirectEditManager((IField) model, this, fieldFigure.getNameLabel());
- ReferenceUpdateCommand elementUpdateCommand = new ReferenceUpdateCommand();
- elementUpdateCommand.setDelegate(manager);
- adtDirectEditPolicy.setUpdateCommand(elementUpdateCommand);
- manager.show();
- }
- else
- {
- LabelEditManager manager = new LabelEditManager(this, new LabelCellEditorLocator(this, null));
- NameUpdateCommandWrapper wrapper = new NameUpdateCommandWrapper();
- adtDirectEditPolicy.setUpdateCommand(wrapper);
- manager.show();
- }
- }
- }
-
- public void doEditName(boolean addFromDesign)
- {
- if (!addFromDesign) return;
-
-// removeFeedback();
-
- Runnable runnable = new Runnable()
- {
- public void run()
- {
- Object object = ((XSDBaseAdapter)getModel()).getTarget();
- if (object instanceof XSDNamedComponent)
- {
- Point p = getNameLabelFigure().getLocation();
- LabelEditManager manager = new LabelEditManager(BaseFieldEditPart.this, new LabelCellEditorLocator(BaseFieldEditPart.this, p));
- NameUpdateCommandWrapper wrapper = new NameUpdateCommandWrapper();
- adtDirectEditPolicy.setUpdateCommand(wrapper);
- manager.show();
- }
- }
- };
- Display.getCurrent().asyncExec(runnable);
-
- }
-
- protected class NameUpdateCommandWrapper extends Command implements IADTUpdateCommand
- {
- Command command;
- protected DirectEditRequest request;
-
- public NameUpdateCommandWrapper()
- {
- super(Messages._UI_ACTION_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(Messages._UI_ACTION_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()
- {
- IField field = (IField)getModel();
- Object newValue = ((CCombo)request.getCellEditor().getControl()).getText();
- if (newValue instanceof String)
- {
- return !newValue.equals(field.getTypeName());
- }
- return true;
- }
- }
-
- protected class ReferenceUpdateCommand extends Command implements IADTUpdateCommand
- {
- protected ComboBoxCellEditorManager delegate;
- protected DirectEditRequest request;
-
- public ReferenceUpdateCommand()
- {
- super(Messages._UI_ACTION_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;
- }
- }
-
-
- public void addFeedback()
- {
- // Put back connection figure so it won't get overlayed by other non highlighted connections
- if (connectionFigure != null && !isSelected)
- {
- 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();
- }
- public String getReaderText()
- {
- IFieldFigure fieldFigure = getFieldFigure();
-
- String name="";
- if (fieldFigure.getNameLabel() !=null&& fieldFigure.getNameLabel().getText().trim().length() > 0)
- name +=fieldFigure.getNameLabel().getText();
- if (fieldFigure.getNameAnnotationLabel() !=null && fieldFigure.getNameAnnotationLabel().getText().trim().length() > 0)
- name += " "+fieldFigure.getNameAnnotationLabel().getText();
- if (fieldFigure.getTypeLabel() !=null && fieldFigure.getTypeLabel().getText().trim().length() > 0)
- name += " type "+fieldFigure.getTypeLabel().getText();
- if (fieldFigure.getTypeAnnotationLabel() !=null && fieldFigure.getTypeAnnotationLabel().getText().trim().length() >0)
- name += " "+fieldFigure.getTypeAnnotationLabel().getText();
- return name;
-
- }
-}
-
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BaseTypeConnectingEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BaseTypeConnectingEditPart.java
deleted file mode 100644
index eebb8e6036..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BaseTypeConnectingEditPart.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.adt.design.editparts;
-
-import java.util.Iterator;
-import org.eclipse.draw2d.ConnectionAnchor;
-import org.eclipse.draw2d.Figure;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.PositionConstants;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.LayerConstants;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IFeedbackHandler;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.IADTUpdateCommand;
-import org.eclipse.wst.xsd.ui.internal.adt.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.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, IConnectionContainer
-{
- private TypeReferenceConnection connectionFigure;
-
- public void activate()
- {
- super.activate();
- }
-
- public void deactivate()
- {
- deactivateConnection();
- super.deactivate();
- }
-
- public void refreshConnections()
- {
- deactivateConnection();
- activateConnection();
- }
-
- protected void activateConnection()
- {
- // If appropriate, create our connectionFigure and add it to the appropriate layer
- if (connectionFigure == null && shouldDrawConnection())
- {
- //System.out.println("activateeConnection()-pre:" + getClass().getName());
- 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);
- }
- super.addFeedback();
- }
-
- public void removeFeedback()
- {
- if (connectionFigure != null)
- {
- connectionFigure.setHighlight(false);
- }
- super.removeFeedback();
- }
-
- protected class NameUpdateCommandWrapper extends Command implements IADTUpdateCommand
- {
- Command command;
- protected DirectEditRequest request;
-
- public NameUpdateCommandWrapper()
- {
- super(Messages._UI_ACTION_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);
- }
-
- public EditPart doGetRelativeEditPart(EditPart editPart, int direction)
- {
- EditPart result = null;
- if (direction == PositionConstants.WEST)
- {
- result = getConnectionEditPart(PositionConstants.WEST);
- }
- else if (direction == PositionConstants.EAST)
- {
- result = getConnectionEditPart(PositionConstants.EAST);
- }
- return result;
- }
-
- private EditPart getConnectionEditPart(int direction)
- {
- // find the first connection that targets this editPart
- // navigate backward along the connection (to the left) to find the source edit part
- EditPart result = null;
- for (Iterator i = getLayer(LayerConstants.CONNECTION_LAYER).getChildren().iterator(); i.hasNext(); )
- {
- Figure figure = (Figure)i.next();
- if (figure instanceof TypeReferenceConnection)
- {
- TypeReferenceConnection typeReferenceConnection = (TypeReferenceConnection)figure;
- ConnectionAnchor thisAnchor = null;
- if (direction == PositionConstants.EAST)
- {
- thisAnchor = typeReferenceConnection.getSourceAnchor();
- }
- else if (direction == PositionConstants.WEST)
- {
- thisAnchor = typeReferenceConnection.getTargetAnchor();
- }
- if (thisAnchor != null && thisAnchor.getOwner() == getFigure())
- {
- ConnectionAnchor outAnchor = null;
- if (direction == PositionConstants.EAST)
- {
- outAnchor = typeReferenceConnection.getTargetAnchor();
- }
- else if (direction == PositionConstants.WEST)
- {
- outAnchor = typeReferenceConnection.getSourceAnchor();
- }
-
- if (outAnchor != null)
- {
- IFigure sourceFigure = outAnchor.getOwner();
- EditPart part = null;
- while (part == null && sourceFigure != null)
- {
- part = (EditPart)getViewer().getVisualPartMap().get(sourceFigure);
- sourceFigure = sourceFigure.getParent();
- }
- result = part;
- break;
- }
- }
- }
- }
- return result;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BoxEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BoxEditPart.java
deleted file mode 100644
index 89a85deaae..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BoxEditPart.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * 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.internal.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.ui.internal.adt.design.editparts.model.Compartment;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.ADTSelectionFeedbackEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.SimpleDirectEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.adt.outline.ITreeElement;
-import org.eclipse.wst.xsd.ui.internal.adt.typeviz.design.figures.BoxFigure;
-
-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()
- {
- super.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/ui/internal/adt/design/editparts/CenteredConnectionAnchor.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/CenteredConnectionAnchor.java
deleted file mode 100644
index 0c93b9d691..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/CenteredConnectionAnchor.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*******************************************************************************
- * 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.internal.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.ui.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;
- private CenteredConnectionAnchor other;
-
- 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);
- }
-
- if (other != null)
- {
- // if within only one pixel of being vertical, we straighten up the line
- Point p2 = other.getLocation(null);
- if (Math.abs(p2.x - p.x) <= 1)
- {
- p.x = p2.x;
- }
- }
- return p;
- }
-
- public Point getReferencePoint()
- {
- return getLocation(null);
- }
-
- public void setOther(CenteredConnectionAnchor other)
- {
- this.other = other;
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/ColumnEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/ColumnEditPart.java
deleted file mode 100644
index 8eb4090fbc..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/ColumnEditPart.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.adt.design.editparts;
-
-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.gef.EditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.AbstractModelCollection;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.ReferencedTypeColumn;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IComplexType;
-
-public class ColumnEditPart extends BaseEditPart
-{
- protected int spacing = 20;
- protected int minorAlignment = -1;
- protected boolean isHorizontal = false;
-
- public ColumnEditPart()
- {
- }
-
- public ColumnEditPart(boolean isHorizontal)
- {
- this.isHorizontal = isHorizontal;
- }
-
- protected IFigure createFigure()
- {
- Figure figure = new Figure();
- ToolbarLayout layout = new ToolbarLayout(isHorizontal);
-
- 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;
- }
-
- protected void refreshChildren()
- {
- super.refreshChildren();
- if (getModel() instanceof ReferencedTypeColumn)
- {
- if (getParent().getChildren().size() > 0)
- {
- EditPart editPart = (EditPart)getParent().getChildren().get(0);
- refreshConnections(editPart);
- }
- }
- else
- {
- refreshConnections(this);
- }
- }
-
-
- public void refreshConnections(EditPart parent)
- {
- for (Iterator i = parent.getChildren().iterator(); i.hasNext(); )
- {
- EditPart editPart = (EditPart)i.next();
- if (editPart instanceof BaseTypeConnectingEditPart)
- {
- BaseTypeConnectingEditPart connectingEditPart = (BaseTypeConnectingEditPart)editPart;
- connectingEditPart.refreshConnections();
- }
- refreshConnections(editPart);
- }
- }
-
- public boolean isSelectable()
- {
- return false;
- }
-}
-
-
-
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/CompartmentEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/CompartmentEditPart.java
deleted file mode 100644
index 15f56e892e..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/CompartmentEditPart.java
+++ /dev/null
@@ -1,217 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.adt.design.editparts;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.PositionConstants;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.Annotation;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.Compartment;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.KeyBoardAccessibilityEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.adt.design.figures.ICompartmentFigure;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IField;
-
-// TODO (cs) common-up with BoxEditPart (?)
-public class CompartmentEditPart extends BaseEditPart // implements
- // IFeedbackHandler
-{
- protected Annotation annotation = new Annotation();
-
- protected IFigure createFigure()
- {
- ICompartmentFigure figure = getFigureFactory().createCompartmentFigure(getModel());
- return figure;
- }
-
- public IFigure getContentPane()
- {
- return getCompartmentFigure().getContentPane();
- }
-
- public boolean hasContent()
- {
- // since the annotation always takes up 1 child, here's a convenience method to figure out if
- return getChildren().size() > 1;
- }
-
- List getChildrenSansAnnotation()
- {
- List children = new ArrayList();
- children.addAll(getChildren());
- for (Iterator i = children.iterator(); i.hasNext(); )
- {
- EditPart child = (EditPart)i.next();
- if (child.getModel() == annotation)
- {
- i.remove();
- break;
- }
- }
- return children;
- }
-
- public EditPart doGetRelativeEditPart(EditPart editPart, int direction)
- {
- EditPart result = null;
-
- // we compute the children sans the annotation EditPart
- // since the annotation EditPart confuses our up/down key handling
- List children = getChildrenSansAnnotation();
- if (children.contains(editPart))
- {
- if (direction == KeyBoardAccessibilityEditPolicy.OUT_TO_PARENT)
- {
- Compartment compartment = (Compartment)getModel();
- for (EditPart parent = editPart.getParent(); parent != null; parent = parent.getParent())
- {
- if (parent.getModel() == compartment.getOwner())
- {
- result = parent;
- break;
- }
- }
- }
- else if (direction == PositionConstants.SOUTH)
- {
- int size = children.size();
- if (size > 0)
- {
- if (children.get(size - 1) == editPart)
- {
- CompartmentEditPart nextCompartment = (CompartmentEditPart)EditPartNavigationHandlerUtil.getNextSibling(CompartmentEditPart.this);
- if (nextCompartment != null && nextCompartment.getChildrenSansAnnotation().size() > 0)
- {
- result = EditPartNavigationHandlerUtil.getFirstChild(nextCompartment);
- }
- else
- {
- result = editPart;
- }
- }
- }
- if (result == null) result = EditPartNavigationHandlerUtil.getNextSibling(editPart);
- }
- else if (direction == PositionConstants.NORTH)
- {
- if (EditPartNavigationHandlerUtil.getFirstChild(CompartmentEditPart.this) == editPart)
- {
- EditPart prevCompartment = EditPartNavigationHandlerUtil.getPrevSibling(CompartmentEditPart.this);
- if (prevCompartment instanceof CompartmentEditPart)
- {
- List prevCompListChildren = ((CompartmentEditPart)prevCompartment).getChildrenSansAnnotation();
- int size = prevCompListChildren.size();
- if (size > 0)
- {
- result = (EditPart)prevCompartment.getChildren().get(size - 1);
- }
- }
- }
- if (result == null) result = EditPartNavigationHandlerUtil.getPrevSibling(editPart);
- }
- }
- return result;
- }
-
- 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/ui/internal/adt/design/editparts/ComplexTypeEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/ComplexTypeEditPart.java
deleted file mode 100644
index 0eceb08ac1..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/ComplexTypeEditPart.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.adt.design.editparts;
-
-import java.util.Iterator;
-
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.ManhattanConnectionRouter;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.FocusTypeColumn;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IComplexType;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IType;
-
-public class ComplexTypeEditPart extends StructureEditPart
-{
- private Font italicFont;
-
- protected boolean shouldDrawConnection()
- {
- if (getParent().getModel() instanceof FocusTypeColumn)
- {
- IComplexType complexType = (IComplexType)getModel();
- return complexType.getSuperType() != null;
- }
- return false;
- }
-
-
- private EditPart getTargetEditPart(IType type)
- {
- ColumnEditPart columnEditPart = null;
- for (EditPart editPart = this; editPart != null; editPart = editPart.getParent())
- {
- if (editPart instanceof ColumnEditPart)
- {
- columnEditPart = (ColumnEditPart)editPart;
- break;
- }
- }
- if (columnEditPart != null)
- {
- for (Iterator i = columnEditPart.getChildren().iterator(); i.hasNext(); )
- {
- EditPart child = (EditPart)i.next();
- if (child.getModel() == type)
- {
- return child;
- }
- }
- }
- return null;
- }
-
- public TypeReferenceConnection createConnectionFigure()
- {
- connectionFigure = null;
- IComplexType complexType = (IComplexType)getModel();
- IType type = complexType.getSuperType();
- if (type != null)
- {
- AbstractGraphicalEditPart referenceTypePart = (AbstractGraphicalEditPart)getTargetEditPart(type);
- if (referenceTypePart != null)
- {
- connectionFigure = new TypeReferenceConnection(true);
- // 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.setConnectionRouter(new ManhattanConnectionRouter());
- ((CenteredConnectionAnchor)connectionFigure.getSourceAnchor()).setOther((CenteredConnectionAnchor)connectionFigure.getTargetAnchor());
- connectionFigure.setHighlight(false);
- }
- }
- return connectionFigure;
- }
-
- protected void refreshVisuals()
- {
- super.refreshVisuals();
- Label label = getNameLabelFigure();
- IComplexType complexType = (IComplexType)getModel();
- if (complexType.isAbstract())
- {
- if (italicFont == null)
- {
- Font font = label.getFont();
- italicFont = getItalicFont(font);
- }
- if (italicFont != null)
- {
- label.setFont(italicFont);
- }
- }
- else
- {
- label.setFont(label.getParent().getFont());
- }
- }
-
- public void deactivate()
- {
- if (italicFont != null)
- {
- italicFont.dispose();
- italicFont = null;
- }
- super.deactivate();
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/EditPartNavigationHandlerUtil.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/EditPartNavigationHandlerUtil.java
deleted file mode 100644
index c234b65f5c..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/EditPartNavigationHandlerUtil.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * 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.internal.adt.design.editparts;
-import java.util.List;
-import org.eclipse.gef.EditPart;
-
-
-public class EditPartNavigationHandlerUtil
-{
- public static EditPart getFirstChild(EditPart editPart)
- {
- EditPart result = null;
- if (editPart.getChildren().size() > 0)
- {
- result = (EditPart)editPart.getChildren().get(0);
- }
- return result;
- }
-
- public static EditPart getLastChild(EditPart editPart)
- {
- EditPart result = null;
- int size = editPart.getChildren().size();
- if (size > 0)
- {
- result = (EditPart)editPart.getChildren().get(size - 1);
- }
- return result;
- }
-
- public static EditPart getNextSibling(EditPart editPart)
- {
- EditPart result = null;
- EditPart parent = editPart.getParent();
- if (parent != null)
- {
- List children = parent.getChildren();
- int index = children.indexOf(editPart);
- if (index + 1 < children.size())
- {
- result = (EditPart)children.get(index + 1);
- }
- }
- return result;
- }
-
- public static EditPart getPrevSibling(EditPart editPart)
- {
- EditPart result = null;
- EditPart parent = editPart.getParent();
- if (parent != null)
- {
- List children = parent.getChildren();
- int index = children.indexOf(editPart);
- if (index - 1 >= 0)
- {
- // if this is the first child
- //
- result = (EditPart)children.get(index - 1);
- }
- }
- return result;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/FieldEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/FieldEditPart.java
deleted file mode 100644
index f17dd39853..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/FieldEditPart.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * 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.internal.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/ui/internal/adt/design/editparts/IAutoDirectEdit.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/IAutoDirectEdit.java
deleted file mode 100644
index bcd3186980..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/IAutoDirectEdit.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.adt.design.editparts;
-
-/**
- * Edit parts that can be direct editable
- *
- */
-public interface IAutoDirectEdit
-{
- public void doEditName(boolean addFromDesign);
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/IConnectionContainer.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/IConnectionContainer.java
deleted file mode 100644
index 176125351a..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/IConnectionContainer.java
+++ /dev/null
@@ -1,16 +0,0 @@
-/*******************************************************************************
- * 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.internal.adt.design.editparts;
-
-public interface IConnectionContainer
-{
- public void refreshConnections();
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/IHolderEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/IHolderEditPart.java
deleted file mode 100644
index 7f7a5ae74c..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/IHolderEditPart.java
+++ /dev/null
@@ -1,16 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.adt.design.editparts;
-
-public interface IHolderEditPart
-{
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/INamedEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/INamedEditPart.java
deleted file mode 100644
index b186c28124..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/INamedEditPart.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * 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.internal.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/ui/internal/adt/design/editparts/RootContentEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/RootContentEditPart.java
deleted file mode 100644
index d2677d4a12..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/RootContentEditPart.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.adt.design.editparts;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.draw2d.Figure;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.MarginBorder;
-import org.eclipse.draw2d.Panel;
-import org.eclipse.draw2d.ToolbarLayout;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IGraphElement;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.RootHolder;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IComplexType;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IField;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IModel;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IStructure;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IType;
-
-public class RootContentEditPart extends BaseEditPart
-{
- List collections = null;
- Figure contentPane;
-
- protected IFigure createFigure()
- {
- Panel panel = new Panel();
- panel.setBorder(new MarginBorder(60));
-
- ToolbarLayout panelLayout = new ToolbarLayout(false);
- panelLayout.setStretchMinorAxis(true);
- panel.setLayoutManager(panelLayout);
-
- contentPane = new Figure();
- panel.add(contentPane);
-
- ToolbarLayout tb = new ToolbarLayout(false);
- tb.setMinorAlignment(ToolbarLayout.ALIGN_CENTER);
- tb.setStretchMinorAxis(true);
- tb.setSpacing(40);
- contentPane.setLayoutManager(tb);
-
- 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)
- {
- if (obj instanceof IGraphElement)
- {
- if (((IGraphElement)obj).isFocusAllowed())
- focusObject = (IStructure)obj;
- }
- }
- else if (obj instanceof IField)
- {
- focusObject = (IField)obj;
- }
- else if (obj instanceof IModel)
- {
- focusObject = (IModel)obj;
- collections.add(focusObject);
- return collections;
- }
- else if (obj instanceof IType)
- {
- if (obj instanceof IGraphElement)
- {
- if (((IGraphElement)obj).isFocusAllowed())
- {
- focusObject = (IType)obj;
- }
- }
- }
- else if (obj instanceof IGraphElement)
- {
- if (((IGraphElement)obj).isFocusAllowed())
- {
- focusObject = (IADTObject)obj;
- collections.add(focusObject);
- return collections;
- }
- }
- if (focusObject != null)
- {
- RootHolder holder = new RootHolder(focusObject);
- collections.add(holder);
- return collections;
- }
- }
- return collections;
- }
-
-
- /**
- * @deprecated Don't call this method. Use DesignViewGraphicalViewer.setInput() instead.
- */
- public void setInput(Object component)
- {
- setModel(component);
- refresh();
- }
-
- /**
- * @deprecated Don't call this method. Use DesignViewGraphicalViewer.getInput() instead.
- */
- public Object getInput()
- {
- return getModel();
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=252589
- public void activate()
- {
- super.activate();
- Object model = getModel();
- // The schema adapter doesn't have to notify the RootContentEditPart of it changes
- if (model instanceof IADTObject)
- {
- IADTObject object = (IADTObject)model;
- object.unregisterListener(this);
- }
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/RootEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/RootEditPart.java
deleted file mode 100644
index fd8758129f..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/RootEditPart.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*******************************************************************************
- * 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.internal.adt.design.editparts;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import org.eclipse.draw2d.BendpointConnectionRouter;
-import org.eclipse.draw2d.ConnectionLayer;
-import org.eclipse.draw2d.Figure;
-import org.eclipse.draw2d.FigureCanvas;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Layer;
-import org.eclipse.draw2d.LayeredPane;
-import org.eclipse.draw2d.RectangleFigure;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.LayerConstants;
-import org.eclipse.gef.editparts.ScalableRootEditPart;
-import org.eclipse.gef.ui.parts.ScrollingGraphicalViewer;
-import org.eclipse.wst.xsd.ui.internal.adt.design.DesignViewerGraphicConstants;
-
-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());
- }
-
- Figure figure = (Figure)getLayer(LayerConstants.FEEDBACK_LAYER);
- if (figure != null)
- {
- if (getViewer() instanceof ScrollingGraphicalViewer)
- {
- //ScrollingGraphicalViewer sgv = (ScrollingGraphicalViewer)getViewer();
- //IndexFigure indexFigure = new IndexFigure(sgv);
- //figure.add(indexFigure);
- //getViewer().addPropertyChangeListener(indexFigure);
- }
- }
- refresh();
- }
-
- protected LayeredPane createPrintableLayers()
- {
- LayeredPane pane = super.createPrintableLayers();
- Layer layer = new ScaledHandleLayer();
- layer.setPreferredSize(new Dimension(5, 5));
- pane.add(layer, DesignViewerGraphicConstants.SCALED_HANDLE_LAYER);
- return pane;
- }
-
-
- class ScaledHandleLayer extends Layer
- {
- ScaledHandleLayer()
- {
- setEnabled(true);
- }
- /**
- * @see org.eclipse.draw2d.Figure#getPreferredSize(int, int)
- */
- public Dimension getPreferredSize(int wHint, int hHint)
- {
- Rectangle rect = new Rectangle();
- for (int i = 0; i < getChildren().size(); i++)
- rect.union(((IFigure)getChildren().get(i)).getBounds());
- return rect.getSize();
- }
- }
-
- class IndexFigure extends RectangleFigure implements PropertyChangeListener
- {
- EditPart editPart;
- ScrollingGraphicalViewer sgv;
- public IndexFigure(ScrollingGraphicalViewer sgv)
- {
- this.sgv = sgv;
- ((FigureCanvas)sgv.getControl()).getViewport().getHorizontalRangeModel().addPropertyChangeListener(this);
- ((FigureCanvas)sgv.getControl()).getViewport().getVerticalRangeModel().addPropertyChangeListener(this);
- Rectangle bounds = new Rectangle(0, 0, 40, 40);
- translateToAbsolute(bounds);
- setBounds(bounds);
- }
- public void propertyChange(PropertyChangeEvent evt)
- {
- System.out.println("scroll-change");
- Rectangle bounds = new Rectangle(0, 0, 40, 40);
- Point p = ((FigureCanvas)sgv.getControl()).getViewport().getViewLocation();
- bounds.translate(p);
- setBounds(bounds);
- }
-
- public Rectangle getBounds()
- {
- Point p = ((FigureCanvas)sgv.getControl()).getViewport().getViewLocation();
- bounds.translate(p);
- return super.getBounds().getCopy().translate(p);
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/RootHolderEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/RootHolderEditPart.java
deleted file mode 100644
index a4ad059af0..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/RootHolderEditPart.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.adt.design.editparts;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Panel;
-import org.eclipse.draw2d.ToolbarLayout;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.FocusTypeColumn;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.ReferencedTypeColumn;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.RootHolder;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-
-public class RootHolderEditPart extends BaseEditPart implements IHolderEditPart
-{
- protected Panel panel;
-
- public RootHolderEditPart()
- {
- }
-
- protected IFigure createFigure()
- {
- panel = new Panel();
- ToolbarLayout layout = new ToolbarLayout(true);
- layout.setStretchMinorAxis(false);
- layout.setSpacing(100);
- panel.setLayoutManager(layout);
-
- return panel;
- }
-
- protected List getModelChildren()
- {
- List collections = new ArrayList();
- RootHolder holder = (RootHolder)getModel();
- IADTObject focusObject = holder.getModel();
- collections.add(new FocusTypeColumn(focusObject));
- collections.add(new ReferencedTypeColumn(focusObject));
- return collections;
- }
-
- protected void createEditPolicies()
- {
- super.createEditPolicies();
- }
-
- public boolean isSelectable()
- {
- return false;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/SectionEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/SectionEditPart.java
deleted file mode 100644
index a25af476be..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/SectionEditPart.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.adt.design.editparts;
-
-import org.eclipse.draw2d.Figure;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.ToolbarLayout;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IComplexType;
-
-public class SectionEditPart extends BaseEditPart
-{
- protected IComplexType complexType;
-
- protected IFigure createFigure()
- {
- Figure fig = new Figure();
- fig.setLayoutManager(new ToolbarLayout());
- return fig;
- }
-
- protected void createEditPolicies()
- {
-
- }
-
- public boolean isSelectable()
- {
- return false;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/StructureEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/StructureEditPart.java
deleted file mode 100644
index 167bfcfc8a..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/StructureEditPart.java
+++ /dev/null
@@ -1,249 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.adt.design.editparts;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.gef.EditPart;
-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.ui.internal.adapters.XSDComplexTypeDefinitionAdapter;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.SetInputToGraphView;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.Compartment;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.ADTDirectEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.ADTSelectionFeedbackEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.KeyBoardAccessibilityEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.adt.design.figures.IStructureFigure;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IStructure;
-import org.eclipse.wst.xsd.ui.internal.common.actions.OpenInNewEditor;
-import org.eclipse.wst.xsd.ui.internal.design.editparts.SpaceFillerForFieldEditPart;
-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();
- protected TypeReferenceConnection connectionFigure;
- protected TypeReferenceConnection connectionFeedbackFigure;
-
- /**
- * 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();
- }
-
-
- public EditPart doGetRelativeEditPart(EditPart editPart, int direction)
- {
- EditPart result = null;
- if (direction == KeyBoardAccessibilityEditPolicy.IN_TO_FIRST_CHILD)
- {
- for (Iterator i = getChildren().iterator(); i.hasNext();)
- {
- CompartmentEditPart compartment = (CompartmentEditPart)i.next();
- if (compartment.hasContent())
- {
- for (Iterator contentChildren = compartment.getChildren().iterator(); contentChildren.hasNext(); )
- {
- Object child = contentChildren.next();
- if (child instanceof SectionEditPart)
- {
- SectionEditPart part = (SectionEditPart) child;
- result = (EditPart)part.getChildren().get(0);
- return result;
- }
- else if (child instanceof BaseFieldEditPart && (!(child instanceof SpaceFillerForFieldEditPart)))
- {
- result = (EditPart)child;
- return result;
- }
- }
- }
- }
- }
- else
- {
- return super.doGetRelativeEditPart(editPart, direction);
- }
- return result;
- }
-
- protected void createEditPolicies()
- {
- super.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")); //$NON-NLS-1$
- compartmentList.add(new Compartment(getStructure(), "element")); //$NON-NLS-1$
- }
- 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)
- {
- if (request instanceof LocationRequest)
- {
- // uncomment for direct edit of name (add else)
-// 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();
-// }
- }
- }
- else if (request.getType() == RequestConstants.REQ_OPEN)
- {
- Object model = getModel();
- if (request instanceof LocationRequest)
- {
- LocationRequest locationRequest = (LocationRequest)request;
- Point p = locationRequest.getLocation();
-
- 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;
- }
- public String getReaderText()
- {
- // return getStructureFigure().getNameLabel().getText();
- return getNameLabelFigure().getText();
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/TopLevelFieldEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/TopLevelFieldEditPart.java
deleted file mode 100644
index 1ad0195f3f..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/TopLevelFieldEditPart.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.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.swt.graphics.Font;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.ADTDirectEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.ADTSelectionFeedbackEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IField;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IType;
-import org.eclipse.wst.xsd.ui.internal.adt.typeviz.design.figures.BoxFigure;
-
-public class TopLevelFieldEditPart extends BoxEditPart implements INamedEditPart
-{
- protected ADTDirectEditPolicy adtDirectEditPolicy = new ADTDirectEditPolicy();
- private Font italicFont;
-
- protected boolean shouldDrawConnection()
- {
- IField field = (IField)getModel();
- IType type = field.getType();
- return (type != null);
- }
-
- public TypeReferenceConnection createConnectionFigure()
- {
- TypeReferenceConnection connectionFigure = null;
- IField field = (IField)getModel();
- IType type = field.getType();
- if (type != null)
- {
- AbstractGraphicalEditPart referenceTypePart = (AbstractGraphicalEditPart)getViewer().getEditPartRegistry().get(type);
- if (referenceTypePart != null)
- {
- connectionFigure = new TypeReferenceConnection();
- connectionFigure.setSourceAnchor(new CenteredConnectionAnchor(getFigure(), CenteredConnectionAnchor.RIGHT, 0));
- int targetAnchorYOffset = 12;
- 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();
- Label label = boxFigure.getNameLabel();
- label.setText(field.getName());
- if (field.isAbstract())
- {
- if (italicFont == null)
- {
- Font font = label.getFont();
- italicFont = getItalicFont(font);
- }
- if (italicFont != null)
- {
- label.setFont(italicFont);
- }
- }
- else
- {
- label.setFont(label.getParent().getFont());
- }
- super.refreshVisuals();
- }
-
- public void deactivate()
- {
- if (italicFont != null)
- {
- italicFont.dispose();
- italicFont = null;
- }
- super.deactivate();
- }
-
- public Label getNameLabelFigure()
- {
- BoxFigure boxFigure = (BoxFigure)getFigure();
- return boxFigure.getNameLabel();
- }
-
- public void performDirectEdit(Point cursorLocation)
- {
-
- }
- public String getReaderText()
- {
- return getNameLabelFigure().getText();
- }
-
- 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/ui/internal/adt/design/editparts/TypeReferenceConnection.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/TypeReferenceConnection.java
deleted file mode 100644
index 0d7da4aba0..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/TypeReferenceConnection.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.adt.design.editparts;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.ConnectionRouter;
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.ManhattanConnectionRouter;
-import org.eclipse.draw2d.PolygonDecoration;
-import org.eclipse.draw2d.PolylineConnection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.widgets.Display;
-
-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 TypeReferenceConnection(boolean fill)
- {
- super();
- PolygonDecoration dec = new PolygonDecoration()
- {
- protected void fillShape(Graphics g)
- {
- try
- {
- g.pushState();
- g.setBackgroundColor(ColorConstants.white);
- super.fillShape(g);
- }
- finally
- {
- g.popState();
- }
- }
-
- };
- dec.setFill(fill);
- dec.setTemplate(PolygonDecoration.TRIANGLE_TIP);
- dec.setScale(14,6);
- setTargetDecoration(dec);
- }
-
-
- 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
- boolean highContrast = false;
- try
- {
- highContrast = Display.getDefault().getHighContrast();
- }
- catch (Exception e)
- {
- }
- if (highContrast)
- {
- setForegroundColor(highlight ? Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND) : ColorConstants.lightGray);
- }
- else
- {
- setForegroundColor(highlight ? activeConnection : inactiveConnection);
- }
- setOpaque(highlight);
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/AbstractModelCollection.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/AbstractModelCollection.java
deleted file mode 100644
index dbeb88e177..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/AbstractModelCollection.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.adt.design.editparts.model;
-
-import java.util.List;
-
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObjectListener;
-
-public abstract class AbstractModelCollection implements IADTObject
-{
- protected IADTObject model;
- protected 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);
- }
-
- public boolean isReadOnly()
- {
- return false;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/Annotation.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/Annotation.java
deleted file mode 100644
index 1f67a7fdd8..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/Annotation.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * 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.internal.adt.design.editparts.model;
-
-import org.eclipse.wst.xsd.ui.internal.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/ui/internal/adt/design/editparts/model/Compartment.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/Compartment.java
deleted file mode 100644
index 628cd4f8ef..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/Compartment.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * 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.internal.adt.design.editparts.model;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObjectListener;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IField;
-import org.eclipse.wst.xsd.ui.internal.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);
- }
-
- public boolean isReadOnly()
- {
- return false;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/FocusTypeColumn.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/FocusTypeColumn.java
deleted file mode 100644
index 60a6fc19c2..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/FocusTypeColumn.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.adt.design.editparts.model;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IField;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IStructure;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IType;
-
-public class FocusTypeColumn extends AbstractModelCollection
-{
- protected boolean isFocusObject = false;
-
- public FocusTypeColumn(IADTObject model)
- {
- super(model, "FocusTypeColumn"); //$NON-NLS-1$
- }
-
- public FocusTypeColumn(IADTObject model, boolean isFocusObject)
- {
- super(model, "FocusTypeColumn"); //$NON-NLS-1$
- this.isFocusObject = isFocusObject;
- }
-
- 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;
- }
-
- public boolean isFocusObject()
- {
- return isFocusObject;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/IActionProvider.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/IActionProvider.java
deleted file mode 100644
index d8443fa552..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/IActionProvider.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/*******************************************************************************
- * 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.internal.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/ui/internal/adt/design/editparts/model/IFeedbackHandler.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/IFeedbackHandler.java
deleted file mode 100644
index 18e860b330..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/IFeedbackHandler.java
+++ /dev/null
@@ -1,17 +0,0 @@
-/*******************************************************************************
- * 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.internal.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/ui/internal/adt/design/editparts/model/IGraphElement.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/IGraphElement.java
deleted file mode 100644
index 9b2f5cba55..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/IGraphElement.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.adt.design.editparts.model;
-
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IModel;
-import org.eclipse.gef.commands.Command;
-
-public interface IGraphElement
-{
- boolean isFocusAllowed();
- IADTObject getTopContainer();
- Command getDeleteCommand();
- IModel getModel();
- boolean isReadOnly();
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/IModelProxy.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/IModelProxy.java
deleted file mode 100644
index f263c38dd6..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/IModelProxy.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/*******************************************************************************
- * 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.internal.adt.design.editparts.model;
-
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IModel;
-
-public interface IModelProxy
-{
- IModel getModel();
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/ReferencedTypeColumn.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/ReferencedTypeColumn.java
deleted file mode 100644
index 95f8970e0a..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/ReferencedTypeColumn.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*******************************************************************************
- * 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.internal.adt.design.editparts.model;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObjectListener;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IField;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IStructure;
-import org.eclipse.wst.xsd.ui.internal.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"); //$NON-NLS-1$
- 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 instanceof IGraphElement)
- {
- if (((IGraphElement)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 instanceof IGraphElement)
- {
- if (((IGraphElement)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)
- {
- }
- notifyListeners(object, property);
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/RootHolder.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/RootHolder.java
deleted file mode 100644
index ca7b3a6225..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/RootHolder.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 22007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.adt.design.editparts.model;
-
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-
-public class RootHolder
-{
- IADTObject model;
-
- public RootHolder(IADTObject model)
- {
- this.model = model;
- }
-
- public IADTObject getModel()
- {
- return model;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editpolicies/ADTDirectEditPolicy.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editpolicies/ADTDirectEditPolicy.java
deleted file mode 100644
index b7f22b30a5..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editpolicies/ADTDirectEditPolicy.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * 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.internal.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.ui.internal.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/ui/internal/adt/design/editpolicies/ADTSelectionFeedbackEditPolicy.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editpolicies/ADTSelectionFeedbackEditPolicy.java
deleted file mode 100644
index 0747165e75..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editpolicies/ADTSelectionFeedbackEditPolicy.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies;
-
-import org.eclipse.gef.editpolicies.SelectionEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.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();
- }
- }
-
- protected void showFocus()
- {
- super.showFocus();
- getHost().setFocus(true);
- }
-
- protected void hideFocus()
- {
- super.hideFocus();
- getHost().setFocus(false);
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editpolicies/DirectEditPolicyDelegate.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editpolicies/DirectEditPolicyDelegate.java
deleted file mode 100644
index 151b493512..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editpolicies/DirectEditPolicyDelegate.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/*******************************************************************************
- * 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.internal.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/ui/internal/adt/design/editpolicies/IADTUpdateCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editpolicies/IADTUpdateCommand.java
deleted file mode 100644
index a4c4eb50bb..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editpolicies/IADTUpdateCommand.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/*******************************************************************************
- * 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.internal.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/ui/internal/adt/design/editpolicies/KeyBoardAccessibilityEditPolicy.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editpolicies/KeyBoardAccessibilityEditPolicy.java
deleted file mode 100644
index dd0ee63e22..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editpolicies/KeyBoardAccessibilityEditPolicy.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * 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.internal.adt.design.editpolicies;
-
-import org.eclipse.draw2d.PositionConstants;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.editpolicies.GraphicalEditPolicy;
-
-public class KeyBoardAccessibilityEditPolicy extends GraphicalEditPolicy
-{
- public static String KEY = "KeyBoardAccessibilityEditPolicy";
-
- public static int OUT_TO_PARENT = PositionConstants.ALWAYS_LEFT;
- public static int IN_TO_FIRST_CHILD = PositionConstants.ALWAYS_RIGHT;
-
- public EditPart getRelativeEditPart(EditPart editPart, int direction)
- {
- return null;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editpolicies/SimpleDirectEditPolicy.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editpolicies/SimpleDirectEditPolicy.java
deleted file mode 100644
index 4e38e39f6e..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editpolicies/SimpleDirectEditPolicy.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * 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.internal.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/ui/internal/adt/design/figures/IADTFigure.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/figures/IADTFigure.java
deleted file mode 100644
index 284a26043b..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/figures/IADTFigure.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * 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.internal.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/ui/internal/adt/design/figures/ICompartmentFigure.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/figures/ICompartmentFigure.java
deleted file mode 100644
index 3e25deff34..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/figures/ICompartmentFigure.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*******************************************************************************
- * 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.internal.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/ui/internal/adt/design/figures/IFieldFigure.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/figures/IFieldFigure.java
deleted file mode 100644
index efabeb0e68..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/figures/IFieldFigure.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************
- * 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.internal.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/ui/internal/adt/design/figures/IFigureFactory.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/figures/IFigureFactory.java
deleted file mode 100644
index d6efe614c4..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/figures/IFigureFactory.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/*******************************************************************************
- * 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.internal.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/ui/internal/adt/design/figures/IStructureFigure.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/figures/IStructureFigure.java
deleted file mode 100644
index 5a96af2019..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/figures/IStructureFigure.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * 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.internal.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/ui/internal/adt/edit/ComponentReferenceEditManager.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/edit/ComponentReferenceEditManager.java
deleted file mode 100644
index 46ac99a38a..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/edit/ComponentReferenceEditManager.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * 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.internal.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/ui/internal/adt/edit/ComponentReferenceEditManager2.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/edit/ComponentReferenceEditManager2.java
deleted file mode 100644
index c01312da73..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/edit/ComponentReferenceEditManager2.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.adt.edit;
-
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-
-public interface ComponentReferenceEditManager2 extends ComponentReferenceEditManager
-{
- void setReferencer(IADTObject field);
- IADTObject getReferencer();
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/edit/IComponentDialog.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/edit/IComponentDialog.java
deleted file mode 100644
index 4194f9b5b4..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/edit/IComponentDialog.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * 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.internal.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/ui/internal/adt/editor/ADTExternalResourceVariant.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/ADTExternalResourceVariant.java
deleted file mode 100644
index 96bf76a6d5..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/ADTExternalResourceVariant.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Jesper Steen Moller - added resolver lookups
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.adt.editor;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.SocketTimeoutException;
-import java.net.URL;
-import java.net.URLConnection;
-
-import org.eclipse.core.resources.IEncodedStorage;
-import org.eclipse.core.resources.IResourceStatus;
-import org.eclipse.core.resources.IStorage;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.content.IContentDescription;
-import org.eclipse.core.runtime.content.IContentTypeManager;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.common.uriresolver.internal.provisional.URIResolverPlugin;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-
-public class ADTExternalResourceVariant extends PlatformObject
-{
- private IStorage storage;
- private String urlString;
-
- public static String getCharset(String name, InputStream stream) throws IOException
- {
- IContentDescription description = getContentDescription(name, stream);
- return description == null ? null : description.getCharset();
- }
-
- public static IContentDescription getContentDescription(String name, InputStream stream) throws IOException
- {
- IContentTypeManager contentTypeManager = Platform.getContentTypeManager();
- try
- {
- return contentTypeManager.getDescriptionFor(stream, name, IContentDescription.ALL);
- }
- finally
- {
- if (stream != null)
- {
- try
- {
- stream.close();
- }
- catch (IOException e)
- {
-
- }
- }
- }
- }
-
- public ADTExternalResourceVariant(String urlString)
- {
- this.urlString = urlString;
- }
-
- class XSDResourceVariantStorage implements IEncodedStorage
- {
-
- public InputStream getContents() throws CoreException
- {
- try
- {
- String physicalUrlString = URIResolverPlugin.createResolver().resolvePhysicalLocation(null, null, urlString);
- URL url = new URL(physicalUrlString);
- URLConnection urlConnection = url.openConnection();
- return urlConnection.getInputStream();
- }
- catch (SocketTimeoutException toException)
- {
- // handle
- }
- catch (IOException e)
- {
-
- }
- return new ByteArrayInputStream(new byte[0]);
- }
-
- public IPath getFullPath()
- {
- // Since this is loaded from an URL, this should never be interpreted as a path
- return null;
- }
-
- public String getName()
- {
- return urlString;
- }
-
- public boolean isReadOnly()
- {
- return true;
- }
-
- public Object getAdapter(Class adapter)
- {
- return ADTExternalResourceVariant.this.getAdapter(adapter);
- }
-
- public String getCharset() throws CoreException
- {
- InputStream contents = getContents();
- try
- {
- String charSet = ADTExternalResourceVariant.getCharset(getName(), contents);
- return charSet;
- }
- catch (IOException e)
- {
- throw new CoreException(new Status(IStatus.ERROR, XSDEditorPlugin.PLUGIN_ID, IResourceStatus.FAILED_DESCRIBING_CONTENTS, NLS.bind("", new String[] { getFullPath().toString() }), e));
- }
- finally
- {
- try
- {
- contents.close();
- }
- catch (IOException ioException)
- {
-
- }
- }
- }
- }
-
- public IStorage getStorage()
- {
- if (storage == null)
- {
- storage = new XSDResourceVariantStorage();
- }
- return storage;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/ADTFileStoreEditorInput.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/ADTFileStoreEditorInput.java
deleted file mode 100644
index d9fc877296..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/ADTFileStoreEditorInput.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.adt.editor;
-
-import org.eclipse.core.filesystem.IFileStore;
-import org.eclipse.ui.ide.FileStoreEditorInput;
-import org.eclipse.wst.xsd.ui.internal.editor.Messages;
-import org.eclipse.xsd.XSDSchema;
-
-public class ADTFileStoreEditorInput extends FileStoreEditorInput implements IADTEditorInput
-{
- private XSDSchema schema;
- private String editorName;
-
- public ADTFileStoreEditorInput(IFileStore fileStore, XSDSchema xsdSchema)
- {
- super(fileStore);
- this.schema = xsdSchema;
- }
-
- 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 Messages._UI_LABEL_TARGET_NAMESPACE + ns;
- else
- return Messages._UI_LABEL_NO_NAMESPACE;
- }
- return super.getToolTipText();
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/ADTMultiPageEditor.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/ADTMultiPageEditor.java
deleted file mode 100644
index dbd3b7ce24..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/ADTMultiPageEditor.java
+++ /dev/null
@@ -1,373 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.adt.editor;
-
-import java.util.List;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPartFactory;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gef.GraphicalViewer;
-import org.eclipse.gef.SelectionManager;
-import org.eclipse.gef.editparts.ZoomManager;
-import org.eclipse.gef.ui.actions.ActionRegistry;
-import org.eclipse.gef.ui.parts.ScrollingGraphicalViewer;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-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.swt.SWT;
-import org.eclipse.swt.custom.StackLayout;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.contexts.IContextActivation;
-import org.eclipse.ui.contexts.IContextService;
-import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.BaseSelectionAction;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.SetInputToGraphView;
-import org.eclipse.wst.xsd.ui.internal.adt.design.ADTFloatingToolbar;
-import org.eclipse.wst.xsd.ui.internal.adt.design.DesignViewGraphicalViewer;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.ADTEditPartFactory;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IModel;
-import org.eclipse.wst.xsd.ui.internal.adt.outline.ADTContentOutlinePage;
-import org.eclipse.wst.xsd.ui.internal.adt.outline.ADTLabelProvider;
-import org.eclipse.wst.xsd.ui.internal.adt.outline.ExtensibleContentOutlinePage;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-
-public abstract class ADTMultiPageEditor extends CommonMultiPageEditor
-{
- protected IModel model;
- private int currentPage = -1;
- protected Button tableOfContentsButton;
- protected ADTFloatingToolbar floatingToolbar;
- private IContextActivation contextActivation;
- public final static String DESIGN_VIEW_CONTEXT = "org.eclipse.wst.xsd.ui.editor.designView"; //$NON-NLS-1$
- public final static String SOURCE_VIEW_CONTEXT = "org.eclipse.wst.xsd.ui.editor.sourceView"; //$NON-NLS-1$
-
- /**
- * Creates a multi-page editor example.
- */
- public ADTMultiPageEditor()
- {
- super();
- }
-
-
- private class InternalLayout extends StackLayout
- {
- public InternalLayout()
- {
- super();
- }
-
- protected void layout(Composite composite, boolean flushCache)
- {
- Control children[] = composite.getChildren();
- Rectangle rect = composite.getClientArea();
- rect.x += marginWidth;
- rect.y += marginHeight;
- rect.width -= 2 * marginWidth;
- rect.height -= 2 * marginHeight;
-
- for (int i = 0; i < children.length; i++)
- {
- if (i == 0) // For the back to schema button
- {
- org.eclipse.draw2d.geometry.Rectangle r = ((GraphicalEditPart)floatingToolbar.getContents()).getFigure().getBounds();
- children[i].setBounds(rect.x + 10, rect.y + 10, r.width, Math.max(24, r.height));
- }
- else if (i == 1 && modeCombo != null) // For the drop down toolbar
- {
- children[i].setBounds(rect.x + rect.width - 90 - maxLength, rect.y + 10, maxLength + 60, 26);
- }
- else // For the main graph viewer
- {
- children[i].setBounds(rect);
- }
- }
- }
- }
-
- protected Composite createGraphPageComposite()
- {
- Composite parent = new Composite(getContainer(), SWT.FLAT);
- parent.setBackground(ColorConstants.white);
-
- parent.setLayout(new InternalLayout());
-
- floatingToolbar = new ADTFloatingToolbar(getModel());
- floatingToolbar.createControl(parent);
- floatingToolbar.getControl().setVisible(true);
- EditPartFactory editPartFactory = getEditorModeManager().getCurrentMode().getEditPartFactory();
- floatingToolbar.setEditPartFactory(editPartFactory);
-
- createViewModeToolbar(parent);
-
- return parent;
- }
-
- protected void createGraphPage()
- {
- super.createGraphPage();
-// toolbarViewer.getControl().moveAbove(graphicalViewer.getControl());
-// graphicalViewer.getControl().moveBelow(toolbarViewer.getControl());
- }
-
- public String getContributorId()
- {
- return "org.eclipse.wst.xsd.ui.internal.editor"; //$NON-NLS-1$
- }
-
- public IContentOutlinePage getContentOutlinePage()
- {
- if (fOutlinePage == null || fOutlinePage.getControl() == null || fOutlinePage.getControl().isDisposed())
- {
- final ProductCustomizationProvider productCustomizationProvider = (ProductCustomizationProvider)getAdapter(ProductCustomizationProvider.class);
- ExtensibleContentOutlinePage outlinePage = null;
- if (productCustomizationProvider != null)
- {
- outlinePage = productCustomizationProvider.getProductContentOutlinePage();
- }
-
- if (outlinePage == null)
- {
- outlinePage = new ADTContentOutlinePage();
- }
- outlinePage.setEditor(this);
- ITreeContentProvider provider = (ITreeContentProvider)getEditorModeManager().getCurrentMode().getOutlineProvider();
- outlinePage.setContentProvider(provider);
- ADTLabelProvider adtLabelProvider = new ADTLabelProvider();
- outlinePage.setLabelProvider(adtLabelProvider);
- outlinePage.setModel(getModel());
- fOutlinePage = outlinePage;
- }
- return fOutlinePage;
- }
-
- /**
- * Creates the pages of the multi-page editor.
- */
- protected void createPages()
- {
- selectionProvider = getSelectionManager();
-
- createGraphPage();
- createSourcePage();
-
- getEditorSite().setSelectionProvider(selectionProvider);
-
- model = buildModel(); // (IFileEditorInput)getEditorInput());
-
- initializeGraphicalViewer();
- floatingToolbar.setModel(model);
-
- int pageIndexToShow = getDefaultPageTypeIndex();
- setActivePage(pageIndexToShow);
- }
-
- protected int getDefaultPageTypeIndex() {
- int pageIndex = SOURCE_PAGE_INDEX;
- if (XSDEditorPlugin.getPlugin().getDefaultPage().equals(XSDEditorPlugin.DESIGN_PAGE)) {
- pageIndex = DESIGN_PAGE_INDEX;
- }
-
- return pageIndex;
- }
-
- /**
- * @see org.eclipse.ui.IWorkbenchPart#setFocus()
- */
- public void setFocus()
- {
- super.setFocus();
- if (getActivePage() == DESIGN_PAGE_INDEX)
- {
- if (graphicalViewer != null && graphicalViewer.getControl() != null)
- {
- List selected = graphicalViewer.getSelectedEditParts();
- if (selected.size() > 0)
- {
- graphicalViewer.setFocus((EditPart)selected.get(0));
- }
- graphicalViewer.getControl().setFocus();
-
- }
- }
- else
- {
- graphicalViewer.setFocus(null);
- }
- }
-
- protected void pageChange(int newPageIndex)
- {
- deactivateContext(contextActivation);
- currentPage = newPageIndex;
- super.pageChange(newPageIndex);
-
- String context = getContext(currentPage);
- contextActivation = activateContext(context);
-
- if (newPageIndex == DESIGN_PAGE_INDEX)
- {
- ISelection selection = graphicalViewer.getSelectionManager().getSelection();
- Object model = null;
- if (selection instanceof StructuredSelection)
- {
- StructuredSelection structuredSelection = (StructuredSelection)selection;
- // While in the source view, selection could have changed.
- // Will try to select the first item when switching back to the design view.
- // We currently do not multi-select figures if multiple elements are selected in the source view.
- // For example, if multiple global elements are selected, the graph view will be in the details view
- // of the first one.
- Object elem = structuredSelection.getFirstElement();
- if (elem instanceof EditPart)
- model = ((EditPart)elem).getModel();
- }
- // Refresh the design page upon page change
- graphicalViewer.getContents().refresh();
- // Need to use the adapter, since after refresh, the old edit part will have been replaced
- // Maintain previous selection:
- if (model != null)
- {
- getSelectionManager().setSelection(new StructuredSelection(model));
- }
- }
- setFocus();
- }
-
- private boolean isTableOfContentsApplicable(Object graphViewInput)
- {
- return !(graphViewInput instanceof IModel);
- }
-
- protected ScrollingGraphicalViewer getGraphicalViewer()
- {
- DesignViewGraphicalViewer viewer = new DesignViewGraphicalViewer(this, getSelectionManager());
- viewer.addInputChangdListener(new ISelectionChangedListener()
- {
- public void selectionChanged(SelectionChangedEvent event)
- {
- IStructuredSelection input = (IStructuredSelection)event.getSelection();
- floatingToolbar.refresh(isTableOfContentsApplicable(input.getFirstElement()));
- }
- });
- // Workaround bug 227687 An edit part's focus state is not updated properly
- // Once this is bug is fixed, we can remove custom selection manager
- viewer.setSelectionManager(new CustomSelectionManager());
- return viewer;
- }
-
- // Workaround bug 227687 An edit part's focus state is not updated properly
- // Once this is bug is fixed, we can remove this class
- private class CustomSelectionManager extends SelectionManager
- {
- public void appendSelection(EditPart editpart)
- {
- if (editpart != getFocus())
- getViewer().setFocus(editpart);
- super.appendSelection(editpart);
- }
- }
-
- abstract public IModel buildModel(); // (IFileEditorInput editorInput);
-
- protected void createActions()
- {
- ActionRegistry registry = getActionRegistry();
-
- BaseSelectionAction action = new SetInputToGraphView(this);
- action.setSelectionProvider(getSelectionManager());
- registry.registerAction(action);
- }
-
-
- public IModel getModel()
- {
- return model;
- }
-
- public Object getAdapter(Class type)
- {
- if (type == ZoomManager.class)
- return graphicalViewer.getProperty(ZoomManager.class.toString());
-
- if (type == GraphicalViewer.class)
- return graphicalViewer;
- if (type == EditPart.class && graphicalViewer != null)
- return graphicalViewer.getRootEditPart();
- if (type == IFigure.class && graphicalViewer != null)
- return ((GraphicalEditPart) graphicalViewer.getRootEditPart()).getFigure();
-
- if (type == IContentOutlinePage.class)
- {
- return getContentOutlinePage();
- }
-
- return super.getAdapter(type);
- }
-
- protected EditPartFactory getEditPartFactory() {
- return new ADTEditPartFactory();
- }
-
- protected void initializeGraphicalViewer()
- {
- graphicalViewer.setContents(model);
- }
-
- public void dispose()
- {
- if (currentPage == SOURCE_PAGE_INDEX)
- {
- XSDEditorPlugin.getPlugin().setSourcePageAsDefault();
- }
- else
- {
- XSDEditorPlugin.getPlugin().setDesignPageAsDefault();
- }
- floatingToolbar = null;
- deactivateContext(contextActivation);
- super.dispose();
- }
- protected String getContext(int pageIndex) {
- if (pageIndex == DESIGN_PAGE_INDEX) {
- return DESIGN_VIEW_CONTEXT;
- } else if (pageIndex == SOURCE_PAGE_INDEX) {
- return SOURCE_VIEW_CONTEXT;
- }
-
- return null;
- }
- private IContextActivation activateContext(String context) {
- IContextService contextService = (IContextService) getSite().getService(IContextService.class);
-
- if (contextService != null && context != null) {
- return contextActivation = contextService.activateContext(context);
- }
- return null;
- }
-
- private void deactivateContext(IContextActivation contextActivation) {
- IContextService contextService = (IContextService) getSite().getService(IContextService.class);
-
- if (contextService != null && contextActivation != null) {
- contextService.deactivateContext(contextActivation);
- }
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/ADTReadOnlyFileEditorInput.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/ADTReadOnlyFileEditorInput.java
deleted file mode 100644
index b5fd8d2c51..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/ADTReadOnlyFileEditorInput.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.adt.editor;
-
-import org.eclipse.core.resources.IStorage;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.IPersistableElement;
-import org.eclipse.ui.IStorageEditorInput;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-import org.eclipse.wst.common.uriresolver.internal.URI;
-import org.eclipse.xsd.XSDSchema;
-
-/**
- *
- * Used for any read-only files, ie. HTTP files.
- *
- */
-public class ADTReadOnlyFileEditorInput implements IStorageEditorInput, IADTEditorInput
-{
- protected String urlString;
- protected IStorage storage;
- protected ADTExternalResourceVariant variant;
- protected XSDSchema xsdSchema;
- protected String editorName;
- protected String editorID = "";
-
- public ADTReadOnlyFileEditorInput(String urlString)
- {
- this.urlString = urlString;
- variant = new ADTExternalResourceVariant(urlString);
- }
-
- /*
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object o)
- {
- if (o == this)
- return true;
-
- if (o instanceof ADTReadOnlyFileEditorInput)
- {
- ADTReadOnlyFileEditorInput input = (ADTReadOnlyFileEditorInput) o;
-
- return urlString.equals(input.getUrlString()) && input.getEditorID().equals(editorID);
- }
-
- return false;
- }
-
- public String getUrlString()
- {
- return urlString;
- }
-
- public IStorage getStorage() throws CoreException
- {
- storage = variant.getStorage();
- return storage;
- }
-
- public boolean exists()
- {
- return false;
- }
-
- public ImageDescriptor getImageDescriptor()
- {
- return null;
- }
-
- public String getName()
- {
- if (editorName == null)
- {
- URI uri = URI.createURI(urlString);
- return uri.lastSegment();
- }
- return editorName;
- }
-
- public IPersistableElement getPersistable()
- {
- // http files cannot persist
- return null;
- }
-
- public String getToolTipText()
- {
- return urlString;
- }
-
- public Object getAdapter(Class adapter)
- {
- if (adapter == IWorkbenchAdapter.class)
- return this;
- if (adapter == IStorage.class)
- return storage;
- return null;
- }
-
- public void setSchema(XSDSchema xsdSchema)
- {
- this.xsdSchema = xsdSchema;
- }
-
- public XSDSchema getSchema()
- {
- return xsdSchema;
- }
-
- public void setEditorName(String name)
- {
- editorName = name;
- }
-
- public void setEditorID(String editorID)
- {
- this.editorID = editorID;
- }
-
- public String getEditorID()
- {
- return editorID;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/CommonMultiPageEditor.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/CommonMultiPageEditor.java
deleted file mode 100644
index 148cc02b3f..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/CommonMultiPageEditor.java
+++ /dev/null
@@ -1,942 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.adt.editor;
-
-import java.text.Collator;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.EventObject;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResourceChangeEvent;
-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.draw2d.geometry.Point;
-import org.eclipse.gef.DefaultEditDomain;
-import org.eclipse.gef.EditPartFactory;
-import org.eclipse.gef.EditPartViewer;
-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.LayerManager;
-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.ScrollingGraphicalViewer;
-import org.eclipse.gef.ui.parts.SelectionSynchronizer;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-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.layout.FillLayout;
-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.Label;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.IPartListener;
-import org.eclipse.ui.IPartService;
-import org.eclipse.ui.IPropertyListener;
-import org.eclipse.ui.IWindowListener;
-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.forms.widgets.ImageHyperlink;
-import org.eclipse.ui.ide.IDE;
-import org.eclipse.ui.ide.IGotoMarker;
-import org.eclipse.ui.part.FileEditorInput;
-import org.eclipse.ui.part.MultiPageEditorPart;
-import org.eclipse.ui.part.MultiPageEditorSite;
-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.ui.StructuredTextEditor;
-import org.eclipse.wst.xml.core.internal.provisional.contenttype.ContentTypeIdForXML;
-import org.eclipse.wst.xsd.ui.internal.adt.design.DesignViewerGraphicConstants;
-import org.eclipse.wst.xsd.ui.internal.adt.design.FlatCCombo;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.RootEditPart;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-
-public abstract class CommonMultiPageEditor extends MultiPageEditorPart implements IResourceChangeListener, CommandStackListener, ITabbedPropertySheetPageContributor, IPropertyListener, IEditorModeListener
-{
- public static int SOURCE_PAGE_INDEX = 1, DESIGN_PAGE_INDEX = 0;
-
- protected IContentOutlinePage fOutlinePage;
- protected DefaultEditDomain editDomain;
- protected SelectionSynchronizer synchronizer;
- protected ActionRegistry actionRegistry;
- protected StructuredTextEditor structuredTextEditor;
- protected CommonSelectionManager selectionProvider;
- protected ScrollingGraphicalViewer graphicalViewer;
- protected EditorModeManager editorModeManager;
- protected FlatCCombo modeCombo;
- private EditorModeAndCustomizedName[] editorModeAndCustomizedNames;
- protected Composite toolbar;
- protected ModeComboListener modeComboListener;
- protected int maxLength = 0;
- protected CommonActivationListener fActivationListener;
-
- public CommonMultiPageEditor()
- {
- super();
- editDomain = new DefaultEditDomain(this)
- {
- public void mouseDown(MouseEvent mouseEvent, EditPartViewer viewer)
- {
- boolean eatTheEvent = false;
- LayerManager manager = (LayerManager)viewer.getEditPartRegistry().get(LayerManager.ID);
- IFigure layer = manager.getLayer(DesignViewerGraphicConstants.SCALED_HANDLE_LAYER);
- if (layer != null)
- {
- Point p = new Point(mouseEvent.x, mouseEvent.y);
- layer.translateToRelative(p);
- IFigure figure = layer.findFigureAt(p);
- if (figure != null && figure != layer)
- {
- // we eat this selection event!
- eatTheEvent = true;
- }
- }
- if (!eatTheEvent)
- {
- super.mouseDown(mouseEvent, viewer);
- }
- }
- };
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor#getContributorId()
- */
- public abstract String getContributorId();
-
-
- /**
- *
- */
- protected abstract void createActions();
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.MultiPageEditorPart#createPages()
- */
- protected void createPages()
- {
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.EditorPart#doSave(org.eclipse.core.runtime.IProgressMonitor)
- */
- public void doSave(IProgressMonitor monitor)
- {
-// getEditor(1).doSave(monitor);
- structuredTextEditor.doSave(monitor);
- getCommandStack().markSaveLocation();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.EditorPart#doSaveAs()
- */
- public void doSaveAs()
- {
- IEditorPart editor = getEditor(1);
-// editor.doSaveAs();
- structuredTextEditor.doSaveAs();
- setInput(structuredTextEditor.getEditorInput());
- setPartName(editor.getTitle());
- getCommandStack().markSaveLocation();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.EditorPart#isSaveAsAllowed()
- */
- public boolean isSaveAsAllowed()
- {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.resources.IResourceChangeListener#resourceChanged(org.eclipse.core.resources.IResourceChangeEvent)
- *
- * 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);
- }
- }
- }
- });
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.gef.commands.CommandStackListener#commandStackChanged(java.util.EventObject)
- */
- public void commandStackChanged(EventObject event)
- {
- firePropertyChange(PROP_DIRTY);
- }
-
- /**
- * 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;
- }
- }
- }
-
- // Should override to set the input to the design viewer for a new document change
- // ie. when doing a saveAs
- protected void setInputToGraphicalViewer(IDocument newInput)
- {
- }
-
- protected void setInput(IEditorInput input)
- {
- super.setInput(input);
- if (graphicalViewer != null)
- {
- setInputToGraphicalViewer(getDocument());
- }
- }
-
- protected IDocument getDocument()
- {
- IDocument document = null;
- if (structuredTextEditor != null)
- {
- document = structuredTextEditor.getDocumentProvider().getDocument(structuredTextEditor.getEditorInput());
- }
- return document;
- }
-
- /**
- * @return
- */
- protected SelectionSynchronizer getSelectionSynchronizer()
- {
- if (synchronizer == null)
- synchronizer = new SelectionSynchronizer();
- return synchronizer;
- }
-
- public CommonSelectionManager getSelectionManager()
- {
- if (selectionProvider == null)
- {
- selectionProvider = new CommonSelectionManager(this);
- }
- return selectionProvider;
- }
-
- /*
- * 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();
- }
-
- /**
- * 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);
- actionRegistry.dispose();
-
- if (structuredTextEditor != null) {
- structuredTextEditor.removePropertyListener(this);
- }
- structuredTextEditor = null;
- editDomain = null;
- fOutlinePage = null;
- synchronizer = null;
- actionRegistry = null;
- selectionProvider = null;
- graphicalViewer = null;
- if (modeCombo != null && !modeCombo.isDisposed())
- {
- modeCombo.removeSelectionListener(modeComboListener);
- modeComboListener = null;
- }
-
- if (fActivationListener != null) {
- fActivationListener.dispose();
- fActivationListener = null;
- }
-
- super.dispose();
- }
-
- protected CommandStack getCommandStack()
- {
- return editDomain.getCommandStack();
- }
-
- /*
- * (non-Javadoc) Method declared on IEditorPart
- */
- public void gotoMarker(IMarker marker)
- {
- setActivePage(SOURCE_PAGE_INDEX);
- IDE.gotoMarker(structuredTextEditor, 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
- {
- super.init(site, editorInput);
-
- getCommandStack().addCommandStackListener(this);
-
- initializeActionRegistry();
-
- String title = null;
- if (getEditorInput() != null) {
- title = getEditorInput().getName();
- }
- setPartName(title);
-
- fActivationListener = new CommonActivationListener(site.getWorkbenchWindow().getPartService());
- }
-
- protected void initializeActionRegistry()
- {
- createActions();
- }
-
- protected ActionRegistry getActionRegistry()
- {
- if (actionRegistry == null)
- actionRegistry = new ActionRegistry();
- return actionRegistry;
- }
-
- public Object getAdapter(Class type)
- {
- if (type == CommandStack.class)
- return getCommandStack();
- if (type == ActionRegistry.class)
- return getActionRegistry();
- if (type == EditorModeManager.class)
- return getEditorModeManager();
- if (type == IGotoMarker.class) {
- return new IGotoMarker() {
- public void gotoMarker(IMarker marker) {
- CommonMultiPageEditor.this.gotoMarker(marker);
- }
- };
- }
- if (type == ITextEditor.class)
- return getTextEditor();
-
- return super.getAdapter(type);
- }
-
- protected DefaultEditDomain getEditDomain()
- {
- return editDomain;
- }
-
- /**
- * 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();
- }
- }
-
- public StructuredTextEditor getTextEditor()
- {
- return structuredTextEditor;
- }
-
- protected Composite createGraphPageComposite()
- {
- Composite parent = new Composite(getContainer(), SWT.NONE);
- parent.setLayout(new FillLayout());
- return parent;
- }
-
- protected void createGraphPage()
- {
- Composite parent = createGraphPageComposite();
-
- graphicalViewer = getGraphicalViewer();
- graphicalViewer.createControl(parent);
-
- getEditDomain().addViewer(graphicalViewer);
-
- configureGraphicalViewer();
- hookGraphicalViewer();
- int index = addPage(parent);
- setPageText(index, Messages._UI_LABEL_DESIGN);
- }
-
- /**
- * @see org.eclipse.ui.part.MultiPageEditorPart#createSite(org.eclipse.ui.IEditorPart)
- */
- protected IEditorSite createSite(IEditorPart editor) {
- IEditorSite site = null;
- if (editor == structuredTextEditor) {
- site = new MultiPageEditorSite(this, editor) {
- public String getId() {
- // sets this id so nested editor is considered xml source
- // page
- return ContentTypeIdForXML.ContentTypeID_XML + ".source"; //$NON-NLS-1$;
- }
- };
- }
- else {
- site = super.createSite(editor);
- }
- return site;
- }
-
- protected void createSourcePage()
- {
- structuredTextEditor = new StructuredTextEditor();
- try
- {
- int index = addPage(structuredTextEditor, getEditorInput());
- setPageText(index, Messages._UI_LABEL_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()); //$NON-NLS-1$
- }
- }
-
- protected void configureGraphicalViewer()
- {
- graphicalViewer.getControl().setBackground(ColorConstants.listBackground);
-
- // Set the root edit part
- // ScalableFreeformRootEditPart root = new ScalableFreeformRootEditPart();
- RootEditPart root = new RootEditPart();
- ZoomManager zoomManager = root.getZoomManager();
-
- List zoomLevelContributions = new ArrayList(3);
- zoomLevelContributions.add(ZoomManager.FIT_ALL);
- zoomLevelContributions.add(ZoomManager.FIT_WIDTH);
- zoomLevelContributions.add(ZoomManager.FIT_HEIGHT);
- zoomManager.setZoomLevelContributions(zoomLevelContributions);
-
- double[] zoomLevels = {.10, .25, .5, .75, 1.0, 1.25, 1.5, 2.0, 2.5, 3, 4, 5};
- zoomManager.setZoomLevels(zoomLevels);
-
- IAction zoomIn = new ZoomInAction(zoomManager);
- IAction zoomOut = new ZoomOutAction(zoomManager);
- 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());
-
- //connectionLayer.setConnectionRouter(new ShortestPathConnectionRouter(connectionLayer));
- // connectionLayer.setVisible(false);
-
- // Zoom
- zoomManager.setZoom(1.0);
- // Scroll-wheel Zoom
- graphicalViewer.setProperty(MouseWheelHandler.KeyGenerator.getKey(SWT.CTRL), MouseWheelZoomHandler.SINGLETON);
- graphicalViewer.setRootEditPart(root);
- graphicalViewer.setEditPartFactory(getEditPartFactory());
- }
-
- protected void hookGraphicalViewer()
- {
- getSelectionSynchronizer().addViewer(graphicalViewer);
- }
-
- protected abstract ScrollingGraphicalViewer getGraphicalViewer();
- protected abstract EditPartFactory getEditPartFactory();
- protected abstract void initializeGraphicalViewer();
-
- protected EditorModeManager getEditorModeManager()
- {
- if (editorModeManager == null)
- {
- editorModeManager = createEditorModeManager();
- editorModeManager.addListener(this);
- editorModeManager.init();
- }
- return editorModeManager;
- }
-
- protected abstract EditorModeManager createEditorModeManager();
-
-
- private String getEditModeName(EditorMode editorMode, ProductCustomizationProvider productCustomizationProvider)
- {
- String result = editorMode.getDisplayName();
- if (productCustomizationProvider != null)
- {
- String customizedName = productCustomizationProvider.getEditorModeDisplayName(editorMode.getId());
- if (customizedName != null)
- {
- result = customizedName;
- }
- }
- return result;
- }
-
- class EditorModeAndCustomizedName
- {
- EditorMode mode;
- String name;
- }
-
- protected void createViewModeToolbar(Composite parent)
- {
- EditorModeManager manager = (EditorModeManager)getAdapter(EditorModeManager.class);
- final ProductCustomizationProvider productCustomizationProvider = (ProductCustomizationProvider)getAdapter(ProductCustomizationProvider.class);
- EditorMode [] modeList = manager.getModes();
-
- int modeListLength = modeList.length;
- boolean showToolBar = modeListLength > 1;
-
- if (showToolBar)
- {
- toolbar = new Composite(parent, SWT.FLAT | SWT.DRAW_TRANSPARENT);
- toolbar.setBackground(ColorConstants.listBackground);
- toolbar.addPaintListener(new PaintListener() {
-
- public void paintControl(PaintEvent e)
- {
- Rectangle clientArea = toolbar.getClientArea();
- e.gc.setForeground(ColorConstants.lightGray);
- e.gc.drawRectangle(clientArea.x, clientArea.y, clientArea.width - 1, clientArea.height - 1);
- }
- });
-
- GridLayout gridLayout = new GridLayout(3, false);
- toolbar.setLayout(gridLayout);
-
- Label label = new Label(toolbar, SWT.FLAT | SWT.HORIZONTAL);
- label.setBackground(ColorConstants.listBackground);
- label.setText(Messages._UI_LABEL_VIEW);
- label.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_CENTER));
-
- modeCombo = new FlatCCombo(toolbar, SWT.FLAT);
- modeCombo.setEditable(false);
- modeCombo.setText(getEditModeName(manager.getCurrentMode(), productCustomizationProvider));
- GC gc = new GC(modeCombo);
- int textWidth = 0;
- maxLength = 0;
-
- // populate combo with modes
- editorModeAndCustomizedNames = new EditorModeAndCustomizedName[modeListLength];
- for (int i = 0; i < modeListLength; i++)
- {
- EditorModeAndCustomizedName entry = new EditorModeAndCustomizedName();
- editorModeAndCustomizedNames[i] = entry;
- entry.name = getEditModeName(modeList[i], productCustomizationProvider);
- entry.mode = modeList[i];
- }
- Arrays.sort(editorModeAndCustomizedNames, new Comparator()
- {
- public int compare(Object arg0, Object arg1)
- {
- EditorModeAndCustomizedName a = (EditorModeAndCustomizedName)arg0;
- EditorModeAndCustomizedName b = (EditorModeAndCustomizedName)arg1;
- return Collator.getInstance().compare(a.name, b.name);
- }
- });
- for (int i = 0; i < editorModeAndCustomizedNames.length; i++ )
- {
- EditorModeAndCustomizedName entry = editorModeAndCustomizedNames[i];
- modeCombo.add(entry.name);
- maxLength = Math.max (gc.stringExtent(entry.name).x, maxLength);
- int approxWidthOfStrings = Math.max (gc.stringExtent(entry.name).x, textWidth);
- if (approxWidthOfStrings > maxLength)
- maxLength = approxWidthOfStrings;
- }
-
- maxLength += gc.stringExtent(Messages._UI_LABEL_VIEW).x;
- gc.dispose();
-
- modeComboListener = new ModeComboListener();
- modeCombo.addSelectionListener(modeComboListener);
- modeCombo.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_END));
- modeCombo.setBackground(toolbar.getBackground());
-
- ImageHyperlink hyperlink = new ImageHyperlink(toolbar, SWT.FLAT);
- hyperlink.setBackground(ColorConstants.white);
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=154457
- Image image = XSDEditorPlugin.getDefault().getIconImage("etool16/help_contents");
- hyperlink.setImage(image);
- hyperlink.setToolTipText(Messages._UI_HOVER_VIEW_MODE_DESCRIPTION);
- hyperlink.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_CENTER));
- hyperlink.addMouseListener(new MouseAdapter()
- {
- public void mouseDown(MouseEvent e)
- {
- if (productCustomizationProvider != null)
- {
- productCustomizationProvider.handleAction("showEditorModeHelp");
- }
- }
- });
- }
- }
-
-
- protected class ModeComboListener implements SelectionListener
- {
- public ModeComboListener()
- {
- }
-
- public void widgetDefaultSelected(SelectionEvent e)
- {
- }
-
- public void widgetSelected(SelectionEvent e)
- {
- if (e.widget == modeCombo)
- {
- EditorModeManager manager = (EditorModeManager)getAdapter(EditorModeManager.class);
- EditorMode [] modeList = manager.getModes();
- if (modeList.length >= 1)
- {
- EditorModeAndCustomizedName entry = editorModeAndCustomizedNames[modeCombo.getSelectionIndex()];
- if (manager.getCurrentMode() != entry.mode)
- {
- manager.setCurrentMode(entry.mode);
- storeCurrentModePreference(entry.mode.getId());
- ProductCustomizationProvider productCustomizationProvider = (ProductCustomizationProvider) getAdapter(ProductCustomizationProvider.class);
- if (productCustomizationProvider != null)
- {
- productCustomizationProvider.handleAction("editorModeChanged");
- }
- }
- }
- }
- }
- }
-
- protected void storeCurrentModePreference(String id)
- {
- // Don't do anything as default. Allow extenders to implement.
- }
-
-
- protected class CommonActivationListener implements IPartListener, IWindowListener
- {
-
- /** Cache of the active workbench part. */
- private IWorkbenchPart fActivePart;
- /** Indicates whether activation handling is currently be done. */
- private boolean fIsHandlingActivation = false;
- /**
- * The part service.
- *
- * @since 3.1
- */
- private IPartService fPartService;
-
- /**
- * Creates this activation listener.
- *
- * @param partService
- * the part service on which to add the part listener
- * @since 3.1
- */
- public CommonActivationListener(IPartService partService)
- {
- fPartService = partService;
- fPartService.addPartListener(this);
- PlatformUI.getWorkbench().addWindowListener(this);
- }
-
- /**
- * Disposes this activation listener.
- *
- * @since 3.1
- */
- public void dispose()
- {
- fPartService.removePartListener(this);
- PlatformUI.getWorkbench().removeWindowListener(this);
- fPartService = null;
- }
-
- /*
- * @see IPartListener#partActivated(org.eclipse.ui.IWorkbenchPart)
- */
- public void partActivated(IWorkbenchPart part)
- {
- fActivePart = part;
- handleActivation();
- }
-
- /*
- * @see IPartListener#partBroughtToTop(org.eclipse.ui.IWorkbenchPart)
- */
- public void partBroughtToTop(IWorkbenchPart part)
- {
- // do nothing
- }
-
- /*
- * @see IPartListener#partClosed(org.eclipse.ui.IWorkbenchPart)
- */
- public void partClosed(IWorkbenchPart part)
- {
- // do nothing
- }
-
- /*
- * @see IPartListener#partDeactivated(org.eclipse.ui.IWorkbenchPart)
- */
- public void partDeactivated(IWorkbenchPart part)
- {
- fActivePart = null;
- }
-
- /*
- * @see IPartListener#partOpened(org.eclipse.ui.IWorkbenchPart)
- */
- public void partOpened(IWorkbenchPart part)
- {
- if (CommonMultiPageEditor.this.equals(part))
- {
- doPostEditorOpenTasks();
- }
- }
-
- /**
- * Handles the activation triggering a element state check in the editor.
- */
- void handleActivation()
- {
- if (fIsHandlingActivation || (getTextEditor() == null))
- {
- return;
- }
-
- if (fActivePart == CommonMultiPageEditor.this)
- {
- fIsHandlingActivation = true;
- try
- {
- getTextEditor().safelySanityCheckState(getEditorInput());
- }
- finally
- {
- fIsHandlingActivation = false;
- }
- }
- }
-
- /*
- * @see org.eclipse.ui.IWindowListener#windowActivated(org.eclipse.ui.IWorkbenchWindow)
- * @since 3.1
- */
- public void windowActivated(IWorkbenchWindow window)
- {
- if (window == getEditorSite().getWorkbenchWindow())
- {
- /*
- * Workaround for problem described in
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=11731 Will be removed
- * when SWT has solved the problem.
- */
- window.getShell().getDisplay().asyncExec(new Runnable()
- {
- public void run()
- {
- handleActivation();
- }
- });
- }
- }
-
- /*
- * @see org.eclipse.ui.IWindowListener#windowDeactivated(org.eclipse.ui.IWorkbenchWindow)
- * @since 3.1
- */
- public void windowDeactivated(IWorkbenchWindow window)
- {
- // do nothing
- }
-
- /*
- * @see org.eclipse.ui.IWindowListener#windowClosed(org.eclipse.ui.IWorkbenchWindow)
- * @since 3.1
- */
- public void windowClosed(IWorkbenchWindow window)
- {
- // do nothing
- }
-
- /*
- * @see org.eclipse.ui.IWindowListener#windowOpened(org.eclipse.ui.IWorkbenchWindow)
- * @since 3.1
- */
- public void windowOpened(IWorkbenchWindow window)
- {
- // do nothing
- }
- }
-
- public boolean isSourcePageActive()
- {
- return getActivePage() == SOURCE_PAGE_INDEX;
- }
-
- /**
- * Invoked during IPartListener#partOpened. Derived classes can override
- * to provide specialized behaviour.
- */
- protected void doPostEditorOpenTasks() {
- // Nothing to do in the base class.
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/CommonSelectionManager.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/CommonSelectionManager.java
deleted file mode 100644
index c91a5f6e87..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/CommonSelectionManager.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2011 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.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.IEditorSite;
-import org.eclipse.ui.part.MultiPageEditorPart;
-import org.eclipse.ui.part.MultiPageSelectionProvider;
-
-public class CommonSelectionManager extends MultiPageSelectionProvider implements ISelectionProvider, ISelectionChangedListener
-{
-
- public CommonSelectionManager(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()
- {
- 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)
- {
- 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);
- }
- // Bug 338126 Properties view not synced with XSD and WSDL design views
- // PropertySheet was changed to be a post selection listener
- // We need to fire off a post selection change event in order for the properties view to update.
- IEditorSite site = getMultiPageEditor().getEditorSite();
- if (site != null)
- {
- ISelectionProvider selectionProvider = site.getSelectionProvider();
- if (selectionProvider instanceof MultiPageSelectionProvider)
- {
- ((MultiPageSelectionProvider)selectionProvider).firePostSelectionChanged(event);
- }
- }
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- finally
- {
- enableNotify = true;
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/ContextMenuParticipant.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/ContextMenuParticipant.java
deleted file mode 100644
index 09d424f5e0..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/ContextMenuParticipant.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * 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.internal.adt.editor;
-
-import org.eclipse.jface.action.IMenuManager;
-
-public class ContextMenuParticipant
-{
- public boolean isApplicable(Object object, String actionId)
- {
- return true;
- }
-
- public void contributeActions(Object object, IMenuManager menu)
- {
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/EditorMode.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/EditorMode.java
deleted file mode 100644
index 56ef845811..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/EditorMode.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * 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.internal.adt.editor;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.gef.EditPartFactory;
-import org.eclipse.jface.viewers.IContentProvider;
-
-public abstract class EditorMode implements IAdaptable
-{
- public abstract String getId();
-
- public abstract String getDisplayName();
-
- public abstract EditPartFactory getEditPartFactory();
-
- // TODO (cs) this should return ITreeContentProvider
- public abstract IContentProvider getOutlineProvider();
-
- public ContextMenuParticipant getContextMenuParticipant()
- {
- return null;
- }
-
- public Object getAdapter(Class adapter)
- {
- return null;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/EditorModeManager.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/EditorModeManager.java
deleted file mode 100644
index 92bef66c30..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/EditorModeManager.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*******************************************************************************
- * 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.internal.adt.editor;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.Platform;
-
-public class EditorModeManager implements IAdaptable
-{
- private List modeList = new ArrayList();
- private EditorMode currentMode = null;
- private List listeners = new ArrayList();
- private String extensionPointId;
- private ProductCustomizationProvider productCustomizationProvider;
-
- public EditorModeManager(String extensionPointId)
- {
- this.extensionPointId = extensionPointId;
- }
-
- public void init()
- {
- readRegistry(extensionPointId);
- currentMode = getDefaultMode();
- }
-
- protected EditorMode getDefaultMode()
- {
- return (EditorMode)modeList.get(0);
- }
-
- protected void addMode(EditorMode mode)
- {
- modeList.add(mode);
- }
-
- public EditorMode getEditorMode(String editorModeId)
- {
- for (Iterator i = modeList.iterator(); i.hasNext(); )
- {
- EditorMode editorMode = (EditorMode)i.next();
- if (editorModeId.equals(editorMode.getId()))
- {
- return editorMode;
- }
- }
- return null;
- }
-
- public void setCurrentMode(EditorMode mode)
- {
- if (modeList.contains(mode))
- {
- currentMode = mode;
- List clonedList = new ArrayList();
- clonedList.addAll(listeners);
- for (Iterator i = clonedList.iterator(); i.hasNext(); )
- {
- IEditorModeListener listener = (IEditorModeListener)i.next();
- listener.editorModeChanged(mode);
- }
- }
- }
-
- public EditorMode getCurrentMode()
- {
- return currentMode;
- }
-
- public EditorMode[] getModes()
- {
- EditorMode[] modes = new EditorMode[modeList.size()];
- modeList.toArray(modes);
- return modes;
- }
-
- public void addListener(IEditorModeListener listener)
- {
- if (!listeners.contains(listener))
- {
- listeners.add(listener);
- }
- }
-
- public void removeListener(IEditorModeListener listener)
- {
- listeners.remove(listener);
- }
-
- private void readRegistry(String id)
- {
- IConfigurationElement[] elements = Platform.getExtensionRegistry().getConfigurationElementsFor(id);
- for (int i = 0; i < elements.length; i++)
- {
- IConfigurationElement element = elements[i];
- String editorModeId = element.getAttribute("id"); //$NON-NLS-1$
- if (editorModeId != null &&
- productCustomizationProvider != null &&
- !productCustomizationProvider.isEditorModeApplicable(editorModeId))
- {
- continue;
- }
- try
- {
- EditorMode mode = (EditorMode)element.createExecutableExtension("class");
- modeList.add(mode);
- }
- catch (Exception e)
- {
- }
- }
- }
-
- public Object getAdapter(Class adapter)
- {
- return null;
- }
-
-
- public void setProductCustomizationProvider(ProductCustomizationProvider productCustomizationProvider)
- {
- this.productCustomizationProvider = productCustomizationProvider;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/IADTEditorInput.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/IADTEditorInput.java
deleted file mode 100644
index a364d66c3f..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/IADTEditorInput.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.adt.editor;
-
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.xsd.XSDSchema;
-
-public interface IADTEditorInput extends IEditorInput
-{
- public XSDSchema getSchema();
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/IEditorModeListener.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/IEditorModeListener.java
deleted file mode 100644
index 7e98bde4f9..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/IEditorModeListener.java
+++ /dev/null
@@ -1,16 +0,0 @@
-/*******************************************************************************
- * 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.internal.adt.editor;
-
-public interface IEditorModeListener
-{
- void editorModeChanged(EditorMode newEditorMode);
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/Messages.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/Messages.java
deleted file mode 100644
index cb7de70269..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/Messages.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.adt.editor;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS
-{
- private static final String BUNDLE_NAME = "org.eclipse.wst.xsd.ui.internal.adt.editor.messages"; //$NON-NLS-1$
-
- private Messages()
- {
- }
-
- static
- {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
- public static String _UI_ACTION_SHOW_PROPERTIES;
- public static String _UI_ACTION_SET_AS_FOCUS;
- public static String _UI_ACTION_DELETE;
- public static String _UI_ACTION_ADD_FIELD;
- public static String _UI_ACTION_BROWSE;
- public static String _UI_ACTION_NEW;
- public static String _UI_ACTION_UPDATE_NAME;
- public static String _UI_ACTION_UPDATE_TYPE;
- public static String _UI_ACTION_UPDATE_ELEMENT_REFERENCE;
- public static String _UI_ACTION_SELECT_ALL;
- public static String _UI_LABEL_DESIGN;
- public static String _UI_LABEL_SOURCE;
- public static String _UI_LABEL_VIEW;
- public static String _UI_HOVER_VIEW_MODE_DESCRIPTION;
- public static String _UI_ACTION_CAPTURE_SCREEN_OVERWRITE_CONFIRMATION_QUESTION;
- public static String _UI_ACTION_CAPTURE_SCREEN_OVERWRITE_CONFIRMATION;
- public static String _UI_ACTION_CAPTURE_SCREEN_ERROR_TITLE;
- public static String _UI_ACTION_CAPTURE_SCREEN_ERROR_DESCRIPTION;
- public static String _UI_ACTION_CAPTURE_SCREEN_FORMAT_NOT_SUPPORTED;
- public static String _UI_CAPTURE_SCREEN_ACTION_TEXT;
- public static String _UI_CAPTURE_SCREEN_ACTION_TOOLTIPTEXT;
- public static String _UI_ACTION_CAPTURE_SCREEN_DEFAULT_FILE_NAME;
- public static String _UI_ACTION_CAPTURE_SCREEN_FILE_SAVE_DIALOG_TITLE;
- public static String _UI_HOVER_BACK_TO_SCHEMA;
- public static String _UI_REFACTOR_CONTEXT_MENU;
- public static String _UI_HYPERLINK_TEXT;
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/ProductCustomizationProvider.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/ProductCustomizationProvider.java
deleted file mode 100644
index bece06041f..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/ProductCustomizationProvider.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.adt.editor;
-
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.NavigationLocation;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.BaseEditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.outline.ExtensibleContentOutlinePage;
-import org.eclipse.xsd.XSDConcreteComponent;
-
-public abstract class ProductCustomizationProvider
-{
- public abstract boolean isEditorModeApplicable(String id);
- public abstract String getEditorModeDisplayName(String id);
-
- public String getProductString(String id)
- {
- return "";
- }
-
- public String getProductString(String id, Object[] args)
- {
- return "";
- }
-
- public void handleAction(String actionId)
- {
- }
-
- public NavigationLocation getNavigationLocation(IEditorPart part, XSDConcreteComponent component, BaseEditPart editPart)
- {
- return null;
- }
-
- public ExtensibleContentOutlinePage getProductContentOutlinePage()
- {
- return null;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/messages.properties b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/messages.properties
deleted file mode 100644
index c110e4d825..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/messages.properties
+++ /dev/null
@@ -1,37 +0,0 @@
-###############################################################################
-# Copyright (c) 2001, 2010 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.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_ACTION_SHOW_PROPERTIES=Sho&w properties
-_UI_ACTION_SET_AS_FOCUS=&Set As Focus
-_UI_ACTION_UPDATE_NAME=Update Name
-_UI_ACTION_UPDATE_TYPE=Update type
-_UI_ACTION_UPDATE_ELEMENT_REFERENCE=Update element reference
-_UI_ACTION_DELETE=&Delete
-_UI_ACTION_BROWSE=&Browse...
-_UI_LABEL_DESIGN=Design
-_UI_LABEL_SOURCE=Source
-_UI_ACTION_NEW=&New...
-_UI_ACTION_ADD_FIELD=Add Field
-_UI_LABEL_VIEW=View:
-_UI_HOVER_VIEW_MODE_DESCRIPTION=Change the view mode of the editor
-_UI_ACTION_CAPTURE_SCREEN_OVERWRITE_CONFIRMATION_QUESTION=Question
-_UI_ACTION_CAPTURE_SCREEN_OVERWRITE_CONFIRMATION=The file {0} already exists. Do you want to replace the existing file?
-_UI_ACTION_CAPTURE_SCREEN_ERROR_TITLE=Error
-_UI_ACTION_CAPTURE_SCREEN_ERROR_DESCRIPTION=Could not save editor contents
-_UI_ACTION_CAPTURE_SCREEN_FORMAT_NOT_SUPPORTED=Format not supported
-_UI_CAPTURE_SCREEN_ACTION_TEXT = &Export Diagram as Image...
-_UI_CAPTURE_SCREEN_ACTION_TOOLTIPTEXT = Export Diagram as Image
-_UI_ACTION_CAPTURE_SCREEN_DEFAULT_FILE_NAME = Diagram
-_UI_ACTION_CAPTURE_SCREEN_FILE_SAVE_DIALOG_TITLE=Export Diagram as Image
-_UI_HOVER_BACK_TO_SCHEMA=Show schema index view
-_UI_ACTION_SELECT_ALL=Select &All
-_UI_REFACTOR_CONTEXT_MENU=Refac&tor
-_UI_HYPERLINK_TEXT = Open {0} with the XML Schema editor
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/facade/IADTObject.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/facade/IADTObject.java
deleted file mode 100644
index bea4a836d9..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/facade/IADTObject.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/*******************************************************************************
- * 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.internal.adt.facade;
-
-public interface IADTObject
-{
- public void registerListener(IADTObjectListener listener);
- public void unregisterListener(IADTObjectListener listener);
- boolean isReadOnly();
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/facade/IADTObjectListener.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/facade/IADTObjectListener.java
deleted file mode 100644
index afc8efb4fb..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/facade/IADTObjectListener.java
+++ /dev/null
@@ -1,16 +0,0 @@
-/*******************************************************************************
- * 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.internal.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/ui/internal/adt/facade/IComplexType.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/facade/IComplexType.java
deleted file mode 100644
index c97adc4f62..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/facade/IComplexType.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.adt.facade;
-
-
-
-public interface IComplexType extends IType, IStructure
-{
- boolean isAbstract();
- Object getContentType();
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/facade/IField.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/facade/IField.java
deleted file mode 100644
index 7e31d32453..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/facade/IField.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.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 isReference();
- boolean isAbstract();
-
- 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/ui/internal/adt/facade/IModel.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/facade/IModel.java
deleted file mode 100644
index 4e42451d9a..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/facade/IModel.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/*******************************************************************************
- * 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.internal.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/ui/internal/adt/facade/IStructure.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/facade/IStructure.java
deleted file mode 100644
index 0c0d16e383..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/facade/IStructure.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************
- * 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.internal.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/ui/internal/adt/facade/IType.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/facade/IType.java
deleted file mode 100644
index cfd1adc99e..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/facade/IType.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * 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.internal.adt.facade;
-
-import org.eclipse.gef.commands.Command;
-
-public interface IType extends IADTObject
-{
- IType getSuperType();
- String getName();
- String getQualifier();
- boolean isComplexType();
- boolean isAnonymous();
-
- Command getUpdateNameCommand(String newName);
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/outline/ADTContentOutlinePage.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/outline/ADTContentOutlinePage.java
deleted file mode 100644
index 48fb01e9c4..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/outline/ADTContentOutlinePage.java
+++ /dev/null
@@ -1,339 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.adt.outline;
-
-import java.util.List;
-import java.util.Stack;
-
-import org.eclipse.emf.common.notify.Notifier;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.jface.action.IStatusLineManager;
-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.IStructuredSelection;
-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.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.ui.part.MultiPageSelectionProvider;
-import org.eclipse.wst.xml.ui.internal.contentoutline.JFaceNodeLabelProvider;
-import org.eclipse.wst.xsd.ui.internal.adapters.CategoryAdapter;
-import org.eclipse.wst.xsd.ui.internal.adapters.RedefineCategoryAdapter;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDAttributeDeclarationAdapter;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDAttributeGroupDefinitionAdapter;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDComplexTypeDefinitionAdapter;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDElementDeclarationAdapter;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDModelGroupDefinitionAdapter;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDRedefineAdapter;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDSchemaAdapter;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDSchemaDirectiveAdapter;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDSimpleTypeDefinitionAdapter;
-import org.eclipse.wst.xsd.ui.internal.adt.design.DesignViewContextMenuProvider;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IModelProxy;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IModel;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDSchema;
-
-public class ADTContentOutlinePage extends ExtensibleContentOutlinePage
-{
- protected int level = 0;
- protected MultiPageSelectionProvider selectionManager;
- protected SelectionManagerSelectionChangeListener selectionManagerSelectionChangeListener = new SelectionManagerSelectionChangeListener();
-
- public ADTContentOutlinePage()
- {
- super();
- }
-
- 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, editor.getSelectionManager());
- menuManager.addMenuListener(menuProvider);
- getSite().registerContextMenu("org.eclipse.wst.xsd.ui.popup.outline", menuManager, editor.getSelectionManager()); //$NON-NLS-1$
-
- // enable popupMenus extension
- // getSite().registerContextMenu("org.eclipse.wst.xsdeditor.ui.popup.outline",
- // menuManager, xsdEditor.getSelectionManager());
-
- // 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)
- {
- // disconnect from old one
- if (selectionManager != null)
- {
- selectionManager.removeSelectionChangedListener(selectionManagerSelectionChangeListener);
- }
- selectionManager = newSelectionManager;
- // connect to new one
- if (selectionManager != null)
- {
- selectionManager.addSelectionChangedListener(selectionManagerSelectionChangeListener);
- }
- }
-
- protected class SelectionManagerSelectionChangeListener implements ISelectionChangedListener
- {
- public void selectionChanged(SelectionChangedEvent event)
- {
- updateStatusLine(getSite().getActionBars().getStatusLineManager(), event.getSelection());
- if (event.getSelectionProvider() != ADTContentOutlinePage.this) //getTreeViewer())
- {
- StructuredSelection selection = (StructuredSelection)event.getSelection();
- StructuredSelection currentSelection = (StructuredSelection) getTreeViewer().getSelection();
-
- Object selectionFirstElement = selection.getFirstElement();
- Object currentFirstElement = currentSelection.getFirstElement();
-
- // TODO: Hack to prevent losing a selection when the schema is selected in the
- // source. Fix is to prevent the source from firing off selection changes when
- // the selection source is not the source view.
-
- if (selectionFirstElement instanceof IModel)
- {
- if (!(currentFirstElement instanceof IModelProxy) || currentFirstElement instanceof RedefineCategoryAdapter)
- {
- getTreeViewer().setSelection(event.getSelection(), true);
- }
- }
- else if (selectionFirstElement instanceof XSDSchemaDirectiveAdapter)
- {
- if (!(currentFirstElement instanceof RedefineCategoryAdapter))
- {
- getTreeViewer().setSelection(event.getSelection(), true);
- }
- }
- else
- {
- IStructuredSelection structuredSelection = (IStructuredSelection) event.getSelection();
- List list = structuredSelection.toList();
- int selectionLength = list.size();
- if (selectionLength > 0)
- {
- for (int i = 0; i < selectionLength; i++)
- {
- Object item = list.get(i);
-
- if (item instanceof AdapterImpl)
- {
- Notifier target = ((AdapterImpl) item).getTarget();
-
- if (!(target instanceof XSDConcreteComponent))
- continue;
-
- XSDConcreteComponent xsdConcreteComponent = (XSDConcreteComponent) target;
-
- // need to expand parent before child, thus a stack is required
- Stack componentStack = new Stack();
- while (xsdConcreteComponent != null)
- {
- componentStack.push(xsdConcreteComponent);
- xsdConcreteComponent = xsdConcreteComponent.getContainer();
- }
-
- // At this point the stack must have the XSDSchemaAdapter and
- // at least one component
- if (componentStack.size() < 2)
- continue;
-
- // Pop off the top node, since it is the XSDSchemaAdapter, which
- // isn't
- // used as part of finding the outline view hierarchy
- componentStack.pop();
-
- if (((XSDConcreteComponent) componentStack.peek()).eAdapters().size() <= 0)
- continue;
-
- Object object = ((XSDConcreteComponent) componentStack.peek()).eAdapters().get(0);
-
- // Find out which category the selected item is contained in
- int categoryIndex = -1;
- if (object instanceof XSDSchemaDirectiveAdapter)
- {
- categoryIndex = CategoryAdapter.DIRECTIVES;
- }
- else if (object instanceof XSDElementDeclarationAdapter)
- {
- categoryIndex = CategoryAdapter.ELEMENTS;
- }
- else if (object instanceof XSDAttributeDeclarationAdapter)
- {
- categoryIndex = CategoryAdapter.ATTRIBUTES;
- }
- else if (object instanceof XSDAttributeGroupDefinitionAdapter)
- {
- categoryIndex = CategoryAdapter.ATTRIBUTES;
- }
- else if (object instanceof XSDComplexTypeDefinitionAdapter || object instanceof XSDSimpleTypeDefinitionAdapter)
- {
- categoryIndex = CategoryAdapter.TYPES;
- }
- else if (object instanceof XSDModelGroupDefinitionAdapter)
- {
- categoryIndex = CategoryAdapter.GROUPS;
- }
-
- // Expand the category
- if (categoryIndex == -1)
- continue;
- CategoryAdapter category = ((XSDSchemaAdapter) model).getCategory(categoryIndex);
- treeViewer.setExpandedState(category, true);
-
- // Do not expand current node of interest, just its parents
- while (componentStack.size() > 1)
- {
- object = componentStack.pop();
- if (object instanceof XSDConcreteComponent)
- {
- XSDConcreteComponent component = (XSDConcreteComponent) object;
- if (component.eAdapters().size() > 0)
- {
- // expand
- getTreeViewer().setExpandedState(component.eAdapters().get(0), true);
- }
- }
- }
- }
- }
- }
- // Bug 251474 - We will restrict selection to only one item
- if (selectionLength == 1)
- {
- getTreeViewer().setSelection(event.getSelection(), true);
- }
- else
- {
- if(structuredSelection.getFirstElement() !=null)
- getTreeViewer().setSelection(new StructuredSelection(structuredSelection.getFirstElement()), true);
- }
- }
- }
- }
- }
-
- protected void updateStatusLine(IStatusLineManager mgr, ISelection selection)
- {
- String text = null;
- Image image = null;
- ILabelProvider statusLineLabelProvider = new StatusLineLabelProvider(getTreeViewer());
- if (statusLineLabelProvider != null && selection instanceof IStructuredSelection && !selection.isEmpty())
- {
- Object firstElement = ((IStructuredSelection) selection).getFirstElement();
- if (firstElement instanceof XSDRedefineAdapter)
- return;
- text = statusLineLabelProvider.getText(firstElement);
- image = statusLineLabelProvider.getImage(firstElement);
- }
- if (image == null)
- {
- mgr.setMessage(text);
- }
- else
- {
- mgr.setMessage(image, text);
- }
- }
-
- protected class StatusLineLabelProvider extends JFaceNodeLabelProvider
- {
- TreeViewer treeViewer = null;
-
- public StatusLineLabelProvider(TreeViewer viewer)
- {
- treeViewer = viewer;
- }
-
- public String getText(Object element)
- {
- if (element == null)
- return null;
-
- StringBuffer s = new StringBuffer();
- s.append(labelProvider.getText(element));
- return s.toString();
- }
-
- public Image getImage(Object element)
- {
- return labelProvider.getImage(element);
- }
- }
-
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/outline/ADTContentOutlineProvider.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/outline/ADTContentOutlineProvider.java
deleted file mode 100644
index ac6e76f24e..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/outline/ADTContentOutlineProvider.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.adt.outline;
-
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObjectListener;
-
-public class ADTContentOutlineProvider implements ITreeContentProvider, IADTObjectListener
-{
- protected Viewer viewer = null;
- protected Object oldInput, newInput;
- protected ADTContentOutlineRefreshJob refreshJob;
-
- 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);
- }
- if (refreshJob != null)
- {
- refreshJob.cancel();
- refreshJob = null;
- }
- }
-
- /* (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;
- if (refreshJob != null)
- {
- refreshJob.cancel();
- }
- refreshJob = new ADTContentOutlineRefreshJob(viewer);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObjectListener#propertyChanged(java.lang.Object, java.lang.String)
- */
- public void propertyChanged(Object object, String property)
- {
- refreshJob.refresh((IADTObject)object);
- }
-
- /**
- * @param model
- */
- private void removeListener(IADTObject model)
- {
- model.unregisterListener(this);
- Object[] children = null;
-
- if (model instanceof ITreeElement)
- {
- children = ((ITreeElement) model).getChildren();
- }
-
- if (children != null)
- {
- int length = children.length;
- for (int i = 0; i < length; i++)
- {
- Object child = children[i];
- if (child instanceof IADTObject && model != child)
- {
- removeListener((IADTObject) child);
- }
- }
- }
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/outline/ADTContentOutlineRefreshJob.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/outline/ADTContentOutlineRefreshJob.java
deleted file mode 100644
index bf04cf473a..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/outline/ADTContentOutlineRefreshJob.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.adt.outline;
-
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.xsd.ui.internal.adapters.CategoryAdapter;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-
-
-/**
- * This job holds a queue of updates (affected nodes) for the XSD editor's
- * outline view. When a new request comes in, the current run is cancelled,
- * the new request is added to the queue, then the job is re-scheduled.
- * This class is loosely based on RefreshStructureJob.
- */
-class ADTContentOutlineRefreshJob extends Job
-{
- /**
- * The delay time in milliseconds.
- */
- private static final long UPDATE_DELAY = 300;
-
- private final List nodesToRefresh = new ArrayList(5);
-
- private final TreeViewer viewer;
-
- public ADTContentOutlineRefreshJob(Viewer viewer)
- {
- super("Refreshing XSD outline"); //$NON-NLS-1$
- setPriority(Job.LONG);
- setSystem(true);
- this.viewer = (TreeViewer)viewer;
- }
-
- private synchronized void addRefreshRequest(IADTObject adtObject)
- {
- if (nodesToRefresh.contains(adtObject))
- {
- return;
- }
-
- nodesToRefresh.add(adtObject);
- }
-
- protected void canceling()
- {
- nodesToRefresh.clear();
- super.canceling();
- }
-
- private void doRefresh(final IADTObject adtObject)
- {
- final Display display = PlatformUI.getWorkbench().getDisplay();
- display.asyncExec(new Runnable()
- {
- public void run()
- {
- boolean isValidViewer = viewer != null && !viewer.getControl().isDisposed();
- if (isValidViewer)
- {
- viewer.refresh(adtObject);
-
- // Needlessly revealing the category nodes causes a lot of UI flicker.
-
- if (!(adtObject instanceof CategoryAdapter))
- {
- viewer.reveal(adtObject);
- }
- }
- }
- });
- }
-
- private synchronized IADTObject[] getNodesToRefresh()
- {
- IADTObject[] toRefresh = new IADTObject [nodesToRefresh.size()];
- nodesToRefresh.toArray(toRefresh);
- nodesToRefresh.clear();
-
- return toRefresh;
- }
-
- public void refresh(IADTObject adtObject)
- {
- if (adtObject == null)
- {
- return;
- }
-
- addRefreshRequest(adtObject);
-
- schedule(UPDATE_DELAY);
- }
-
- protected IStatus run(IProgressMonitor monitor)
- {
- IStatus status = Status.OK_STATUS;
- try
- {
- performRefreshes(monitor);
- }
- finally
- {
- monitor.done();
- }
- return status;
- }
-
- private void performRefreshes(IProgressMonitor monitor)
- {
- IADTObject[] nodes = getNodesToRefresh();
-
- for (int index = 0; index < nodes.length; index++)
- {
- if (monitor.isCanceled())
- {
- throw new OperationCanceledException();
- }
- IADTObject node = nodes[index];
- doRefresh(node);
- }
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/outline/ADTLabelProvider.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/outline/ADTLabelProvider.java
deleted file mode 100644
index 14a6d4d845..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/outline/ADTLabelProvider.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * 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.internal.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-NLS-1$
- }
-
- /* (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/ui/internal/adt/outline/ExtensibleContentOutlinePage.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/outline/ExtensibleContentOutlinePage.java
deleted file mode 100644
index 4e19a5667b..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/outline/ExtensibleContentOutlinePage.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.adt.outline;
-
-import org.eclipse.core.runtime.ListenerList;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.util.SafeRunnable;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-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.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.part.IPageSite;
-import org.eclipse.ui.part.Page;
-import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
-import org.eclipse.wst.xsd.ui.internal.adt.editor.ADTMultiPageEditor;
-
-public class ExtensibleContentOutlinePage extends Page implements IContentOutlinePage, ISelectionChangedListener
-{
- protected ListenerList selectionChangedListeners = new ListenerList();
- protected TreeViewer treeViewer;
- protected Object model;
- protected ITreeContentProvider contentProvider;
- protected ILabelProvider labelProvider;
- protected ADTMultiPageEditor editor;
-
- protected ExtensibleContentOutlinePage()
- {
- super();
- }
-
- public void createControl(Composite parent)
- {
- treeViewer = new TreeViewer(parent, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL);
- treeViewer.addSelectionChangedListener(this);
- }
-
- public void setEditor(ADTMultiPageEditor editor)
- {
- 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;
- }
-
- public void setFocus()
- {
- treeViewer.getControl().setFocus();
- }
-
- public void setSelection(ISelection selection)
- {
- if (treeViewer != null)
- {
- treeViewer.setSelection(selection);
- }
- }
-
- public void addSelectionChangedListener(ISelectionChangedListener listener)
- {
- selectionChangedListeners.add(listener);
- }
-
- protected void fireSelectionChanged(ISelection selection)
- {
- // create an event
- final SelectionChangedEvent event = new SelectionChangedEvent(this, selection);
-
- // fire the event
- Object[] listeners = selectionChangedListeners.getListeners();
- for (int i = 0; i < listeners.length; ++i)
- {
- final ISelectionChangedListener l = (ISelectionChangedListener) listeners[i];
- Platform.run(new SafeRunnable()
- {
- public void run()
- {
- l.selectionChanged(event);
- }
- });
- }
- }
-
- public Control getControl()
- {
- if (treeViewer == null)
- {
- return null;
- }
- return treeViewer.getControl();
- }
-
- public ISelection getSelection()
- {
- if (treeViewer == null)
- {
- return StructuredSelection.EMPTY;
- }
- return treeViewer.getSelection();
- }
-
- public TreeViewer getTreeViewer()
- {
- return treeViewer;
- }
-
- public void init(IPageSite pageSite)
- {
- super.init(pageSite);
- pageSite.setSelectionProvider(this);
- }
-
- public void removeSelectionChangedListener(ISelectionChangedListener listener)
- {
- selectionChangedListeners.remove(listener);
- }
-
- public void selectionChanged(SelectionChangedEvent event)
- {
- fireSelectionChanged(event.getSelection());
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/outline/ITreeElement.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/outline/ITreeElement.java
deleted file mode 100644
index a660d9a30b..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/outline/ITreeElement.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************
- * 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.internal.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/ui/internal/adt/properties/ADTTabbedPropertySheetPage.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/properties/ADTTabbedPropertySheetPage.java
deleted file mode 100644
index 5c1343f4f6..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/properties/ADTTabbedPropertySheetPage.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.adt.properties;
-
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
-
-/**
- * @deprecated. Extenders should specialize...ie. XSDTabbedPropertySheetPage
- */
-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/internal/common/actions/AddXSDAnyAttributeAction.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDAnyAttributeAction.java
deleted file mode 100644
index 07785fc680..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDAnyAttributeAction.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * 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.internal.common.actions;
-
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDAdapterFactory;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter;
-import org.eclipse.wst.xsd.ui.internal.common.commands.AddXSDAnyAttributeCommand;
-import org.eclipse.wst.xsd.ui.internal.common.util.Messages;
-import org.eclipse.xsd.XSDAttributeGroupDefinition;
-import org.eclipse.xsd.XSDComplexTypeDefinition;
-
-public class AddXSDAnyAttributeAction extends XSDBaseAction
-{
- public static String ID = "org.eclipse.wst.xsd.ui.AddXSDAnyAttributeAction"; //$NON-NLS-1$
- protected XSDComplexTypeDefinition xsdComplexTypeDefinition;
-
- public AddXSDAnyAttributeAction(IWorkbenchPart part)
- {
- super(part);
- setText(Messages._UI_ACTION_ADD_ANY_ATTRIBUTE);
- setId(ID);
- }
-
- public void run()
- {
- Object selection = ((IStructuredSelection) getSelection()).getFirstElement();
-
- if (selection instanceof XSDBaseAdapter)
- {
- selection = ((XSDBaseAdapter) selection).getTarget();
- }
- AddXSDAnyAttributeCommand command = null;
- if (selection instanceof XSDComplexTypeDefinition)
- {
- command = new AddXSDAnyAttributeCommand(Messages._UI_ACTION_ADD_ANY_ATTRIBUTE, (XSDComplexTypeDefinition) selection);
- getCommandStack().execute(command);
- }
- else if (selection instanceof XSDAttributeGroupDefinition)
- {
- command = new AddXSDAnyAttributeCommand(Messages._UI_ACTION_ADD_ANY_ATTRIBUTE, (XSDAttributeGroupDefinition)selection);
- getCommandStack().execute(command);
- }
-
- if (command != null)
- {
- addedComponent = command.getAddedComponent();
- Adapter adapter = XSDAdapterFactory.getInstance().adapt(addedComponent);
- selectAddedComponent(adapter);
- }
- }
-
-
- protected boolean calculateEnabled()
- {
- boolean rc = super.calculateEnabled();
- if (rc)
- {
- Object selection = ((IStructuredSelection) getSelection()).getFirstElement();
-
- if (selection instanceof XSDBaseAdapter)
- {
- selection = ((XSDBaseAdapter) selection).getTarget();
- }
- if (selection instanceof XSDComplexTypeDefinition)
- {
- return ((XSDComplexTypeDefinition)selection).getAttributeWildcardContent() == null;
- }
- else if (selection instanceof XSDAttributeGroupDefinition)
- {
- return ((XSDAttributeGroupDefinition)selection).getAttributeWildcardContent() == null;
- }
-
- }
- return rc;
- }
-
-
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDAnyElementAction.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDAnyElementAction.java
deleted file mode 100644
index d50a53bb53..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDAnyElementAction.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.actions;
-
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDAdapterFactory;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter;
-import org.eclipse.wst.xsd.ui.internal.common.commands.AddXSDAnyElementCommand;
-import org.eclipse.wst.xsd.ui.internal.common.util.Messages;
-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;
-
-public class AddXSDAnyElementAction extends XSDBaseAction
-{
- public static String ID = "org.eclipse.wst.xsd.ui.AddXSDAnyElementAction"; //$NON-NLS-1$
-
- public AddXSDAnyElementAction(IWorkbenchPart part)
- {
- super(part);
- setText(Messages._UI_ACTION_ADD_ANY_ELEMENT);
- setId(ID);
- }
-
- public void run()
- {
- Object selection = ((IStructuredSelection) getSelection()).getFirstElement();
-
- if (selection instanceof XSDBaseAdapter)
- {
- selection = ((XSDBaseAdapter) selection).getTarget();
- }
-
- XSDModelGroup modelGroup = getModelGroup(selection);
-
- AddXSDAnyElementCommand command = new AddXSDAnyElementCommand(getText(), modelGroup);
- if (selection instanceof XSDComplexTypeDefinition)
- {
- command.setComplexType((XSDComplexTypeDefinition)selection);
- }
- command.setDoCreateModelGroupForComplexType(modelGroup == null);
- getCommandStack().execute(command);
- addedComponent = command.getAddedComponent();
- Adapter adapter = XSDAdapterFactory.getInstance().adapt(addedComponent);
- selectAddedComponent(adapter);
- }
-
- private XSDModelGroup getModelGroup(Object selection)
- {
- if (selection instanceof XSDModelGroup)
- {
- return (XSDModelGroup) selection;
- }
- else if (selection instanceof XSDComplexTypeDefinition)
- {
- XSDComplexTypeContent content = ((XSDComplexTypeDefinition)selection).getContent();
- if (content instanceof XSDParticle)
- {
- XSDParticleContent particleContent = ((XSDParticle)content).getContent();
- if (particleContent instanceof XSDModelGroup)
- {
- return (XSDModelGroup)particleContent;
- }
- }
- }
- return null;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDAttributeDeclarationAction.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDAttributeDeclarationAction.java
deleted file mode 100644
index 7c113fe61d..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDAttributeDeclarationAction.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.actions;
-
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDAdapterFactory;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter;
-import org.eclipse.wst.xsd.ui.internal.common.commands.AddXSDAttributeDeclarationCommand;
-import org.eclipse.wst.xsd.ui.internal.common.util.Messages;
-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.XSDSchema;
-
-public class AddXSDAttributeDeclarationAction extends XSDBaseAction
-{
- public static String ID = "org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDAttributeDeclarationAction.AddXSDAttributeAction"; //$NON-NLS-1$
- public static String BEFORE_SELECTED_ID = "org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDAttributeDeclarationAction.BEFORE_SELECTED_ID"; //$NON-NLS-1$
- public static String AFTER_SELECTED_ID = "org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDAttributeDeclarationAction.AFTER_SELECTED_ID"; //$NON-NLS-1$
- public static String REF_ID = "org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDAttributeReferenceAction"; //$NON-NLS-1$
- boolean isReference = false;
-
- public AddXSDAttributeDeclarationAction(IWorkbenchPart part)
- {
- super(part);
- setText(Messages._UI_ACTION_ADD_ATTRIBUTE);
- setId(ID);
- isReference = false;
- }
-
- public AddXSDAttributeDeclarationAction(IWorkbenchPart part, String id, String label, boolean isReference)
- {
- super(part);
- setText(label);
- setId(id);
- this.isReference = isReference;
- doDirectEdit = !isReference;
- }
-
- public void run()
- {
- Object selection = ((IStructuredSelection) getSelection()).getFirstElement();
-
- if (selection instanceof XSDBaseAdapter)
- {
- selection = ((XSDBaseAdapter) selection).getTarget();
- if (selection instanceof XSDAttributeDeclaration)
- {
- selection = ((XSDAttributeDeclaration) selection).getContainer();
- }
- }
- AddXSDAttributeDeclarationCommand command = null;
- if (selection instanceof XSDComplexTypeDefinition)
- {
- command = new AddXSDAttributeDeclarationCommand(Messages._UI_ACTION_ADD_ATTRIBUTE, (XSDComplexTypeDefinition) selection);
- command.setReference(isReference);
- getCommandStack().execute(command);
- }
- else if (selection instanceof XSDAttributeUse)
- {
- XSDAttributeUse xsdAttributeUse = (XSDAttributeUse) selection;
- XSDConcreteComponent parent = null;
- XSDComplexTypeDefinition ct = null;
- XSDAttributeGroupDefinition group = null;
- for (parent = xsdAttributeUse.getContainer(); parent != null;)
- {
- if (parent instanceof XSDComplexTypeDefinition)
- {
- ct = (XSDComplexTypeDefinition) parent;
- break;
- }
- else if (parent instanceof XSDAttributeGroupDefinition)
- {
- group = (XSDAttributeGroupDefinition)parent;
- break;
- }
- parent = parent.getContainer();
- }
- if (ct != null)
- {
- XSDAttributeUse sel = (XSDAttributeUse) selection;
- int index = ct.getAttributeContents().indexOf(sel);
- command = new AddXSDAttributeDeclarationCommand(Messages._UI_ACTION_ADD_ATTRIBUTE, ct, getId(), index);
- command.setReference(isReference);
- getCommandStack().execute(command);
- }
- else if (group != null)
- {
- XSDAttributeUse sel = (XSDAttributeUse) selection;
- int index = group.eContents().indexOf(sel);
- command = new AddXSDAttributeDeclarationCommand(Messages._UI_ACTION_ADD_ATTRIBUTE, group, getId(), index);
- command.setReference(isReference);
- getCommandStack().execute(command);
- }
- }
- else if (selection instanceof XSDAttributeGroupDefinition)
- {
- command = new AddXSDAttributeDeclarationCommand(Messages._UI_ACTION_ADD_ATTRIBUTE, (XSDAttributeGroupDefinition)selection);
- command.setReference(isReference);
- getCommandStack().execute(command);
- }
- else if (selection instanceof XSDSchema)
- {
- command = new AddXSDAttributeDeclarationCommand(Messages._UI_ACTION_ADD_ATTRIBUTE, (XSDSchema)selection);
- getCommandStack().execute(command);
- }
-
- if (command != null)
- {
- addedComponent = command.getAddedComponent();
- Adapter adapter = XSDAdapterFactory.getInstance().adapt(addedComponent);
- selectAddedComponent(adapter);
- }
-
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDAttributeGroupDefinitionAction.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDAttributeGroupDefinitionAction.java
deleted file mode 100644
index f30a3e78de..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDAttributeGroupDefinitionAction.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*******************************************************************************
- * 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.internal.common.actions;
-
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDAdapterFactory;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter;
-import org.eclipse.wst.xsd.ui.internal.common.commands.AddXSDAttributeGroupDefinitionCommand;
-import org.eclipse.wst.xsd.ui.internal.common.util.Messages;
-import org.eclipse.xsd.XSDComplexTypeDefinition;
-import org.eclipse.xsd.XSDSchema;
-
-public class AddXSDAttributeGroupDefinitionAction extends XSDBaseAction
-{
- public static String ID = "AddXSDAttributeGroupDefinitionAction"; //$NON-NLS-1$
- public static String REF_ID = "AddXSDAttributeGroupDefinitionRefAction"; //$NON-NLS-1$
-
- public AddXSDAttributeGroupDefinitionAction(IWorkbenchPart part)
- {
- super(part);
- setText(Messages._UI_ACTION_ADD_ATTRIBUTE_GROUP);
- setId(ID);
- }
-
- public AddXSDAttributeGroupDefinitionAction(IWorkbenchPart part, String id)
- {
- super(part);
- if (id.equals(REF_ID))
- {
- setText(Messages._UI_ACTION_ADD_ATTRIBUTE_GROUP_REF);
- }
- else
- {
- setText(Messages._UI_ACTION_ADD_ATTRIBUTE_GROUP_DEFINITION);
- }
- 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(Messages._UI_ACTION_ADD_ATTRIBUTE_GROUP_REF, (XSDComplexTypeDefinition) selection);
- getCommandStack().execute(command);
- }
- else if (selection instanceof XSDSchema)
- {
- command = new AddXSDAttributeGroupDefinitionCommand(Messages._UI_ACTION_ADD_ATTRIBUTE_GROUP_DEFINITION, (XSDSchema) selection);
- getCommandStack().execute(command);
- }
-
- if (command != null)
- {
- addedComponent = command.getAddedComponent();
- Adapter adapter = XSDAdapterFactory.getInstance().adapt(addedComponent);
- selectAddedComponent(adapter);
- }
-
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDComplexTypeDefinitionAction.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDComplexTypeDefinitionAction.java
deleted file mode 100644
index c55f4eff43..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDComplexTypeDefinitionAction.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * 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.internal.common.actions;
-
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDAdapterFactory;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter;
-import org.eclipse.wst.xsd.ui.internal.common.commands.AddXSDComplexTypeDefinitionCommand;
-import org.eclipse.wst.xsd.ui.internal.common.util.Messages;
-import org.eclipse.xsd.XSDSchema;
-
-public class AddXSDComplexTypeDefinitionAction extends XSDBaseAction
-{
- public static final String ID = "org.eclipse.wst.xsd.ui.internal.editor.AddXSDComplexTypeDefinitionAction"; //$NON-NLS-1$
-
- public AddXSDComplexTypeDefinitionAction(IWorkbenchPart part)
- {
- super(part);
- setText(Messages._UI_ACTION_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(Messages._UI_ACTION_ADD_COMPLEX_TYPE, (XSDSchema) selection);
- getCommandStack().execute(command);
-
- addedComponent = command.getAddedComponent();
- Adapter adapter = XSDAdapterFactory.getInstance().adapt(addedComponent);
- selectAddedComponent(adapter);
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDElementAction.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDElementAction.java
deleted file mode 100644
index 68bd64a737..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDElementAction.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.actions;
-
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDAdapterFactory;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter;
-import org.eclipse.wst.xsd.ui.internal.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;
-import org.eclipse.xsd.impl.XSDModelGroupImpl;
-
-//revisit this and see if we can reuse AddFieldAction??
-
-public class AddXSDElementAction extends XSDBaseAction
-{
- public static String ID = "org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDElementAction"; //$NON-NLS-1$
- public static String BEFORE_SELECTED_ID = "org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDElementAction.BEFORE_SELECTED_ID"; //$NON-NLS-1$
- public static String AFTER_SELECTED_ID = "org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDElementAction.AFTER_SELECTED_ID"; //$NON-NLS-1$
- public static String REF_ID = "org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDElementReferenceAction"; //$NON-NLS-1$
- boolean isReference;
-
- public AddXSDElementAction(IWorkbenchPart part, String id, String label, boolean isReference)
- {
- super(part);
- setText(label);
- setId(id);
- this.isReference = isReference;
- doDirectEdit = !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;
- XSDModelGroupDefinition group = null;
- XSDModelGroupImpl ctGroup = null;
-
- for (parent = xsdConcreteComponent.getContainer(); parent != null; )
- {
- if (parent instanceof XSDComplexTypeDefinition)
- {
- ct = (XSDComplexTypeDefinition)parent;
- break;
- }
- else if (parent instanceof XSDModelGroupDefinition)
- {
- group = (XSDModelGroupDefinition)parent;
- break;
- }
- else if (parent instanceof XSDModelGroupImpl)
- {
- ctGroup = (XSDModelGroupImpl) parent;
- break;
- }
- parent = parent.getContainer();
- }
- if (ct != null)
- {
- command = new AddXSDElementCommand(getText(), ct);
- command.setReference(isReference);
- getCommandStack().execute(command);
- }
- else if (ctGroup != null)
- {
- XSDElementDeclaration sel = (XSDElementDeclaration) selection;
- int index = ctGroup.getContents().indexOf(sel.eContainer());
- command = new AddXSDElementCommand(getText(), ctGroup, getId(), index);
- command.setReference(isReference);
- getCommandStack().execute(command);
- }
- else if (group != null)
- {
- command = new AddXSDElementCommand(getText(), group);
- command.setReference(isReference);
- getCommandStack().execute(command);
- }
- }
-
- if (command != null)
- {
- addedComponent = command.getAddedComponent();
- Adapter adapter = XSDAdapterFactory.getInstance().adapt(addedComponent);
- selectAddedComponent(adapter);
- }
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDEnumerationFacetAction.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDEnumerationFacetAction.java
deleted file mode 100644
index fe4c11fb0d..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDEnumerationFacetAction.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.actions;
-
-import java.util.List;
-
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDAdapterFactory;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDComplexTypeDefinitionAdapter;
-import org.eclipse.wst.xsd.ui.internal.common.commands.AddEnumerationsCommand;
-import org.eclipse.wst.xsd.ui.internal.common.util.Messages;
-import org.eclipse.wst.xsd.ui.internal.common.util.XSDCommonUIUtils;
-import org.eclipse.xsd.XSDComplexTypeDefinition;
-import org.eclipse.xsd.XSDEnumerationFacet;
-import org.eclipse.xsd.XSDSimpleTypeDefinition;
-import org.eclipse.xsd.XSDTypeDefinition;
-
-public class AddXSDEnumerationFacetAction extends XSDBaseAction
-{
- public static String ID = "org.eclipse.wst.xsd.ui.AddXSDEnumerationFacetAction"; //$NON-NLS-1$
- public static String BEFORE_SELECTED_ID = "org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDEnumerationFacetAction.BEFORE_SELECTED_ID"; //$NON-NLS-1$
- public static String AFTER_SELECTED_ID = "org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDEnumerationFacetAction.AFTER_SELECTED_ID"; //$NON-NLS-1$
-
- public AddXSDEnumerationFacetAction(IWorkbenchPart part, String id, String label)
- {
- super(part);
- setText(label);
- setId(id);
- }
-
- public AddXSDEnumerationFacetAction(IWorkbenchPart part)
- {
- super(part);
- setText(Messages._UI_ACTION_ADD_ENUMERATION);
- setId(ID);
- }
-
- public void run()
- {
- Object selection = ((IStructuredSelection) getSelection()).getFirstElement();
-
- if (selection instanceof XSDBaseAdapter)
- {
- selection = ((XSDBaseAdapter) selection).getTarget();
- int index = -1;
- AddEnumerationsCommand command = null;
- XSDSimpleTypeDefinition st = null;
- if (selection instanceof XSDSimpleTypeDefinition)
- {
- st = (XSDSimpleTypeDefinition)selection;
- command = new AddEnumerationsCommand(getText(), st);
- }
- else if (selection instanceof XSDEnumerationFacet)
- {
- st = ((XSDEnumerationFacet)selection).getSimpleTypeDefinition();
- index = st.getFacetContents().indexOf(selection);
- doDirectEdit = true;
- command = new AddEnumerationsCommand(getText(), st, getId(), index);
- }
- else if (selection instanceof XSDComplexTypeDefinition) // Support for Complex Type's simple Content with enumerations
- {
- st = (XSDSimpleTypeDefinition) ((XSDComplexTypeDefinition)selection).getContent();
- command = new AddEnumerationsCommand(getText(), st);
- }
- else // null
- {
- return;
- }
-
- List enumList = st.getEnumerationFacets();
-
- String newName = XSDCommonUIUtils.createUniqueEnumerationValue("value", enumList); //$NON-NLS-1$
-
- command.setValue(newName);
- getCommandStack().execute(command);
- addedComponent = command.getAddedComponent();
- Adapter adapter = XSDAdapterFactory.getInstance().adapt(addedComponent);
- selectAddedComponent(adapter);
- }
- }
-
- protected boolean calculateEnabled() {
-
- boolean parentResult = super.calculateEnabled();
- boolean endResult = true;
- Object selection = ((IStructuredSelection) getSelection()).getFirstElement();
- if (selection instanceof XSDComplexTypeDefinitionAdapter)
- {
- XSDComplexTypeDefinition definition = ((XSDComplexTypeDefinitionAdapter) selection).getXSDComplexTypeDefinition();
- XSDTypeDefinition baseType = definition.getBaseType();
- if (baseType instanceof XSDSimpleTypeDefinition)
- endResult = false;
- }
- endResult = endResult & parentResult;
- return endResult;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDModelGroupAction.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDModelGroupAction.java
deleted file mode 100644
index f4fb4648c6..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDModelGroupAction.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.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.ui.internal.adapters.XSDAdapterFactory;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter;
-import org.eclipse.wst.xsd.ui.internal.common.commands.AddXSDModelGroupCommand;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-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;
-import org.eclipse.xsd.XSDModelGroupDefinition;
-
-public class AddXSDModelGroupAction extends XSDBaseAction
-{
- public static String SEQUENCE_ID = "AddXSDSequenceModelGroupAction"; //$NON-NLS-1$
- public static String CHOICE_ID = "AddXSDChoiceModelGroupAction"; //$NON-NLS-1$
- public static String ALL_ID = "AddXSDAllModelGroupAction"; //$NON-NLS-1$
- 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
- || xsdComponent instanceof XSDModelGroupDefinition)
- {
- 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/internal/common/actions/AddXSDModelGroupDefinitionAction.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDModelGroupDefinitionAction.java
deleted file mode 100644
index d49a367a58..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDModelGroupDefinitionAction.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * 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.internal.common.actions;
-
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDAdapterFactory;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter;
-import org.eclipse.wst.xsd.ui.internal.common.commands.AddXSDModelGroupDefinitionCommand;
-import org.eclipse.wst.xsd.ui.internal.common.util.Messages;
-import org.eclipse.xsd.XSDConcreteComponent;
-
-public class AddXSDModelGroupDefinitionAction extends XSDBaseAction
-{
- public static final String MODELGROUPDEFINITION_ID = "AddXSDModelGroupDefinitionAction"; //$NON-NLS-1$
- public static final String MODELGROUPDEFINITIONREF_ID = "AddXSDModelGroupDefinitionRefAction"; //$NON-NLS-1$
- boolean isReference;
-
- public AddXSDModelGroupDefinitionAction(IWorkbenchPart part, boolean isReference)
- {
- super(part);
- this.isReference = isReference;
- if (isReference)
- {
- setText(Messages._UI_ACTION_ADD_GROUP_REF);
- setId(MODELGROUPDEFINITION_ID);
- }
- else
- {
- setText(Messages._UI_ACTION_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);
-
- addedComponent = command.getAddedComponent();
- Adapter adapter = XSDAdapterFactory.getInstance().adapt(addedComponent);
- selectAddedComponent(adapter);
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDRedefinableContentAction.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDRedefinableContentAction.java
deleted file mode 100644
index 8b8c19c020..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDRedefinableContentAction.java
+++ /dev/null
@@ -1,229 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.actions;
-
-
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.wst.common.core.search.scope.SearchScope;
-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.IComponentDescriptionProvider;
-import org.eclipse.wst.common.ui.internal.search.dialogs.IComponentList;
-import org.eclipse.wst.common.ui.internal.search.dialogs.IComponentSearchListProvider;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter;
-import org.eclipse.wst.xsd.ui.internal.common.commands.AddRedefinedComponentCommand;
-import org.eclipse.wst.xsd.ui.internal.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-import org.eclipse.xsd.XSDNamedComponent;
-import org.eclipse.xsd.XSDRedefinableComponent;
-import org.eclipse.xsd.XSDRedefine;
-
-
-public abstract class AddXSDRedefinableContentAction extends XSDBaseAction
-{
- protected AddXSDRedefinableContentAction(IWorkbenchPart part, String ID, String text)
- {
- super(part);
- setText(text);
- setId(ID);
- }
-
- public void run()
- {
- Object selection = ((IStructuredSelection)getSelection()).getFirstElement();
-
- if (selection instanceof XSDBaseAdapter)
- {
- selection = ((XSDBaseAdapter)selection).getTarget();
- }
-
- if (selection instanceof XSDRedefine)
- {
- ComponentSearchListDialogConfiguration configuration = new ComponentSearchListDialogConfiguration();
- configuration.setDescriptionProvider(new RedefineDescriptor());
- configuration.setSearchListProvider(new RedefineSearchListProvider((XSDRedefine)selection, this));
- ComponentSearchListDialog dialog = new ComponentSearchListDialog(Display.getDefault().getActiveShell(), Messages._UI_LABEL_REDEFINE_COMPONENT, configuration)
- {
- protected Control createDialogArea(Composite parent)
- {
- // Adjust the dialog's initial size.
-
- Composite mainComposite = (Composite)super.createDialogArea(parent);
- GridData gridData = (GridData)mainComposite.getLayoutData();
- gridData.heightHint = 500;
- gridData.widthHint = 350;
- return mainComposite;
- }
- };
- dialog.create();
- dialog.setBlockOnOpen(true);
- int result = dialog.open();
-
- if (result == Window.OK)
- {
- ComponentSpecification selectedComponent = dialog.getSelectedComponent();
- buildRedefine((XSDRedefine)selection, selectedComponent);
- }
- }
- }
-
- protected abstract AddRedefinedComponentCommand getCommand(XSDRedefine redefine, XSDRedefinableComponent redefinableComponent);
-
- protected abstract void buildComponentsList(XSDRedefine xsdRedefine, Set redefinedComponentsNames, IComponentList componentList);
-
- protected void buildRedefine(XSDRedefine redefine, ComponentSpecification selectedComponent)
- {
- XSDRedefinableComponent redefinableComponent = (XSDRedefinableComponent)selectedComponent.getObject();
- AddRedefinedComponentCommand command = getCommand(redefine, redefinableComponent);
- getCommandStack().execute(command);
- addedComponent = command.getAddedComponent();
- }
-
- class RedefineSearchListProvider implements IComponentSearchListProvider
- {
- XSDRedefine xsdRedefine;
- AddXSDRedefinableContentAction action;
-
- public RedefineSearchListProvider(XSDRedefine xsdRedefine, AddXSDRedefinableContentAction action)
- {
- this.xsdRedefine = xsdRedefine;
- this.action = action;
- }
-
- // Should refactor this to have a separate subclass for each type of redefine.
- public void populateComponentList(IComponentList list, SearchScope scope, IProgressMonitor pm)
- {
- List currentRedefines = xsdRedefine.getContents();
- Set redefinedComponentsNames = new HashSet(currentRedefines.size());
- Iterator redefinesIterator = currentRedefines.iterator();
- while (redefinesIterator.hasNext())
- {
- XSDRedefinableComponent component = (XSDRedefinableComponent)redefinesIterator.next();
- String redefinedComponentName = component.getName();
- redefinedComponentsNames.add(redefinedComponentName);
- }
- action.buildComponentsList(xsdRedefine, redefinedComponentsNames, list);
- }
- }
-
- class RedefineDescriptor implements IComponentDescriptionProvider
- {
- public IFile getFile(Object component)
- {
- if (component instanceof XSDNamedComponent)
- {
- if (((XSDNamedComponent)component).getSchema() == null)
- {
- return null;
- }
- String location = ((XSDNamedComponent)component).getSchema().getSchemaLocation();
- String platformResource = "platform:/resource"; //$NON-NLS-1$
- if (location != null && location.startsWith(platformResource))
- {
- Path path = new Path(location.substring(platformResource.length()));
- return ResourcesPlugin.getWorkspace().getRoot().getFile(path);
- }
- }
- return null;
- }
-
- public Image getFileIcon(Object component)
- {
- return XSDEditorPlugin.getXSDImage("icons/XSDFile.gif"); //$NON-NLS-1$
- }
-
- public ILabelProvider getLabelProvider()
- {
- return new XSDRedefineComponentsLabelProvider();
- }
-
- public String getName(Object component)
- {
- if (component instanceof XSDNamedComponent)
- {
- return ((XSDNamedComponent)component).getName();
- }
- return "";
- }
-
- public String getQualifier(Object component)
- {
- if (component instanceof XSDNamedComponent)
- {
- return ((XSDNamedComponent)component).getTargetNamespace();
- }
- return "";
- }
-
- public boolean isApplicable(Object component)
- {
- return true;
- }
-
- }
-
- protected abstract Image getRedefinedComponentImage();
-
- class XSDRedefineComponentsLabelProvider implements ILabelProvider
- {
-
- public Image getImage(Object element)
- {
- Image image = getRedefinedComponentImage();
- return image;
- }
-
- public String getText(Object element)
- {
- if (element instanceof XSDNamedComponent)
- {
- return ((XSDNamedComponent)element).getName();
- }
- return "";
- }
-
- public void addListener(ILabelProviderListener listener)
- {
- }
-
- public void dispose()
- {
- }
-
- public boolean isLabelProperty(Object element, String property)
- {
- return false;
- }
-
- public void removeListener(ILabelProviderListener listener)
- {
- }
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDRedefinedAttributeGroupAction.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDRedefinedAttributeGroupAction.java
deleted file mode 100644
index 5f5b0e4365..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDRedefinedAttributeGroupAction.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.wst.xsd.ui.internal.common.actions;
-
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.wst.common.ui.internal.search.dialogs.IComponentList;
-import org.eclipse.wst.xsd.ui.internal.common.commands.AddRedefinedComponentCommand;
-import org.eclipse.wst.xsd.ui.internal.common.commands.RedefineAttributeGroupCommand;
-import org.eclipse.wst.xsd.ui.internal.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-import org.eclipse.xsd.XSDAttributeGroupDefinition;
-import org.eclipse.xsd.XSDRedefinableComponent;
-import org.eclipse.xsd.XSDRedefine;
-
-
-public class AddXSDRedefinedAttributeGroupAction extends AddXSDRedefinableContentAction
-{
- public static final String ID = "org.eclipse.wst.xsd.ui.actions.RedefineAttributeGroup"; //$NON-NLS-1$
-
- public AddXSDRedefinedAttributeGroupAction(IWorkbenchPart part)
- {
- super(part, ID, Messages._UI_ACTION_REDEFINE_ATTRIBUTE_GROUP);
- }
-
- protected AddRedefinedComponentCommand getCommand(XSDRedefine redefine, XSDRedefinableComponent redefinableComponent)
- {
- AddRedefinedComponentCommand command = new RedefineAttributeGroupCommand(
- Messages._UI_ACTION_REDEFINE_ATTRIBUTE_GROUP,
- redefine,
- redefinableComponent);
- return command;
- }
-
- protected void buildComponentsList(XSDRedefine xsdRedefine, Set redefinedComponentsNames, IComponentList componentList)
- {
- List attributeGroups = xsdRedefine.getIncorporatedSchema().getAttributeGroupDefinitions();
- Iterator iterator = attributeGroups.iterator();
- while (iterator.hasNext())
- {
- XSDAttributeGroupDefinition attributeGroupDefinition = (XSDAttributeGroupDefinition)iterator.next();
- String attributeGroupDefinitionName = attributeGroupDefinition.getName();
- if (!redefinedComponentsNames.contains(attributeGroupDefinitionName))
- {
- componentList.add(attributeGroupDefinition);
- }
- }
- }
-
- protected Image getRedefinedComponentImage()
- {
- return XSDEditorPlugin.getXSDImage(Messages._UI_IMAGE_ATTRIBUTE_GROUP);
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDRedefinedComplexTypeAction.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDRedefinedComplexTypeAction.java
deleted file mode 100644
index 901d5a6c6c..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDRedefinedComplexTypeAction.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.wst.xsd.ui.internal.common.actions;
-
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.wst.common.ui.internal.search.dialogs.IComponentList;
-import org.eclipse.wst.xsd.ui.internal.common.commands.AddRedefinedComponentCommand;
-import org.eclipse.wst.xsd.ui.internal.common.commands.RedefineComplexTypeCommand;
-import org.eclipse.wst.xsd.ui.internal.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-import org.eclipse.xsd.XSDComplexTypeDefinition;
-import org.eclipse.xsd.XSDRedefinableComponent;
-import org.eclipse.xsd.XSDRedefine;
-import org.eclipse.xsd.XSDTypeDefinition;
-
-
-public class AddXSDRedefinedComplexTypeAction extends AddXSDRedefinableContentAction
-{
- public static final String ID = "org.eclipse.wst.xsd.ui.actions.RedefineComplexType"; //$NON-NLS-1$
-
- public AddXSDRedefinedComplexTypeAction(IWorkbenchPart part)
- {
- super(part, ID, Messages._UI_ACTION_REDEFINE_COMPLEX_TYPE);
- }
-
- protected AddRedefinedComponentCommand getCommand(XSDRedefine redefine, XSDRedefinableComponent redefinableComponent)
- {
- AddRedefinedComponentCommand command = new RedefineComplexTypeCommand(
- Messages._UI_ACTION_REDEFINE_COMPLEX_TYPE,
- redefine,
- redefinableComponent);
- return command;
- }
-
- protected void buildComponentsList(XSDRedefine xsdRedefine, Set redefinedComponentsNames, IComponentList componentList)
- {
- List typeDefinitions = xsdRedefine.getIncorporatedSchema().getTypeDefinitions();
- Iterator iterator = typeDefinitions.iterator();
- while (iterator.hasNext())
- {
- XSDTypeDefinition typeDefinition = (XSDTypeDefinition)iterator.next();
- String typeDefinitionName = typeDefinition.getName();
- if (typeDefinition instanceof XSDComplexTypeDefinition && !redefinedComponentsNames.contains(typeDefinitionName))
- {
- componentList.add(typeDefinition);
- }
- }
- }
-
- protected Image getRedefinedComponentImage()
- {
- return XSDEditorPlugin.getXSDImage(Messages._UI_IMAGE_COMPLEX_TYPE);
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDRedefinedModelGroupAction.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDRedefinedModelGroupAction.java
deleted file mode 100644
index d3839a92dd..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDRedefinedModelGroupAction.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.wst.xsd.ui.internal.common.actions;
-
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.wst.common.ui.internal.search.dialogs.IComponentList;
-import org.eclipse.wst.xsd.ui.internal.common.commands.AddRedefinedComponentCommand;
-import org.eclipse.wst.xsd.ui.internal.common.commands.RedefineModelGroupCommand;
-import org.eclipse.wst.xsd.ui.internal.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-import org.eclipse.xsd.XSDModelGroupDefinition;
-import org.eclipse.xsd.XSDRedefinableComponent;
-import org.eclipse.xsd.XSDRedefine;
-
-
-public class AddXSDRedefinedModelGroupAction extends AddXSDRedefinableContentAction
-{
- public static final String ID = "org.eclipse.wst.xsd.ui.actions.RedefineModelGroup"; //$NON-NLS-1$
-
- public AddXSDRedefinedModelGroupAction(IWorkbenchPart part)
- {
- super(part, ID, Messages._UI_ACTION_REDEFINE_MODEL_GROUP);
- }
-
- protected AddRedefinedComponentCommand getCommand(XSDRedefine redefine, XSDRedefinableComponent redefinableComponent)
- {
- AddRedefinedComponentCommand command = new RedefineModelGroupCommand(
- Messages._UI_ACTION_REDEFINE_MODEL_GROUP,
- redefine,
- redefinableComponent);
- return command;
- }
-
- protected void buildComponentsList(XSDRedefine xsdRedefine, Set redefinedComponentsNames, IComponentList componentList)
- {
- List modelGroupList = xsdRedefine.getIncorporatedSchema().getModelGroupDefinitions();
- Iterator iterator = modelGroupList.iterator();
- while (iterator.hasNext())
- {
- XSDModelGroupDefinition modelGroupDefinition = (XSDModelGroupDefinition)iterator.next();
- String modelGroupDefinitionName = modelGroupDefinition.getName();
- if (!redefinedComponentsNames.contains(modelGroupDefinitionName))
- {
- componentList.add(modelGroupDefinition);
- }
- }
- }
-
- protected Image getRedefinedComponentImage()
- {
- return XSDEditorPlugin.getXSDImage(Messages._UI_IMAGE_MODEL_GROUP);
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDRedefinedSimpleTypeAction.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDRedefinedSimpleTypeAction.java
deleted file mode 100644
index dd86050645..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDRedefinedSimpleTypeAction.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.wst.xsd.ui.internal.common.actions;
-
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.wst.common.ui.internal.search.dialogs.IComponentList;
-import org.eclipse.wst.xsd.ui.internal.common.commands.AddRedefinedComponentCommand;
-import org.eclipse.wst.xsd.ui.internal.common.commands.RedefineSimpleTypeCommand;
-import org.eclipse.wst.xsd.ui.internal.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-import org.eclipse.xsd.XSDRedefinableComponent;
-import org.eclipse.xsd.XSDRedefine;
-import org.eclipse.xsd.XSDSimpleTypeDefinition;
-import org.eclipse.xsd.XSDTypeDefinition;
-
-
-public class AddXSDRedefinedSimpleTypeAction extends AddXSDRedefinableContentAction
-{
- public static final String ID = "org.eclipse.wst.xsd.ui.actions.RedefineSimpleType"; //$NON-NLS-1$
-
- public AddXSDRedefinedSimpleTypeAction(IWorkbenchPart part)
- {
- super(part, ID, Messages._UI_ACTION_REDEFINE_SIMPLE_TYPE);
- }
-
- public AddRedefinedComponentCommand getCommand(XSDRedefine redefine, XSDRedefinableComponent redefinableComponent)
- {
- AddRedefinedComponentCommand command = new RedefineSimpleTypeCommand(
- Messages._UI_ACTION_REDEFINE_SIMPLE_TYPE,
- redefine,
- redefinableComponent);
- return command;
- }
-
- protected void buildComponentsList(XSDRedefine xsdRedefine, Set redefinedComponentsNames, IComponentList componentList)
- {
- List typeDefinitions = xsdRedefine.getIncorporatedSchema().getTypeDefinitions();
- Iterator iterator = typeDefinitions.iterator();
- while (iterator.hasNext())
- {
- XSDTypeDefinition typeDefinition = (XSDTypeDefinition)iterator.next();
- String typeDefinitionName = typeDefinition.getName();
- if (typeDefinition instanceof XSDSimpleTypeDefinition && !redefinedComponentsNames.contains(typeDefinitionName))
- {
- componentList.add(typeDefinition);
- }
- }
-
- }
-
- protected Image getRedefinedComponentImage()
- {
- return XSDEditorPlugin.getXSDImage(Messages._UI_IMAGE_SIMPLE_TYPE);
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDSchemaDirectiveAction.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDSchemaDirectiveAction.java
deleted file mode 100644
index 0324f1c91c..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDSchemaDirectiveAction.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.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.ui.internal.adapters.XSDAdapterFactory;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDSchemaDirectiveAdapter;
-import org.eclipse.wst.xsd.ui.internal.common.commands.AddXSDImportCommand;
-import org.eclipse.wst.xsd.ui.internal.common.commands.AddXSDIncludeCommand;
-import org.eclipse.wst.xsd.ui.internal.common.commands.AddXSDRedefineCommand;
-import org.eclipse.wst.xsd.ui.internal.common.commands.BaseCommand;
-import org.eclipse.wst.xsd.ui.internal.common.util.XSDDirectivesSchemaLocationUpdater;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-import org.eclipse.xsd.XSDSchema;
-
-public class AddXSDSchemaDirectiveAction extends XSDBaseAction
-{
- public static String INCLUDE_ID = "org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDIncludeAction"; //$NON-NLS-1$
- public static String IMPORT_ID = "org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDImportAction"; //$NON-NLS-1$
- public static String REDEFINE_ID = "org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDRedefineAction"; //$NON-NLS-1$
- String label;
-
- public AddXSDSchemaDirectiveAction(IWorkbenchPart part, String ID, String label)
- {
- super(part);
- setText(label);
- setId(ID);
- this.label = label;
- }
-
- public void run()
- {
- Object selection = ((IStructuredSelection) getSelection()).getFirstElement();
-
- if (selection instanceof XSDBaseAdapter)
- {
- selection = ((XSDBaseAdapter) selection).getTarget();
- }
-
- BaseCommand command = null;
- if (selection instanceof XSDSchema)
- {
- if (INCLUDE_ID.equals(getId()))
- {
- command = new AddXSDIncludeCommand(label, (XSDSchema) selection);
- }
- else if (IMPORT_ID.equals(getId()))
- {
- command = new AddXSDImportCommand(label, (XSDSchema) selection);
- }
- else if (REDEFINE_ID.equals(getId()))
- {
- command = new AddXSDRedefineCommand(label, (XSDSchema) selection);
- }
- getCommandStack().execute(command);
- }
-
- if (command != null)
- {
- Adapter adapter = XSDAdapterFactory.getInstance().adapt(command.getAddedComponent());
- if (adapter != null)
- {
- provider.setSelection(new StructuredSelection(adapter));
- // Automatically open the schema location dialog if the preference is enabled
- if(XSDEditorPlugin.getDefault().getAutomaticallyOpenSchemaLocationDialogSetting())
- {
- XSDSchemaDirectiveAdapter xsdSchemaDirectiveAdapter = null;
- if(adapter instanceof XSDSchemaDirectiveAdapter)
- {
- xsdSchemaDirectiveAdapter = (XSDSchemaDirectiveAdapter)adapter;
- }
- XSDDirectivesSchemaLocationUpdater.updateSchemaLocation((XSDSchema) selection, xsdSchemaDirectiveAdapter.getTarget(),
- (command instanceof AddXSDIncludeCommand || command instanceof AddXSDRedefineCommand));
- }
- // The graphical view may deselect, so select again
- provider.setSelection(new StructuredSelection(adapter));
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDSimpleTypeDefinitionAction.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDSimpleTypeDefinitionAction.java
deleted file mode 100644
index bc7cd73e62..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDSimpleTypeDefinitionAction.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * 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.internal.common.actions;
-
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDAdapterFactory;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter;
-import org.eclipse.wst.xsd.ui.internal.common.commands.AddXSDSimpleTypeDefinitionCommand;
-import org.eclipse.wst.xsd.ui.internal.common.util.Messages;
-import org.eclipse.xsd.XSDSchema;
-
-public class AddXSDSimpleTypeDefinitionAction extends XSDBaseAction
-{
- public static final String ID = "org.eclipse.wst.xsd.ui.internal.editor.AddXSDSimpleTypeDefinitionAction"; //$NON-NLS-1$
-
- public AddXSDSimpleTypeDefinitionAction(IWorkbenchPart part)
- {
- super(part);
- setText(Messages._UI_ACTION_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(Messages._UI_ACTION_ADD_SIMPLE_TYPE, (XSDSchema) selection);
- getCommandStack().execute(command);
-
- addedComponent = command.getAddedComponent();
- Adapter adapter = XSDAdapterFactory.getInstance().adapt(addedComponent);
- selectAddedComponent(adapter);
- }
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/DeleteXSDConcreteComponentAction.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/DeleteXSDConcreteComponentAction.java
deleted file mode 100644
index abfe49d036..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/DeleteXSDConcreteComponentAction.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.actions;
-
-import java.util.Iterator;
-
-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.ui.internal.adapters.XSDAdapterFactory;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter;
-import org.eclipse.wst.xsd.ui.internal.common.commands.DeleteCommand;
-import org.eclipse.wst.xsd.ui.internal.common.util.Messages;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDSchema;
-
-/**
- * @deprecated Use org.eclipse.wst.xsd.ui.internal.adt.actions.DeleteAction
- *
- */
-public class DeleteXSDConcreteComponentAction extends XSDBaseAction
-{
- public static final String DELETE_XSD_COMPONENT_ID = "org.eclipse.wst.xsd.ui.internal.common.actions.DeleteXSDConcreteComponentAction"; //$NON-NLS-1$
-
- public DeleteXSDConcreteComponentAction(IWorkbenchPart part)
- {
- super(part);
- setText(Messages._UI_ACTION_DELETE);
- setId(DELETE_XSD_COMPONENT_ID);
- setImageDescriptor(XSDEditorPlugin.getImageDescriptor("icons/delete_obj.gif") ); //$NON-NLS-1$
- }
-
- public void run()
- {
- for (Iterator i = ((IStructuredSelection) getSelection()).iterator(); i.hasNext();)
- {
- Object selection = i.next();
- boolean doReselect = false;
-
- if (selection instanceof XSDBaseAdapter)
- {
- selection = ((XSDBaseAdapter) selection).getTarget();
- }
-
- if (selection instanceof XSDConcreteComponent)
- {
- XSDConcreteComponent xsdComponent = (XSDConcreteComponent) selection;
- XSDSchema model = xsdComponent.getSchema();
-
- doReselect = xsdComponent.eContainer() instanceof XSDSchema;
-
- DeleteCommand command = new DeleteCommand(getText(), xsdComponent);
- getCommandStack().execute(command);
-
- if (model != null && doReselect)
- {
- Adapter adapter = XSDAdapterFactory.getInstance().adapt(model);
- if (adapter != null)
- provider.setSelection(new StructuredSelection(adapter));
- }
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/OpenInNewEditor.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/OpenInNewEditor.java
deleted file mode 100644
index 1efade029c..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/OpenInNewEditor.java
+++ /dev/null
@@ -1,546 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.actions;
-
-import java.net.URI;
-
-import org.eclipse.core.filesystem.EFS;
-import org.eclipse.core.filesystem.IFileStore;
-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.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorReference;
-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.ide.FileStoreEditorInput;
-import org.eclipse.ui.ide.IDE;
-import org.eclipse.ui.part.FileEditorInput;
-import org.eclipse.wst.common.uriresolver.internal.util.URIHelper;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDSchemaDirectiveAdapter;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.BaseSelectionAction;
-import org.eclipse.wst.xsd.ui.internal.adt.editor.ADTFileStoreEditorInput;
-import org.eclipse.wst.xsd.ui.internal.adt.editor.ADTReadOnlyFileEditorInput;
-import org.eclipse.wst.xsd.ui.internal.common.util.Messages;
-import org.eclipse.wst.xsd.ui.internal.editor.InternalXSDMultiPageEditor;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDFileEditorInput;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDFeature;
-import org.eclipse.xsd.XSDRedefine;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.XSDSchemaDirective;
-import org.eclipse.xsd.impl.XSDImportImpl;
-
-public class OpenInNewEditor extends BaseSelectionAction
-{
- public static final String ID = "OpenInNewEditor"; //$NON-NLS-1$
-
- public OpenInNewEditor(IWorkbenchPart part)
- {
- super(part);
- setText(Messages._UI_ACTION_OPEN_IN_NEW_EDITOR); //$NON-NLS-1$
- setId(ID);
- }
-
- protected boolean calculateEnabled()
- {
- return true;
- }
-
- public void run()
- {
- Object selection = ((IStructuredSelection) getSelection()).getFirstElement();
- IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- IWorkbenchPage page = null;
- IEditorInput editorInput = null;
- if (workbenchWindow != null)
- {
- page = workbenchWindow.getActivePage();
- IEditorPart activeEditor = page.getActiveEditor();
- if (activeEditor != null)
- {
- editorInput = activeEditor.getEditorInput();
- }
-
- }
-
- if (selection instanceof XSDBaseAdapter)
- {
- XSDBaseAdapter xsdAdapter = (XSDBaseAdapter) selection;
- XSDConcreteComponent fComponent = (XSDConcreteComponent) xsdAdapter.getTarget();
- XSDSchema schema = fComponent.getSchema();
-
- boolean isReference = false;
- if (fComponent instanceof XSDFeature)
- {
- isReference = ((XSDFeature)fComponent).isFeatureReference();
- fComponent = ((XSDFeature)fComponent).getResolvedFeature();
- }
-
- String schemaLocation = null;
- IPath schemaPath = null;
- IFile schemaFile = null;
-
- // Special case any imports/includes
- if (selection instanceof XSDSchemaDirectiveAdapter)
- {
- XSDSchemaDirective dir = (XSDSchemaDirective)((XSDSchemaDirectiveAdapter)selection).getTarget();
- // force load of imported schema
- if (dir instanceof XSDImportImpl)
- {
- ((XSDImportImpl)dir).importSchema();
- }
- if (dir.getResolvedSchema() != null)
- {
- schemaLocation = URIHelper.removePlatformResourceProtocol(dir.getResolvedSchema().getSchemaLocation());
- schemaPath = new Path(schemaLocation);
- schemaFile = ResourcesPlugin.getWorkspace().getRoot().getFile(schemaPath);
- schema = dir.getResolvedSchema();
- fComponent = dir.getResolvedSchema();
- }
- } // Handle any other external components
- else if (fComponent.getSchema() != null && fComponent.eContainer() instanceof XSDSchema ||
- fComponent.eContainer() instanceof XSDRedefine || isReference)
- {
- schemaLocation = URIHelper.removePlatformResourceProtocol(fComponent.getSchema().getSchemaLocation());
- schemaPath = new Path(schemaLocation);
- schemaFile = ResourcesPlugin.getWorkspace().getRoot().getFile(schemaPath);
-
- try
- {
- XSDSchema xsdSchema = (XSDSchema)getWorkbenchPart().getAdapter(XSDSchema.class);
- if (fComponent.getSchema() == xsdSchema)
- {
- IEditorPart editorPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
- if (editorPart instanceof InternalXSDMultiPageEditor)
- {
- ((InternalXSDMultiPageEditor) editorPart).openOnGlobalReference(fComponent);
- }
- return;
- }
- }
- catch (Exception e)
- {
-
- }
- }
-
- // If the schemaFile exists in the workspace
- if (page != null && schemaFile != null && schemaFile.exists())
- {
- try
- {
- // Get the current editor's schema
- XSDSchema xsdSchema = (XSDSchema)getWorkbenchPart().getAdapter(XSDSchema.class);
- IEditorPart editorPart = null;
- // This first check is to ensure that the schema is actually
- // different than the current one we are editing against in the editor, and that we
- // are in the same resource file....hence multiple schemas in the same file.
- if (xsdSchema != null && fComponent.getRootContainer().eResource() == xsdSchema.eResource() && xsdSchema != schema)
- {
- String editorName = null;
- XSDFileEditorInput xsdFileEditorInput = new XSDFileEditorInput(schemaFile, fComponent.getSchema());
- // will use FileEditorInput's name if still null
- // Try to use the same editor name as the current one
- if (editorInput != null)
- {
- editorName = editorInput.getName();
- xsdFileEditorInput.setEditorName(editorName);
- }
- editorPart = getExistingEditorForInlineSchema(page, schemaFile, schema);
- if (editorPart == null)
- {
- editorPart = page.openEditor(xsdFileEditorInput, XSDEditorPlugin.EDITOR_ID, true, 0);
- }
- }
- else
- {
- editorPart = page.openEditor(new FileEditorInput(schemaFile), XSDEditorPlugin.EDITOR_ID);
- }
- if (editorPart instanceof InternalXSDMultiPageEditor)
- {
- ((InternalXSDMultiPageEditor) editorPart).openOnGlobalReference(fComponent);
- }
- }
- catch (Exception e)
- {
- }
- }
- else
- {
- // open the xsd externally
- if (schemaLocation != null)
- openExternalFiles(page, schemaLocation, fComponent);
- }
- }
- }
-
- public static void openXSDEditor(IEditorInput editorInput, XSDConcreteComponent xsdComponent)
- {
- openXSDEditor(editorInput, xsdComponent.getSchema(), xsdComponent);
- }
-
- public static void openXSDEditor(IEditorInput editorInput, XSDSchema schema, XSDConcreteComponent xsdComponent)
- {
- IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- IWorkbenchPage page = null;
- if (workbenchWindow != null)
- {
- page = workbenchWindow.getActivePage();
- }
-
- String resource = schema.getSchemaLocation();
-
- if (editorInput instanceof FileEditorInput && resource != null && !resource.startsWith("http"))
- {
- String schemaLocation = URIHelper.removePlatformResourceProtocol(resource);
- openWorkspaceFile(page, schemaLocation, xsdComponent);
- }
- else
- {
- openExternalFiles(page, resource, xsdComponent);
- }
- }
-
- public static void openInlineSchema(IEditorInput editorInput, XSDConcreteComponent xsdComponent, XSDSchema schema, String editorName)
- {
- IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- IWorkbenchPage page = null;
- if (workbenchWindow != null)
- {
- page = workbenchWindow.getActivePage();
- }
-
- boolean isWorkspaceFile = false;
-
- String schemaLocation = schema.getSchemaLocation();
- String workspaceFileLocation = URIHelper.removePlatformResourceProtocol(schemaLocation);
- IPath workspaceFilePath = new Path(workspaceFileLocation);
- IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(workspaceFilePath);
-
- if (page != null && file != null && file.exists())
- {
- isWorkspaceFile = true;
- }
-
- if (isWorkspaceFile)
- {
- try
- {
- IEditorPart editorPart = null;
- XSDFileEditorInput xsdFileEditorInput = new XSDFileEditorInput(file, schema);
- xsdFileEditorInput.setEditorName(editorName);
- IEditorReference[] refs = page.getEditorReferences();
- int length = refs.length;
- for (int i = 0; i < length; i++)
- {
- IEditorInput input = refs[i].getEditorInput();
- if (input instanceof XSDFileEditorInput)
- {
- IFile aFile = ((XSDFileEditorInput) input).getFile();
- if (aFile.getFullPath().equals(file.getFullPath()))
- {
- if (((XSDFileEditorInput) input).getSchema() == schema)
- {
- editorPart = refs[i].getEditor(true);
- page.activate(refs[i].getPart(true));
- break;
- }
- }
- }
- }
- if (editorPart == null)
- {
- editorPart = page.openEditor(xsdFileEditorInput, XSDEditorPlugin.EDITOR_ID, true, 0); //$NON-NLS-1$
- }
- if (editorPart instanceof InternalXSDMultiPageEditor)
- {
- InternalXSDMultiPageEditor xsdEditor = (InternalXSDMultiPageEditor) editorPart;
- xsdEditor.openOnGlobalReference(xsdComponent);
- }
- }
- catch (PartInitException pie)
- {
- }
- }
- else
- {
- if (schemaLocation != null && !schemaLocation.startsWith("http"))
- {
- String fileLocation = null;
- // This is to workaround the difference in URI resolution. On linux, the resolved location is
- // platform:/resource/ On Windows, it's file://
- //
- if (java.io.File.separatorChar == '/')
- {
- fileLocation = "/" + URIHelper.removePlatformResourceProtocol(schemaLocation);
- }
- else // Windows
- {
- fileLocation = URIHelper.removeProtocol(schemaLocation);
- }
- IPath schemaPath = new Path(fileLocation);
- IFileStore fileStore = EFS.getLocalFileSystem().getStore(schemaPath);
- if (!fileStore.fetchInfo().isDirectory() && fileStore.fetchInfo().exists())
- {
- try
- {
- ADTFileStoreEditorInput xsdFileStoreEditorInput = new ADTFileStoreEditorInput(fileStore, schema);
- xsdFileStoreEditorInput.setEditorName(editorName);
-
- IEditorPart editorPart = null;
- IEditorReference[] refs = page.getEditorReferences();
- int length = refs.length;
- for (int i = 0; i < length; i++)
- {
- IEditorInput input = refs[i].getEditorInput();
- if (input instanceof ADTFileStoreEditorInput)
- {
- URI uri = ((ADTFileStoreEditorInput) input).getURI();
- if (uri.equals(xsdFileStoreEditorInput.getURI()) && ((ADTFileStoreEditorInput) input).getSchema() == xsdFileStoreEditorInput.getSchema())
- {
- editorPart = refs[i].getEditor(true);
- page.activate(refs[i].getPart(true));
- break;
- }
- }
- }
-
- if (page != null && editorPart == null)
- {
- editorPart = page.openEditor(xsdFileStoreEditorInput, XSDEditorPlugin.EDITOR_ID, true, 0); //$NON-NLS-1$
- }
- if (editorPart instanceof InternalXSDMultiPageEditor)
- {
- InternalXSDMultiPageEditor xsdEditor = (InternalXSDMultiPageEditor) editorPart;
- xsdEditor.openOnGlobalReference(xsdComponent);
- }
- }
- catch (PartInitException pie)
- {
-
- }
- }
- }
- else
- {
- try
- {
- IEditorPart editorPart = null;
- IEditorReference[] refs = page.getEditorReferences();
- int length = refs.length;
- // Need to find if an editor on that schema has already been opened
- for (int i = 0; i < length; i++)
- {
- IEditorInput input = refs[i].getEditorInput();
- if (input instanceof ADTReadOnlyFileEditorInput)
- {
- ADTReadOnlyFileEditorInput xsdFileStorageEditorInput = (ADTReadOnlyFileEditorInput) input;
- if (xsdFileStorageEditorInput.getUrlString().equals(schemaLocation)
- && xsdFileStorageEditorInput.getEditorID().equals(XSDEditorPlugin.EDITOR_ID))
- {
- editorPart = refs[i].getEditor(true);
- page.activate(refs[i].getPart(true));
- break;
- }
- }
- }
- if (editorPart == null)
- {
- ADTReadOnlyFileEditorInput xsdFileStorageEditorInput = new ADTReadOnlyFileEditorInput(schemaLocation);
- xsdFileStorageEditorInput.setSchema(schema);
- xsdFileStorageEditorInput.setEditorName(editorName);
- xsdFileStorageEditorInput.setEditorID(XSDEditorPlugin.EDITOR_ID);
- editorPart = page.openEditor(xsdFileStorageEditorInput, XSDEditorPlugin.EDITOR_ID, true, 0);
- }
- if (editorPart instanceof InternalXSDMultiPageEditor)
- {
- InternalXSDMultiPageEditor xsdEditor = (InternalXSDMultiPageEditor) editorPart;
- xsdEditor.openOnGlobalReference(xsdComponent);
- }
- }
- catch (PartInitException pie)
- {
- }
-
- }
- return;
- }
- }
-
- private IEditorPart getExistingEditorForInlineSchema(IWorkbenchPage page, IFile schemaFile, XSDSchema schema)
- {
- IEditorReference [] refs = page.getEditorReferences();
- int length = refs.length;
- IEditorPart editorPart = null;
- try
- {
- for (int i = 0; i < length; i++)
- {
- IEditorInput input = refs[i].getEditorInput();
- if (input instanceof XSDFileEditorInput)
- {
- IFile aFile = ((XSDFileEditorInput)input).getFile();
- if (aFile.getFullPath().equals(schemaFile.getFullPath()))
- {
- if (((XSDFileEditorInput)input).getSchema() == schema)
- {
- editorPart = refs[i].getEditor(true);
- page.activate(refs[i].getPart(true));
- break;
- }
- }
- }
- }
- }
- catch (PartInitException e)
- {
- }
- return editorPart;
- }
-
- public static void openWorkspaceFile(IWorkbenchPage page, String schemaLocation, XSDConcreteComponent xsdComponent)
- {
- IPath schemaPath = new Path(schemaLocation);
- IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(schemaPath);
- if (page != null && file != null && file.exists())
- {
- try
- {
- IEditorPart editorPart = IDE.openEditor(page, file, true);
- if (editorPart instanceof InternalXSDMultiPageEditor)
- {
- InternalXSDMultiPageEditor xsdEditor = (InternalXSDMultiPageEditor) editorPart;
- xsdEditor.openOnGlobalReference(xsdComponent);
- }
- }
- catch (PartInitException pie)
- {
-
- }
- }
- }
-
- public static void openExternalFiles(IWorkbenchPage page, String schemaLocation, XSDConcreteComponent fComponent)
- {
- if (schemaLocation == null) return; // Assert not null
-
- IPath schemaPath = new Path(schemaLocation);
-// Initially tried to use schemaPath.getDevice() to determine if it is an http reference. However, on Linux, it is null.
-// So as a result of bug 221421, we will just use the schemaLocation.
- if (!schemaLocation.startsWith("http"))
- {
- schemaPath = new Path(URIHelper.removeProtocol(schemaLocation));
- }
- IFileStore fileStore = EFS.getLocalFileSystem().getStore(schemaPath);
- URI schemaURI = URI.create(schemaLocation);
- if (!fileStore.fetchInfo().isDirectory() && fileStore.fetchInfo().exists())
- {
- try
- {
- IEditorPart editorPart = null;
- IEditorReference[] refs = page.getEditorReferences();
- int length = refs.length;
- // Need to find if an editor on that schema has already been opened
- for (int i = 0; i < length; i++)
- {
- IEditorInput input = refs[i].getEditorInput();
- if (input instanceof FileStoreEditorInput)
- {
- URI uri = ((FileStoreEditorInput) input).getURI();
- if (uri.equals(schemaURI))
- {
- editorPart = refs[i].getEditor(true);
- page.activate(refs[i].getPart(true));
- break;
- }
- }
- }
- if (editorPart == null)
- {
- editorPart = IDE.openEditorOnFileStore(page, fileStore);
- }
- if (editorPart instanceof InternalXSDMultiPageEditor)
- {
- InternalXSDMultiPageEditor xsdEditor = (InternalXSDMultiPageEditor) editorPart;
- xsdEditor.openOnGlobalReference(fComponent);
- }
- }
- catch (PartInitException pie)
- {
- }
- }
- else
- {
- try
- {
- if (schemaLocation.startsWith("http"))
- {
- try
- {
- IEditorPart editorPart = null;
- IEditorReference[] refs = page.getEditorReferences();
- int length = refs.length;
- // Need to find if an editor on that schema has already been opened
- for (int i = 0; i < length; i++)
- {
- IEditorInput input = refs[i].getEditorInput();
- if (input instanceof ADTReadOnlyFileEditorInput)
- {
- ADTReadOnlyFileEditorInput readOnlyEditorInput = (ADTReadOnlyFileEditorInput) input;
- if (readOnlyEditorInput.getUrlString().equals(schemaLocation) &&
- XSDEditorPlugin.EDITOR_ID.equals(readOnlyEditorInput.getEditorID()))
- {
- editorPart = refs[i].getEditor(true);
- page.activate(refs[i].getPart(true));
- break;
- }
- }
- }
- if (editorPart == null)
- {
- ADTReadOnlyFileEditorInput readOnlyStorageEditorInput = new ADTReadOnlyFileEditorInput(schemaLocation);
- readOnlyStorageEditorInput.setEditorID(XSDEditorPlugin.EDITOR_ID);
- editorPart = page.openEditor(readOnlyStorageEditorInput, XSDEditorPlugin.EDITOR_ID, true, 0); //$NON-NLS-1$
- }
- if (editorPart instanceof InternalXSDMultiPageEditor)
- {
- InternalXSDMultiPageEditor xsdEditor = (InternalXSDMultiPageEditor) editorPart;
- xsdEditor.openOnGlobalReference(fComponent);
- }
- }
- catch (PartInitException pie)
- {
- }
-
- }
- else
- {
- FileStoreEditorInput xsdFileStoreEditorInput = new FileStoreEditorInput(fileStore);
- page.openEditor(xsdFileStoreEditorInput, XSDEditorPlugin.EDITOR_ID, true, 0); //$NON-NLS-1$
- }
-
- }
- catch (PartInitException e)
- {
-
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/SetBaseTypeAction.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/SetBaseTypeAction.java
deleted file mode 100644
index dbc3a457a4..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/SetBaseTypeAction.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.wst.xsd.ui.internal.common.actions;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.window.Window;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter;
-import org.eclipse.wst.xsd.ui.internal.adt.edit.ComponentReferenceEditManager;
-import org.eclipse.wst.xsd.ui.internal.adt.edit.IComponentDialog;
-import org.eclipse.wst.xsd.ui.internal.common.util.Messages;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDComplexTypeBaseTypeEditManager;
-import org.eclipse.wst.xsd.ui.internal.editor.search.XSDSearchListDialogDelegate;
-import org.eclipse.xsd.XSDComplexTypeDefinition;
-import org.eclipse.xsd.XSDSimpleTypeDefinition;
-
-public class SetBaseTypeAction extends XSDBaseAction
-{
- public static String ID = "org.eclipse.wst.xsd.ui.internal.common.actions.setBaseType"; //$NON-NLS-1$
-
- public SetBaseTypeAction(IWorkbenchPart part)
- {
- super(part);
- setText(Messages._UI_ACTION_SET_BASE_TYPE + "..."); //$NON-NLS-1$
- setId(ID);
- }
-
- public void run()
- {
- Object selection = ((IStructuredSelection) getSelection()).getFirstElement();
-
- if (selection instanceof XSDBaseAdapter)
- {
- selection = ((XSDBaseAdapter) selection).getTarget();
-
- boolean complexType = selection instanceof XSDComplexTypeDefinition;
- boolean simpleType = selection instanceof XSDSimpleTypeDefinition;
-
- if (complexType || simpleType)
- {
-
- if (getWorkbenchPart() instanceof IEditorPart)
- {
- IEditorPart editor = (IEditorPart)getWorkbenchPart();
-
- ComponentReferenceEditManager manager = (ComponentReferenceEditManager)editor.getAdapter(XSDComplexTypeBaseTypeEditManager.class);
- ComponentSpecification newValue;
- IComponentDialog dialog = null;
- dialog = manager.getBrowseDialog();
- if (dialog != null)
- {
- if(simpleType)
- {
- ((XSDSearchListDialogDelegate) dialog).showComplexTypes(false);
- }
- if (dialog.createAndOpen() == Window.OK)
- {
- newValue = dialog.getSelectedComponent();
- manager.modifyComponentReference(selection, newValue);
- }
- }
- }
- }
- }
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/SetMultiplicityAction.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/SetMultiplicityAction.java
deleted file mode 100644
index a33996a005..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/SetMultiplicityAction.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * 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.internal.common.actions;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter;
-import org.eclipse.wst.xsd.ui.internal.common.commands.SetMultiplicityCommand;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDElementDeclaration;
-import org.eclipse.xsd.XSDModelGroup;
-import org.eclipse.xsd.XSDModelGroupDefinition;
-
-public class SetMultiplicityAction extends XSDBaseAction
-{
- public static String REQUIRED_ID = "org.eclipse.wst.xsd.ui.internal.common.actions.SetMultiplicity.REQUIRED_ID"; //$NON-NLS-1$
- public static String ZERO_OR_ONE_ID = "org.eclipse.wst.xsd.ui.internal.common.actions.SetMultiplicity.ZERO_OR_ONE_ID"; //$NON-NLS-1$
- public static String ZERO_OR_MORE_ID = "org.eclipse.wst.xsd.ui.internal.common.actions.SetMultiplicity.ZERO_OR_MORE_ID"; //$NON-NLS-1$
- public static String ONE_OR_MORE_ID = "org.eclipse.wst.xsd.ui.internal.common.actions.SetMultiplicity.ONE_OR_MORE_ID"; //$NON-NLS-1$
-
- 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);
- }
-
- protected boolean calculateEnabled()
- {
- boolean state = super.calculateEnabled();
- if (state)
- {
- XSDConcreteComponent xsdConcreteComponent = getXSDInput();
- if (xsdConcreteComponent instanceof XSDElementDeclaration)
- {
- return !((XSDElementDeclaration)xsdConcreteComponent).isGlobal();
- }
- else if (xsdConcreteComponent instanceof XSDModelGroup)
- {
- return !(((XSDModelGroup)xsdConcreteComponent).eContainer() instanceof XSDModelGroupDefinition);
- }
- }
- return state;
- }
-
- private XSDConcreteComponent getXSDInput()
- {
- Object selection = ((IStructuredSelection) getSelection()).getFirstElement();
-
- XSDConcreteComponent xsdConcreteComponent = null;
- if (selection instanceof XSDBaseAdapter)
- {
- xsdConcreteComponent = (XSDConcreteComponent)((XSDBaseAdapter) selection).getTarget();
- }
- return xsdConcreteComponent;
- }
-
- public void run()
- {
- XSDConcreteComponent xsdConcreteComponent = getXSDInput();
- 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/internal/common/actions/SetTypeAction.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/SetTypeAction.java
deleted file mode 100644
index 2083e4f420..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/SetTypeAction.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.actions;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter;
-import org.eclipse.wst.xsd.ui.internal.common.commands.SetTypeCommand;
-import org.eclipse.wst.xsd.ui.internal.editor.Messages;
-import org.eclipse.xsd.XSDConcreteComponent;
-
-public class SetTypeAction extends XSDBaseAction
-{
- public static final String SET_NEW_TYPE_ID = "SetTypeAction_AddType"; //$NON-NLS-1$
- public static final String SELECT_EXISTING_TYPE_ID = "SetTypeAction_ExistingType"; //$NON-NLS-1$
-
- 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(Messages._UI_ACTION_SET_TYPE, 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/internal/common/actions/XSDBaseAction.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/XSDBaseAction.java
deleted file mode 100644
index 472d9605c0..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/XSDBaseAction.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.actions;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.views.contentoutline.ContentOutline;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.BaseSelectionAction;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.BaseFieldEditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.IAutoDirectEdit;
-import org.eclipse.wst.xsd.ui.internal.design.editparts.TopLevelComponentEditPart;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDSchema;
-
-public class XSDBaseAction extends BaseSelectionAction
-{
- XSDConcreteComponent addedComponent;
-
- 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;
- }
-
- protected void doEdit(Object obj, IWorkbenchPart part)
- {
- if (obj instanceof TopLevelComponentEditPart)
- {
- TopLevelComponentEditPart editPart = (TopLevelComponentEditPart)obj;
- if (addedComponent == ((XSDBaseAdapter)editPart.getModel()).getTarget())
- {
- editPart.setScroll(true);
- editPart.addFeedback();
- editPart.doEditName(!(part instanceof ContentOutline));
- }
- }
- else if (obj instanceof BaseFieldEditPart)
- {
- BaseFieldEditPart editPart = (BaseFieldEditPart)obj;
- editPart.doEditName(!(part instanceof ContentOutline));
- }
- else if (obj instanceof IAutoDirectEdit)
- {
- ((IAutoDirectEdit)obj).doEditName(!(part instanceof ContentOutline));
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddDocumentationCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddDocumentationCommand.java
deleted file mode 100644
index 4462eccf0a..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddDocumentationCommand.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.commands;
-
-import java.util.List;
-
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
-import org.eclipse.wst.xsd.ui.internal.common.util.XSDCommonUIUtils;
-import org.eclipse.xsd.XSDAnnotation;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDSchema;
-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()
- {
- if (input instanceof XSDSchema)
- {
- ensureSchemaElement((XSDSchema)input);
- }
-
- try
- {
- beginRecording(input.getElement());
-
- xsdAnnotation = XSDCommonUIUtils.getInputXSDAnnotation(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);
- }
-
- 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 = ""; //$NON-NLS-1$
- Node childNode = documentationElement.getOwnerDocument().createTextNode(newValue);
- documentationElement.appendChild(childNode);
- }
- }
- }
- catch (Exception e)
- {
-
- }
- finally
- {
- endRecording();
- }
- }
-
- public void undo()
- {
- super.undo();
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddEnumerationsCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddEnumerationsCommand.java
deleted file mode 100644
index 6cb8fa7892..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddEnumerationsCommand.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.commands;
-
-import java.util.List;
-
-import org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDEnumerationFacetAction;
-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;
- // The index of the currently selected item. If no item is selected, index will be less than 0
- private int index = -1;
- // Determines where the element should be inserted based on the currently selected element. If no
- // element is selected, use the default behaviour of appending the element to the end
- private String addEnumerationLocation;
-
- public AddEnumerationsCommand(String label, XSDSimpleTypeDefinition simpleType)
- {
- super(label);
- this.simpleType = simpleType;
- }
-
- public AddEnumerationsCommand(String label, XSDSimpleTypeDefinition simpleType, String ID, int index)
- {
- super(label);
- this.simpleType = simpleType;
- this.index = index;
- this.addEnumerationLocation = ID;
- }
-
- public void setValue(String value)
- {
- this.value = value;
- }
-
- public void execute()
- {
- try
- {
- beginRecording(simpleType.getElement());
- XSDFactory factory = XSDSchemaBuildingTools.getXSDFactory();
- XSDEnumerationFacet enumerationFacet = factory.createXSDEnumerationFacet();
- enumerationFacet.setLexicalValue(value);
-
- index = getInsertionIndex();
- List facets = simpleType.getFacetContents();
- if (index >=0 && index < facets.size())
- {
- facets.add(index, enumerationFacet);
- }
- else
- {
- facets.add(enumerationFacet);
- }
- formatChild(simpleType.getElement());
- addedXSDConcreteComponent = enumerationFacet;
- }
- finally
- {
- endRecording();
- }
- }
-
- protected int getInsertionIndex()
- {
- if (index < 0)
- return -1;
-
- if (addEnumerationLocation.equals(AddXSDEnumerationFacetAction.BEFORE_SELECTED_ID))
- {
- return index;
- }
- else if (addEnumerationLocation.equals(AddXSDEnumerationFacetAction.AFTER_SELECTED_ID))
- {
- index++;
- return index;
- }
- else
- {
- return -1;
- }
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddExtensibilityElementCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddExtensibilityElementCommand.java
deleted file mode 100644
index 6747f59c12..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddExtensibilityElementCommand.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*******************************************************************************
- * 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.internal.common.commands;
-
-import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.SpecificationForExtensionsSchema;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-public class AddExtensibilityElementCommand extends BaseCommand
-{
- Element input, elementToAdd;
- SpecificationForExtensionsSchema extensionSchemaSpec;
-
- public AddExtensibilityElementCommand(String label, Element input, Element elementToAdd)
- {
- super(label);
- this.input = input;
- this.elementToAdd = elementToAdd;
- }
-
- public void execute()
- {
- super.execute();
- try
- {
- beginRecording(input);
- addElement();
- }
- finally
- {
- endRecording();
- }
- }
-
- public void undo()
- {
- super.undo();
- // TODO
- }
-
- public void setSchemaProperties(SpecificationForExtensionsSchema appInfoSchemaSpec)
- {
- this.extensionSchemaSpec = appInfoSchemaSpec;
- }
-
- private void addElement()
- {
- if (input != null)
- {
- Document doc = input.getOwnerDocument();
- String name = elementToAdd.getAttribute("name"); //$NON-NLS-1$
- try
- {
- Element rootElement = doc.createElementNS(extensionSchemaSpec.getNamespaceURI(), name);
- String prefix = input.getPrefix();
- rootElement.setPrefix(prefix);
- String xmlns = (prefix == null || prefix.equals("")) ? "xmlns" : "xmlns:" + prefix; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Attr nsURIAttribute = doc.createAttribute(xmlns);
- nsURIAttribute.setValue(extensionSchemaSpec.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/internal/common/commands/AddExtensionAttributeCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddExtensionAttributeCommand.java
deleted file mode 100644
index 8ee0c5253e..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddExtensionAttributeCommand.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.commands;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-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 AddExtensionAttributeCommand extends AddExtensionCommand
-{
- private static DOMNamespaceInfoManager manager = new DOMNamespaceInfoManager();
- private XSDAttributeDeclaration attribute;
- private boolean appInfoAttributeAdded = false;
- private String attributeQName;
- private String namespacePrefix;
-
- public AddExtensionAttributeCommand(String label, XSDConcreteComponent component,
- XSDAttributeDeclaration attribute)
- {
- super(label);
- this.component = component;
- this.attribute = attribute;
- }
-
- public void execute()
- {
- try
- {
- beginRecording(component.getElement());
- super.execute();
- namespacePrefix = handleNamespacePrefices();
-
- attributeQName = namespacePrefix + ":" + attribute.getName(); //$NON-NLS-1$
-
- if (!(component.getElement().hasAttribute(attributeQName)))
- {
- appInfoAttributeAdded = true;
- component.getElement().setAttribute(attributeQName, ""); //$NON-NLS-1$
- }
- }
- finally
- {
- endRecording();
- }
- }
-
- public void undo()
- {
- super.undo();
- 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){
- prefix = createUniquePrefix(component);
- }
-
- NamespaceInfo info = new NamespaceInfo(attribute.getTargetNamespace(), prefix, ""); //$NON-NLS-1$
- List infoList = new ArrayList(1);
- infoList.add(info);
- manager.addNamespaceInfo(schemaElement, infoList, false);
- return prefix;
- }
-
- protected String createUniquePrefix(XSDConcreteComponent component)
- {
- String prefix = "p"; //$NON-NLS-1$
- 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/internal/common/commands/AddExtensionCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddExtensionCommand.java
deleted file mode 100644
index 5672104048..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddExtensionCommand.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * 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.internal.common.commands;
-
-import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.SpecificationForExtensionsSchema;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDSchema;
-
-public class AddExtensionCommand extends BaseCommand
-{
- protected SpecificationForExtensionsSchema extensionsSchemaSpec;
- protected XSDConcreteComponent component;
-
- protected AddExtensionCommand(String label)
- {
- super(label);
- }
-
- public void setSchemaProperties(SpecificationForExtensionsSchema appInfoSchemaSpec)
- {
- this.extensionsSchemaSpec = appInfoSchemaSpec;
- }
-
- public Object getNewObject()
- {
- return null;
- }
-
- public void execute()
- {
- if (component instanceof XSDSchema)
- {
- ensureSchemaElement((XSDSchema)component);
- }
-
- super.execute();
- }
-
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddExtensionElementCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddExtensionElementCommand.java
deleted file mode 100644
index 2446901182..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddExtensionElementCommand.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.commands;
-
-import java.util.List;
-import java.util.Map;
-import org.eclipse.wst.xml.core.internal.contentmodel.util.NamespaceTable;
-import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.SpecificationForExtensionsSchema;
-import org.eclipse.wst.xsd.ui.internal.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.Document;
-import org.w3c.dom.Element;
-
-public class AddExtensionElementCommand extends AddExtensionCommand
-{
- XSDElementDeclaration element;
- Element appInfo;
- Element newElement;
-
- public AddExtensionElementCommand(String label, XSDConcreteComponent input, XSDElementDeclaration element)
- {
- super(label);
- this.component = input;
- this.element = element;
- }
-
- public void execute()
- {
- try
- {
- beginRecording(component.getElement());
- super.execute();
- addAnnotationSet(component.getSchema(), extensionsSchemaSpec);
- formatChild(component.getElement());
- }
- finally
- {
- endRecording();
- }
- }
-
- public void undo()
- {
- super.undo();
- XSDAnnotation xsdAnnotation = XSDCommonUIUtils.getInputXSDAnnotation(component, false);
- xsdAnnotation.getElement().removeChild(appInfo);
- List appInfos = xsdAnnotation.getApplicationInformation();
- appInfos.remove(appInfo);
- xsdAnnotation.updateElement();
-
- }
-
- public void setSchemaProperties(SpecificationForExtensionsSchema spec)
- {
- this.extensionsSchemaSpec = spec;
- }
-
- public void addAnnotationSet(XSDSchema xsdSchema, SpecificationForExtensionsSchema spec)
- {
- XSDAnnotation xsdAnnotation = XSDCommonUIUtils.getInputXSDAnnotation(component, true);
- addAnnotationSet(spec, xsdAnnotation);
- }
-
- private void addAnnotationSet(SpecificationForExtensionsSchema spec, XSDAnnotation xsdAnnotation)
- {
- XSDSchema schema= xsdAnnotation.getSchema();
- Element schemaElement = schema.getElement();
-
- if (xsdAnnotation.getApplicationInformation().size() == 0)
- {
- appInfo = xsdAnnotation.createApplicationInformation(null);
- xsdAnnotation.getElement().appendChild(appInfo);
- List appInfos = xsdAnnotation.getApplicationInformation();
- appInfos.add(appInfo);
- }
- else
- {
- // use the first appInfo
- appInfo = (Element)xsdAnnotation.getApplicationInformation().get(0);
- }
-
- String prefix = addNamespaceDeclarationIfRequired(schemaElement, "p", spec.getNamespaceURI());
-
- if (appInfo != null)
- {
- Document doc = appInfo.getOwnerDocument();
-
- newElement = doc.createElementNS(spec.getNamespaceURI(), element.getName());
- newElement.setPrefix(prefix);
- appInfo.appendChild(newElement);
-
- xsdAnnotation.updateElement();
- }
- }
-
- public Object getNewObject()
- {
- return newElement;
- }
-
- /**
- * @deprecated
- */
- protected String createUniquePrefix(XSDConcreteComponent component)
- {
- String prefix = "p"; //$NON-NLS-1$
- Map prefMapper = component.getSchema().getQNamePrefixToNamespaceMap();
- if ( prefMapper.get(prefix) != null){
- int i = 1;
- while ( prefMapper.get(prefix + i) != null)
- i++;
- prefix += i;
- }
- return prefix;
- }
-
- // TODO... common this up with wsdl.ui
- private String addNamespaceDeclarationIfRequired(Element schemaElement, String prefixHint, String namespace)
- {
- String prefix = null;
- NamespaceTable namespaceTable = new NamespaceTable(schemaElement.getOwnerDocument());
- namespaceTable.addElement(schemaElement);
- prefix = namespaceTable.getPrefixForURI(namespace);
- if (prefix == null)
- {
- String basePrefix = prefixHint;
- prefix = basePrefix;
- String xmlnsColon = "xmlns:"; //$NON-NLS-1$
- String attributeName = xmlnsColon + prefix;
- int count = 0;
- while (schemaElement.hasAttribute(attributeName))
- {
- count++;
- prefix = basePrefix + count;
- attributeName = xmlnsColon + prefix;
- }
- schemaElement.setAttribute(attributeName, namespace);
- }
- return prefix;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddRedefinedComponentCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddRedefinedComponentCommand.java
deleted file mode 100644
index 05ecede51d..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddRedefinedComponentCommand.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.wst.xsd.ui.internal.common.commands;
-
-
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDAttributeGroupDefinitionAdapter;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDComplexTypeDefinitionAdapter;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDModelGroupDefinitionAdapter;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDSimpleTypeDefinitionAdapter;
-import org.eclipse.xsd.XSDRedefinableComponent;
-import org.eclipse.xsd.XSDRedefine;
-import org.w3c.dom.Element;
-
-
-/**
- * Base class for commands that add redefined components to a schema redefine.
- */
-public abstract class AddRedefinedComponentCommand extends BaseCommand
-{
- protected XSDRedefine redefine;
-
- protected XSDRedefinableComponent redefinableComponent;
-
- public AddRedefinedComponentCommand(String label, XSDRedefine redefine, XSDRedefinableComponent redefinableComponent)
- {
- super(label);
- this.redefine = redefine;
- this.redefinableComponent = redefinableComponent;
- }
-
- protected abstract void doExecute();
-
- public void execute()
- {
- Element element = redefine.getElement();
-
- try
- {
- beginRecording(element);
- doExecute();
- Object adapter = redefinableComponent.eAdapters().get(0);
- if (adapter instanceof XSDComplexTypeDefinitionAdapter)
- {
- ((XSDComplexTypeDefinitionAdapter)adapter).updateDeletedMap(redefinableComponent.getName());
- }
- else if (adapter instanceof XSDSimpleTypeDefinitionAdapter)
- {
- ((XSDSimpleTypeDefinitionAdapter)adapter).updateDeletedMap(redefinableComponent.getName());
- }
- else if (adapter instanceof XSDAttributeGroupDefinitionAdapter)
- {
- ((XSDAttributeGroupDefinitionAdapter)adapter).updateDeletedMap(redefinableComponent.getName());
- }
- else if (adapter instanceof XSDModelGroupDefinitionAdapter)
- {
- ((XSDModelGroupDefinitionAdapter)adapter).updateDeletedMap(redefinableComponent.getName());
- }
- redefine.getContents().add(addedXSDConcreteComponent);
- formatChild(addedXSDConcreteComponent.getElement());
- }
- finally
- {
- endRecording();
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddXSDAnyAttributeCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddXSDAnyAttributeCommand.java
deleted file mode 100644
index 211cbc9d82..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddXSDAnyAttributeCommand.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * 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.internal.common.commands;
-
-import org.eclipse.xsd.XSDAttributeGroupDefinition;
-import org.eclipse.xsd.XSDComplexTypeDefinition;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDFactory;
-import org.eclipse.xsd.XSDWildcard;
-
-public class AddXSDAnyAttributeCommand extends BaseCommand
-{
- XSDComplexTypeDefinition xsdComplexTypeDefinition;
- XSDAttributeGroupDefinition xsdAttributeGroupDefinition;
- XSDConcreteComponent input;
-
- public AddXSDAnyAttributeCommand(String label, XSDComplexTypeDefinition xsdComplexTypeDefinition)
- {
- super(label);
- this.xsdComplexTypeDefinition = xsdComplexTypeDefinition;
- this.input = xsdComplexTypeDefinition;
- }
-
- public AddXSDAnyAttributeCommand(String label, XSDAttributeGroupDefinition xsdAttributeGroupDefinition)
- {
- super(label);
- this.xsdAttributeGroupDefinition = xsdAttributeGroupDefinition;
- this.input = xsdAttributeGroupDefinition;
- }
-
- public void execute()
- {
- try
- {
- beginRecording(input.getElement());
-
- XSDWildcard anyAttribute = XSDFactory.eINSTANCE.createXSDWildcard();
- if (xsdComplexTypeDefinition != null)
- {
- xsdComplexTypeDefinition.setAttributeWildcardContent(anyAttribute);
- formatChild(xsdComplexTypeDefinition.getElement());
- }
- else if (xsdAttributeGroupDefinition != null)
- {
- xsdAttributeGroupDefinition.setAttributeWildcardContent(anyAttribute);
- formatChild(xsdAttributeGroupDefinition.getElement());
- }
- addedXSDConcreteComponent = anyAttribute;
- }
- finally
- {
- endRecording();
- }
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddXSDAnyElementCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddXSDAnyElementCommand.java
deleted file mode 100644
index 1b88a5809c..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddXSDAnyElementCommand.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.commands;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.xsd.XSDComplexTypeDefinition;
-import org.eclipse.xsd.XSDCompositor;
-import org.eclipse.xsd.XSDFactory;
-import org.eclipse.xsd.XSDModelGroup;
-import org.eclipse.xsd.XSDParticle;
-import org.eclipse.xsd.XSDWildcard;
-import org.eclipse.xsd.util.XSDSchemaBuildingTools;
-
-public class AddXSDAnyElementCommand extends BaseCommand
-{
- XSDModelGroup parent;
- XSDComplexTypeDefinition complexType;
- boolean doCreateModelGroupForComplexType = false;
-
- public AddXSDAnyElementCommand(String label, XSDModelGroup parent)
- {
- super(label);
- this.parent = parent;
- }
-
- public void setComplexType(XSDComplexTypeDefinition complexType)
- {
- this.complexType = complexType;
- }
-
- public void setDoCreateModelGroupForComplexType(boolean doCreate)
- {
- this.doCreateModelGroupForComplexType = doCreate;
- }
-
- private void createModelGroup()
- {
- XSDFactory factory = XSDSchemaBuildingTools.getXSDFactory();
- XSDParticle particle = factory.createXSDParticle();
- parent = factory.createXSDModelGroup();
- parent.setCompositor(XSDCompositor.SEQUENCE_LITERAL);
- particle.setContent(parent);
- complexType.setContent(particle);
- }
-
- public void execute()
- {
- try
- {
- if (doCreateModelGroupForComplexType)
- {
- Assert.isNotNull(complexType);
- beginRecording(complexType.getElement());
- createModelGroup();
- }
- else
- {
- beginRecording(parent.getElement());
- }
- XSDWildcard wildCard = XSDFactory.eINSTANCE.createXSDWildcard();
- XSDParticle particle = XSDFactory.eINSTANCE.createXSDParticle();
- particle.setContent(wildCard);
- parent.getContents().add(particle);
- addedXSDConcreteComponent = wildCard;
- formatChild(parent.getElement());
- }
- finally
- {
- endRecording();
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddXSDAttributeDeclarationCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddXSDAttributeDeclarationCommand.java
deleted file mode 100644
index 00df7e042e..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddXSDAttributeDeclarationCommand.java
+++ /dev/null
@@ -1,238 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.commands;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.wst.xsd.ui.internal.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.util.XSDConstants;
-import org.w3c.dom.Text;
-
-public class AddXSDAttributeDeclarationCommand extends BaseCommand
-{
- XSDComplexTypeDefinition xsdComplexTypeDefinition;
- XSDModelGroup xsdModelGroup;
- XSDConcreteComponent parent;
- boolean isReference;
- private String nameToAdd;
- // The index of the currently selected item. If no item is selected, index will be less than 0
- private int index = -1;
- // Determines where the attribute should be inserted based on the currently selected attribute. If no
- // attribute is selected, use the default behaviour of appending the attribute to the end
- private String addAttributeLocation;
-
- public AddXSDAttributeDeclarationCommand(String label, XSDComplexTypeDefinition xsdComplexTypeDefinition)
- {
- super(label);
- this.xsdComplexTypeDefinition = xsdComplexTypeDefinition;
- }
-
- public AddXSDAttributeDeclarationCommand(String label, XSDConcreteComponent parent)
- {
- super(label);
- this.parent = parent;
- }
-
- public AddXSDAttributeDeclarationCommand(String label, XSDConcreteComponent parent, String addAttributeLocation, int index)
- {
- super(label);
- if (parent instanceof XSDComplexTypeDefinition)
- {
- this.xsdComplexTypeDefinition = (XSDComplexTypeDefinition) parent;
- }
- else
- {
- this.parent = parent;
- }
- this.addAttributeLocation = addAttributeLocation;
- this.index = index;
- }
-
- protected int getInsertionIndex()
- {
- if (index < 0)
- return -1;
-
- if (addAttributeLocation.equals(org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDAttributeDeclarationAction.BEFORE_SELECTED_ID))
- {
- return index;
- }
- else if (addAttributeLocation.equals(org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDAttributeDeclarationAction.AFTER_SELECTED_ID))
- {
- index++;
- return index;
- }
- else
- {
- return -1;
- }
- }
-
- public void execute()
- {
- XSDAttributeDeclaration attribute = XSDFactory.eINSTANCE.createXSDAttributeDeclaration();
- try
- {
- if (parent == null)
- {
- beginRecording(xsdComplexTypeDefinition.getElement());
- if (!isReference)
- {
- attribute.setName(getNewName(nameToAdd == null ? "NewAttribute" : nameToAdd)); //$NON-NLS-1$
- attribute.setTypeDefinition(xsdComplexTypeDefinition.getSchema().getSchemaForSchema().resolveSimpleTypeDefinition("string")); //$NON-NLS-1$
- }
- else
- {
- attribute.setResolvedAttributeDeclaration(setGlobalAttributeReference(xsdComplexTypeDefinition.getSchema()));
- }
- XSDAttributeUse attributeUse = XSDFactory.eINSTANCE.createXSDAttributeUse();
- attributeUse.setAttributeDeclaration(attribute);
- attributeUse.setContent(attribute);
-
- if (xsdComplexTypeDefinition.getAttributeContents() != null)
- {
- index = getInsertionIndex();
- if (index >= 0 && index < xsdComplexTypeDefinition.getAttributeContents().size())
- {
- xsdComplexTypeDefinition.getAttributeContents().add(index, attributeUse);
- }
- else
- {
- xsdComplexTypeDefinition.getAttributeContents().add(attributeUse);
- }
- formatChild(xsdComplexTypeDefinition.getElement());
- }
- }
- else
- {
- beginRecording(parent.getElement());
- if (parent instanceof XSDSchema)
- {
- XSDSchema xsdSchema = (XSDSchema) parent;
- attribute = createGlobalXSDAttributeDeclaration(xsdSchema);
- }
- else if (parent instanceof XSDAttributeGroupDefinition)
- {
- if (!isReference)
- {
- attribute.setTypeDefinition(parent.getSchema().getSchemaForSchema().resolveSimpleTypeDefinition("string")); //$NON-NLS-1$
-
- 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)); //$NON-NLS-1$
- }
- else
- {
- attribute.setResolvedAttributeDeclaration(setGlobalAttributeReference(parent.getSchema()));
- }
-
- XSDAttributeUse attributeUse = XSDFactory.eINSTANCE.createXSDAttributeUse();
- attributeUse.setAttributeDeclaration(attribute);
- attributeUse.setContent(attribute);
-
- index = getInsertionIndex();
- if (index >= 0 && index < (((XSDAttributeGroupDefinition) parent).getResolvedAttributeGroupDefinition().getContents().size()))
- {
- ((XSDAttributeGroupDefinition) parent).getResolvedAttributeGroupDefinition().getContents().add(index, attributeUse);
- }
- else
- {
- ((XSDAttributeGroupDefinition) parent).getResolvedAttributeGroupDefinition().getContents().add(attributeUse);
- }
- formatChild(parent.getElement());
- }
- }
- }
- finally
- {
- endRecording();
- }
- addedXSDConcreteComponent = attribute;
- }
-
- ArrayList names;
-
- public void setNameToAdd(String name)
- {
- nameToAdd = name;
- }
-
- protected String getNewName(String description)
- {
- ArrayList usedAttributeNames = new ArrayList();
- usedAttributeNames.addAll(XSDCommonUIUtils.getAllAttributes(xsdComplexTypeDefinition));
- usedAttributeNames.addAll(XSDCommonUIUtils.getInheritedAttributes(xsdComplexTypeDefinition));
- return XSDCommonUIUtils.createUniqueElementName(description, usedAttributeNames); //$NON-NLS-1$
- }
-
- public void setReference(boolean isReference)
- {
- this.isReference = isReference;
- }
-
- protected XSDAttributeDeclaration createGlobalXSDAttributeDeclaration(XSDSchema xsdSchema)
- {
- ensureSchemaElement(xsdSchema);
- XSDAttributeDeclaration attribute = XSDFactory.eINSTANCE.createXSDAttributeDeclaration();
- attribute.setTypeDefinition(xsdSchema.getSchemaForSchema().resolveSimpleTypeDefinition("string")); //$NON-NLS-1$
- attribute.setName(XSDCommonUIUtils.createUniqueElementName(nameToAdd == null ? "NewAttribute" : nameToAdd, xsdSchema.getAttributeDeclarations())); //$NON-NLS-1$
- Text textNode = xsdSchema.getDocument().createTextNode("\n"); //$NON-NLS-1$
- xsdSchema.getElement().appendChild(textNode);
- xsdSchema.getContents().add(attribute);
- return attribute;
- }
-
- protected XSDAttributeDeclaration setGlobalAttributeReference(XSDSchema xsdSchema)
- {
- List list = xsdSchema.getAttributeDeclarations();
- XSDAttributeDeclaration referencedAttribute = null;
- boolean isUserDefined = false;
- for (Iterator i = list.iterator(); i.hasNext(); )
- {
- Object obj = i.next();
- if (obj instanceof XSDAttributeDeclaration)
- {
- XSDAttributeDeclaration attr = (XSDAttributeDeclaration) obj;
- if (!XSDConstants.SCHEMA_INSTANCE_URI_2001.equals(attr.getTargetNamespace()))
- {
- referencedAttribute = attr;
- isUserDefined = true;
- break;
- }
- }
- }
- if (!isUserDefined)
- {
- referencedAttribute = createGlobalXSDAttributeDeclaration(xsdSchema);
- Text textNode = xsdSchema.getDocument().createTextNode("\n"); //$NON-NLS-1$
- xsdSchema.getElement().appendChild(textNode);
- xsdSchema.getContents().add(referencedAttribute);
- }
-
- return referencedAttribute;
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddXSDAttributeGroupDefinitionCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddXSDAttributeGroupDefinitionCommand.java
deleted file mode 100644
index 2ee575e73a..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddXSDAttributeGroupDefinitionCommand.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*******************************************************************************
- * 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.internal.common.commands;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.wst.xsd.ui.internal.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();
- try
- {
- if (xsdSchema == null)
- {
- beginRecording(xsdComplexTypeDefinition.getElement());
- 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())); //$NON-NLS-1$
- xsdComplexTypeDefinition.getSchema().getContents().add(attributeGroup2);
- attributeGroup.setResolvedAttributeGroupDefinition(attributeGroup2);
- }
-
- if (xsdComplexTypeDefinition.getAttributeContents() != null)
- {
- xsdComplexTypeDefinition.getAttributeContents().add(attributeGroup);
- }
- addedXSDConcreteComponent = attributeGroup;
- }
- else
- {
- ensureSchemaElement(xsdSchema);
- // put this after, since we don't have a DOM node yet
- beginRecording(xsdSchema.getElement());
- attributeGroup.setName(XSDCommonUIUtils.createUniqueElementName("NewAttributeGroup", xsdSchema.getAttributeGroupDefinitions())); //$NON-NLS-1$
- Text textNode = xsdSchema.getDocument().createTextNode("\n"); //$NON-NLS-1$
- xsdSchema.getElement().appendChild(textNode);
- xsdSchema.getContents().add(attributeGroup);
- addedXSDConcreteComponent = attributeGroup;
- }
- }
- finally
- {
- endRecording();
- }
- }
-
- 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/internal/common/commands/AddXSDComplexTypeDefinitionCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddXSDComplexTypeDefinitionCommand.java
deleted file mode 100644
index fa636cc11e..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddXSDComplexTypeDefinitionCommand.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.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()
- {
- try
- {
- beginRecording(parent.getElement());
- XSDFactory factory = XSDSchemaBuildingTools.getXSDFactory();
- XSDComplexTypeDefinition complexType = factory.createXSDComplexTypeDefinition();
- addedXSDConcreteComponent = complexType;
- String newName = getNewName(nameToAdd == null ? "NewComplexType" : nameToAdd, parent.getSchema()); //$NON-NLS-1$
- complexType.setName(newName);
- if (parent instanceof XSDSchema)
- {
- try
- {
- XSDSchema xsdSchema = (XSDSchema) parent;
- ensureSchemaElement(xsdSchema);
- Text textNode = xsdSchema.getDocument().createTextNode("\n"); //$NON-NLS-1$
- xsdSchema.getElement().appendChild(textNode);
- xsdSchema.getContents().add(complexType);
- }
- catch (Exception e)
- {
-
- }
- }
- else if (parent instanceof XSDElementDeclaration)
- {
- ((XSDElementDeclaration) parent).setAnonymousTypeDefinition(complexType);
- formatChild(parent.getElement());
- }
- createdComplexType = complexType;
- }
- finally
- {
- endRecording();
- }
- }
-
- 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 = ""; //$NON-NLS-1$
- 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/internal/common/commands/AddXSDElementCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddXSDElementCommand.java
deleted file mode 100644
index a1bdff69e0..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddXSDElementCommand.java
+++ /dev/null
@@ -1,388 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.commands;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.wst.xsd.ui.internal.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;
- // The index of the currently selected item. If no item is selected, index will be less than 0
- private int index = -1;
- // Determines where the element should be inserted based on the currently selected element. If no
- // element is selected, use the default behaviour of appending the element to the end
- private String addElementLocation;
-
- 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, XSDModelGroup xsdModelGroup, String ID, int index)
- {
- super(label);
- this.xsdModelGroup = xsdModelGroup;
- this.index = index;
- this.addElementLocation = ID;
- }
-
- 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;
- }
-
- public void setAddElementLocation(String LocationType)
- {
- addElementLocation = LocationType;
- }
-
- protected int getInsertionIndex()
- {
- if (index < 0)
- return -1;
-
- if (addElementLocation.equals(org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDElementAction.BEFORE_SELECTED_ID))
- {
- return index;
- }
- else if (addElementLocation.equals(org.eclipse.wst.xsd.ui.internal.common.actions.AddXSDElementAction.AFTER_SELECTED_ID))
- {
- index++;
- return index;
- }
- else
- {
- return -1;
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.gef.commands.Command#execute()
- */
- public void execute()
- {
- try
- {
- if (xsdSchema != null)
- {
- beginRecording(xsdSchema.getElement());
- XSDElementDeclaration element = createGlobalXSDElementDeclaration();
- Text textNode = xsdSchema.getDocument().createTextNode("\n"); //$NON-NLS-1$
- xsdSchema.getElement().appendChild(textNode);
- xsdSchema.getContents().add(element);
- addedXSDConcreteComponent = element;
- }
- else if (xsdModelGroupDefinition != null)
- {
- beginRecording(xsdModelGroupDefinition.getElement());
- if (xsdModelGroup == null)
- {
- XSDFactory factory = XSDSchemaBuildingTools.getXSDFactory();
- XSDParticle particle = factory.createXSDParticle();
- xsdModelGroup = factory.createXSDModelGroup();
- xsdModelGroup.setCompositor(XSDCompositor.SEQUENCE_LITERAL);
- particle.setContent(xsdModelGroup);
- xsdModelGroupDefinition.setModelGroup(xsdModelGroup);
- }
- xsdSchema = xsdModelGroupDefinition.getSchema();
- if (!isReference)
- {
- xsdModelGroup.getContents().add(createXSDElementDeclarationForModelGroupDefinitions());
- }
- else
- {
- xsdModelGroup.getContents().add(createXSDElementReference());
- }
- formatChild(xsdModelGroupDefinition.getElement());
- }
- else if (xsdModelGroup != null && (xsdComplexTypeDefinition == null || xsdModelGroupDefinition == null) )
- {
- xsdSchema = xsdModelGroup.getSchema();
- beginRecording(xsdSchema.getElement());
- if (!isReference)
- {
- index = getInsertionIndex();
- if(index >= 0 && index < xsdModelGroup.getContents().size())
- {
- xsdModelGroup.getContents().add(index,createXSDElementDeclaration());
- }
- else
- {
- xsdModelGroup.getContents().add(createXSDElementDeclaration());
- }
- }
- else
- {
- xsdModelGroup.getContents().add(createXSDElementReference());
- }
- formatChild(xsdModelGroup.getElement());
- }
- else
- {
- xsdSchema = xsdComplexTypeDefinition.getSchema();
- beginRecording(xsdSchema.getElement());
- 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);
- }
- if (!isReference)
- {
- xsdModelGroup.getContents().add(createXSDElementDeclarationForComplexType());
- }
- else
- {
- xsdModelGroup.getContents().add(createXSDElementReference());
- }
- formatChild(xsdComplexTypeDefinition.getElement());
- }
- }
- finally
- {
- endRecording();
- }
- }
-
- protected XSDParticle createXSDElementDeclaration()
- {
- XSDSimpleTypeDefinition type = xsdModelGroup.getSchema().getSchemaForSchema().resolveSimpleTypeDefinition("string"); //$NON-NLS-1$
-
- XSDElementDeclaration element = XSDFactory.eINSTANCE.createXSDElementDeclaration();
-
- XSDConcreteComponent comp = xsdModelGroup.getContainer();
- ArrayList usedAttributeNames = new ArrayList();
- XSDCommonUIUtils.resetVisitedGroupsStack();
- usedAttributeNames.addAll(XSDCommonUIUtils.getChildElements(xsdModelGroup));
- while (comp != null)
- {
- if (comp instanceof XSDModelGroupDefinition)
- {
- usedAttributeNames.addAll(XSDCommonUIUtils.getAllAttributes((XSDModelGroupDefinition)comp));
- break;
- }
- else if (comp instanceof XSDComplexTypeDefinition)
- {
- usedAttributeNames.addAll(XSDCommonUIUtils.getAllAttributes((XSDComplexTypeDefinition)comp));
- usedAttributeNames.addAll(XSDCommonUIUtils.getInheritedAttributes((XSDComplexTypeDefinition)comp));
- break;
- }
- comp = comp.getContainer();
- }
- element.setName(XSDCommonUIUtils.createUniqueElementName(
- nameToAdd == null ? "NewElement" : nameToAdd , usedAttributeNames)); //$NON-NLS-1$
- 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"); //$NON-NLS-1$
- 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"); //$NON-NLS-1$
-
- 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)); //$NON-NLS-1$
- element.setTypeDefinition(type);
-
- XSDParticle particle = XSDFactory.eINSTANCE.createXSDParticle();
- particle.setContent(element);
- addedXSDConcreteComponent = element;
- return particle;
- }
-
- protected XSDParticle createXSDElementDeclarationForModelGroupDefinitions()
- {
- XSDSimpleTypeDefinition type = xsdModelGroup.getSchema().getSchemaForSchema().resolveSimpleTypeDefinition("string"); //$NON-NLS-1$
-
- XSDElementDeclaration element = XSDFactory.eINSTANCE.createXSDElementDeclaration();
-
- ArrayList usedAttributeNames = new ArrayList();
- usedAttributeNames.addAll(XSDCommonUIUtils.getAllAttributes(xsdModelGroupDefinition));
- element.setName(XSDCommonUIUtils.createUniqueElementName(
- nameToAdd == null ? "NewElement" : nameToAdd , usedAttributeNames)); //$NON-NLS-1$
- element.setTypeDefinition(type);
-
- XSDParticle particle = XSDFactory.eINSTANCE.createXSDParticle();
- particle.setContent(element);
- addedXSDConcreteComponent = element;
- return particle;
- }
-
- protected XSDElementDeclaration createGlobalXSDElementDeclaration()
- {
- ensureSchemaElement(xsdSchema);
- XSDSimpleTypeDefinition type = xsdSchema.getSchemaForSchema().resolveSimpleTypeDefinition("string"); //$NON-NLS-1$
- XSDFactory factory = XSDSchemaBuildingTools.getXSDFactory();
- XSDElementDeclaration element = factory.createXSDElementDeclaration();
-
- element.setName(XSDCommonUIUtils.createUniqueElementName(
- nameToAdd == null ? "NewElement" : nameToAdd , xsdSchema.getElementDeclarations())); //$NON-NLS-1$
- element.setTypeDefinition(type);
-
- return element;
- }
-
- public XSDModelGroup getModelGroup(XSDModelGroupDefinition modelGroupDef)
- {
- return modelGroupDef.getModelGroup();
- }
-
- //PORT
- public XSDModelGroup getModelGroup(XSDComplexTypeDefinition cType)
- {
- XSDParticle particle = null;
-
- XSDComplexTypeContent xsdComplexTypeContent = cType.getContent();
- if (xsdComplexTypeContent instanceof XSDParticle)
- {
- particle = (XSDParticle)xsdComplexTypeContent;
- }
-
- 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/internal/common/commands/AddXSDImportCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddXSDImportCommand.java
deleted file mode 100644
index e91f872f2a..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddXSDImportCommand.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * 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.internal.common.commands;
-
-import org.eclipse.xsd.XSDFactory;
-import org.eclipse.xsd.XSDImport;
-import org.eclipse.xsd.XSDSchema;
-
-public class AddXSDImportCommand extends AddXSDSchemaDirectiveCommand
-{
- public AddXSDImportCommand(String label, XSDSchema schema)
- {
- super(label);
- this.xsdSchema = schema;
- }
-
- public void execute()
- {
- try
- {
- super.execute();
- // Add this after if we don't have a DOM Node yet
- beginRecording(xsdSchema.getElement());
- XSDImport xsdImport = XSDFactory.eINSTANCE.createXSDImport();
- xsdSchema.getContents().add(findNextPositionToInsert(), xsdImport);
- addedXSDConcreteComponent = xsdImport;
- formatChild(xsdSchema.getElement());
- }
- finally
- {
- endRecording();
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddXSDIncludeCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddXSDIncludeCommand.java
deleted file mode 100644
index e69b309467..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddXSDIncludeCommand.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * 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.internal.common.commands;
-
-import org.eclipse.xsd.XSDFactory;
-import org.eclipse.xsd.XSDInclude;
-import org.eclipse.xsd.XSDSchema;
-
-public class AddXSDIncludeCommand extends AddXSDSchemaDirectiveCommand
-{
- public AddXSDIncludeCommand(String label, XSDSchema schema)
- {
- super(label);
- this.xsdSchema = schema;
- }
-
- public void execute()
- {
- try
- {
- super.execute();
- // Add this after if we don't have a DOM Node yet
- beginRecording(xsdSchema.getElement());
- XSDInclude xsdInclude = XSDFactory.eINSTANCE.createXSDInclude();
- xsdInclude.setSchemaLocation(""); //$NON-NLS-1$
- xsdSchema.getContents().add(findNextPositionToInsert(), xsdInclude);
- addedXSDConcreteComponent = xsdInclude;
- formatChild(xsdSchema.getElement());
- }
- finally
- {
- endRecording();
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddXSDModelGroupCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddXSDModelGroupCommand.java
deleted file mode 100644
index 5d14b27017..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddXSDModelGroupCommand.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.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.XSDModelGroupDefinition;
-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()
- {
- try
- {
- beginRecording(parent.getElement());
- 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());
- }
- finally
- {
- endRecording();
- }
- }
-
- 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());
- }
-
- }
- }
- else if (parent instanceof XSDModelGroupDefinition)
- {
- XSDModelGroupDefinition modelGroupDefinition = (XSDModelGroupDefinition)parent;
- owner = null;
- newModelGroup = createModelGroup();
- if (modelGroupDefinition.getModelGroup() != null)
- {
- XSDModelGroup newParent = modelGroupDefinition.getModelGroup();
- newParent.getContents().add(newModelGroup.getContainer());
- }
- else
- {
- modelGroupDefinition.setModelGroup(newModelGroup);
- }
- }
- 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/internal/common/commands/AddXSDModelGroupDefinitionCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddXSDModelGroupDefinitionCommand.java
deleted file mode 100644
index 7e782d8294..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddXSDModelGroupDefinitionCommand.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.commands;
-
-import java.util.List;
-
-import org.eclipse.wst.xsd.ui.internal.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.XSDSchema;
-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 (parent instanceof XSDSchema)
- {
- ensureSchemaElement((XSDSchema)parent);
- }
- try
- {
- beginRecording(parent.getElement());
- 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();
- int length = list.size();
- if (length > 1)
- {
- for (int i = 0; i < length; i++)
- {
- XSDModelGroupDefinition gr = (XSDModelGroupDefinition) list.get(i);
- if (gr.getModelGroup() != parent)
- {
- def.setResolvedModelGroupDefinition(gr);
- }
- }
- }
- else if (length <= 1)
- {
- XSDModelGroupDefinition newGroupDef = createXSDModelGroupDefinition();
- def.setResolvedModelGroupDefinition(newGroupDef);
- }
-
- if (parent instanceof XSDModelGroup)
- {
- ((XSDModelGroup) parent).getContents().add(particle);
- }
- formatChild(def.getElement());
- addedXSDConcreteComponent = def;
- }
- }
- finally
- {
- endRecording();
- }
- }
-
- protected XSDModelGroupDefinition createXSDModelGroupDefinition()
- {
- XSDFactory factory = XSDSchemaBuildingTools.getXSDFactory();
- XSDModelGroupDefinition def = factory.createXSDModelGroupDefinition();
- List list = parent.getSchema().getModelGroupDefinitions();
- String newName = XSDCommonUIUtils.createUniqueElementName("NewGroupDefinition", list); //$NON-NLS-1$
- def.setName(newName);
-
- XSDModelGroup modelGroup = createModelGroup();
- def.setModelGroup(modelGroup);
- Text textNode = parent.getSchema().getDocument().createTextNode("\n"); //$NON-NLS-1$
- 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/internal/common/commands/AddXSDRedefineCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddXSDRedefineCommand.java
deleted file mode 100644
index e2fd36721a..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddXSDRedefineCommand.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * 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.internal.common.commands;
-
-import org.eclipse.xsd.XSDFactory;
-import org.eclipse.xsd.XSDRedefine;
-import org.eclipse.xsd.XSDSchema;
-
-public class AddXSDRedefineCommand extends AddXSDSchemaDirectiveCommand
-{
- public AddXSDRedefineCommand(String label, XSDSchema schema)
- {
- super(label);
- this.xsdSchema = schema;
- }
-
- public void execute()
- {
- super.execute();
- try
- {
- // Add this after if we don't have a DOM Node yet
- beginRecording(xsdSchema.getElement());
- XSDRedefine xsdRedefine = XSDFactory.eINSTANCE.createXSDRedefine();
- xsdRedefine.setSchemaLocation(""); //$NON-NLS-1$
- xsdSchema.getContents().add(findNextPositionToInsert(), xsdRedefine);
- addedXSDConcreteComponent = xsdRedefine;
- formatChild(xsdSchema.getElement());
- }
- finally
- {
- endRecording();
- }
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddXSDSchemaDirectiveCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddXSDSchemaDirectiveCommand.java
deleted file mode 100644
index a4f9008868..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddXSDSchemaDirectiveCommand.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * 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.internal.common.commands;
-
-import java.util.Iterator;
-
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.XSDSchemaDirective;
-
-public abstract class AddXSDSchemaDirectiveCommand extends BaseCommand
-{
- protected XSDSchema xsdSchema;
-
- public AddXSDSchemaDirectiveCommand(String label)
- {
- super(label);
- }
-
- public void undo()
- {
- super.undo();
- }
-
- protected boolean adopt(XSDConcreteComponent model)
- {
- return false;
- }
-
- protected int findNextPositionToInsert()
- {
- int index = 0;
- for (Iterator i = xsdSchema.getContents().iterator(); i.hasNext(); )
- {
- Object o = i.next();
- if (o instanceof XSDSchemaDirective)
- {
- index ++;
- }
- else
- {
- break;
- }
- }
- return index;
- }
-
- public void execute()
- {
- ensureSchemaElement(xsdSchema);
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddXSDSimpleTypeDefinitionCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddXSDSimpleTypeDefinitionCommand.java
deleted file mode 100644
index 8cabbef36d..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/AddXSDSimpleTypeDefinitionCommand.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.commands;
-
-import org.eclipse.wst.xsd.ui.internal.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()
- {
- if (parent instanceof XSDSchema)
- {
- ensureSchemaElement((XSDSchema)parent);
- }
-
- try
- {
- beginRecording(parent.getElement());
- XSDSimpleTypeDefinition typeDef = XSDFactory.eINSTANCE.createXSDSimpleTypeDefinition();
- typeDef.setBaseTypeDefinition(parent.getSchema().getSchemaForSchema().resolveSimpleTypeDefinition(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, "string")); //$NON-NLS-1$
-
- if (parent instanceof XSDSchema)
- {
- typeDef.setName(XSDCommonUIUtils.createUniqueElementName(nameToAdd == null ? "NewSimpleType" : nameToAdd, ((XSDSchema) parent).getTypeDefinitions())); //$NON-NLS-1$
- createdSimpleType = typeDef;
- try
- {
- XSDSchema xsdSchema = (XSDSchema) parent;
- Text textNode = xsdSchema.getDocument().createTextNode("\n"); //$NON-NLS-1$
- 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());
-
- addedXSDConcreteComponent = createdSimpleType;
- }
- finally
- {
- endRecording();
- }
- }
-
- public XSDSimpleTypeDefinition getCreatedSimpleType()
- {
- return createdSimpleType;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/BaseCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/BaseCommand.java
deleted file mode 100644
index 495fba8796..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/BaseCommand.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2011 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.commands;
-
-import java.util.Map;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Preferences;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.wst.sse.core.internal.encoding.CommonEncodingPreferenceNames;
-import org.eclipse.wst.sse.core.internal.format.IStructuredFormatProcessor;
-import org.eclipse.wst.xml.core.internal.XMLCorePlugin;
-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.editor.XSDEditorPlugin;
-import org.eclipse.xsd.XSDConcreteComponent;
-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;
-import org.w3c.dom.ProcessingInstruction;
-import org.w3c.dom.Text;
-
-public class BaseCommand extends Command
-{
- private static final String XML = "xml"; //$NON-NLS-1$
-
- XSDConcreteComponent addedXSDConcreteComponent;
-
- public BaseCommand()
- {
- super();
- }
-
- public BaseCommand(String label)
- {
- // Commands inherit their name from the associated action.
- // This label shows up in the undo menu and it would look ugly with the mnemonic in it.
- // Ideally, we'd have separate strings.
-
- super(label != null ? label.replaceFirst("&", "") : "");
- }
-
- public XSDConcreteComponent getAddedComponent()
- {
- return addedXSDConcreteComponent;
- }
-
- IDOMNode domNode;
- protected void beginRecording(Object element) {
- if (element instanceof IDOMNode)
- {
- domNode = (IDOMNode) element;
- domNode.getModel().beginRecording(this, getUndoDescription());
- }
- }
-
- protected void endRecording()
- {
- if (domNode != null)
- domNode.getModel().endRecording(this);
- }
-
- protected String getUndoDescription() {
- return getLabel();
- }
-
- 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();
- }
- }
- }
-
- protected static void ensureSchemaElement(XSDSchema schema)
- {
- Document document = schema.getDocument();
-
- Element schemaElement = document.getDocumentElement();
-
- if (schemaElement == null)
- {
- String targetNamespace = getDefaultNamespace(schema);
- schema.setTargetNamespace(targetNamespace);
- Map qNamePrefixToNamespaceMap = schema.getQNamePrefixToNamespaceMap();
- qNamePrefixToNamespaceMap.put("tns", targetNamespace);
- if (XSDEditorPlugin.getDefault().isQualifyXMLSchemaLanguage())
- {
- String prefix = XSDEditorPlugin.getDefault().getXMLSchemaPrefix();
- schema.setSchemaForSchemaQNamePrefix(prefix);
- qNamePrefixToNamespaceMap.put(prefix, XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001);
- }
- else
- {
- qNamePrefixToNamespaceMap.put(null, XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001);
- }
-
- schema.updateElement();
- ensureXMLDirective(document);
- }
- }
-
- private static void ensureXMLDirective(Document document)
- {
- if (hasXMLDirective(document))
- {
- return;
- }
-
- Node firstChild = document.getFirstChild();
- ProcessingInstruction xmlDeclaration = getXMLDeclaration(document);
- document.insertBefore(xmlDeclaration, firstChild);
- Text textNode = document.createTextNode(System.getProperty("line.separator"));
- document.insertBefore(textNode, firstChild);
- }
-
- private static boolean hasXMLDirective(Document document)
- {
- Node firstChild = document.getFirstChild();
-
- if (firstChild == null)
- {
- return false;
- }
-
- if (firstChild.getNodeType() != Node.PROCESSING_INSTRUCTION_NODE)
- {
- return false;
- }
-
- ProcessingInstruction processingInstruction = (ProcessingInstruction)firstChild;
-
- if (!XML.equals(processingInstruction.getTarget()))
- {
- return false;
- }
-
- return true;
- }
-
- private static ProcessingInstruction getXMLDeclaration(Document document)
- {
- Preferences preference = XMLCorePlugin.getDefault().getPluginPreferences();
- String charSet = preference.getString(CommonEncodingPreferenceNames.OUTPUT_CODESET);
- if (charSet == null || charSet.trim().equals(""))
- {
- charSet = "UTF-8";
- }
- ProcessingInstruction xmlDeclaration = document.createProcessingInstruction(XML, "version=\"1.0\" encoding=\"" + charSet + "\"");
- return xmlDeclaration;
- }
-
- private static String getDefaultNamespace(XSDSchema schema)
- {
- String namespace = XSDEditorPlugin.getDefault().getXMLSchemaTargetNamespace();
-
- if (!namespace.endsWith("/"))
- {
- namespace = namespace.concat("/");
- }
-
- namespace += getFileName(schema) + "/";
-
- return namespace;
-
- }
-
- private static String getFileName(XSDSchema schema)
- {
- URI schemaURI = schema.eResource().getURI();
- IPath filePath = new Path(schemaURI.toString());
- return filePath.removeFileExtension().lastSegment().toString();
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/ChangeToLocalSimpleTypeCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/ChangeToLocalSimpleTypeCommand.java
deleted file mode 100644
index bf10d8b590..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/ChangeToLocalSimpleTypeCommand.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * 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.internal.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);
- try
- {
- beginRecording(parent.getElement());
-
- if (parent instanceof XSDElementDeclaration)
- {
- ((XSDElementDeclaration) parent).setAnonymousTypeDefinition(anonymousSimpleType);
- }
- else if (parent instanceof XSDAttributeDeclaration)
- {
- ((XSDAttributeDeclaration) parent).setAnonymousTypeDefinition(anonymousSimpleType);
- }
- formatChild(parent.getElement());
- }
- finally
- {
- endRecording();
- }
- }
-
- 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/internal/common/commands/DeleteCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/DeleteCommand.java
deleted file mode 100644
index 09cc838b8a..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/DeleteCommand.java
+++ /dev/null
@@ -1,221 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.commands;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDAttributeGroupDefinitionAdapter;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDComplexTypeDefinitionAdapter;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDModelGroupDefinitionAdapter;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDSimpleTypeDefinitionAdapter;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDVisitor;
-import org.eclipse.wst.xsd.ui.internal.common.util.Messages;
-import org.eclipse.wst.xsd.ui.internal.common.util.XSDDirectivesManager;
-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.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.util.XSDConstants;
-
-public class DeleteCommand extends BaseCommand
-{
- XSDConcreteComponent target;
-
- public DeleteCommand(String label, XSDConcreteComponent target)
- {
- super(label);
- this.target = target;
- }
-
- public DeleteCommand(XSDConcreteComponent target)
- {
- super(Messages._UI_ACTION_DELETE);
- 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"); //$NON-NLS-1$
- element.setTypeDefinition(type);
- }
- super.visitElementDeclaration(element);
- }
- };
-
- XSDConcreteComponent parent = target.getContainer();
- XSDSchema schema = target.getSchema();
-
- try
- {
- beginRecording(parent.getElement());
- boolean doCleanup = false;
- if (target instanceof XSDModelGroup || target instanceof XSDElementDeclaration || target instanceof XSDModelGroupDefinition)
- {
- doCleanup = true;
- if (parent instanceof XSDParticle)
- {
- if (parent.getContainer() instanceof XSDModelGroup)
- {
- XSDModelGroup modelGroup = (XSDModelGroup) ((XSDParticle) parent).getContainer();
-
- modelGroup.getContents().remove(parent);
- }
- else if (parent.getContainer() instanceof XSDComplexTypeDefinition)
- {
- XSDComplexTypeDefinition complexType = (XSDComplexTypeDefinition) parent.getContainer();
- complexType.setContent(null);
- }
- }
- else if (parent instanceof XSDSchema)
- {
- visitor.visitSchema(target.getSchema());
- ((XSDSchema) parent).getContents().remove(target);
- }
- else if (parent instanceof XSDRedefine)
- {
- Object adapter = target.eAdapters().get(0);
- if (adapter instanceof XSDModelGroupDefinitionAdapter)
- {
- ((XSDModelGroupDefinitionAdapter) adapter).setReadOnly(true);
- ((XSDModelGroupDefinitionAdapter) adapter).setChangeReadOnlyField(true);
- }
- ((XSDRedefine) parent).getContents().remove(target);
- }
- }
- else if (target instanceof XSDAttributeDeclaration)
- {
- doCleanup = true;
- 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(parent);
- }
-
- if (parent.getContainer() instanceof XSDAttributeGroupDefinition)
- {
- XSDAttributeGroupDefinition attrGroup = (XSDAttributeGroupDefinition) parent.getContainer();
-
- attrGroup.getContents().remove(parent);
- }
- }
- else if (parent instanceof XSDSchema)
- {
- visitor.visitSchema(target.getSchema());
- ((XSDSchema) parent).getContents().remove(target);
- }
- }
- else if (target instanceof XSDAttributeGroupDefinition && parent instanceof XSDComplexTypeDefinition)
- {
- doCleanup = true;
- ((XSDComplexTypeDefinition) parent).getAttributeContents().remove(target);
- }
- else if (target instanceof XSDEnumerationFacet)
- {
- XSDEnumerationFacet enumerationFacet = (XSDEnumerationFacet) target;
- enumerationFacet.getSimpleTypeDefinition().getFacetContents().remove(enumerationFacet);
- }
- else if (target instanceof XSDWildcard)
- {
- if (parent instanceof XSDParticle)
- {
- if (parent.getContainer() instanceof XSDModelGroup)
- {
- XSDModelGroup modelGroup = (XSDModelGroup) ((XSDParticle) parent).getContainer();
- modelGroup.getContents().remove(parent);
- }
- }
- else if (parent instanceof XSDComplexTypeDefinition)
- {
- ((XSDComplexTypeDefinition) parent).setAttributeWildcardContent(null);
- }
- else if (parent instanceof XSDAttributeGroupDefinition)
- {
- ((XSDAttributeGroupDefinition) parent).setAttributeWildcardContent(null);
- }
- }
- else if (target instanceof XSDTypeDefinition && parent instanceof XSDElementDeclaration)
- {
- doCleanup = true;
- ((XSDElementDeclaration) parent).setTypeDefinition(target.resolveSimpleTypeDefinition(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, "string"));
- }
- else
- {
- if (parent instanceof XSDSchema)
- {
- doCleanup = true;
- visitor.visitSchema(target.getSchema());
- ((XSDSchema) parent).getContents().remove(target);
- }
- else if(parent instanceof XSDRedefine)
- {
- doCleanup = false;
- EList contents = ((XSDRedefine)parent).getContents();
- Object adapter = target.eAdapters().get(0);
- if (adapter instanceof XSDComplexTypeDefinitionAdapter)
- {
-
- ((XSDComplexTypeDefinitionAdapter) adapter).setReadOnly(true);
- ((XSDComplexTypeDefinitionAdapter) adapter).setChangeReadOnlyField(true);
- }
- else if (adapter instanceof XSDSimpleTypeDefinitionAdapter)
- {
-
- ((XSDSimpleTypeDefinitionAdapter) adapter).setReadOnly(true);
- ((XSDSimpleTypeDefinitionAdapter) adapter).setChangeReadOnlyField(true);
- }
- else if (adapter instanceof XSDAttributeGroupDefinitionAdapter)
- {
-
- ((XSDAttributeGroupDefinitionAdapter) adapter).setReadOnly(true);
- ((XSDAttributeGroupDefinitionAdapter) adapter).setChangeReadOnlyField(true);
- }
- contents.remove(target);
- }
- }
-
- if (doCleanup)
- XSDDirectivesManager.removeUnusedXSDImports(schema);
- }
- finally
- {
- endRecording();
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/ExtensibleAddExtensionCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/ExtensibleAddExtensionCommand.java
deleted file mode 100644
index 6ce4c73635..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/ExtensibleAddExtensionCommand.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.commands;
-
-import java.util.List;
-
-import org.eclipse.wst.xml.core.internal.contentmodel.util.NamespaceTable;
-import org.eclipse.wst.xsd.ui.internal.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.eclipse.xsd.util.XSDConstants;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-public class ExtensibleAddExtensionCommand extends AddExtensionCommand
-{
- protected XSDElementDeclaration element;
- protected Element appInfo;
- protected Element newElement;
-
- public ExtensibleAddExtensionCommand(String label)
- {
- super(label);
- }
-
- public XSDElementDeclaration getXSDElementDeclarationElement()
- {
- return element;
- }
-
- public Element getNewElement()
- {
- return newElement;
- }
-
- public Element getAppInfo()
- {
- return appInfo;
- }
-
- public XSDSchema getXSDSchema()
- {
- return component.getSchema();
- }
-
- public void setInputs(XSDConcreteComponent input, XSDElementDeclaration element)
- {
- this.component = input;
- this.element = element;
- }
-
- public XSDAnnotation getXSDAnnotation()
- {
- if (component != null)
- {
- XSDAnnotation xsdAnnotation = XSDCommonUIUtils.getInputXSDAnnotation(component, false);
- return xsdAnnotation;
- }
- return null;
- }
-
- public void execute()
- {
- try
- {
- beginRecording(component.getElement());
- super.execute();
- doPreprocessing();
- addExtensionNode();
- doCustomizedActions();
-
- formatChild(component.getElement());
- }
- finally
- {
- endRecording();
- }
- }
-
- protected void doPreprocessing()
- {
-
- }
-
- protected void addExtensionNode()
- {
- XSDAnnotation xsdAnnotation = XSDCommonUIUtils.getInputXSDAnnotation(component, true);
- XSDSchema schema= xsdAnnotation.getSchema();
- Element schemaElement = schema.getElement();
-
- if (xsdAnnotation.getApplicationInformation().size() == 0)
- {
- appInfo = xsdAnnotation.createApplicationInformation(null);
- xsdAnnotation.getElement().appendChild(appInfo);
- List appInfos = xsdAnnotation.getApplicationInformation();
- appInfos.add(appInfo);
- }
- else
- {
- // use the first appInfo
- appInfo = (Element)xsdAnnotation.getApplicationInformation().get(0);
- }
-
- if (appInfo != null)
- {
- Document doc = appInfo.getOwnerDocument();
- String prefix = addToNamespaceTable(schemaElement);
- newElement = doc.createElementNS(extensionsSchemaSpec.getNamespaceURI(), element.getName());
- newElement.setPrefix(prefix);
- appInfo.appendChild(newElement);
-
- xsdAnnotation.updateElement();
- }
- }
-
- protected String addToNamespaceTable(Element schemaElement)
- {
- String prefix = addNamespaceDeclarationIfRequired(schemaElement, "p", extensionsSchemaSpec.getNamespaceURI());
- return prefix;
- }
-
-
- protected void doCustomizedActions()
- {
-
- }
-
- public void undo()
- {
- super.undo();
- }
-
- public Object getNewObject()
- {
- return newElement;
- }
-
- // TODO... common this up with wsdl.ui
- protected String addNamespaceDeclarationIfRequired(Element schemaElement, String prefixHint, String namespace)
- {
- String prefix = null;
- NamespaceTable namespaceTable = new NamespaceTable(schemaElement.getOwnerDocument());
- namespaceTable.addElement(schemaElement);
- prefix = namespaceTable.getPrefixForURI(namespace);
- if (prefix == null)
- {
- String basePrefix = prefixHint;
- prefix = basePrefix;
- String xmlnsColon = "xmlns:"; //$NON-NLS-1$
- String attributeName = xmlnsColon + prefix;
- int count = 0;
- while (schemaElement.hasAttribute(attributeName))
- {
- count++;
- prefix = basePrefix + count;
- attributeName = xmlnsColon + prefix;
- }
- schemaElement.setAttribute(attributeName, namespace);
- }
- return prefix;
- }
-
- protected void addSchemaAttribute(Element schemaElement, String namespace, String attributeName, String attributeValue)
- {
- String prefix = null;
- NamespaceTable namespaceTable = new NamespaceTable(schemaElement.getOwnerDocument());
- namespaceTable.addElement(schemaElement);
- prefix = namespaceTable.getPrefixForURI(namespace);
- try
- {
- if (prefix != null)
- {
- if (schemaElement.getAttributeNode(prefix + ":" + attributeName) == null)
- schemaElement.setAttribute(prefix + ":" + attributeName, attributeValue);
- }
- else
- {
- if (schemaElement.getAttributeNode(attributeName) == null)
- schemaElement.setAttribute(attributeName, attributeValue);
- }
- }
- catch (Exception e)
- {
-
- }
- }
-
- protected void addSourceAttributeToAppInfo(String namespace)
- {
- if (appInfo.getAttributeNode(XSDConstants.SOURCE_ATTRIBUTE) == null)
- appInfo.setAttribute(XSDConstants.SOURCE_ATTRIBUTE, namespace);
- }
-
- /**
- *
- * @param element
- * @param attributeName
- * @param attributeValue
- */
- protected void addAttribute(Element element, String attributeName, String attributeValue)
- {
- element.setAttribute(attributeName, attributeValue);
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/ExtensibleRemoveExtensionNodeCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/ExtensibleRemoveExtensionNodeCommand.java
deleted file mode 100644
index cb5ff38f82..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/ExtensibleRemoveExtensionNodeCommand.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.commands;
-
-import org.eclipse.wst.xsd.ui.internal.util.XSDDOMHelper;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.util.XSDConstants;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Node;
-
-public class ExtensibleRemoveExtensionNodeCommand extends BaseCommand
-{
- protected Node node;
- protected XSDConcreteComponent input;
-
- public ExtensibleRemoveExtensionNodeCommand(String label)
- {
- super(label);
- }
-
- public void setNode(Node node)
- {
- this.node = node;
- }
-
- public XSDConcreteComponent getInput()
- {
- return input;
- }
-
- public void setInput(XSDConcreteComponent input)
- {
- this.input = input;
- }
-
- public void execute()
- {
- super.execute();
- try
- {
- beginRecording(node);
-
- doPreprocessing();
-
- if (node.getNodeType() == Node.ATTRIBUTE_NODE)
- {
- Attr attr = (Attr) node;
- attr.getOwnerElement().removeAttributeNode(attr);
- }
- else if (node.getNodeType() == Node.ELEMENT_NODE)
- {
- Node parent = node.getParentNode();
- if (parent != null)
- {
- XSDDOMHelper.removeNodeAndWhitespace(node);
-
- if (XSDDOMHelper.hasOnlyWhitespace(parent))
- {
- if (XSDConstants.APPINFO_ELEMENT_TAG.equals(parent.getLocalName()))
- {
- XSDDOMHelper.removeNodeAndWhitespace(parent);
- }
- }
- }
- }
-
- doCustomizedActions();
-
- }
- finally
- {
- endRecording();
- }
- }
-
- protected void doPreprocessing()
- {
-
- }
-
- protected void doCustomizedActions()
- {
-
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/RedefineAttributeGroupCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/RedefineAttributeGroupCommand.java
deleted file mode 100644
index 3d473b4e8d..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/RedefineAttributeGroupCommand.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.commands;
-
-
-import org.eclipse.xsd.XSDAttributeGroupDefinition;
-import org.eclipse.xsd.XSDFactory;
-import org.eclipse.xsd.XSDRedefinableComponent;
-import org.eclipse.xsd.XSDRedefine;
-
-
-/**
- * Creates a redefined attribute group based on the input attribute group and adds it to the parent redefine.
- */
-public class RedefineAttributeGroupCommand extends AddRedefinedComponentCommand
-{
- public RedefineAttributeGroupCommand(String label, XSDRedefine redefine, XSDRedefinableComponent redefinableComponent)
- {
- super(label, redefine, redefinableComponent);
- }
-
- protected void doExecute()
- {
- XSDAttributeGroupDefinition redefinedAttributeGroupDefinition = XSDFactory.eINSTANCE.createXSDAttributeGroupDefinition();
- redefinedAttributeGroupDefinition.setName(redefinableComponent.getName());
- addedXSDConcreteComponent = redefinedAttributeGroupDefinition;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/RedefineComplexTypeCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/RedefineComplexTypeCommand.java
deleted file mode 100644
index 34dad50c1f..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/RedefineComplexTypeCommand.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.commands;
-
-
-import org.eclipse.xsd.XSDComplexTypeDefinition;
-import org.eclipse.xsd.XSDDerivationMethod;
-import org.eclipse.xsd.XSDFactory;
-import org.eclipse.xsd.XSDRedefinableComponent;
-import org.eclipse.xsd.XSDRedefine;
-
-
-/**
- * Creates a redefined complex type based on the input complex type and adds it to the parent redefine.
- */
-public class RedefineComplexTypeCommand extends AddRedefinedComponentCommand
-{
- public RedefineComplexTypeCommand(String label, XSDRedefine redefine, XSDRedefinableComponent redefinableComponent)
- {
- super(label, redefine, redefinableComponent);
- }
-
- protected void doExecute()
- {
- XSDComplexTypeDefinition redefinedComplexTypeDefinition = XSDFactory.eINSTANCE.createXSDComplexTypeDefinition();
- redefinedComplexTypeDefinition.setName(redefinableComponent.getName());
- redefinedComplexTypeDefinition.setContent(XSDFactory.eINSTANCE.createXSDComplexTypeDefinition().getContent());
- redefinedComplexTypeDefinition.setDerivationMethod(XSDDerivationMethod.EXTENSION_LITERAL);
- redefinedComplexTypeDefinition.setBaseTypeDefinition((XSDComplexTypeDefinition)redefinableComponent);
- addedXSDConcreteComponent = redefinedComplexTypeDefinition;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/RedefineModelGroupCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/RedefineModelGroupCommand.java
deleted file mode 100644
index 7366eebefc..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/RedefineModelGroupCommand.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.commands;
-
-
-import org.eclipse.xsd.XSDModelGroupDefinition;
-import org.eclipse.xsd.XSDRedefinableComponent;
-import org.eclipse.xsd.XSDRedefine;
-
-
-/**
- * Creates a redefined model group based on the input model group and adds it to the parent redefine.
- */
-public class RedefineModelGroupCommand extends AddRedefinedComponentCommand
-{
-
- public RedefineModelGroupCommand(String label, XSDRedefine redefine, XSDRedefinableComponent redefinableComponent)
- {
- super(label, redefine, redefinableComponent);
- }
-
- protected void doExecute()
- {
- XSDModelGroupDefinition modelGroup = (XSDModelGroupDefinition) redefinableComponent;
- XSDModelGroupDefinition redefinedModelGroupDefinition = (XSDModelGroupDefinition)modelGroup.cloneConcreteComponent(true, false);
- addedXSDConcreteComponent = redefinedModelGroupDefinition;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/RedefineSimpleTypeCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/RedefineSimpleTypeCommand.java
deleted file mode 100644
index 00765ae3d1..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/RedefineSimpleTypeCommand.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.wst.xsd.ui.internal.common.commands;
-
-
-import org.eclipse.xsd.XSDFactory;
-import org.eclipse.xsd.XSDRedefinableComponent;
-import org.eclipse.xsd.XSDRedefine;
-import org.eclipse.xsd.XSDSimpleTypeDefinition;
-
-
-/**
- * Creates a redefined simple type based on the input simple type and adds it to the parent redefine.
- */
-public class RedefineSimpleTypeCommand extends AddRedefinedComponentCommand
-{
- public RedefineSimpleTypeCommand(String label, XSDRedefine redefine, XSDRedefinableComponent redefinableComponent)
- {
- super(label, redefine, redefinableComponent);
- }
-
- protected void doExecute()
- {
- XSDSimpleTypeDefinition redefinedSimpleTypeDefinition = XSDFactory.eINSTANCE.createXSDSimpleTypeDefinition();
- redefinedSimpleTypeDefinition.setName(redefinableComponent.getName());
- redefinedSimpleTypeDefinition.setBaseTypeDefinition((XSDSimpleTypeDefinition)redefinableComponent);
- addedXSDConcreteComponent = redefinedSimpleTypeDefinition;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/RemoveExtensionAttributerCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/RemoveExtensionAttributerCommand.java
deleted file mode 100644
index a173a43def..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/RemoveExtensionAttributerCommand.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * 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.internal.common.commands;
-
-import org.eclipse.gef.commands.Command;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Element;
-
-/**
- * @deprecated
- */
-public class RemoveExtensionAttributerCommand extends Command
-{
- Element hostElement;
- Attr attr;
-
- public RemoveExtensionAttributerCommand(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/internal/common/commands/RemoveExtensionElementCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/RemoveExtensionElementCommand.java
deleted file mode 100644
index d33c756093..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/RemoveExtensionElementCommand.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * 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.internal.common.commands;
-
-import org.eclipse.gef.commands.Command;
-import org.eclipse.xsd.XSDAnnotation;
-import org.w3c.dom.Node;
-
-/**
- * @deprecated
- */
-public class RemoveExtensionElementCommand extends Command
-{
- XSDAnnotation xsdAnnotation;
- Node appInfo;
-
- public RemoveExtensionElementCommand(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/internal/common/commands/RemoveExtensionNodeCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/RemoveExtensionNodeCommand.java
deleted file mode 100644
index e41166b976..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/RemoveExtensionNodeCommand.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.commands;
-
-import org.eclipse.wst.xsd.ui.internal.util.XSDDOMHelper;
-import org.eclipse.xsd.util.XSDConstants;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Node;
-
-public class RemoveExtensionNodeCommand extends BaseCommand
-{
- Node node;
-
- public RemoveExtensionNodeCommand(String label, Node node)
- {
- super(label);
- this.node = node;
- }
-
- public void execute()
- {
- super.execute();
- try
- {
- beginRecording(node);
- if (node.getNodeType() == Node.ATTRIBUTE_NODE)
- {
- Attr attr = (Attr) node;
- attr.getOwnerElement().removeAttributeNode(attr);
- }
- else if (node.getNodeType() == Node.ELEMENT_NODE)
- {
- Node parent = node.getParentNode();
- if (parent != null)
- {
- XSDDOMHelper.removeNodeAndWhitespace(node);
-
- if (XSDDOMHelper.hasOnlyWhitespace(parent))
- {
- if (XSDConstants.APPINFO_ELEMENT_TAG.equals(parent.getLocalName()))
- {
- XSDDOMHelper.removeNodeAndWhitespace(parent);
- }
- }
- }
- }
- }
- finally
- {
- endRecording();
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/SetBaseTypeAndManagerDirectivesCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/SetBaseTypeAndManagerDirectivesCommand.java
deleted file mode 100644
index 1ec47ce5a6..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/SetBaseTypeAndManagerDirectivesCommand.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.commands;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.wst.xsd.ui.internal.common.util.XSDDirectivesManager;
-import org.eclipse.xsd.XSDComponent;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDTypeDefinition;
-
-public class SetBaseTypeAndManagerDirectivesCommand extends UpdateTypeReferenceAndManageDirectivesCommand
-{
-
- public SetBaseTypeAndManagerDirectivesCommand(XSDConcreteComponent concreteComponent, String componentName, String componentNamespace, IFile file)
- {
- super(concreteComponent, componentName, componentNamespace, file);
- }
-
- public void execute()
- {
- try
- {
- beginRecording(concreteComponent.getElement());
- XSDComponent td = computeComponent();
- if (td != null && td instanceof XSDTypeDefinition)
- {
- SetBaseTypeCommand command = new SetBaseTypeCommand(concreteComponent, (XSDTypeDefinition) td);
- command.execute();
- XSDDirectivesManager.removeUnusedXSDImports(concreteComponent.getSchema());
- }
- }
- catch (Exception e)
- {
-
- }
- finally
- {
- endRecording();
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/SetBaseTypeCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/SetBaseTypeCommand.java
deleted file mode 100644
index 7b74ec92a2..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/SetBaseTypeCommand.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.commands;
-
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter;
-import org.eclipse.wst.xsd.ui.internal.common.util.Messages;
-import org.eclipse.xsd.XSDComplexTypeContent;
-import org.eclipse.xsd.XSDComplexTypeDefinition;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDDerivationMethod;
-import org.eclipse.xsd.XSDFactory;
-import org.eclipse.xsd.XSDSimpleTypeDefinition;
-import org.eclipse.xsd.XSDTypeDefinition;
-import org.eclipse.xsd.XSDVariety;
-
-public class SetBaseTypeCommand extends BaseCommand
-{
- XSDConcreteComponent concreteComponent;
- XSDTypeDefinition baseType;
- XSDBaseAdapter adapter;
-
-
- public SetBaseTypeCommand(XSDConcreteComponent concreteComponent, XSDTypeDefinition baseType)
- {
- super(Messages._UI_ACTION_SET_BASE_TYPE);
- this.concreteComponent = concreteComponent;
- this.baseType = baseType;
- }
-
- public void execute()
- {
- try
- {
- beginRecording(concreteComponent.getElement());
- if (concreteComponent instanceof XSDComplexTypeDefinition)
- {
- XSDComplexTypeDefinition complexType = (XSDComplexTypeDefinition) concreteComponent;
- XSDComplexTypeContent contentType = (baseType instanceof XSDComplexTypeDefinition) ? ((XSDComplexTypeDefinition)baseType).getContentType() : null;
-
- // Complex type simple content
- if (baseType instanceof XSDSimpleTypeDefinition || (contentType != null && contentType instanceof XSDSimpleTypeDefinition))
- {
- if (!(complexType.getContent() instanceof XSDSimpleTypeDefinition))
- {
- XSDSimpleTypeDefinition simpleContent = XSDFactory.eINSTANCE.createXSDSimpleTypeDefinition();
- complexType.setContent(simpleContent);
- }
- }
- // Complex type complex content
- else if(baseType instanceof XSDComplexTypeDefinition)
- {
- if(!(complexType.getContent() instanceof XSDComplexTypeDefinition))
- {
- XSDComplexTypeDefinition complexContent = XSDFactory.eINSTANCE.createXSDComplexTypeDefinition();
- complexType.setContent(complexContent.getContent());
- }
- }
- complexType.setDerivationMethod(XSDDerivationMethod.EXTENSION_LITERAL);
- complexType.setBaseTypeDefinition(baseType);
- // vb This call should not be needed. The XSD Infoset model should reconcile itself properly.
- complexType.updateElement(true);
- formatChild(complexType.getElement());
- }
- else if (concreteComponent instanceof XSDSimpleTypeDefinition)
- {
- XSDSimpleTypeDefinition simpleType = (XSDSimpleTypeDefinition) concreteComponent;
- if (baseType instanceof XSDSimpleTypeDefinition)
- {
- XSDVariety variety = simpleType.getVariety();
- if (variety.getValue() == XSDVariety.ATOMIC)
- {
- simpleType.setBaseTypeDefinition((XSDSimpleTypeDefinition) baseType);
- }
- else if (variety.getValue() == XSDVariety.UNION)
- {
- simpleType.getMemberTypeDefinitions().add(baseType);
- }
- else if (variety.getValue() == XSDVariety.LIST)
- {
- simpleType.setItemTypeDefinition((XSDSimpleTypeDefinition) baseType);
- }
- }
- }
- }
- finally
- {
- endRecording();
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/SetMultiplicityCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/SetMultiplicityCommand.java
deleted file mode 100644
index 1679feca03..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/SetMultiplicityCommand.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * 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.internal.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()
- {
- try
- {
- beginRecording(parent.getElement());
- 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);
- }
- }
- finally
- {
- endRecording();
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/SetTypeCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/SetTypeCommand.java
deleted file mode 100644
index da4cb49c22..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/SetTypeCommand.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*******************************************************************************
- * 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.internal.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.ui.internal.adapters.XSDBaseAdapter;
-import org.eclipse.wst.xsd.ui.internal.adt.edit.ComponentReferenceEditManager;
-import org.eclipse.wst.xsd.ui.internal.adt.edit.IComponentDialog;
-import org.eclipse.wst.xsd.ui.internal.common.actions.SetTypeAction;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDTypeReferenceEditManager;
-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()
- {
- try
- {
- beginRecording(parent.getElement());
- 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());
- }
- }
- finally
- {
- endRecording();
- }
- }
-
- 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(XSDTypeReferenceEditManager.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/internal/common/commands/SetXSDFacetValueCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/SetXSDFacetValueCommand.java
deleted file mode 100644
index 45c6884bb7..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/SetXSDFacetValueCommand.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.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 SetXSDFacetValueCommand(String label, XSDFacet facet, String value)
- {
- super(label);
- this.facet = facet;
- this.value = value;
- }
-
- public void setValue(String value)
- {
- this.value = value;
- }
-
- public void execute()
- {
- try
- {
- beginRecording(facet.getElement());
- facet.setLexicalValue(value);
- }
- finally
- {
- endRecording();
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateAttributeReferenceAndManagerDirectivesCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateAttributeReferenceAndManagerDirectivesCommand.java
deleted file mode 100644
index 7d38b4cb5c..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateAttributeReferenceAndManagerDirectivesCommand.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.commands;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.wst.xsd.ui.internal.common.util.XSDDirectivesManager;
-import org.eclipse.xsd.XSDAttributeDeclaration;
-import org.eclipse.xsd.XSDComponent;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDSchema;
-
-public class UpdateAttributeReferenceAndManagerDirectivesCommand extends UpdateComponentReferenceAndManageDirectivesCommand
-{
-
- public UpdateAttributeReferenceAndManagerDirectivesCommand(XSDConcreteComponent concreteComponent, String componentName, String componentNamespace, IFile file)
- {
- super(concreteComponent, componentName, componentNamespace, file);
- }
-
- protected XSDComponent getDefinedComponent(XSDSchema schema, String componentName, String componentNamespace)
- {
- XSDAttributeDeclaration result = schema.resolveAttributeDeclaration(componentNamespace, componentName);
- if (result.eContainer() == null)
- {
- result = null;
- }
- return result;
- }
-
- public void execute()
- {
- try
- {
- beginRecording(concreteComponent.getElement());
- XSDComponent componentDef = computeComponent();
- if (componentDef != null)
- {
- UpdateAttributeReferenceCommand command = new UpdateAttributeReferenceCommand(org.eclipse.wst.xsd.ui.internal.editor.Messages._UI_ACTION_UPDATE_ATTRIBUTE_REFERENCE, (XSDAttributeDeclaration) concreteComponent,
- (XSDAttributeDeclaration) componentDef);
- command.execute();
- XSDDirectivesManager.removeUnusedXSDImports(concreteComponent.getSchema());
- }
- }
- catch (Exception e)
- {
- }
- finally
- {
- endRecording();
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateAttributeReferenceCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateAttributeReferenceCommand.java
deleted file mode 100644
index 6af63752d3..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateAttributeReferenceCommand.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.commands;
-
-import org.eclipse.xsd.XSDAttributeDeclaration;
-
-public class UpdateAttributeReferenceCommand extends BaseCommand
-{
- XSDAttributeDeclaration attribute, ref;
-
- public UpdateAttributeReferenceCommand(String label, XSDAttributeDeclaration attribute, XSDAttributeDeclaration ref)
- {
- super(label);
- this.attribute = attribute;
- this.ref = ref;
- }
-
- public void execute()
- {
- try
- {
- beginRecording(attribute.getElement());
- attribute.setResolvedAttributeDeclaration(ref);
- }
- finally
- {
- endRecording();
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateAttributeValueCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateAttributeValueCommand.java
deleted file mode 100644
index b76f241939..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateAttributeValueCommand.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.commands;
-
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.xsd.ui.internal.common.util.Messages;
-import org.w3c.dom.Element;
-
-/*
- * This command is used from the extension view to edit extension elements
- * and attributes which are implemented as DOM objects (not part of the EMF model)
- *
- * (trung) also used in XSDComplexTypeAdvancedSection to change attribute of
- * specical attributes like block, restriction which is not part of EMF Model
- */
-public class UpdateAttributeValueCommand extends BaseCommand
-{
- protected Element element;
- protected String attributeName;
- protected String attributeValue;
-
- /** Whether the attribute should be deleted if value to
- * be set is an empty String or null */
- protected boolean deleteIfValueEmpty = false;
-
- public UpdateAttributeValueCommand(Element element, String attributeName, String attributeValue, boolean deleteIfValueEmpty)
- {
- this.element = element;
- this.attributeName = attributeName;
- this.attributeValue = attributeValue;
- this.deleteIfValueEmpty = deleteIfValueEmpty;
- }
-
- public UpdateAttributeValueCommand(Element element, String attributeName, String attributeValue, String label)
- {
- this(element, attributeName, attributeValue, false);
-
- // The command label is shared with the actual UI label, which contains
- // mnemonics and colon characters. Since we don't want these to show up in
- // the undo menu we do a little bit of regular expression magic here to remove them.
-
- setLabel(NLS.bind(Messages._UI_ACTION_CHANGE, label.replaceAll("[&:]", "")));
- }
-
- public UpdateAttributeValueCommand(Element element, String attributeName, String attributeValue)
- {
- this(element, attributeName, attributeValue, false);
- setLabel(NLS.bind(Messages._UI_ACTION_CHANGE, attributeName));
- }
-
- public void setDeleteIfEmpty(boolean v)
- {
- deleteIfValueEmpty = v;
- }
-
- public void setAttributeName(String attributeName)
- {
- this.attributeName = attributeName;
- }
-
- public void execute()
- {
- try
- {
- beginRecording(element);
- if (deleteIfValueEmpty &&
- (attributeValue == null || attributeValue.equals("") ) )
- {
- element.removeAttribute(attributeName);
- }
- else
- {
- element.setAttribute(attributeName, attributeValue);
- }
-
- doPostProcessing();
- }
- finally
- {
- endRecording();
- }
- }
-
- protected void doPostProcessing()
- {
-
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateComplexTypeDerivationBy.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateComplexTypeDerivationBy.java
deleted file mode 100644
index facae6a3d3..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateComplexTypeDerivationBy.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.commands;
-
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-import org.eclipse.xsd.XSDComplexTypeDefinition;
-import org.eclipse.xsd.XSDDerivationMethod;
-import org.eclipse.xsd.XSDTypeDefinition;
-import org.eclipse.xsd.util.XSDConstants;
-
-public class UpdateComplexTypeDerivationBy extends BaseCommand
-{
- private XSDComplexTypeDefinition complexType;
- private String derivation;
-
- public UpdateComplexTypeDerivationBy(XSDComplexTypeDefinition complexType, String derivation)
- {
- this.complexType = complexType;
- this.derivation = derivation;
- // TODO: use new Message bundle mechanism
- setLabel(XSDEditorPlugin.getXSDString("_UI_DERIVEDBY_CHANGE"));
- }
-
- public void execute()
- {
- super.execute();
- try
- {
- beginRecording(complexType.getElement());
- XSDTypeDefinition originalBaseType = complexType.getBaseType();
- if (derivation.equals(XSDConstants.EXTENSION_ELEMENT_TAG))
- {
- complexType.setDerivationMethod(XSDDerivationMethod.EXTENSION_LITERAL);
- }
- else if (derivation.equals(XSDConstants.RESTRICTION_ELEMENT_TAG))
- {
- complexType.setDerivationMethod(XSDDerivationMethod.RESTRICTION_LITERAL);
- }
- complexType.setBaseTypeDefinition(originalBaseType);
- }
- finally
- {
- endRecording();
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateComponentReferenceAndManageDirectivesCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateComponentReferenceAndManageDirectivesCommand.java
deleted file mode 100644
index 9a23f365bc..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateComponentReferenceAndManageDirectivesCommand.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.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.util.XSDResourceImpl;
-public abstract class UpdateComponentReferenceAndManageDirectivesCommand extends BaseCommand
-{
- 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 XSDComponent computeComponent()
- {
- XSDComponent result = null;
- XSDSchema schema = concreteComponent.getSchema();
- XSDSchemaDirective directive = 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 != null && componentNamespace.equals(schema.getTargetNamespace()))
- {
- // we need to add an include
- // if the component's namespace is not null and matches the schema's
- // target namespace
- directive = XSDFactory.eINSTANCE.createXSDInclude();
- }
- else if (componentNamespace == null)
- {
- // we need to add an include
- // if the component's namespace is null, then we can just add it
- // only if the current namespace is not null
- directive = XSDFactory.eINSTANCE.createXSDInclude();
-
- // we have to ensure the schema for schema prefix is NOT null
- if (schema.getSchemaForSchemaQNamePrefix() == null)
- {
- String targetNS = schema.getTargetNamespace();
- if (targetNS == null)
- targetNS = "";
- // this will just update the schema for schema prefix to be, say, xsd
- UpdateNamespaceInformationCommand command = new UpdateNamespaceInformationCommand("", schema, "", targetNS);
- command.execute();
- }
- }
- else
- {
- // we need to add an import
- XSDImport xsdImport = XSDFactory.eINSTANCE.createXSDImport();
- xsdImport.setNamespace(componentNamespace);
- directive = xsdImport;
- }
-
- String location = computeNiceLocation(schema.getSchemaLocation(), file);
- directive.setSchemaLocation(location);
- // 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)
- {
- String platformLocation = "platform:/resource" + file.getFullPath();
- Resource resource = concreteComponent.eResource().getResourceSet().createResource(URI.createURI(platformLocation));
- if (resource instanceof XSDResourceImpl)
- {
- try
- {
- resource.load(null);
- XSDResourceImpl resourceImpl = (XSDResourceImpl) resource;
- resolvedSchema = resourceImpl.getSchema();
- if (resolvedSchema != null)
- {
- 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 final static String PLATFORM_RESOURCE_PREFIX = "platform:/resource";
- private String computeNiceLocation(String baseLocation, IFile file)
- {
- if (baseLocation.startsWith(PLATFORM_RESOURCE_PREFIX))
- {
- URI baseURI = URI.createURI(baseLocation);
- URI fileURI = URI.createPlatformResourceURI(file.getFullPath().toString());
- URI relative = fileURI.deresolve(baseURI, false, true, true);
- return relative.toString();
- }
- else
- {
- URI baseURI = URI.createURI(baseLocation);
- URI fileURI = URI.createFileURI(file.getLocation().toOSString());
- URI relative = fileURI.deresolve(baseURI, false, true, true);
- return relative.toString();
- }
- }
-
- protected abstract XSDComponent getDefinedComponent(XSDSchema schema, String componentName, String componentNamespace);
-
- public abstract void execute();
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateContentModelCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateContentModelCommand.java
deleted file mode 100644
index 87a560efbb..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateContentModelCommand.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * 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.internal.common.commands;
-
-import org.eclipse.xsd.XSDCompositor;
-import org.eclipse.xsd.XSDModelGroup;
-
-public class UpdateContentModelCommand extends BaseCommand
-{
- 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()
- {
- try
- {
- super.execute();
- beginRecording(xsdModelGroup.getElement());
- xsdModelGroup.setCompositor(newXSDCompositor);
- }
- finally
- {
- endRecording();
- }
- }
-
- public void undo()
- {
- xsdModelGroup.setCompositor(oldXSDCompositor);
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateElementReferenceAndManageDirectivesCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateElementReferenceAndManageDirectivesCommand.java
deleted file mode 100644
index b8aeb47443..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateElementReferenceAndManageDirectivesCommand.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.commands;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.wst.xsd.ui.internal.common.util.Messages;
-import org.eclipse.wst.xsd.ui.internal.common.util.XSDDirectivesManager;
-import org.eclipse.xsd.XSDComponent;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDElementDeclaration;
-import org.eclipse.xsd.XSDSchema;
-
-public class UpdateElementReferenceAndManageDirectivesCommand extends UpdateComponentReferenceAndManageDirectivesCommand
-{
- public UpdateElementReferenceAndManageDirectivesCommand(XSDConcreteComponent concreteComponent, String componentName, String componentNamespace, IFile file)
- {
- super(concreteComponent, componentName, componentNamespace, file);
- }
-
- protected XSDComponent 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
- {
- beginRecording(concreteComponent.getElement());
- XSDComponent elementDef = computeComponent();
- if (elementDef != null)
- {
- UpdateElementReferenceCommand command = new UpdateElementReferenceCommand(Messages._UI_ACTION_UPDATE_ELEMENT_REFERENCE, (XSDElementDeclaration) concreteComponent,
- (XSDElementDeclaration) elementDef);
- command.execute();
- XSDDirectivesManager.removeUnusedXSDImports(concreteComponent.getSchema());
- }
- }
- catch (Exception e)
- {
- }
- finally
- {
- endRecording();
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateElementReferenceCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateElementReferenceCommand.java
deleted file mode 100644
index d4b52781f4..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateElementReferenceCommand.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * 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.internal.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()
- {
- try
- {
- beginRecording(element.getElement());
- element.setResolvedElementDeclaration(ref);
- }
- finally
- {
- endRecording();
- }
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateMaxOccursCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateMaxOccursCommand.java
deleted file mode 100644
index d159eb17a9..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateMaxOccursCommand.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.commands;
-
-import org.eclipse.xsd.XSDParticle;
-import org.eclipse.xsd.util.XSDConstants;
-import org.w3c.dom.Element;
-
-public class UpdateMaxOccursCommand extends BaseCommand
-{
- 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()
- {
- try
- {
- Element element = particle.getElement();
- beginRecording(element);
- removeMaxOccursAttribute = (!(element.hasAttribute(XSDConstants.MAXOCCURS_ATTRIBUTE)))? true: false;
- oldMaxOccurs = particle.getMaxOccurs();
- particle.setMaxOccurs(newMaxOccurs);
- }
- finally
- {
- endRecording();
- }
- }
-
- 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/internal/common/commands/UpdateMinOccursCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateMinOccursCommand.java
deleted file mode 100644
index 5e317665a6..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateMinOccursCommand.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.commands;
-
-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 BaseCommand
-{
- 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();
- try
- {
- beginRecording(element);
- removeMinOccursAttribute = (!(element.hasAttribute(XSDConstants.MINOCCURS_ATTRIBUTE))) ? 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);
- }
- }
- finally
- {
- endRecording();
- }
- }
-
- 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/internal/common/commands/UpdateNameCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateNameCommand.java
deleted file mode 100644
index 730a7c2790..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateNameCommand.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.commands;
-
-import org.eclipse.ltk.core.refactoring.participants.RenameRefactoring;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.part.FileEditorInput;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
-import org.eclipse.wst.xsd.ui.internal.refactor.PerformUnsavedRefactoringOperation;
-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.xsd.XSDComplexTypeDefinition;
-import org.eclipse.xsd.XSDNamedComponent;
-import org.eclipse.xsd.XSDSchema;
-
-public class UpdateNameCommand extends BaseCommand
-{
-// 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()
- {
- try
- {
- beginRecording(component.getElement());
- renameComponent(newName);
- }
- finally
- {
- endRecording();
- }
- }
-
- /**
- * Performs a rename refactoring to rename the component and all the
- * references to it within the current schema.
- *
- * @param newName the new component name.
- */
- private void renameComponent(String newName)
- {
- // this is a 'globally' defined component (e.g. global element)
- if (component.eContainer() instanceof XSDSchema)
- {
- IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (workbenchWindow != null)
- {
- IWorkbenchPage page = workbenchWindow.getActivePage();
- if (page != null)
- {
- IEditorInput editorInput = page.getActiveEditor().getEditorInput();
- if (editorInput instanceof FileEditorInput)
- {
- RefactoringComponent refactoringComponent = new XMLRefactoringComponent(
- component,
- (IDOMElement)component.getElement(),
- component.getName(),
- component.getTargetNamespace());
-
- RenameComponentProcessor processor = new RenameComponentProcessor(refactoringComponent, newName, true);
- RenameRefactoring refactoring = new RenameRefactoring(processor);
- PerformUnsavedRefactoringOperation operation = new PerformUnsavedRefactoringOperation(refactoring);
- operation.run(null);
- }
- else
- {
- // We can't refactor rename external files
- component.setName(newName);
- }
- }
- }
- }
- else
- {
- // this is a 'locally' defined component (e.g. local element)
- // no need to call refactoring since this component can't be referenced
- component.setName(newName);
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateNamespaceInformationCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateNamespaceInformationCommand.java
deleted file mode 100644
index 35efdd6740..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateNamespaceInformationCommand.java
+++ /dev/null
@@ -1,298 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.commands;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.apache.xerces.util.XMLChar;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-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.XSDSchema;
-import org.eclipse.xsd.util.XSDConstants;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-public class UpdateNamespaceInformationCommand extends BaseCommand
-{
- protected XSDSchema xsdSchema;
- protected String newPrefix, newTargetNamespace;
-
- public UpdateNamespaceInformationCommand(String label, XSDSchema xsdSchema, String newPrefix, String newTargetNamespace)
- {
- super(label);
- this.xsdSchema = xsdSchema;
- this.newPrefix = newPrefix;
- this.newTargetNamespace = newTargetNamespace;
- }
-
- public void execute()
- {
- ensureSchemaElement(xsdSchema);
-
- Element element = xsdSchema.getElement();
- try
- {
- //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$
- beginRecording(element);
-
- String xsdForXSDPrefix = xsdSchema.getSchemaForSchemaQNamePrefix();
- Map map = xsdSchema.getQNamePrefixToNamespaceMap();
-
- // 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.hasAttribute("xmlns") && //$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.hasAttribute("xmlns")) //$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);
- }
- }
-
- // do our own referential integrity
- TargetNamespaceChangeHandler targetNamespaceChangeHandler = new TargetNamespaceChangeHandler(xsdSchema, oldNamespace, targetNamespace);
- targetNamespaceChangeHandler.resolve();
-
- updateElement(xsdSchema);
-
- //doc.getModel().endRecording(this);
- }
- finally
- {
- endRecording();
- }
- }
-
-
- // 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("")) //$NON-NLS-1$
- {
- 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;
- }
-
- protected boolean validatePrefix(String prefix)
- {
- if (prefix != null && prefix.equals("")) return true;
- return XMLChar.isValidNCName(prefix);
- }
-
- public void redo()
- {
- execute();
- }
-
- public void undo()
- {
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateNumericBoundsFacetCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateNumericBoundsFacetCommand.java
deleted file mode 100644
index 0f5cea91e8..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateNumericBoundsFacetCommand.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*******************************************************************************
- * 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.internal.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()
- {
- try
- {
- beginRecording(xsdSimpleType.getElement());
-
- 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());
- }
- finally
- {
- endRecording();
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateStringLengthFacetCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateStringLengthFacetCommand.java
deleted file mode 100644
index b5e78e9280..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateStringLengthFacetCommand.java
+++ /dev/null
@@ -1,230 +0,0 @@
-/*******************************************************************************
- * 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.internal.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()
- {
- try
- {
- beginRecording(xsdSimpleType.getElement());
- 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());
- }
- finally
- {
- endRecording();
- }
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateTextValueCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateTextValueCommand.java
deleted file mode 100644
index 66636465db..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateTextValueCommand.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * 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.internal.common.commands;
-
-import org.eclipse.wst.xml.ui.internal.tabletree.TreeContentHelper;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-/*
- * This command is used from the extension view to edit extension elements
- * and which are implemented as DOM objects (not part of the EMF model)
- */
-public class UpdateTextValueCommand extends BaseCommand
-{
- Element element;
- String value;
-
- public UpdateTextValueCommand(Element element, String value)
- {
- this.element = element;
- this.value = value;
- }
-
-
- public void execute()
- {
- try
- {
- beginRecording(element);
- Node textNode = null;
- TreeContentHelper helper = new TreeContentHelper();
- for (Node node = element.getFirstChild(); node != null; node = node.getNextSibling())
- {
- if (node.getNodeType() == Node.TEXT_NODE &&
- !helper.isIgnorableText(node))
- {
- textNode = node;
- break;
- }
- }
- if (textNode == null)
- {
- textNode = element.getOwnerDocument().createTextNode("");
- element.appendChild(textNode);
- }
- helper.setNodeValue(textNode, value);
- }
- finally
- {
- endRecording();
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateTypeReferenceAndManageDirectivesCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateTypeReferenceAndManageDirectivesCommand.java
deleted file mode 100644
index 0ed77b38da..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateTypeReferenceAndManageDirectivesCommand.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.commands;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.wst.xsd.ui.internal.common.util.XSDDirectivesManager;
-import org.eclipse.xsd.XSDComponent;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.XSDTypeDefinition;
-
-public class UpdateTypeReferenceAndManageDirectivesCommand extends UpdateComponentReferenceAndManageDirectivesCommand
-{
-
- public UpdateTypeReferenceAndManageDirectivesCommand(XSDConcreteComponent concreteComponent,
- String componentName, String componentNamespace, IFile file)
- {
- super(concreteComponent, componentName, componentNamespace, file);
- }
-
-
- protected XSDComponent 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
- {
- beginRecording(concreteComponent.getElement());
- XSDComponent td = computeComponent();
- if (td != null && td instanceof XSDTypeDefinition)
- {
- UpdateTypeReferenceCommand command = new UpdateTypeReferenceCommand(concreteComponent, (XSDTypeDefinition) td);
- command.execute();
- XSDDirectivesManager.removeUnusedXSDImports(concreteComponent.getSchema());
- }
- }
- catch (Exception e)
- {
- }
- finally
- {
- endRecording();
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateTypeReferenceCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateTypeReferenceCommand.java
deleted file mode 100644
index cda106c5bb..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateTypeReferenceCommand.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*******************************************************************************
- * 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.internal.common.commands;
-
-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 BaseCommand
-{
- XSDConcreteComponent concreteComponent;
- XSDTypeDefinition newType;
-
- public UpdateTypeReferenceCommand(XSDConcreteComponent concreteComponent, XSDTypeDefinition newType)
- {
- this.concreteComponent = concreteComponent;
- this.newType = newType;
- }
-
- public void execute()
- {
- try
- {
- beginRecording(concreteComponent.getElement());
-
- if (concreteComponent instanceof XSDElementDeclaration)
- {
- setElementType((XSDElementDeclaration) concreteComponent);
- }
- else if (concreteComponent instanceof XSDAttributeUse)
- {
- setAttributeType((XSDAttributeUse) concreteComponent);
- }
- else if (concreteComponent instanceof XSDAttributeDeclaration)
- {
- setAttributeType((XSDAttributeDeclaration) concreteComponent);
- }
- }
- finally
- {
- endRecording();
- }
- }
-
- 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/internal/common/commands/UpdateXSDPatternFacetCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateXSDPatternFacetCommand.java
deleted file mode 100644
index 3d1b6adc1d..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateXSDPatternFacetCommand.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * 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.internal.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()
- {
- try
- {
- beginRecording(xsdSimpleTypeDefinition.getElement());
- 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());
- }
- finally
- {
- endRecording();
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateXSDWhiteSpaceFacetCommand.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateXSDWhiteSpaceFacetCommand.java
deleted file mode 100644
index bd92c3fab8..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/commands/UpdateXSDWhiteSpaceFacetCommand.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * 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.internal.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()
- {
- try
- {
- beginRecording(xsdSimpleTypeDefinition.getElement());
- 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());
- }
- finally
- {
- endRecording();
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/providers/XSDSectionLabelProvider.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/providers/XSDSectionLabelProvider.java
deleted file mode 100644
index 321e5f8837..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/providers/XSDSectionLabelProvider.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.providers;
-
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.ide.FileStoreEditorInput;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDAdapterFactory;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter;
-import org.eclipse.wst.xsd.ui.internal.adt.outline.ITreeElement;
-import org.eclipse.wst.xsd.ui.internal.editor.Messages;
-import org.eclipse.xsd.XSDAttributeDeclaration;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDElementDeclaration;
-import org.eclipse.xsd.XSDModelGroupDefinition;
-import org.eclipse.xsd.XSDNamedComponent;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.util.XSDConstants;
-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);
- 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 org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_LABEL_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(" ref");//$NON-NLS-1$
- // This string is not easily translatable to other languages.
- // For now, make it english-only since we use the element tag as the title anyway
-// sb.append(Messages.UI_PAGE_HEADING_REFERENCE);
- }
-
- IWorkbench workbench = PlatformUI.getWorkbench();
- IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
- if (workbenchWindow != null)
- {
- IWorkbenchPage page = workbenchWindow.getActivePage();
- if (page != null)
- {
- IEditorPart editorPart = page.getActiveEditor();
- XSDSchema xsdSchema = ((XSDConcreteComponent) selected).getSchema();
- IEditorInput editorInput = editorPart.getEditorInput();
- boolean isReadOnly = false;
- if (!(editorInput instanceof IFileEditorInput || editorInput instanceof FileStoreEditorInput))
- {
- isReadOnly = true;
- }
- if (editorPart != null && xsdSchema != editorPart.getAdapter(XSDSchema.class) || isReadOnly)
- {
- sb.append(" (" + Messages.UI_LABEL_READ_ONLY + ")"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- }
- return sb.toString();
- }
- else
- {
- // If the element is null, then let's use the model object to find
- // an appropriate name
- if ((XSDConcreteComponent) selected instanceof XSDNamedComponent)
- {
- return ((XSDNamedComponent)selected).getName();
- }
- else if ((XSDConcreteComponent) selected instanceof XSDSchema)
- {
- return XSDConstants.SCHEMA_ELEMENT_TAG;
- }
- // last resort....
- return "(" + Messages.UI_LABEL_READ_ONLY + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- if (object instanceof Element)
- {
- return ((Element) object).getLocalName();
- }
- }
-
- return result;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/AbstractExtensionsSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/AbstractExtensionsSection.java
deleted file mode 100644
index c0705c64ac..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/AbstractExtensionsSection.java
+++ /dev/null
@@ -1,615 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections;
-
-import java.util.List;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-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.jface.window.Window;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.SashForm;
-import org.eclipse.swt.custom.ScrolledComposite;
-import org.eclipse.swt.events.MouseTrackAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-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.Tree;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.forms.widgets.ExpandableComposite;
-import org.eclipse.ui.forms.widgets.Section;
-import org.eclipse.ui.views.properties.PropertySheet;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
-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.common.commands.AddExtensionCommand;
-import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.AddExtensionsComponentDialog;
-import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.DOMExtensionDetailsContentProvider;
-import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.DOMExtensionItemMenuListener;
-import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.ExtensionDetailsViewer;
-import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.ExtensionsSchemasRegistry;
-import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.SpecificationForExtensionsSchema;
-import org.eclipse.wst.xsd.ui.internal.common.util.Messages;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorCSHelpIds;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-public abstract class AbstractExtensionsSection extends AbstractSection
-{
- protected ExtensionDetailsViewer extensionDetailsViewer;
- protected TreeViewer extensionTreeViewer;
- protected ITreeContentProvider extensionTreeContentProvider;
- protected ILabelProvider extensionTreeLabelProvider;
- protected Label contentLabel;
- protected ISelectionChangedListener elementSelectionChangedListener;
- protected IDocumentChangedNotifier documentChangeNotifier;
- protected INodeAdapter internalNodeAdapter = new InternalNodeAdapter();
-
- private Composite page;
- protected Button addButton, removeButton;
- private Object prevInput;
- private SpecificationForExtensionsSchema prevCategory;
-
- /**
- *
- */
- public AbstractExtensionsSection()
- {
- super();
- }
-
- public void setInput(IWorkbenchPart part, ISelection selection)
- {
- super.setInput(part, selection);
- extensionDetailsViewer.setCommandStack(getCommandStack());
- }
-
- class InternalNodeAdapter implements INodeAdapter
- {
-
- public boolean isAdapterForType(Object type)
- {
- // this method should never be called
- // we don't use objects of this class as 'standard' adapters
- return true;
- }
-
- public void notifyChanged(INodeNotifier notifier, int eventType, Object changedFeature, Object oldValue, Object newValue, int pos)
- {
- boolean isRoot = false;
- if (notifier instanceof Element)
- {
- if (isTreeViewerInputElement((Element)notifier))// TODO
- {
- isRoot = true;
- extensionTreeViewer.refresh(extensionTreeViewer.getInput());
- }
- }
- if (!isRoot)
- {
- extensionTreeViewer.refresh(notifier);
- if ( newValue instanceof Element)
- {
- extensionTreeViewer.expandToLevel(notifier, 1);
- extensionTreeViewer.setSelection(new StructuredSelection(newValue));
- }
- }
- }
- }
-
- protected boolean isTreeViewerInputElement(Element element)
- {
- return false;
- }
-
- public void createContents(Composite parent)
- {
- // TODO (cs) add assertion
- if (extensionTreeContentProvider == null)
- return;
-
- IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
- documentChangeNotifier = (IDocumentChangedNotifier)editor.getAdapter(IDocumentChangedNotifier.class);
-
- if (documentChangeNotifier != null)
- {
- documentChangeNotifier.addListener(internalNodeAdapter);
- }
-
- 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);
-
- SashForm sashForm = new SashForm(page, SWT.HORIZONTAL);
- // Try to limit the initial width of the section
-
- int w = SWT.DEFAULT;
- try
- {
- IWorkbenchPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart();
-
- // Find the width of the Tabbed Property Sheet's composite excluding the tab
- if (part instanceof PropertySheet)
- {
- PropertySheet sheet = (PropertySheet)part;
- if (sheet.getCurrentPage() instanceof TabbedPropertySheetPage)
- {
- TabbedPropertySheetPage tabbedPage = (TabbedPropertySheetPage)sheet.getCurrentPage();
- Composite targetComposite = null;
- if (tabbedPage.getControl() instanceof Composite)
- {
- Composite c = (Composite)tabbedPage.getControl();
- int length = c.getChildren().length;
- for (int i = 0; i < length; i++)
- {
- Control ctrl = c.getChildren()[i];
- int length2 = (((Composite)ctrl).getChildren()).length;
- for (int j = 0; j < length2; j++ )
- {
- if ((((Composite)ctrl).getChildren())[j] instanceof ScrolledComposite)
- {
- targetComposite = (Composite)(((Composite)ctrl).getChildren())[j];
- break;
- }
- }
- }
- }
- if (targetComposite != null)
- {
- w = targetComposite.getSize().x - 20; // ensure scrollbars don't show
- }
- // The above can be accomplished by the following code
- // but because TabbedPropertyComposite is in an internal package, I will get a discouraged
- // access warning.
- // w = ((TabbedPropertyComposite)(tabbedPage.getControl())).getTabComposite().getSize().x;
- }
- }
- }
- catch(Exception e)
- {
- w = SWT.DEFAULT;
- }
- gridData = new GridData();
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- gridData.verticalAlignment = GridData.FILL;
- gridData.horizontalAlignment = GridData.FILL;
- // The initial size should be set, not the widthHint, which forces the width
- // to remain constant.
- sashForm.setSize(w, SWT.DEFAULT);
- sashForm.setLayoutData(gridData);
- sashForm.setForeground(ColorConstants.white);
- sashForm.setBackground(ColorConstants.white);
- Control[] children = sashForm.getChildren();
- for (int i = 0; i < children.length; i++)
- {
- children[i].setVisible(false);
- }
- Composite leftContent = getWidgetFactory().createComposite(sashForm, SWT.FLAT);
- gridLayout = new GridLayout();
- gridLayout.numColumns = 1;
- leftContent.setLayout(gridLayout);
-
- Section section = getWidgetFactory().createSection(leftContent, SWT.FLAT | ExpandableComposite.TITLE_BAR);
- section.setText(Messages._UI_LABEL_EXTENSIONS);
- section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- Composite tableAndButtonComposite = getWidgetFactory().createComposite(leftContent, SWT.FLAT);
- tableAndButtonComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
- gridLayout = new GridLayout();
- gridLayout.numColumns = 2;
- tableAndButtonComposite.setLayout(gridLayout);
-
- extensionTreeViewer = new TreeViewer(tableAndButtonComposite, SWT.FLAT | SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.LINE_SOLID);
- MenuManager menuManager = new MenuManager();
- extensionTreeViewer.getTree().setMenu(menuManager.createContextMenu(extensionTreeViewer.getTree()));
- menuManager.addMenuListener(new DOMExtensionItemMenuListener(extensionTreeViewer));
-
- gridLayout = new GridLayout();
- gridLayout.numColumns = 1;
- extensionTreeViewer.getTree().setLayout(gridLayout);
- gridData = new GridData();
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- gridData.verticalAlignment = GridData.FILL;
- gridData.horizontalAlignment = GridData.FILL;
-
- extensionTreeViewer.getTree().setLayoutData(gridData);
- extensionTreeViewer.setContentProvider(extensionTreeContentProvider);
- extensionTreeViewer.setLabelProvider(extensionTreeLabelProvider);
- elementSelectionChangedListener = new ElementSelectionChangedListener();
- extensionTreeViewer.addSelectionChangedListener(elementSelectionChangedListener);
- extensionTreeViewer.getTree().addMouseTrackListener(new MouseTrackAdapter()
- {
- public void mouseHover(org.eclipse.swt.events.MouseEvent e)
- {
- ISelection selection = extensionTreeViewer.getSelection();
- if (selection instanceof StructuredSelection)
- {
- Object obj = ((StructuredSelection) selection).getFirstElement();
- if (obj instanceof Element)
- {
- Element element = (Element) obj;
- ExtensionsSchemasRegistry registry = getExtensionsSchemasRegistry();
- // ApplicationSpecificSchemaProperties[] properties =
- // registry.getAllApplicationSpecificSchemaProperties();
- // ApplicationSpecificSchemaProperties[] properties =
- // (ApplicationSpecificSchemaProperties[])
- // registry.getAllApplicationSpecificSchemaProperties().toArray(new
- // ApplicationSpecificSchemaProperties[0]);
- List properties = registry.getAllExtensionsSchemasContribution();
-
- int length = properties.size();
- for (int i = 0; i < length; i++)
- {
- SpecificationForExtensionsSchema current = (SpecificationForExtensionsSchema) properties.get(i);
- if (current.getNamespaceURI().equals(element.getNamespaceURI()))
- {
- extensionTreeViewer.getTree().setToolTipText(current.getDescription());
- break;
- }
- }
- }
- }
- }
-
- });
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(extensionTreeViewer.getControl(),
- XSDEditorCSHelpIds.EXTENSIONS_TAB__EXTENSIONS);
-
- Composite buttonComposite = getWidgetFactory().createComposite(tableAndButtonComposite, SWT.FLAT);
- //ColumnLayout columnLayout = new ColumnLayout();
- //buttonComposite.setLayout(columnLayout);
- buttonComposite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
- gridLayout = new GridLayout();
- gridLayout.marginTop = 0;
- gridLayout.marginBottom = 0;
- gridLayout.numColumns = 1;
- gridLayout.makeColumnsEqualWidth = true;
- buttonComposite.setLayout(gridLayout);
-
- addButton = getWidgetFactory().createButton(buttonComposite, Messages._UI_ACTION_ADD_WITH_DOTS, SWT.FLAT);
- addButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- addButton.addSelectionListener(this);
- addButton.setToolTipText(Messages._UI_ACTION_ADD_EXTENSION_COMPONENT);
- //addButton.setLayoutData(new ColumnLayoutData(ColumnLayoutData.FILL));
- addButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(addButton,
- XSDEditorCSHelpIds.EXTENSIONS_TAB__ADD);
-
- removeButton = getWidgetFactory().createButton(buttonComposite, Messages._UI_DELETE_BUTTON, SWT.FLAT);
- removeButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- removeButton.addSelectionListener(this);
- removeButton.setToolTipText(Messages._UI_ACTION_DELETE_EXTENSION_COMPONENT);
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(removeButton,
- XSDEditorCSHelpIds.EXTENSIONS_TAB__DELETE);
-
- //removeButton.setLayoutData(new ColumnLayoutData(ColumnLayoutData.FILL));
-
- // TODO (cs) uncomment the up/down button when we have time to implement
- //
- //Button up = getWidgetFactory().createButton(buttonComposite, Messages._UI_LABEL_UP, SWT.FLAT);
- //up.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- //Button down = getWidgetFactory().createButton(buttonComposite, Messages._UI_LABEL_DOWN, SWT.FLAT);
- //down.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- Composite rightContent = getWidgetFactory().createComposite(sashForm, SWT.FLAT);
- Section section2 = getWidgetFactory().createSection(rightContent, SWT.FLAT | ExpandableComposite.TITLE_BAR);
- section2.setText(Messages._UI_LABEL_EXTENSION_DETAILS);
- section2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- //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 = 2;
- 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 = { 40, 60 };
- sashForm.setWeights(weights);
- }
-
- protected void createElementContentWidget(Composite parent)
- {
- extensionDetailsViewer = new ExtensionDetailsViewer(parent, getWidgetFactory());
- extensionDetailsViewer.setContentProvider(new DOMExtensionDetailsContentProvider());
- extensionDetailsViewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(extensionDetailsViewer.getControl(),
- XSDEditorCSHelpIds.EXTENSIONS_TAB__EXTENSIONS_DETAILS);
- }
-
-
- /*
- * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh()
- */
- public void refresh()
- {
- setListenerEnabled(false);
- if (input != null)
- {
- if ( prevInput == input)
- return;
- else
- prevInput = input;
-
- Tree tree = extensionTreeViewer.getTree();
- extensionDetailsViewer.setInput(null);
- tree.removeAll();
-
- addButton.setEnabled(!isReadOnly);
-
- extensionTreeViewer.setInput(input);
- if (tree.getSelectionCount() == 0 && tree.getItemCount() > 0)
- {
- TreeItem treeItem = tree.getItem(0);
- extensionTreeViewer.setSelection(new StructuredSelection(treeItem.getData()));
- }
- removeButton.setEnabled(tree.getSelectionCount() > 0 && !isReadOnly);
- // Bugzilla 197315. Make this bulletproof for maintenance release.
- Control detailsViewerControl = extensionDetailsViewer.getControl();
- if (detailsViewerControl != null && !detailsViewerControl.isDisposed())
- {
- detailsViewerControl.setEnabled(!isReadOnly);
- }
- }
- setListenerEnabled(true);
- }
-
- public Composite getPage()
- {
- return page;
- }
-
- protected abstract AddExtensionCommand getAddExtensionCommand(Object o);
- protected abstract Command getRemoveExtensionCommand(Object o);
- protected abstract ExtensionsSchemasRegistry getExtensionsSchemasRegistry();
-
- protected AddExtensionsComponentDialog createAddExtensionsComponentDialog()
- {
- return new AddExtensionsComponentDialog(composite.getShell(), getExtensionsSchemasRegistry());
- }
-
- public void widgetSelected(SelectionEvent event)
- {
- if (event.widget == addButton)
- {
- ExtensionsSchemasRegistry registry = getExtensionsSchemasRegistry();
- AddExtensionsComponentDialog dialog = createAddExtensionsComponentDialog();
-
- List properties = registry.getAllExtensionsSchemasContribution();
-
- dialog.setInput(properties);
- dialog.setBlockOnOpen(true);
- dialog.setPrefStore( getPrefStore() );
-
- if (prevCategory != null)
- dialog.setInitialCategorySelection(prevCategory);
-
- if (dialog.open() == Window.OK)
- {
- Object newSelection = null;
- Object[] result = dialog.getResult();
- if (result != null)
- {
- SpecificationForExtensionsSchema extensionsSchemaSpec = (SpecificationForExtensionsSchema) result[1];
- AddExtensionCommand addExtensionCommand = getAddExtensionCommand(result[0]);
- if (addExtensionCommand != null)
- {
- addExtensionCommand.setSchemaProperties(extensionsSchemaSpec);
- if (getCommandStack() != null)
- {
- getCommandStack().execute(addExtensionCommand);
- newSelection = addExtensionCommand.getNewObject();
- }
- }
- }
- //refresh();
- if (newSelection != null)
- {
- extensionTreeViewer.setSelection(new StructuredSelection(newSelection));
- }
- }
-
- prevCategory = dialog.getSelectedCategory();
- }
- else if (event.widget == removeButton)
- {
- ISelection selection = extensionTreeViewer.getSelection();
-
- if (selection instanceof StructuredSelection)
- {
- Object o = ((StructuredSelection) selection).getFirstElement();
- Command command = getRemoveExtensionCommand(o);
- if (getCommandStack() != null)
- {
- getCommandStack().execute(command);
- }
- }
- }
- else if (event.widget == extensionTreeViewer.getTree())
- {
-
- }
- }
-
- // TODO make this one an abstract method. XSDEditor and WSDLEditor should return
- // diferent IpreferenceStore objects
- protected IPreferenceStore getPrefStore() {
- return null;
- }
-
- public void widgetDefaultSelected(SelectionEvent event)
- {
-
- }
-
- public boolean shouldUseExtraSpace()
- {
- return true;
- }
-
- public void dispose()
- {
- if (documentChangeNotifier != null)
- documentChangeNotifier.removeListener(internalNodeAdapter);
- }
-
-
- Node selectedNode;
-
- class ElementSelectionChangedListener implements ISelectionChangedListener
- {
- public void selectionChanged(SelectionChangedEvent event)
- {
- boolean isDeleteEnabled = false;
- ISelection selection = event.getSelection();
- if (selection instanceof StructuredSelection)
- {
- StructuredSelection structuredSelection = (StructuredSelection)selection;
- if (structuredSelection.size() > 0)
- {
- Object obj = structuredSelection.getFirstElement();
- if (obj instanceof Node)
- {
- selectedNode = (Node) obj;
- extensionDetailsViewer.setInput(obj);
- isDeleteEnabled = true;
- }
- }
- else
- {
- // if nothing is selected then don't show any details
- //
- extensionDetailsViewer.setInput(null);
- }
-
- // Upon element selection, the details view populates fine, but there is no vertical scrollbar,
- // so it misleads the user into thinking there are no other attributes available
- // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=174073
- // This is a workaround to force a layout of the tab composite
- IWorkbenchPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart();
- if (part instanceof PropertySheet)
- {
- PropertySheet sheet = (PropertySheet)part;
- if (sheet.getCurrentPage() instanceof TabbedPropertySheetPage)
- {
- TabbedPropertySheetPage tabbedPage = (TabbedPropertySheetPage)sheet.getCurrentPage();
- if (tabbedPage.getControl() instanceof Composite)
- {
- Composite c = (Composite)tabbedPage.getControl();
- Point p = c.getSize();
- // c.layout(true, true) doesn't appear to work.
- // But this forces a relayout:
- c.setSize(p.x, p.y + 1);
- // Change the size back to the original
- c.setSize(p.x, p.y);
- }
- }
- }
- }
- removeButton.setEnabled(isDeleteEnabled && !isReadOnly);
- }
- }
-
- public ITreeContentProvider getExtensionTreeContentProvider()
- {
- return extensionTreeContentProvider;
- }
-
- public void setExtensionTreeContentProvider(ITreeContentProvider extensionTreeContentProvider)
- {
- this.extensionTreeContentProvider = extensionTreeContentProvider;
- }
-
- public ILabelProvider getExtensionTreeLabelProvider()
- {
- return extensionTreeLabelProvider;
- }
-
- public void setExtensionTreeLabelProvider(ILabelProvider extensionTreeLabelProvider)
- {
- this.extensionTreeLabelProvider = extensionTreeLabelProvider;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/AbstractSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/AbstractSection.java
deleted file mode 100644
index 1d07b36818..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/AbstractSection.java
+++ /dev/null
@@ -1,396 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections;
-
-import org.eclipse.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.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.IFileEditorInput;
-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.ide.FileStoreEditorInput;
-import org.eclipse.ui.views.properties.tabbed.AbstractPropertySection;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
-import org.eclipse.wst.xsd.ui.internal.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.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;
- protected boolean isTraversing = false;
-
- 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;
- }
-
- IEditorInput editorInput = owningEditor.getEditorInput();
- if (!(editorInput instanceof IFileEditorInput || editorInput instanceof FileStoreEditorInput))
- {
- isReadOnly = true;
- }
- }
-
- public void refresh()
- {
- super.refresh();
- composite.setEnabled(!isReadOnly);
- }
-
- 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;
- }
- }
- }
- }
- }
-
- protected boolean shouldPerformComboSelection(int eventType, Object selectedItem)
- {
- // if traversing through combobox, don't automatically pop up
- // the browse and new dialog boxes
- boolean wasTraversing = isTraversing;
- if (isTraversing)
- isTraversing = false;
-
- // we only care about default selecting (hitting enter in combobox)
- // for browse.. and new.. otherwise, selection event will be fired
- if (eventType == SWT.DefaultSelection)
- {
- if (selectedItem instanceof String && ((Messages._UI_COMBO_BROWSE.equals(selectedItem) || Messages._UI_COMBO_NEW.equals(selectedItem))))
- return true;
- return false;
- }
-
- // if was traversing and got selection event, do nothing if it's
- // browse.. or new..
- if (wasTraversing && selectedItem instanceof String)
- {
- if (Messages._UI_COMBO_BROWSE.equals(selectedItem) || Messages._UI_COMBO_NEW.equals(selectedItem))
- {
- return false;
- }
- }
- return true;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/AbstractSectionDescriptor.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/AbstractSectionDescriptor.java
deleted file mode 100644
index e0b33bb5c0..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/AbstractSectionDescriptor.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*******************************************************************************
- * 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.internal.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-NLS-1$
- }
-
- /* (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 ""; //$NON-NLS-1$
- }
-
-
- public int getEnablesFor()
- {
- return ENABLES_FOR_ANY;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/AnnotationSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/AnnotationSection.java
deleted file mode 100644
index 8de7f40285..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/AnnotationSection.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections;
-
-import 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.ui.PlatformUI;
-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.internal.common.commands.AddDocumentationCommand;
-import org.eclipse.wst.xsd.ui.internal.common.util.Messages;
-import org.eclipse.wst.xsd.ui.internal.common.util.XSDCommonUIUtils;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorCSHelpIds;
-import org.eclipse.xsd.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);
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(simpleText,
- XSDEditorCSHelpIds.DOCUMENTATION_TAB__NO_LABEL);
-
-
- 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();
-
- if (simpleText.isFocusControl()) return;
- 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(Messages._UI_ACTION_ADD_DOCUMENTATION, null, (XSDConcreteComponent) input, simpleText.getText(), ""); //$NON-NLS-1$
- 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));
- }
- }
- else
- {
- simpleText.setText("");
- }
- }
- catch (Exception e)
- {
-
- }
- }
- else
- {
- simpleText.setText(""); //$NON-NLS-1$
- }
- }
-
- private String doSerialize(Element element) throws IOException
- {
- String source = ""; //$NON-NLS-1$
-
- 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/internal/common/properties/sections/CommonDirectivesSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/CommonDirectivesSection.java
deleted file mode 100644
index e301ebbc41..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/CommonDirectivesSection.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections;
-
-import java.util.HashMap;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.emf.common.util.URI;
-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.IEditorInput;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.wst.common.uriresolver.internal.util.URIHelper;
-import org.eclipse.wst.xsd.ui.internal.common.util.Messages;
-import org.eclipse.wst.xsd.ui.internal.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;
- protected boolean isValidSchemaLocation = true;
-
- // TODO: common up code with XSDSelectIncludeFileWizard
- public void doHandleEvent(Event event)
- {
- errorText.setText(""); //$NON-NLS-1$
-
- if (event.widget == schemaLocationText)
- {
- String errorMessage = ""; //$NON-NLS-1$
- isValidSchemaLocation = true;
- String xsdModelFile = schemaLocationText.getText();
- String namespace = ""; //$NON-NLS-1$
- XSDSchema externalSchema = null;
-
- if (xsdModelFile.length() == 0)
- {
- handleSchemaLocationChange(xsdModelFile, "", null); //$NON-NLS-1$
- return;
- }
-
- try
- {
- IFile currentIFile = null;
- IEditorInput editorInput = getActiveEditor().getEditorInput();
- if (editorInput instanceof IFileEditorInput)
- {
- currentIFile = ((IFileEditorInput)editorInput).getFile();
- }
-
- URI newURI = URI.createURI(xsdModelFile);
- String xsdFile = URIHelper.getRelativeURI(newURI.toString(), currentIFile.getFullPath().toString());
- final String normalizedXSDFile = URIHelper.normalize(xsdFile, currentIFile.getLocation().toString(), ""); //$NON-NLS-1$
- final String normalizedURI = URI.encodeFragment(URIHelper.addImpliedFileProtocol(normalizedXSDFile), true).toString();
- XSDParser parser = new XSDParser(new HashMap());
- parser.parse(normalizedURI);
- externalSchema = parser.getSchema();
-
- if (externalSchema != null)
- {
- String extNamespace = externalSchema.getTargetNamespace();
- if (extNamespace == null) extNamespace = ""; //$NON-NLS-1$
- namespace = extNamespace;
-
- if (externalSchema.getDiagnostics() != null &&
- externalSchema.getDiagnostics().size() > 0)
- {
- isValidSchemaLocation = false;
- errorMessage = XSDEditorPlugin.getResourceString("_UI_INCORRECT_XML_SCHEMA", xsdModelFile); //$NON-NLS-1$
- }
- 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); //$NON-NLS-1$
- 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); //$NON-NLS-1$
- isValidSchemaLocation = false;
- }
- }
- }
- }
- }
- else
- {
- errorMessage = Messages._UI_ERROR_INVALID_FILE;
- isValidSchemaLocation = false;
- }
- }
- catch(Exception e)
- {
- errorMessage = Messages._UI_ERROR_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/internal/common/properties/sections/EnumerationsSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/EnumerationsSection.java
deleted file mode 100644
index e8e2adde5c..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/EnumerationsSection.java
+++ /dev/null
@@ -1,392 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import com.ibm.icu.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.ui.internal.common.commands.AddEnumerationsCommand;
-import org.eclipse.wst.xsd.ui.internal.common.commands.DeleteCommand;
-import org.eclipse.wst.xsd.ui.internal.common.commands.SetXSDFacetValueCommand;
-import org.eclipse.wst.xsd.ui.internal.common.util.Messages;
-import org.eclipse.wst.xsd.ui.internal.common.util.XSDCommonUIUtils;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-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();
- String newName = XSDCommonUIUtils.createUniqueEnumerationValue("value", enumList); //$NON-NLS-1$
-
- AddEnumerationsCommand command = new AddEnumerationsCommand(Messages._UI_ACTION_ADD_ENUMERATION, (XSDSimpleTypeDefinition) input);
- command.setValue(newName);
- 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(Messages._UI_ACTION_ADD_ENUMERATIONS);
- while (tokenizer.hasMoreTokens())
- {
- String token = tokenizer.nextToken();
- if (dialog.isPreserveWhitespace() == false)
- {
- token = token.trim();
- }
- AddEnumerationsCommand command = new AddEnumerationsCommand(Messages._UI_ACTION_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(Messages._UI_ACTION_DELETE_ENUMERATION);
- while (i.hasNext())
- {
- Object obj = i.next();
- if (obj != null)
- {
- if (obj instanceof XSDEnumerationFacet)
- {
- XSDEnumerationFacet enumFacet = (XSDEnumerationFacet) obj;
-
- DeleteCommand deleteCommand = new DeleteCommand(Messages._UI_ACTION_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$ //$NON-NLS-2$
- 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(Messages._UI_ACTION_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"); //$NON-NLS-1$
- }
-
- public String getColumnText(Object element, int columnIndex)
- {
- 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$
- }
-
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/ExtensionsSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/ExtensionsSection.java
deleted file mode 100644
index 1fad5105af..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/ExtensionsSection.java
+++ /dev/null
@@ -1,294 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.wst.xsd.ui.internal.common.commands.AddExtensionAttributeCommand;
-import org.eclipse.wst.xsd.ui.internal.common.commands.AddExtensionCommand;
-import org.eclipse.wst.xsd.ui.internal.common.commands.AddExtensionElementCommand;
-import org.eclipse.wst.xsd.ui.internal.common.commands.ExtensibleAddExtensionCommand;
-import org.eclipse.wst.xsd.ui.internal.common.commands.ExtensibleRemoveExtensionNodeCommand;
-import org.eclipse.wst.xsd.ui.internal.common.commands.RemoveExtensionNodeCommand;
-import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.AddExtensionsComponentDialog;
-import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.CategoryProvider;
-import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.DOMExtensionTreeLabelProvider;
-import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.ExtensionItemFilter;
-import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.ExtensionsSchemasRegistry;
-import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.SpecificationForExtensionsSchema;
-import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.XSDExtensionTreeContentProvider;
-import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.custom.NodeFilter;
-import org.eclipse.wst.xsd.ui.internal.common.util.Messages;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-import org.eclipse.wst.xsd.ui.internal.text.XSDModelAdapter;
-import org.eclipse.wst.xsd.ui.internal.util.ModelReconcileAdapter;
-import org.eclipse.xsd.XSDAttributeDeclaration;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDElementDeclaration;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-public class ExtensionsSection extends AbstractExtensionsSection
-{
- XSDModelAdapter adapter = null;
-
- public ExtensionsSection()
- {
- super();
- setExtensionTreeLabelProvider(new DOMExtensionTreeLabelProvider());
- setExtensionTreeContentProvider(new XSDExtensionTreeContentProvider());
- }
-
- protected AddExtensionsComponentDialog createAddExtensionsComponentDialog()
- {
- AddExtensionsComponentDialog dialog = new AddExtensionsComponentDialog(composite.getShell(), getExtensionsSchemasRegistry())
- {
- protected IStructuredContentProvider getCategoryContentProvider()
- {
- return new XSDCategoryContentProvider();
- }
- };
- dialog.addElementsTableFilter(new AddExtensionsComponentDialogFilter(input, dialog));
- return dialog;
- }
-
- public void setInput(IWorkbenchPart part, ISelection selection)
- {
- super.setInput(part, selection);
- if (adapter == null)
- {
- if (selection instanceof StructuredSelection)
- {
- Object obj = ((StructuredSelection) selection).getFirstElement();
- if (obj instanceof XSDConcreteComponent)
- {
- Element element = ((XSDConcreteComponent)obj).getElement();
- if (element != null)
- {
- adapter = XSDModelAdapter.lookupOrCreateModelAdapter(element.getOwnerDocument());
- if (adapter != null)
- {
- ModelReconcileAdapter modelReconcileAdapter = adapter.getModelReconcileAdapter();
- if (modelReconcileAdapter != null)
- {
- modelReconcileAdapter.addListener(internalNodeAdapter);
- }
- }
- }
- }
- }
- }
- extensionTreeViewer.expandToLevel(2);
- }
-
- public void dispose()
- {
- super.dispose();
- if (adapter != null)
- {
- ModelReconcileAdapter modelReconcileAdapter = adapter.getModelReconcileAdapter();
- if (modelReconcileAdapter != null)
- {
- modelReconcileAdapter.removeListener(internalNodeAdapter);
- }
- }
- }
-
- protected AddExtensionCommand getAddExtensionCommand(Object o)
- {
- AddExtensionCommand addExtensionCommand = null;
- if (o instanceof XSDElementDeclaration)
- {
- XSDElementDeclaration element = (XSDElementDeclaration) o;
- ExtensibleAddExtensionCommand extensibleAddExtensionCommand = getExtensionsSchemasRegistry().getAddExtensionCommand(element.getTargetNamespace());
- if (extensibleAddExtensionCommand != null)
- {
- extensibleAddExtensionCommand.setInputs((XSDConcreteComponent) input, element);
- addExtensionCommand = extensibleAddExtensionCommand;
- }
- else
- {
- addExtensionCommand = new AddExtensionElementCommand(Messages._UI_ACTION_ADD_APPINFO_ELEMENT, (XSDConcreteComponent) input, element);
- }
- }
- else if (o instanceof XSDAttributeDeclaration)
- {
- XSDAttributeDeclaration attribute = (XSDAttributeDeclaration) o;
- addExtensionCommand = new AddExtensionAttributeCommand(Messages._UI_ACTION_ADD_APPINFO_ATTRIBUTE, (XSDConcreteComponent) input, attribute);
- }
- return addExtensionCommand;
- }
-
- protected Command getRemoveExtensionCommand(Object o)
- {
- Command command = null;
- try
- {
- if (o instanceof Node)
- {
- Node node = (Node)o;
- ExtensibleRemoveExtensionNodeCommand removeCommand = getExtensionsSchemasRegistry().getRemoveExtensionNodeCommand(node.getNamespaceURI());
- if (removeCommand != null)
- {
- removeCommand.setInput((XSDConcreteComponent)input);
- removeCommand.setNode(node);
- return removeCommand;
- }
- else
- {
- command = new RemoveExtensionNodeCommand(Messages._UI_ACTION_DELETE_APPINFO_ELEMENT, node);
- // command.execute();
- }
- }
- }
- catch (Exception e)
- {
- }
- return command;
- }
-
- protected ExtensionsSchemasRegistry getExtensionsSchemasRegistry()
- {
- return XSDEditorPlugin.getDefault().getExtensionsSchemasRegistry();
- }
-
- protected boolean isTreeViewerInputElement(Element element)
- {
- if (input instanceof XSDConcreteComponent)
- {
- XSDConcreteComponent component = (XSDConcreteComponent)input;
- Element componentElement = component.getElement();
- Node parent = element.getParentNode();
- Node grandParent = parent != null ? parent.getParentNode() : null;
- return componentElement == element || componentElement == parent || componentElement == grandParent;
- }
- return false;
- }
-
- protected IPreferenceStore getPrefStore()
- {
- return XSDEditorPlugin.getPlugin().getPreferenceStore();
- }
-
- static class XSDCategoryContentProvider implements IStructuredContentProvider
- {
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
- */
- public Object[] getElements(Object inputElement)
- {
- SpecificationForExtensionsSchema[] extensionsSchemaSpecs = null;
- try
- {
- List inputList = (List) inputElement;
-
- List total = new ArrayList();
- total.addAll(inputList);
-
- List dynamicCategories = XSDEditorPlugin.getPlugin().getExtensionsSchemasRegistry().getCategoryProviders();
- for (Iterator iter = dynamicCategories.iterator(); iter.hasNext(); )
- {
- CategoryProvider categoryProvider = (CategoryProvider)iter.next();
- for (Iterator it = categoryProvider.getCategories().iterator(); it.hasNext(); )
- {
- SpecificationForExtensionsSchema sp = (SpecificationForExtensionsSchema)it.next();
- total.add(sp);
- }
- }
-
- extensionsSchemaSpecs = (SpecificationForExtensionsSchema[]) total.toArray(new SpecificationForExtensionsSchema[0]);
- }
- catch (Exception e)
- {
- }
- return extensionsSchemaSpecs;
- }
-
- /*
- * (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
-
- }
- }
-
- /**
- * This filter is to be used by the dialog invoked when addButton is pressed
- */
- protected class AddExtensionsComponentDialogFilter extends ViewerFilter
- {
- private Object input;
- private AddExtensionsComponentDialog dialog;
-
- public AddExtensionsComponentDialogFilter(Object input, AddExtensionsComponentDialog dialog)
- {
- this.input = input;
- this.dialog = dialog;
- }
-
- public boolean select(Viewer viewer, Object parentElement, Object element)
- {
- if (input instanceof XSDConcreteComponent &&
- element instanceof XSDConcreteComponent)
- {
- SpecificationForExtensionsSchema spec = dialog.getSelectedCategory();
- // here we obtain the node filter that was registered for the applicable namespace
- // notied
- NodeFilter filter = XSDEditorPlugin.getPlugin().getNodeCustomizationRegistry().getNodeFilter(spec.getNamespaceURI());
-
- if (filter == null)
- {
- // Check if a node filter has been specified, if so, then use it
- filter = spec.getNodeFilter();
- }
-
- if (filter instanceof ExtensionItemFilter)
- {
- ExtensionItemFilter extensionItemFilter = (ExtensionItemFilter)filter;
- return extensionItemFilter.isApplicableContext((XSDConcreteComponent)input, (XSDConcreteComponent)element);
- }
- else
- {
- // TODO cs: even if it's just a plain old NodeFilter we should still be able to use it!
- }
- }
- return true;
- }
- }
-
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/FacetViewer.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/FacetViewer.java
deleted file mode 100644
index e13d74d745..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/FacetViewer.java
+++ /dev/null
@@ -1,559 +0,0 @@
-/*******************************************************************************
- * 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.internal.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.ui.internal.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/internal/common/properties/sections/IDocumentChangedNotifier.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/IDocumentChangedNotifier.java
deleted file mode 100644
index a72e632f4e..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/IDocumentChangedNotifier.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*******************************************************************************
- * 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.internal.common.properties.sections;
-
-import org.eclipse.wst.sse.core.internal.provisional.INodeAdapter;
-
-public interface IDocumentChangedNotifier
-{
- public void addListener(INodeAdapter adapter);
- public void removeListener(INodeAdapter adapter);
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/MultiplicitySection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/MultiplicitySection.java
deleted file mode 100644
index 556acfa0e8..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/MultiplicitySection.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections;
-
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.wst.xsd.ui.internal.common.commands.UpdateMaxOccursCommand;
-import org.eclipse.wst.xsd.ui.internal.common.commands.UpdateMinOccursCommand;
-import org.eclipse.wst.xsd.ui.internal.common.util.Messages;
-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 RefactoringSection
-{
- protected CCombo minCombo, maxCombo;
-
- 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();
- }
- super.doWidgetSelected(e);
- }
-
- 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$ //$NON-NLS-2$
- {
- newMax = XSDParticle.UNBOUNDED;
- }
- else
- {
- if (newValue.length() > 0)
- {
- newMax = Integer.parseInt(newValue);
- }
- }
- setListenerEnabled(false);
- UpdateMaxOccursCommand command = new UpdateMaxOccursCommand(Messages._UI_ACTION_CHANGE_MAXIMUM_OCCURRENCE, particle, newMax);
- getCommandStack().execute(command);
- setListenerEnabled(true);
-
- }
- catch (NumberFormatException e)
- {
- setErrorMessage(Messages._UI_ERROR_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();
- if (newValue.length() == 0)
- {
- particle.unsetMinOccurs();
- }
- try
- {
- int newMin = 1;
- if (newValue.equals("unbounded") || newValue.equals("*")) //$NON-NLS-1$ //$NON-NLS-2$
- {
- newMin = XSDParticle.UNBOUNDED;
- }
- else
- {
- newMin = Integer.parseInt(newValue);
- }
- UpdateMinOccursCommand command = new UpdateMinOccursCommand(Messages._UI_ACTION_CHANGE_MINIMUM_OCCURRENCE, 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)
- {
- if (element.hasAttribute(XSDConstants.MINOCCURS_ATTRIBUTE) && refreshMinText)
- {
- String min = element.getAttribute(XSDConstants.MINOCCURS_ATTRIBUTE);
- minCombo.setText(min);
- }
- if (element.hasAttribute(XSDConstants.MAXOCCURS_ATTRIBUTE) && refreshMaxText)
- {
- String max = element.getAttribute(XSDConstants.MAXOCCURS_ATTRIBUTE);
- maxCombo.setText(max);
- }
- }
- }
- }
- }
- }
-
- protected XSDParticle getAssociatedParticle(XSDParticleContent particleContent)
- {
- XSDConcreteComponent xsdComp = particleContent.getContainer();
- if (xsdComp instanceof XSDParticle)
- {
- return (XSDParticle) xsdComp;
- }
- return null;
- }
-
- public void dispose()
- {
- if (minCombo != null && !minCombo.isDisposed())
- removeListeners(minCombo);
- if (maxCombo != null && !maxCombo.isDisposed())
- removeListeners(maxCombo);
- super.dispose();
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/RefactoringSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/RefactoringSection.java
deleted file mode 100644
index b9efd04c87..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/RefactoringSection.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections;
-
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.forms.events.HyperlinkEvent;
-import org.eclipse.ui.forms.events.IHyperlinkListener;
-import org.eclipse.ui.forms.widgets.ImageHyperlink;
-import org.eclipse.wst.xsd.ui.internal.common.util.Messages;
-import org.eclipse.wst.xsd.ui.internal.editor.ISelectionMapper;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-import org.eclipse.wst.xsd.ui.internal.refactor.handlers.RenameHandler;
-import org.eclipse.xsd.XSDSchema;
-
-public abstract class RefactoringSection extends AbstractSection implements IHyperlinkListener
-{
- /**
- * Clicking on it invokes the refactor->rename action.
- */
- private ImageHyperlink renameHyperlink;
-
- protected boolean hideHyperLink;
-
- /**
- * Invokes the refactor->rename action on the current selection.
- */
- private void invokeRenameRefactoring()
- {
- IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
- XSDSchema schema = (XSDSchema) editor.getAdapter(XSDSchema.class);
- ISelection selection = new StructuredSelection(input);
- ISelectionMapper mapper = (ISelectionMapper) editor.getAdapter(ISelectionMapper.class);
- selection = mapper != null ? mapper.mapSelection(selection) : selection;
- RenameHandler renameHandler = new RenameHandler();
- renameHandler.execute(selection, schema);
- }
-
- protected void showLink(boolean isVisible)
- {
- renameHyperlink.setVisible(isVisible);
- }
-
- /**
- * Creates the refactor/rename hyperlink shown beside a component name.
- * Clicking on the hyperlink invokes the refactor/rename action.
- *
- * @param parent
- * the parent composite. Must not be null.
- */
- protected void createRenameHyperlink(Composite parent)
- {
- renameHyperlink = getWidgetFactory().createImageHyperlink(parent, SWT.NONE);
-
- renameHyperlink.setImage(XSDEditorPlugin.getXSDImage("icons/quickassist.gif")); //$NON-NLS-1$
- renameHyperlink.setToolTipText(Messages._UI_TOOLTIP_RENAME_REFACTOR);
- renameHyperlink.addHyperlinkListener(this);
- }
-
- protected void setRenameHyperlinkEnabled(boolean isEnabled)
- {
- renameHyperlink.setEnabled(isEnabled);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.forms.events.IHyperlinkListener#linkActivated(org.eclipse.ui.forms.events.HyperlinkEvent)
- */
- public void linkActivated(HyperlinkEvent e)
- {
- invokeRenameRefactoring();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.forms.events.IHyperlinkListener#linkEntered(org.eclipse.ui.forms.events.HyperlinkEvent)
- */
- public void linkEntered(HyperlinkEvent e)
- {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.forms.events.IHyperlinkListener#linkExited(org.eclipse.ui.forms.events.HyperlinkEvent)
- */
- public void linkExited(HyperlinkEvent e)
- {
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/SchemaLocationSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/SchemaLocationSection.java
deleted file mode 100644
index e8798bb0c5..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/SchemaLocationSection.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections;
-
-import org.eclipse.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.ui.IWorkbenchPart;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.xsd.ui.internal.common.util.XSDDirectivesSchemaLocationUpdater;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorCSHelpIds;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-import org.eclipse.xsd.XSDInclude;
-import org.eclipse.xsd.XSDRedefine;
-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);
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(schemaLocationText,
- XSDEditorCSHelpIds.GENERAL_TAB__INCLUDE_REDEFINE__SCHEMALOCATION);
-
- // 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(""); //$NON-NLS-1$
-
- data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.horizontalSpan = 3;
- data.grabExcessHorizontalSpace = true;
- errorText.setLayoutData(data);
-
- }
-
- public void doWidgetSelected(SelectionEvent event)
- {
- if (event.widget == wizardButton)
- {
- XSDDirectivesSchemaLocationUpdater.updateSchemaLocation(xsdSchema,input,true);
- 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 = ""; //$NON-NLS-1$
- }
- schemaLocationText.setText(location);
- }
-
- setListenerEnabled(true);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISection#shouldUseExtraSpace()
- */
- public boolean shouldUseExtraSpace()
- {
- return true;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/SimpleContentUnionMemberTypesDialog.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/SimpleContentUnionMemberTypesDialog.java
deleted file mode 100644
index a090be1f09..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/SimpleContentUnionMemberTypesDialog.java
+++ /dev/null
@@ -1,312 +0,0 @@
-/*******************************************************************************
- * 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.internal.common.properties.sections;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.jface.dialogs.Dialog;
-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.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.ui.internal.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 == Window.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(" "); //$NON-NLS-1$
- }
- }
- 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); //$NON-NLS-1$
-
- Label instructions = new Label(client, SWT.LEFT | SWT.WRAP);
- instructions.setText(XSDEditorPlugin.getXSDString("_UI_LABEL_SELECT_MEMBERTYPES")); //$NON-NLS-1$
-
- 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")); //$NON-NLS-1$
-
- 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(">"); //$NON-NLS-1$
- addButton.addSelectionListener(this);
- removeButton = new Button(buttonComposite, SWT.PUSH);
- removeButton.setText("<"); //$NON-NLS-1$
- 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")); //$NON-NLS-1$
- item.setData(items.get(i));
- }
- }
-
- public void populateUserSimpleType(boolean showAnonymous)
- {
- table.removeAll();
- if (showAnonymous)
- {
- TableItem anonymousItem = new TableItem(table, SWT.NONE);
- anonymousItem.setText("**anonymous**"); //$NON-NLS-1$
- anonymousItem.setData("**anonymous**"); //$NON-NLS-1$
- }
- 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")); //$NON-NLS-1$
- 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/internal/common/properties/sections/SpecificConstraintsWidget.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/SpecificConstraintsWidget.java
deleted file mode 100644
index c13b65ddca..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/SpecificConstraintsWidget.java
+++ /dev/null
@@ -1,727 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import com.ibm.icu.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.ui.internal.common.commands.AddEnumerationsCommand;
-import org.eclipse.wst.xsd.ui.internal.common.commands.ChangeToLocalSimpleTypeCommand;
-import org.eclipse.wst.xsd.ui.internal.common.commands.DeleteCommand;
-import org.eclipse.wst.xsd.ui.internal.common.commands.SetXSDFacetValueCommand;
-import org.eclipse.wst.xsd.ui.internal.common.commands.UpdateXSDPatternFacetCommand;
-import org.eclipse.wst.xsd.ui.internal.common.util.Messages;
-import org.eclipse.wst.xsd.ui.internal.common.util.XSDCommonUIUtils;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-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.XSDFacet;
-import org.eclipse.xsd.XSDFactory;
-import org.eclipse.xsd.XSDFeature;
-import org.eclipse.xsd.XSDPatternFacet;
-import org.eclipse.xsd.XSDSimpleTypeDefinition;
-
-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;
-
- /**
- * @deprecated
- * @param composite
- * @param factory
- * @param feature
- * @param input
- * @param facetSection
- */
- public SpecificConstraintsWidget(Composite composite, TabbedPropertySheetWidgetFactory factory, XSDFeature feature, XSDSimpleTypeDefinition input, XSDFacetSection facetSection)
- {
- this(composite, factory, feature, input, facetSection, ENUMERATION);
- }
-
- public SpecificConstraintsWidget(Composite composite, TabbedPropertySheetWidgetFactory factory, XSDFeature feature, XSDSimpleTypeDefinition input, XSDFacetSection facetSection, int kind)
- {
- this.factory = factory;
- this.input = input;
- this.composite = composite;
- this.feature = feature;
- this.facetSection = facetSection;
- this.kind = kind;
-
- 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, Messages._UI_ACTION_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, Messages._UI_ACTION_ADD_WITH_DOTS, 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, Messages._UI_ACTION_EDIT_WITH_DOTS, SWT.PUSH);
- data = new GridData();
- data.grabExcessHorizontalSpace = true;
- data.horizontalAlignment = GridData.FILL;
- editButton.setLayoutData(data);
- editButton.addSelectionListener(this);
-
-
- deleteButton = getWidgetFactory().createButton(buttonComposite, Messages._UI_ACTION_DELETE, SWT.PUSH);
-
- data = new GridData();
- data.grabExcessHorizontalSpace = true;
- data.horizontalAlignment = GridData.FILL;
- deleteButton.setLayoutData(data);
- deleteButton.addSelectionListener(this);
-
- setButtonStates(kind);
- 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 int getConstraintKind()
- {
- return this.kind;
- }
-
- protected void setButtonStates(int kind)
- {
- boolean add, addUsing, delete, edit;
-
- boolean listHasItems = false;
- StructuredSelection selection = (StructuredSelection) constraintsTableViewer.getSelection();
- if (selection != null)
- {
- if (selection.toList().size() > 0)
- {
- listHasItems = true;
- }
- }
-
- if (kind == ENUMERATION)
- {
- add = true;
- addUsing = true;
- edit = false;
- }
- else if (kind == PATTERN)
- {
- add = false;
- addUsing = true;
- edit = listHasItems;
- }
- else
- {
- add = true;
- addUsing = true;
- edit = true;
- }
- delete = listHasItems;
-
- if (!addButton.isDisposed())
- {
- addButton.setEnabled(add);
- }
- if (!addUsingDialogButton.isDisposed())
- {
- addUsingDialogButton.setEnabled(addUsing);
- }
- if (!deleteButton.isDisposed())
- {
- deleteButton.setEnabled(delete);
- }
- if (!editButton.isDisposed())
- {
- editButton.setEnabled(edit);
- }
- }
-
- public void widgetSelected(SelectionEvent e)
- {
- XSDSimpleTypeDefinition st = input;
- if (e.widget == addButton)
- {
- List enumList = st.getEnumerationFacets();
- String newName = XSDCommonUIUtils.createUniqueEnumerationValue("value", enumList); //$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(Messages._UI_ACTION_CHANGE_PATTERN, feature);
- changeToAnonymousCommand.setAnonymousSimpleType(anonymousSimpleType);
- compoundCommand.add(changeToAnonymousCommand);
- input = anonymousSimpleType;
- }
- targetSimpleType = anonymousSimpleType;
- }
- else
- {
- targetSimpleType = input;
- }
-
- AddEnumerationsCommand command = new AddEnumerationsCommand(Messages._UI_ACTION_ADD_ENUMERATION, targetSimpleType);
- command.setValue(newName);
- 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(Messages._UI_ACTION_CHANGE_PATTERN, feature);
- changeToAnonymousCommand.setAnonymousSimpleType(anonymousSimpleType);
- compoundCommand.add(changeToAnonymousCommand);
- input = anonymousSimpleType;
- }
- targetSimpleType = anonymousSimpleType;
- }
- else
- {
- targetSimpleType = input;
- }
-
- UpdateXSDPatternFacetCommand command = new UpdateXSDPatternFacetCommand(Messages._UI_ACTION_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(Messages._UI_ACTION_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("", feature); //$NON-NLS-1$
- 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(Messages._UI_ACTION_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(Messages._UI_ACTION_DELETE_CONSTRAINTS);
- }
- else
- {
- compoundCommand.setLabel(Messages._UI_ACTION_DELETE_PATTERN);
- }
- while (i.hasNext())
- {
- Object obj = i.next();
- if (obj != null)
- {
- if (obj instanceof XSDPatternFacet)
- {
- UpdateXSDPatternFacetCommand command = new UpdateXSDPatternFacetCommand("", input, UpdateXSDPatternFacetCommand.DELETE); //$NON-NLS-1$
- command.setPatternToEdit((XSDPatternFacet)obj);
- compoundCommand.add(command);
- }
- else if (obj instanceof XSDEnumerationFacet)
- {
- XSDEnumerationFacet enumFacet = (XSDEnumerationFacet) obj;
- DeleteCommand deleteCommand = new DeleteCommand(Messages._UI_ACTION_DELETE_ENUMERATION, enumFacet);
- compoundCommand.add(deleteCommand);
- }
- }
- }
- commandStack.execute(compoundCommand);
- constraintsTableViewer.refresh();
- }
- }
- 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();
- pattern.setLexicalValue(newPattern);
- constraintsTableViewer.refresh();
- }
- }
- }
- }
-
- setButtonStates(this.kind);
- }
-
- public void widgetDefaultSelected(SelectionEvent e)
- {
-
- }
-
-
- public void setConstraintKind(int kind)
- {
- this.kind = kind;
- setButtonStates(kind);
- constraintsTableViewer.setInput(input);
- constraintsTableViewer.refresh();
- }
-
- public void doModify(Object element, String property, Object value)
- {
- setButtonStates(this.kind);
- 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(Messages._UI_ACTION_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 = { Messages._UI_LABEL_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;
- boolean isDefined = false;
- Iterator iter;
- if (kind == PATTERN)
- {
- iter = st.getPatternFacets().iterator();
- }
- else
- {
- iter = st.getEnumerationFacets().iterator();
- }
-
- while (iter.hasNext())
- {
- XSDFacet facet = (XSDFacet) iter.next();
- isDefined = (facet.getRootContainer() == facetSection.xsdSchema);
- }
-
- if (kind == PATTERN)
- {
- if (isDefined)
- {
- return st.getPatternFacets().toArray();
- }
- }
- else
- {
- if (isDefined)
- {
- 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"); //$NON-NLS-1$
- }
- }
-
- 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 = ""; //$NON-NLS-1$
- return value;
- }
- return ""; //$NON-NLS-1$
- }
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDActionManager.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDActionManager.java
deleted file mode 100644
index b31fa6c429..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDActionManager.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*******************************************************************************
- * 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.internal.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/internal/common/properties/sections/XSDAnyElementContentsSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDAnyElementContentsSection.java
deleted file mode 100644
index a17ab481c2..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDAnyElementContentsSection.java
+++ /dev/null
@@ -1,250 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections;
-
-import java.util.Iterator;
-
-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.ui.PlatformUI;
-import org.eclipse.wst.xsd.ui.internal.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorCSHelpIds;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDParticle;
-import org.eclipse.xsd.XSDProcessContents;
-import org.eclipse.xsd.XSDWildcard;
-
-public class XSDAnyElementContentsSection extends MultiplicitySection
-{
- CCombo namespaceCombo;
- CCombo processContentsCombo;
-
- private String[] namespaceComboValues = { "", //$NON-NLS-1$
- "##any", //$NON-NLS-1$
- "##other", //$NON-NLS-1$
- "##targetNamespace", //$NON-NLS-1$
- "##local" //$NON-NLS-1$
- };
-
- /**
- *
- */
- public XSDAnyElementContentsSection()
- {
- super();
- }
-
- protected void createContents(Composite parent)
- {
- composite = getWidgetFactory().createFlatFormComposite(parent);
-
- GridData data = new GridData();
-
- GridLayout gridLayout = new GridLayout();
- gridLayout.marginTop = 0;
- gridLayout.marginBottom = 0;
- gridLayout.numColumns = 2;
- composite.setLayout(gridLayout);
-
- data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
- data.grabExcessHorizontalSpace = false;
-
- CLabel namespaceLabel = getWidgetFactory().createCLabel(composite, Messages._UI_LABEL_ATTRIBUTES_NAMESPACE);
- namespaceLabel.setLayoutData(data);
-
- namespaceCombo = getWidgetFactory().createCCombo(composite, SWT.FLAT);
- data = new GridData();
- data.grabExcessHorizontalSpace = true;
- data.horizontalAlignment = GridData.FILL;
- namespaceCombo.setLayoutData(data);
- namespaceCombo.setItems(namespaceComboValues);
- namespaceCombo.addSelectionListener(this);
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(namespaceCombo,
- XSDEditorCSHelpIds.GENERAL_TAB__ANYELEMENT__NAMESPACE);
-
- CLabel processContentsLabel = getWidgetFactory().createCLabel(composite, Messages._UI_LABEL_ATTRIBUTES_PROCESSCONTENTS);
- data = new GridData();
- data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
- data.grabExcessHorizontalSpace = false;
- processContentsLabel.setLayoutData(data);
-
- processContentsCombo = getWidgetFactory().createCCombo(composite, SWT.FLAT);
- data = new GridData();
- data.grabExcessHorizontalSpace = true;
- data.horizontalAlignment = GridData.FILL;
- processContentsCombo.setLayoutData(data);
- Iterator list = XSDProcessContents.VALUES.iterator();
- processContentsCombo.add(""); //$NON-NLS-1$
- while (list.hasNext())
- {
- processContentsCombo.add(((XSDProcessContents) list.next()).getName());
- }
- processContentsCombo.addSelectionListener(this);
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(processContentsCombo,
- XSDEditorCSHelpIds.GENERAL_TAB__ANYELEMENT__PROCESSCONTENTS);
-
- // ------------------------------------------------------------------
- // 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$
- applyAllListeners(minCombo);
- minCombo.addSelectionListener(this);
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(minCombo,
- XSDEditorCSHelpIds.GENERAL_TAB__ANYELEMENT__MIN_OCCURENCE);
-
- // ------------------------------------------------------------------
- // 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$
- applyAllListeners(maxCombo);
- maxCombo.addSelectionListener(this);
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(maxCombo,
- XSDEditorCSHelpIds.GENERAL_TAB__ANYELEMENT__MAX_OCCURENCE);
- }
-
- /*
- * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh()
- */
- public void refresh()
- {
- setListenerEnabled(false);
- namespaceCombo.setText(""); //$NON-NLS-1$
- processContentsCombo.setText(""); //$NON-NLS-1$
- if (input != null)
- {
- if (input instanceof XSDWildcard)
- {
- XSDWildcard wildcard = (XSDWildcard) input;
- if (wildcard.isSetLexicalNamespaceConstraint())
- {
- namespaceCombo.setText(wildcard.getStringLexicalNamespaceConstraint());
- }
- else
- {
- namespaceCombo.setText("");
- }
- if (wildcard.isSetProcessContents())
- {
- XSDProcessContents pc = wildcard.getProcessContents();
- processContentsCombo.setText(pc.getName());
- }
-
- if (wildcard.eContainer() instanceof XSDParticle)
- {
- minCombo.setEnabled(!isReadOnly);
- maxCombo.setEnabled(!isReadOnly);
- }
- else
- {
- minCombo.setEnabled(false);
- maxCombo.setEnabled(false);
- }
- }
- }
- refreshMinMax();
- setListenerEnabled(true);
- }
-
- public boolean shouldUseExtraSpace()
- {
- return false;
- }
-
- public void doWidgetSelected(SelectionEvent e)
- {
- XSDConcreteComponent concreteComponent = (XSDConcreteComponent) input;
- if (concreteComponent instanceof XSDWildcard)
- {
- XSDWildcard wildcard = (XSDWildcard) concreteComponent;
- if (e.widget == namespaceCombo)
- {
- String newValue = namespaceCombo.getText();
- boolean removeAttribute = false;
- if (newValue.length() == 0)
- {
- removeAttribute = true;
- }
- // TODO use commands
- // beginRecording(XSDEditorPlugin.getXSDString("_UI_NAMESPACE_CHANGE"),
- // element); //$NON-NLS-1$
- if (removeAttribute)
- {
- wildcard.unsetLexicalNamespaceConstraint();
- }
- else
- {
- wildcard.setStringLexicalNamespaceConstraint(newValue);
- }
- // endRecording(element);
- }
- else if (e.widget == processContentsCombo)
- {
- String newValue = processContentsCombo.getText();
- boolean removeAttribute = false;
- if (newValue.length() == 0)
- {
- removeAttribute = true;
- }
- // beginRecording(XSDEditorPlugin.getXSDString("_UI_PROCESSCONTENTS_CHANGE"),
- // element); //$NON-NLS-1$
- if (removeAttribute)
- {
- wildcard.unsetProcessContents();
- }
- else
- {
- wildcard.setProcessContents(XSDProcessContents.get(processContentsCombo.getItem(processContentsCombo.getSelectionIndex())));
- }
- // endRecording(element);
- }
- }
- super.doWidgetSelected(e);
- }
-
- public void dispose()
- {
- if (minCombo != null && !minCombo.isDisposed())
- minCombo.removeSelectionListener(this);
- if (maxCombo != null && !maxCombo.isDisposed())
- maxCombo.removeSelectionListener(this);
- super.dispose();
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDAttributeDeclarationSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDAttributeDeclarationSection.java
deleted file mode 100644
index 1ab3e25504..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDAttributeDeclarationSection.java
+++ /dev/null
@@ -1,908 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections;
-
-import org.apache.xerces.util.XMLChar;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.window.Window;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.custom.CLabel;
-import org.eclipse.swt.events.SelectionEvent;
-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.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification;
-import org.eclipse.wst.xsd.ui.internal.adt.edit.ComponentReferenceEditManager;
-import org.eclipse.wst.xsd.ui.internal.adt.edit.IComponentDialog;
-import org.eclipse.wst.xsd.ui.internal.common.commands.BaseCommand;
-import org.eclipse.wst.xsd.ui.internal.common.commands.UpdateAttributeValueCommand;
-import org.eclipse.wst.xsd.ui.internal.common.commands.UpdateNameCommand;
-import org.eclipse.wst.xsd.ui.internal.dialogs.NewTypeDialog;
-import org.eclipse.wst.xsd.ui.internal.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDAttributeReferenceEditManager;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorCSHelpIds;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDTypeReferenceEditManager;
-import org.eclipse.wst.xsd.ui.internal.editor.search.XSDSearchListDialogDelegate;
-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 RefactoringSection
-{
- protected Text nameText, defaultOrFixedText;
- protected CCombo componentNameCombo, typeCombo, usageCombo, formCombo;
- protected Button defaultButton, fixedButton;
- protected String typeName = "", refName = ""; //$NON-NLS-1$
- 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, org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_LABEL_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.setEnabled(!isAttributeReference);
- applyAllListeners(nameText);
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(nameText,
- XSDEditorCSHelpIds.GENERAL_TAB__ATTRIBUTE__NAME);
-
- // ------------------------------------------------------------------
- // Refactor/rename hyperlink
- // ------------------------------------------------------------------
- if (!hideHyperLink)
- {
- createRenameHyperlink(composite);
- setRenameHyperlinkEnabled(!isAttributeReference);
- }
- else
- {
- getWidgetFactory().createCLabel(composite, "");
- }
-
-
- // ------------------------------------------------------------------
- // Ref Label
- // ------------------------------------------------------------------
- if (isAttributeReference)
- {
- data = new GridData();
- data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
- data.grabExcessHorizontalSpace = false;
- CLabel refLabel = getWidgetFactory().createCLabel(composite, org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_LABEL_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.addListener(SWT.Traverse, this);
- componentNameCombo.setLayoutData(data);
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(componentNameCombo,
- XSDEditorCSHelpIds.GENERAL_TAB__ATTRIBUTE__NAME);
-
- // dummy
- 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().createCCombo(composite);
- typeCombo.setLayoutData(data);
- typeCombo.addSelectionListener(this);
- typeCombo.addListener(SWT.Traverse, this);
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(typeCombo,
- XSDEditorCSHelpIds.GENERAL_TAB__ATTRIBUTE__TYPE);
-
- // dummy
- getWidgetFactory().createCLabel(composite, ""); //$NON-NLS-1$
-
- // ------------------------------------------------------------------
- // UsageLabel
- // ------------------------------------------------------------------
- data = new GridData();
- data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
- data.grabExcessHorizontalSpace = false;
- CLabel useLabel = getWidgetFactory().createCLabel(composite, XSDEditorPlugin.getXSDString("_UI_USAGE"));
- useLabel.setLayoutData(data);
-
- // ------------------------------------------------------------------
- // UsageCombo
- // ------------------------------------------------------------------
- data = new GridData();
- data.grabExcessHorizontalSpace = true;
- data.horizontalAlignment = GridData.FILL;
- usageCombo = getWidgetFactory().createCCombo(composite);
- usageCombo.setLayoutData(data);
- usageCombo.addSelectionListener(this);
- usageCombo.add("");
- usageCombo.add("required"); //$NON-NLS-1$
- usageCombo.add("optional"); //$NON-NLS-1$
- usageCombo.add("prohibited"); //$NON-NLS-1$
- usageCombo.addSelectionListener(this);
-
- // dummy
- getWidgetFactory().createCLabel(composite, ""); //$NON-NLS-1$
-
- // ------------------------------------------------------------------
- // defaultLabel
- // ------------------------------------------------------------------
- data = new GridData();
- data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
- data.grabExcessHorizontalSpace = false;
- CLabel defaultLabel = getWidgetFactory().createCLabel(composite, org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_VALUE_COLON);
- defaultLabel.setLayoutData(data);
-
- Composite radio = getWidgetFactory().createComposite(composite);
- radio.setLayout(new RowLayout());
-
- defaultButton = new Button(radio, SWT.RADIO);
- defaultButton.setText(org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_DEFAULT);
- defaultButton.setBackground(parent.getBackground());
- defaultButton.addSelectionListener(this);
-
- fixedButton = new Button(radio, SWT.RADIO);
- fixedButton.setText(org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_FIXED);
- fixedButton.setBackground(parent.getBackground());
- fixedButton.addSelectionListener(this);
-
- // dummy
- getWidgetFactory().createCLabel(composite, ""); //$NON-NLS-1$
-
- // dummy
- getWidgetFactory().createCLabel(composite, ""); //$NON-NLS-1$
-
- // ------------------------------------------------------------------
- // defaultText
- // ------------------------------------------------------------------
- data = new GridData();
- data.grabExcessHorizontalSpace = true;
- data.horizontalAlignment = GridData.FILL;
- defaultOrFixedText = getWidgetFactory().createText(composite, ""); //$NON-NLS-1$
- defaultOrFixedText.setLayoutData(data);
- applyAllListeners(defaultOrFixedText);
-
- //PlatformUI.getWorkbench().getHelpSystem().setHelp(nameText,
- // XSDEditorCSHelpIds.GENERAL_TAB__ATTRIBUTE__DEFAULT);
-
- // dummy
- getWidgetFactory().createCLabel(composite, ""); //$NON-NLS-1$
-
- // ------------------------------------------------------------------
- // FormLabel
- // ------------------------------------------------------------------
- data = new GridData();
- data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
- data.grabExcessHorizontalSpace = false;
- CLabel formLabel = getWidgetFactory().createCLabel(composite, org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_FORM);
- formLabel.setLayoutData(data);
-
- // ------------------------------------------------------------------
- // FormCombo
- // ------------------------------------------------------------------
- data = new GridData();
- data.grabExcessHorizontalSpace = true;
- data.horizontalAlignment = GridData.FILL;
- formCombo = getWidgetFactory().createCCombo(composite);
- formCombo.setLayoutData(data);
- formCombo.addSelectionListener(this);
- formCombo.add("");
- formCombo.add("qualified"); //$NON-NLS-1$
- formCombo.add("unqualified"); //$NON-NLS-1$
- formCombo.addSelectionListener(this);
-
- // dummy
- getWidgetFactory().createCLabel(composite, ""); //$NON-NLS-1$
- }
-
- private void fillTypesCombo()
- {
- IEditorPart editor = getActiveEditor();
- XSDTypeReferenceEditManager manager = (XSDTypeReferenceEditManager)editor.getAdapter(XSDTypeReferenceEditManager.class);
- if (manager != null)
- {
- ComponentSpecification[] items = manager.getQuickPicks();
-
- typeCombo.removeAll();
- typeCombo.add(Messages._UI_COMBO_BROWSE);
- typeCombo.add(Messages._UI_COMBO_NEW);
- for (int i = 0; i < items.length; i++)
- {
- typeCombo.add(items[i].getName());
- }
-
- XSDAttributeDeclaration namedComponent = ((XSDAttributeDeclaration) input).getResolvedAttributeDeclaration();
- XSDTypeDefinition namedComponentType = namedComponent.getType();
- if (namedComponentType != null)
- {
- String currentTypeName = namedComponentType.getQName(xsdSchema); // no
- // prefix
- ComponentSpecification ret = getComponentSpecFromQuickPickForValue(currentTypeName, manager);
- if (ret == null) // not in quickPick
- typeCombo.add(currentTypeName);
- }
- }
- }
-
- private ComponentSpecification getComponentSpecFromQuickPickForValue(String value, ComponentReferenceEditManager editManager)
- {
- if (editManager != null)
- {
- ComponentSpecification[] quickPicks = editManager.getQuickPicks();
- if (quickPicks != null)
- {
- for (int i=0; i < quickPicks.length; i++)
- {
- ComponentSpecification componentSpecification = quickPicks[i];
- if (value !=null && componentSpecification!=null && value.equals(componentSpecification.getName()))
- {
- return componentSpecification;
- }
- }
- }
- }
- return null;
- }
-
- /*
- * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh()
- */
- public void refresh()
- {
- super.refresh();
-
- setListenerEnabled(false);
-
- // refresh name
-
- nameText.setText(""); //$NON-NLS-1$
- if (input instanceof XSDAttributeDeclaration)
- {
- XSDAttributeDeclaration namedComponent = ((XSDAttributeDeclaration) input).getResolvedAttributeDeclaration();
-
- String name = namedComponent.getName();
- if (name != null)
- {
- nameText.setText(name);
- }
- }
-
- if (isAttributeReference)
- {
- refreshRefCombo();
- }
-
- // refresh type
-
- typeCombo.setText(""); //$NON-NLS-1$
- if (input != null)
- {
- if (input instanceof XSDAttributeDeclaration)
- {
- XSDAttributeDeclaration xsdAttribute = (XSDAttributeDeclaration) input;
- isAttributeReference = ((XSDAttributeDeclaration)input).isAttributeDeclarationReference();
- XSDTypeDefinition typeDef = xsdAttribute.getResolvedAttributeDeclaration().getTypeDefinition();
- boolean isAnonymous = xsdAttribute.getAnonymousTypeDefinition() != null;
-
- if (isAnonymous)
- {
- typeCombo.setText("**anonymous**"); //$NON-NLS-1$
- }
- else
- {
- fillTypesCombo();
- 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$
- }
- }
-
- usageCombo.setText("");
- usageCombo.setEnabled(!xsdAttribute.isGlobal());
-
- Element element = xsdAttribute.getElement();
- boolean hasUseAttribute = false;
- if (element != null)
- {
- hasUseAttribute = element.hasAttribute(XSDConstants.USE_ATTRIBUTE);
- if (hasUseAttribute)
- {
- String usage = element.getAttribute(XSDConstants.USE_ATTRIBUTE);
- usageCombo.setText(usage);
- }
- }
-
- defaultOrFixedText.setText(""); //$NON-NLS-1$
-
- boolean hasDefaultAttribute = false, hasFixedAttribute = false;
- if (element != null)
- {
- hasDefaultAttribute = element.hasAttribute(XSDConstants.DEFAULT_ATTRIBUTE);
- hasFixedAttribute = element.hasAttribute(XSDConstants.FIXED_ATTRIBUTE);
-
- // Case where no fixed or default attributes exist, so ensure one of the radio buttons is selected
- if (!hasDefaultAttribute && !hasFixedAttribute)
- {
- if (!defaultButton.getSelection() && !fixedButton.getSelection()) // if none are selected then pick fixed
- fixedButton.setSelection(true);
- }
- else
- {
- // if both are present in source (an error!), assume that *fixed* takes "precedence"
- defaultButton.setSelection(!hasFixedAttribute && hasDefaultAttribute);
- fixedButton.setSelection(hasFixedAttribute);
- if (hasDefaultAttribute)
- {
- String theDefault = element.getAttribute(XSDConstants.DEFAULT_ATTRIBUTE);
- defaultOrFixedText.setText(theDefault);
- }
- if (hasFixedAttribute) // will overwrite default if both present
- {
- String fixed = element.getAttribute(XSDConstants.FIXED_ATTRIBUTE);
- defaultOrFixedText.setText(fixed);
- }
- }
- }
-
- formCombo.setText("");
- formCombo.setEnabled(!xsdAttribute.isGlobal() && !isAttributeReference);
- boolean hasFormAttribute = false;
- if (element != null)
- {
- hasFormAttribute = element.hasAttribute(XSDConstants.FORM_ATTRIBUTE);
- if (hasFormAttribute)
- {
- String form = element.getAttribute(XSDConstants.FORM_ATTRIBUTE);
- formCombo.setText(form);
- }
- }
- }
- }
-
- setListenerEnabled(true);
- }
-
- public boolean shouldUseExtraSpace()
- {
- return false;
- }
-
- public void doWidgetDefaultSelected(SelectionEvent e)
- {
- if (e.widget == typeCombo)
- {
- String selection = typeCombo.getText();
- if (shouldPerformComboSelection(SWT.DefaultSelection, selection))
- handleWidgetSelection(e);
- } else if (e.widget == componentNameCombo)
- {
- String selection = componentNameCombo.getText();
- if (shouldPerformComboSelection(SWT.DefaultSelection, selection))
- handleWidgetSelection(e);
- } else
- {
- handleWidgetSelection(e);
- }
- }
-
- public void doWidgetSelected(SelectionEvent e)
- {
- if (e.widget == typeCombo)
- {
- String selection = typeCombo.getText();
- if (shouldPerformComboSelection(SWT.Selection, selection))
- handleWidgetSelection(e);
- } else if (e.widget == componentNameCombo)
- {
- String selection = componentNameCombo.getText();
- if (shouldPerformComboSelection(SWT.Selection, selection))
- handleWidgetSelection(e);
- } else
- {
- handleWidgetSelection(e);
- }
- }
-
- private void handleWidgetSelection(SelectionEvent e)
- {
- if (e.widget == typeCombo)
- {
- IEditorPart editor = getActiveEditor();
- if (editor == null) return;
- ComponentReferenceEditManager manager = (ComponentReferenceEditManager)editor.getAdapter(XSDTypeReferenceEditManager.class);
-
- String selection = typeCombo.getText();
- ComponentSpecification newValue;
- IComponentDialog dialog= null;
- if ( selection.equals(Messages._UI_COMBO_BROWSE))
- {
- dialog = manager.getBrowseDialog();
- ((XSDSearchListDialogDelegate) dialog).showComplexTypes(false);
- }
- else if ( selection.equals(Messages._UI_COMBO_NEW))
- {
- dialog = manager.getNewDialog();
- ((NewTypeDialog) dialog).allowComplexType(false);
- }
-
- if (dialog != null)
- {
- if (dialog.createAndOpen() == Window.OK)
- {
- newValue = dialog.getSelectedComponent();
- XSDAttributeDeclaration xsdAttribute = ((XSDAttributeDeclaration) input).getResolvedAttributeDeclaration();
- manager.modifyComponentReference(xsdAttribute, newValue);
- }
- else{
- typeCombo.setText(typeName);
- }
- }
- else //use the value from selected quickPick item
- {
- newValue = getComponentSpecFromQuickPickForValue(selection, manager);
- if (newValue != null)
- manager.modifyComponentReference(input, newValue);
- }
- }
- else if (e.widget == componentNameCombo)
- {
- IEditorPart editor = getActiveEditor();
- if (editor == null) return;
- ComponentReferenceEditManager manager = (ComponentReferenceEditManager)editor.getAdapter(XSDAttributeReferenceEditManager.class);
-
- String selection = componentNameCombo.getText();
- ComponentSpecification newValue;
- IComponentDialog dialog= null;
- if ( selection.equals(Messages._UI_COMBO_BROWSE))
- {
- dialog = manager.getBrowseDialog();
- }
- else if ( selection.equals(Messages._UI_COMBO_NEW))
- {
- dialog = manager.getNewDialog();
- }
-
- if (dialog != null)
- {
- if (dialog.createAndOpen() == Window.OK)
- {
- newValue = dialog.getSelectedComponent();
- manager.modifyComponentReference(input, newValue);
- }
- else
- {
- componentNameCombo.setText(refName);
- }
- }
- else //use the value from selected quickPick item
- {
- newValue = getComponentSpecFromQuickPickForValue(selection, manager);
- if (newValue != null)
- manager.modifyComponentReference(input, newValue);
- }
- }
- else
- {
- XSDAttributeDeclaration xsdAttribute = (XSDAttributeDeclaration) input;
- Element element = xsdAttribute.getElement();
- if (e.widget == usageCombo)
- {
- final String newValue = usageCombo.getText();
- if (element != null)
- {
- PropertiesChangeCommand command = new PropertiesChangeCommand(element, org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_USAGE)
- {
- protected void doExecuteSteps()
- {
- if (newValue.length() == 0)
- element.removeAttribute(XSDConstants.USE_ATTRIBUTE);
- else
- element.setAttribute(XSDConstants.USE_ATTRIBUTE, newValue);
- }
- };
- getCommandStack().execute(command);
- }
- }
- else if (e.widget == formCombo)
- {
- final String newValue = formCombo.getText();
- if (element != null)
- {
- PropertiesChangeCommand command = new PropertiesChangeCommand(element, org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_LABEL_FORM)
- {
- protected void doExecuteSteps()
- {
- if (newValue.length() == 0)
- element.removeAttribute(XSDConstants.FORM_ATTRIBUTE);
- else
- element.setAttribute(XSDConstants.FORM_ATTRIBUTE, newValue);
- }
- };
- getCommandStack().execute(command);
- }
- }
- else if (e.widget == defaultButton)
- {
- boolean newValue = defaultButton.getSelection();
- if (element != null)
- {
- if (newValue)
- {
- if (element.hasAttribute(XSDConstants.FIXED_ATTRIBUTE))
- {
- final String value = element.getAttribute(XSDConstants.FIXED_ATTRIBUTE);
-
- PropertiesChangeCommand command = new PropertiesChangeCommand(element, org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_DEFAULT)
- {
- protected void doExecuteSteps()
- {
- element.removeAttribute(XSDConstants.FIXED_ATTRIBUTE);
- element.setAttribute(XSDConstants.DEFAULT_ATTRIBUTE, value);
- }
- };
- getCommandStack().execute(command);
- }
- }
- }
- }
- else if (e.widget == fixedButton)
- {
- boolean newValue = fixedButton.getSelection();
- if (element != null)
- {
- if (newValue)
- {
- if (element.hasAttribute(XSDConstants.DEFAULT_ATTRIBUTE))
- {
- final String value = element.getAttribute(XSDConstants.DEFAULT_ATTRIBUTE);
- PropertiesChangeCommand command = new PropertiesChangeCommand(element, org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_FIXED)
- {
- protected void doExecuteSteps()
- {
- element.removeAttribute(XSDConstants.DEFAULT_ATTRIBUTE);
- element.setAttribute(XSDConstants.FIXED_ATTRIBUTE, value);
- }
- };
- getCommandStack().execute(command);
- }
- }
- }
- }
- }
- super.doWidgetSelected(e);
- }
-
- protected void doHandleEvent(Event event)
- {
- if (event.type == SWT.Traverse) {
- if (event.detail == SWT.TRAVERSE_ARROW_NEXT || event.detail == SWT.TRAVERSE_ARROW_PREVIOUS) {
- isTraversing = true;
- return;
- }
- }
- 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(org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_ACTION_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();
- }
-
- }
- }
- else if (event.widget == defaultOrFixedText)
- {
- XSDAttributeDeclaration xsdAttribute = (XSDAttributeDeclaration) input;
- String newValue = defaultOrFixedText.getText();
- Element element = xsdAttribute.getElement();
- if (element != null)
- {
- if (newValue.length() == 0)
- {
- PropertiesChangeCommand command = new PropertiesChangeCommand(element, org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_LABEL_VALUE)
- {
- protected void doExecuteSteps()
- {
- element.removeAttribute(XSDConstants.FIXED_ATTRIBUTE);
- element.removeAttribute(XSDConstants.DEFAULT_ATTRIBUTE);
- }
- };
- getCommandStack().execute(command);
- }
- else
- {
- UpdateAttributeValueCommand command = null;
- if (fixedButton.getSelection())
- {
- command = new UpdateAttributeValueCommand(element, XSDConstants.FIXED_ATTRIBUTE, newValue, org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_FIXED)
- {
- protected void doPostProcessing()
- {
- element.removeAttribute(XSDConstants.DEFAULT_ATTRIBUTE);
- }
- };
- }
- else
- {
- command = new UpdateAttributeValueCommand(element, XSDConstants.DEFAULT_ATTRIBUTE, newValue, org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_DEFAULT)
- {
- protected void doPostProcessing()
- {
- element.removeAttribute(XSDConstants.FIXED_ATTRIBUTE);
- }
- };
- }
- command.setDeleteIfEmpty(true);
- getCommandStack().execute(command);
- }
- }
- }
- }
-
- 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(org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_ERROR_INVALID_NAME);
- return false;
- }
-
- return true;
- }
-
- public void dispose()
- {
- if (componentNameCombo != null && !componentNameCombo.isDisposed())
- {
- componentNameCombo.removeSelectionListener(this);
- componentNameCombo.removeListener(SWT.Traverse, this);
- }
- if (nameText != null && !nameText.isDisposed())
- removeListeners(nameText);
- if (typeCombo != null && !typeCombo.isDisposed())
- {
- typeCombo.removeSelectionListener(this);
- typeCombo.removeListener(SWT.Traverse, this);
- }
- super.dispose();
- }
-
- public void setInput(IWorkbenchPart part, ISelection selection)
- {
- super.setInput(part, selection);
- setListenerEnabled(false);
- init();
- relayout();
-
- setListenerEnabled(true);
- }
-
- protected void init()
- {
- if (input instanceof XSDAttributeDeclaration)
- {
- XSDAttributeDeclaration xsdAttribute = (XSDAttributeDeclaration) input;
- isAttributeReference = xsdAttribute.isAttributeDeclarationReference();
- hideHyperLink = !xsdAttribute.isGlobal() || isAttributeReference;
- }
- }
-
- 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();
- }
-
- protected void refreshRefCombo()
- {
- componentNameCombo.setText(""); //$NON-NLS-1$
- fillComponentNameCombo();
- }
-
- private void fillComponentNameCombo()
- {
- IEditorPart editor = getActiveEditor();
- ComponentReferenceEditManager manager = (ComponentReferenceEditManager)editor.getAdapter(XSDAttributeReferenceEditManager.class);
-
- componentNameCombo.removeAll();
- componentNameCombo.add(Messages._UI_ACTION_BROWSE);
- componentNameCombo.add(Messages._UI_ACTION_NEW);
- ComponentSpecification[] quickPicks = manager.getQuickPicks();
- if (quickPicks != null)
- {
- for (int i=0; i < quickPicks.length; i++)
- {
- ComponentSpecification componentSpecification = quickPicks[i];
- componentNameCombo.add(componentSpecification.getName());
- }
- }
- ComponentSpecification[] history = manager.getHistory();
- if (history != null)
- {
- for (int i=0; i < history.length; i++)
- {
- ComponentSpecification componentSpecification = history[i];
- componentNameCombo.add(componentSpecification.getName());
- }
- }
-
- XSDAttributeDeclaration namedComponent = (XSDAttributeDeclaration) input;
- Element element = namedComponent.getElement();
- if (element != null)
- {
- String attrValue = element.getAttribute(XSDConstants.REF_ATTRIBUTE);
- if (attrValue == null)
- {
- attrValue = ""; //$NON-NLS-1$
- }
- ComponentSpecification ret = getComponentSpecFromQuickPickForValue(attrValue, manager);
- if (ret == null)
- {
- componentNameCombo.add(attrValue);
- }
- componentNameCombo.setText(attrValue);
- refName = attrValue;
- }
- }
-
- protected class PropertiesChangeCommand extends BaseCommand
- {
- protected Element element;
- public PropertiesChangeCommand(Element element, String label)
- {
- super(NLS.bind(org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_ACTION_CHANGE, label));
- this.element = element;
- }
-
- public void execute()
- {
- try
- {
- beginRecording(element);
- doExecuteSteps();
- }
- finally
- {
- endRecording();
- }
- }
-
- protected void doExecuteSteps()
- {
-
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDAttributeGroupDefinitionSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDAttributeGroupDefinitionSection.java
deleted file mode 100644
index 8a409f0d03..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDAttributeGroupDefinitionSection.java
+++ /dev/null
@@ -1,295 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections;
-
-import 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.ui.PlatformUI;
-import org.eclipse.wst.xsd.ui.internal.common.commands.UpdateNameCommand;
-import org.eclipse.wst.xsd.ui.internal.common.util.Messages;
-import org.eclipse.wst.xsd.ui.internal.common.util.XSDDirectivesManager;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorCSHelpIds;
-import org.eclipse.wst.xsd.ui.internal.util.TypesHelper;
-import org.eclipse.xsd.XSDAttributeGroupDefinition;
-import org.eclipse.xsd.XSDNamedComponent;
-import org.eclipse.xsd.util.XSDConstants;
-import org.w3c.dom.Element;
-
-public class XSDAttributeGroupDefinitionSection extends RefactoringSection
-{
- protected Text nameText;
- protected CCombo refCombo;
- boolean isReference;
-
- public XSDAttributeGroupDefinitionSection()
- {
- super();
- }
-
- protected void createContents(Composite parent)
- {
- composite = getWidgetFactory().createFlatFormComposite(parent);
-
- GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 3;
- 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;
-
- refCombo = getWidgetFactory().createCCombo(composite, SWT.FLAT);
- refCombo.addSelectionListener(this);
- refCombo.setLayoutData(data);
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(refCombo,
- XSDEditorCSHelpIds.GENERAL_TAB__ATTRIBUTEGROUP_REFS__REF);
- }
- else
- {
- // ------------------------------------------------------------------
- // NameLabel
- // ------------------------------------------------------------------
- GridData data = new GridData();
- data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
- data.grabExcessHorizontalSpace = false;
- CLabel nameLabel = getWidgetFactory().createCLabel(composite, Messages._UI_LABEL_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);
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(nameText,
- XSDEditorCSHelpIds.GENERAL_TAB__ATTRIBUTEGROUP__NAME);
-
- // ------------------------------------------------------------------
- // Refactor/rename hyperlink
- // ------------------------------------------------------------------
- if (!hideHyperLink)
- {
- createRenameHyperlink(composite);
- setRenameHyperlinkEnabled(!isReference);
- }
- else
- {
- getWidgetFactory().createCLabel(composite, "");
- }
- }
- }
-
- 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 = ""; //$NON-NLS-1$
- }
- refCombo.setText(attrValue);
- }
- }
- else
- {
- // refresh name
- nameText.setText(""); //$NON-NLS-1$
-
- 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.getGlobalAttributeGroups();
- items.add(0, ""); //$NON-NLS-1$
- refCombo.setItems((String [])items.toArray(new String[0]));
- }
- }
-
- 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();
- }
-
- protected void init()
- {
- if (input instanceof XSDAttributeGroupDefinition)
- {
- XSDAttributeGroupDefinition group = (XSDAttributeGroupDefinition) input;
- isReference = group.isAttributeGroupDefinitionReference();
- hideHyperLink = isReference;
- }
- }
-
- 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(Messages._UI_ACTION_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(Messages._UI_ERROR_INVALID_NAME);
- return false;
- }
-
- return true;
- }
-
- public void doWidgetSelected(SelectionEvent e)
- {
- if (e.widget == refCombo)
- {
- String newValue = refCombo.getText();
- if (input instanceof XSDNamedComponent)
- {
- XSDNamedComponent namedComponent = (XSDNamedComponent)input;
- Element element = namedComponent.getElement();
-
- if (namedComponent instanceof XSDAttributeGroupDefinition)
- {
- element.setAttribute(XSDConstants.REF_ATTRIBUTE, newValue);
- XSDDirectivesManager.removeUnusedXSDImports(namedComponent.getSchema());
- }
- }
- }
- super.doWidgetSelected(e);
- }
-
-
- public void dispose()
- {
- if (nameText != null && !nameText.isDisposed())
- removeListeners(nameText);
- super.dispose();
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDComplexTypeAdvancedSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDComplexTypeAdvancedSection.java
deleted file mode 100644
index 4c4f99d749..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDComplexTypeAdvancedSection.java
+++ /dev/null
@@ -1,257 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections;
-
-import org.eclipse.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.ui.internal.common.commands.UpdateAttributeValueCommand;
-import org.eclipse.wst.xsd.ui.internal.common.util.Messages;
-import org.eclipse.xsd.XSDComplexTypeDefinition;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.util.XSDConstants;
-
-public class XSDComplexTypeAdvancedSection extends AbstractSection
-{
- private static final String EMPTY = ""; //$NON-NLS-1$
- private static final String FALSE = "false"; //$NON-NLS-1$
- private static final String TRUE = "true"; //$NON-NLS-1$
- protected CCombo blockCombo;
- protected CCombo finalCombo;
- protected CCombo mixedCombo;
- protected CCombo abstractCombo;
-
- private String finalValues[] = { EMPTY, XSDConstants.RESTRICTION_ELEMENT_TAG, //$NON-NLS-1$
- XSDConstants.EXTENSION_ELEMENT_TAG, "#" + XSDConstants.ALL_ELEMENT_TAG }; //$NON-NLS-1$
-
- private String blockValues[] = { EMPTY, XSDConstants.RESTRICTION_ELEMENT_TAG, //$NON-NLS-1$
- XSDConstants.EXTENSION_ELEMENT_TAG, "#" + XSDConstants.ALL_ELEMENT_TAG }; //$NON-NLS-1$
-
- private String booleanValues[] = { EMPTY, TRUE, FALSE }; // TODO use some
- // external string
- // here instead
- protected void createContents(Composite parent)
- {
- composite = getWidgetFactory().createFlatFormComposite(parent);
-
- GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 2;
- composite.setLayout(gridLayout);
-
- // ------------------------------------------------------------------
- // AbstractLabel
- // ------------------------------------------------------------------
- GridData data = new GridData();
- data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
- data.grabExcessHorizontalSpace = false;
-
- CLabel abstractLabel = getWidgetFactory().createCLabel(composite, Messages._UI_LABEL_ABSTRACT);
- abstractLabel.setLayoutData(data);
-
- // ------------------------------------------------------------------
- // AbstractCombo
- // ------------------------------------------------------------------
- data = new GridData();
- data.grabExcessHorizontalSpace = true;
- data.horizontalAlignment = GridData.FILL;
- abstractCombo = getWidgetFactory().createCCombo(composite);
- abstractCombo.setLayoutData(data);
- abstractCombo.setEditable(false);
-
- abstractCombo.setItems(booleanValues);
- abstractCombo.addSelectionListener(this);
-
- // ------------------------------------------------------------------
- // BlockLabel
- // ------------------------------------------------------------------
- data = new GridData();
- data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
- data.grabExcessHorizontalSpace = false;
-
- CLabel blockLabel = getWidgetFactory().createCLabel(composite, Messages._UI_LABEL_BLOCK);
- blockLabel.setLayoutData(data);
-
- // ------------------------------------------------------------------
- // BlockCombo
- // ------------------------------------------------------------------
- data = new GridData();
- data.grabExcessHorizontalSpace = true;
- data.horizontalAlignment = GridData.FILL;
- blockCombo = getWidgetFactory().createCCombo(composite);
- blockCombo.setLayoutData(data);
- blockCombo.setEditable(false);
-
- blockCombo.setItems(blockValues);
- blockCombo.addSelectionListener(this);
-
- // ------------------------------------------------------------------
- // FinalLabel
- // ------------------------------------------------------------------
- data = new GridData();
- data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
- data.grabExcessHorizontalSpace = false;
-
- CLabel finalLabel = getWidgetFactory().createCLabel(composite, Messages._UI_LABEL_FINAL);
- finalLabel.setLayoutData(data);
-
- // ------------------------------------------------------------------
- // FinalCombo
- // ------------------------------------------------------------------
- data = new GridData();
- data.grabExcessHorizontalSpace = true;
- data.horizontalAlignment = GridData.FILL;
- finalCombo = getWidgetFactory().createCCombo(composite);
- finalCombo.setLayoutData(data);
- finalCombo.setEditable(false);
-
- finalCombo.setItems(finalValues);
- finalCombo.addSelectionListener(this);
-
- // ------------------------------------------------------------------
- // Mixed Label
- // ------------------------------------------------------------------
- data = new GridData();
- data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
- data.grabExcessHorizontalSpace = false;
-
- CLabel mixedLabel = getWidgetFactory().createCLabel(composite, Messages._UI_LABEL_MIXED);
- mixedLabel.setLayoutData(data);
-
- // ------------------------------------------------------------------
- // Mixed Combo
- // ------------------------------------------------------------------
- data = new GridData();
- data.grabExcessHorizontalSpace = true;
- data.horizontalAlignment = GridData.FILL;
- mixedCombo = getWidgetFactory().createCCombo(composite);
- mixedCombo.setLayoutData(data);
- mixedCombo.setEditable(false);
-
- mixedCombo.setItems(booleanValues);
- mixedCombo.addSelectionListener(this);
-
- }
-
- public void doWidgetSelected(SelectionEvent e)
- {
- XSDComplexTypeDefinition complexType = (XSDComplexTypeDefinition) input;
- if (e.widget == blockCombo)
- {
- String value = blockCombo.getText();
- UpdateAttributeValueCommand command = new UpdateAttributeValueCommand(complexType.getElement(), XSDConstants.BLOCK_ATTRIBUTE, value, Messages._UI_LABEL_BLOCK);
- command.setDeleteIfEmpty(true);
- getCommandStack().execute(command);
- }
- else if (e.widget == finalCombo)
- {
- String value = finalCombo.getText();
- UpdateAttributeValueCommand command = new UpdateAttributeValueCommand(complexType.getElement(), XSDConstants.FINAL_ATTRIBUTE, value, Messages._UI_LABEL_FINAL);
- command.setDeleteIfEmpty(true);
- getCommandStack().execute(command);
- }
- else if (e.widget == abstractCombo)
- {
- String value = abstractCombo.getText();
- UpdateAttributeValueCommand command = new UpdateAttributeValueCommand(complexType.getElement(), XSDConstants.ABSTRACT_ATTRIBUTE, value, Messages._UI_LABEL_ABSTRACT);
- command.setDeleteIfEmpty(true);
- getCommandStack().execute(command);
- }
- else if (e.widget == mixedCombo)
- {
- String value = mixedCombo.getText();
- UpdateAttributeValueCommand command = new UpdateAttributeValueCommand(complexType.getElement(), XSDConstants.MIXED_ATTRIBUTE, value, Messages._UI_LABEL_MIXED);
- command.setDeleteIfEmpty(true);
- getCommandStack().execute(command);
- }
- }
-
- public void refresh()
- {
- super.refresh();
-
- setListenerEnabled(false);
- try
- {
- if (input instanceof XSDComplexTypeDefinition)
- {
- XSDComplexTypeDefinition complexType = (XSDComplexTypeDefinition) input;
-
- boolean enabled = true;
- if (complexType.getContainer() instanceof XSDSchema)
- {
- enabled = !isReadOnly;
- }
- else
- {
- enabled = false;
- }
-
- if (complexType.getElement().hasAttribute(XSDConstants.BLOCK_ATTRIBUTE))
- {
- String blockAttValue = complexType.getElement().getAttribute(XSDConstants.BLOCK_ATTRIBUTE);
- blockCombo.setText(blockAttValue);
- }
- else
- {
- blockCombo.setText(EMPTY);
- }
- blockCombo.setEnabled(enabled);
-
- if (complexType.getElement().hasAttribute(XSDConstants.FINAL_ATTRIBUTE))
- {
- String finalAttValue = complexType.getElement().getAttribute(XSDConstants.FINAL_ATTRIBUTE);
- finalCombo.setText(finalAttValue);
- }
- else
- {
- finalCombo.setText(EMPTY);
- }
- finalCombo.setEnabled(enabled);
-
- if (complexType.getElement().hasAttribute(XSDConstants.ABSTRACT_ATTRIBUTE))
- {
- boolean absAttValue = complexType.isAbstract();
- if (absAttValue)
- abstractCombo.setText(TRUE);
- else
- abstractCombo.setText(FALSE);
- }
- else
- {
- abstractCombo.setText(EMPTY);
- }
- abstractCombo.setEnabled(enabled);
-
- if (complexType.getElement().hasAttribute(XSDConstants.MIXED_ATTRIBUTE))
- {
- boolean mixedValue = complexType.isMixed();
- if (mixedValue)
- mixedCombo.setText(TRUE);
- else
- mixedCombo.setText(FALSE);
- }
- else
- {
- mixedCombo.setText(EMPTY);
- }
-
- }
- }
- catch (Exception e)
- {
- }
- setListenerEnabled(true);
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDComplexTypeSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDComplexTypeSection.java
deleted file mode 100644
index ce8fecb970..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDComplexTypeSection.java
+++ /dev/null
@@ -1,410 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections;
-
-import org.apache.xerces.util.XMLChar;
-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.events.SelectionListener;
-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.Event;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification;
-import org.eclipse.wst.xsd.ui.internal.adt.edit.ComponentReferenceEditManager;
-import org.eclipse.wst.xsd.ui.internal.adt.edit.IComponentDialog;
-import org.eclipse.wst.xsd.ui.internal.common.commands.UpdateComplexTypeDerivationBy;
-import org.eclipse.wst.xsd.ui.internal.common.commands.UpdateNameCommand;
-import org.eclipse.wst.xsd.ui.internal.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDComplexTypeBaseTypeEditManager;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorCSHelpIds;
-import org.eclipse.wst.xsd.ui.internal.util.XSDDOMHelper;
-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;
-
-public class XSDComplexTypeSection extends RefactoringSection implements SelectionListener
-{
- protected Text nameText;
- protected CCombo baseTypeCombo;
- protected CCombo derivedByCombo;
- private String derivedByChoicesComboValues[] = { "", XSDConstants.RESTRICTION_ELEMENT_TAG, XSDConstants.EXTENSION_ELEMENT_TAG }; //$NON-NLS-1$
-
- 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, Messages.UI_LABEL_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);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(nameText,
- XSDEditorCSHelpIds.GENERAL_TAB__COMPLEX_TYPE__NAME);
-
- // ------------------------------------------------------------------
- // Refactor/rename hyperlink
- // ------------------------------------------------------------------
- createRenameHyperlink(composite);
-
- // ------------------------------------------------------------------
- // 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().createCCombo(composite);
- baseTypeCombo.setEditable(false);
- baseTypeCombo.setLayoutData(data);
- baseTypeCombo.addSelectionListener(this);
- baseTypeCombo.addListener(SWT.Traverse, this);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(baseTypeCombo,
- XSDEditorCSHelpIds.GENERAL_TAB__COMPLEX_TYPE__INHERIT_FROM);
-
-
- // ------------------------------------------------------------------
- // Spacer label
- // ------------------------------------------------------------------
- getWidgetFactory().createCLabel(composite, "");
-
- // ------------------------------------------------------------------
- // 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);
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(derivedByCombo,
- XSDEditorCSHelpIds.GENERAL_TAB__COMPLEX_TYPE__INHERIT_BY);
-
- // ------------------------------------------------------------------
- // Spacer label
- // ------------------------------------------------------------------
- getWidgetFactory().createCLabel(composite, "");
- }
-
- /*
- * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh()
- */
- public void refresh()
- {
- super.refresh();
- if (Display.getCurrent() == null)
- return;
-
- setListenerEnabled(false);
- showLink(!hideHyperLink);
-
- try
- {
- nameText.setText(""); //$NON-NLS-1$
- baseTypeCombo.setText(""); //$NON-NLS-1$
- fillTypesCombo();
-
- if (input instanceof XSDComplexTypeDefinition)
- {
- XSDComplexTypeDefinition complexType = (XSDComplexTypeDefinition) input;
- String name = complexType.getName();
- if (name == null)
- name = ""; //$NON-NLS-1$
-
- boolean isAnonymousType = name.equals("") ? true : false; //$NON-NLS-1$
- 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 = ""; //$NON-NLS-1$
- }
- else if (baseType.equals("anyType"))
- {
- baseType = ""; //$NON-NLS-1$
- }
- }
- baseTypeCombo.setText(baseType);
-
- derivedByCombo.setText(""); //$NON-NLS-1$
- int derivationMethod = complexType.getDerivationMethod().getValue();
- XSDDOMHelper domHelper = new XSDDOMHelper();
- if(domHelper.getDerivedByElementFromComplexType(complexType.getElement()) != null) {
- if (derivationMethod == XSDDerivationMethod.EXTENSION)
- {
- derivedByCombo.setText(XSDConstants.EXTENSION_ELEMENT_TAG);
- }
- else if (derivationMethod == XSDDerivationMethod.RESTRICTION)
- {
- derivedByCombo.setText(XSDConstants.RESTRICTION_ELEMENT_TAG);
- }
- }
- }
-
- }
- finally
- {
- setListenerEnabled(true);
- }
- }
-
- public void doWidgetDefaultSelected(SelectionEvent e)
- {
- if (e.widget == baseTypeCombo)
- {
- String selection = baseTypeCombo.getText();
- if (shouldPerformComboSelection(SWT.DefaultSelection, selection))
- handleWidgetSelection(e);
- } else
- {
- handleWidgetSelection(e);
- }
- }
-
- public void doWidgetSelected(SelectionEvent e)
- {
- if (e.widget == baseTypeCombo)
- {
- String selection = baseTypeCombo.getText();
- if (shouldPerformComboSelection(SWT.Selection, selection))
- handleWidgetSelection(e);
- } else
- {
- handleWidgetSelection(e);
- }
- }
-
- private void handleWidgetSelection(SelectionEvent e)
- {
- if (e.widget == baseTypeCombo)
- {
- IEditorPart editor = getActiveEditor();
- if (editor == null) return;
- ComponentReferenceEditManager manager = (ComponentReferenceEditManager)editor.getAdapter(XSDComplexTypeBaseTypeEditManager.class);
-
- String selection = baseTypeCombo.getText();
- ComponentSpecification newValue;
- IComponentDialog dialog= null;
- if ( selection.equals(Messages._UI_COMBO_BROWSE))
- {
- dialog = manager.getBrowseDialog();
- }
- else if ( selection.equals(Messages._UI_COMBO_NEW))
- {
- dialog = manager.getNewDialog();
- }
-
- if (dialog != null)
- {
- if (dialog.createAndOpen() == Window.OK)
- {
- newValue = dialog.getSelectedComponent();
- manager.modifyComponentReference(input, newValue);
- }
- else
- {
- refresh();
- }
- }
- }
- else if (e.widget == derivedByCombo)
- {
- XSDComplexTypeDefinition complexType = (XSDComplexTypeDefinition) input;
- String value = derivedByCombo.getText();
- Command command = new UpdateComplexTypeDerivationBy(complexType, value);
-
- if (getCommandStack() != null)
- {
- getCommandStack().execute(command);
- }
- }
- super.doWidgetSelected(e);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISection#shouldUseExtraSpace()
- */
- public boolean shouldUseExtraSpace()
- {
- return false;
- }
-
- public void dispose()
- {
- super.dispose();
- if (baseTypeCombo != null && !baseTypeCombo.isDisposed())
- baseTypeCombo.removeListener(SWT.Traverse, this);
- }
-
- public void doHandleEvent(Event event)
- {
- if (event.type == SWT.Traverse) {
- if (event.detail == SWT.TRAVERSE_ARROW_NEXT || event.detail == SWT.TRAVERSE_ARROW_PREVIOUS) {
- isTraversing = true;
- return;
- }
- }
- 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(org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_ACTION_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(org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_ERROR_INVALID_NAME);
- return false;
- }
-
- return true;
- }
-
- public void setInput(IWorkbenchPart part, ISelection selection)
- {
- super.setInput(part, selection);
- setListenerEnabled(false);
- if (input instanceof XSDComplexTypeDefinition)
- {
- XSDComplexTypeDefinition complexType = (XSDComplexTypeDefinition) input;
- hideHyperLink = !(complexType.getContainer() instanceof XSDSchema);
-
- }
-
- setListenerEnabled(true);
- }
-
- private void fillTypesCombo()
- {
- baseTypeCombo.removeAll();
- baseTypeCombo.add(Messages._UI_COMBO_BROWSE);
- baseTypeCombo.add(Messages._UI_COMBO_NEW);
- // Add the current Type of this attribute if needed
- XSDComplexTypeDefinition complexType = (XSDComplexTypeDefinition) input;
- XSDTypeDefinition baseType = complexType.getBaseType();
- if (baseType != null && baseType.getQName() != null)
- {
- String currentTypeName = baseType.getQName(xsdSchema); //no prefix
- if (currentTypeName != null && !currentTypeName.equals("anyType"))
- baseTypeCombo.add(currentTypeName);
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDElementDeclarationAdvancedSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDElementDeclarationAdvancedSection.java
deleted file mode 100644
index 56c6aa98ab..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDElementDeclarationAdvancedSection.java
+++ /dev/null
@@ -1,453 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * David Carver - STAR - added nillable advanced tab option, bug 209356
- *******************************************************************************/
-
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections;
-
-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.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification;
-import org.eclipse.wst.xsd.ui.internal.adt.edit.ComponentReferenceEditManager;
-import org.eclipse.wst.xsd.ui.internal.adt.edit.IComponentDialog;
-import org.eclipse.wst.xsd.ui.internal.common.commands.UpdateAttributeValueCommand;
-import org.eclipse.wst.xsd.ui.internal.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDSubstitutionGroupEditManager;
-import org.eclipse.xsd.XSDElementDeclaration;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.util.XSDConstants;
-import org.w3c.dom.Element;
-
-public class XSDElementDeclarationAdvancedSection extends AbstractSection
-{
- private static final String EMPTY = ""; //$NON-NLS-1$
- private static final String FALSE = "false"; //$NON-NLS-1$
- private static final String TRUE = "true"; //$NON-NLS-1$
- protected CCombo blockCombo;
- protected CCombo finalCombo;
- protected CCombo abstractCombo;
- protected CCombo substGroupCombo;
- protected CCombo nillableCombo;
-
- private String blockValues[] = { EMPTY, "#" + XSDConstants.ALL_ELEMENT_TAG, //$NON-NLS-1$
- XSDConstants.EXTENSION_ELEMENT_TAG, XSDConstants.RESTRICTION_ELEMENT_TAG,
- "substitution" }; //$NON-NLS-1$
-
- private String finalValues[] = { EMPTY, "#" + XSDConstants.ALL_ELEMENT_TAG, XSDConstants.EXTENSION_ELEMENT_TAG, //$NON-NLS-1$
- XSDConstants.RESTRICTION_ELEMENT_TAG }; //$NON-NLS-1$
-
- private String booleanValues[] = { EMPTY, TRUE, FALSE };
-
- protected void createContents(Composite parent)
- {
- composite = getWidgetFactory().createFlatFormComposite(parent);
-
- GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 2;
- composite.setLayout(gridLayout);
-
- // ------------------------------------------------------------------
- // AbstractLabel
- // ------------------------------------------------------------------
- GridData data = new GridData();
- data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
- data.grabExcessHorizontalSpace = false;
-
- CLabel abstractLabel = getWidgetFactory().createCLabel(composite, org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_LABEL_ABSTRACT);
- abstractLabel.setLayoutData(data);
-
- // ------------------------------------------------------------------
- // AbstractCombo
- // ------------------------------------------------------------------
- data = new GridData();
- data.grabExcessHorizontalSpace = true;
- data.horizontalAlignment = GridData.FILL;
- abstractCombo = getWidgetFactory().createCCombo(composite);
- abstractCombo.setLayoutData(data);
- abstractCombo.setEditable(false);
-
- abstractCombo.setItems(booleanValues);
- abstractCombo.addSelectionListener(this);
-
- // ------------------------------------------------------------------
- // BlockLabel
- // ------------------------------------------------------------------
- data = new GridData();
- data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
- data.grabExcessHorizontalSpace = false;
-
- CLabel blockLabel = getWidgetFactory().createCLabel(composite, org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_LABEL_BLOCK);
- blockLabel.setLayoutData(data);
-
- // ------------------------------------------------------------------
- // BlockCombo
- // ------------------------------------------------------------------
- data = new GridData();
- data.grabExcessHorizontalSpace = true;
- data.horizontalAlignment = GridData.FILL;
- blockCombo = getWidgetFactory().createCCombo(composite);
- blockCombo.setLayoutData(data);
- blockCombo.setEditable(false);
-
- blockCombo.setItems(blockValues);
- blockCombo.addSelectionListener(this);
-
- // ------------------------------------------------------------------
- // FinalLabel
- // ------------------------------------------------------------------
- data = new GridData();
- data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
- data.grabExcessHorizontalSpace = false;
-
- CLabel finalLabel = getWidgetFactory().createCLabel(composite, org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_LABEL_FINAL);
- finalLabel.setLayoutData(data);
-
- // ------------------------------------------------------------------
- // FinalCombo
- // ------------------------------------------------------------------
- data = new GridData();
- data.grabExcessHorizontalSpace = true;
- data.horizontalAlignment = GridData.FILL;
- finalCombo = getWidgetFactory().createCCombo(composite);
- finalCombo.setLayoutData(data);
- finalCombo.setEditable(false);
-
- finalCombo.setItems(finalValues);
- finalCombo.addSelectionListener(this);
-
- // ------------------------------------------------------------------
- // Substitution Group Label
- // ------------------------------------------------------------------
- data = new GridData();
- data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
- data.grabExcessHorizontalSpace = false;
-
- CLabel subGroupLabel = getWidgetFactory().createCLabel(composite, org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_LABEL_SUBSTITUTION_GROUP);
- subGroupLabel.setLayoutData(data);
-
- // ------------------------------------------------------------------
- // Substitution Group Combo
- // ------------------------------------------------------------------
- data = new GridData();
- data.grabExcessHorizontalSpace = true;
- data.horizontalAlignment = GridData.FILL;
- substGroupCombo = getWidgetFactory().createCCombo(composite);
- substGroupCombo.setLayoutData(data);
- substGroupCombo.setEditable(true);
- substGroupCombo.addSelectionListener(this);
- substGroupCombo.addListener(SWT.Traverse, this);
- applyAllListeners(substGroupCombo);
-
- // ------------------------------------------------------------------
- // Nillable Label
- // ------------------------------------------------------------------
- data = new GridData();
- data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
- data.grabExcessHorizontalSpace = false;
-
- CLabel nillableLabel = getWidgetFactory().createCLabel(composite, org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_LABEL_NILLABLE);
- nillableLabel.setLayoutData(data);
-
- // ------------------------------------------------------------------
- // NillableCombo
- // ------------------------------------------------------------------
- data = new GridData();
- data.grabExcessHorizontalSpace = true;
- data.horizontalAlignment = GridData.FILL;
- nillableCombo = getWidgetFactory().createCCombo(composite);
- nillableCombo.setLayoutData(data);
- nillableCombo.setEditable(false);
-
- nillableCombo.setItems(booleanValues);
- nillableCombo.addSelectionListener(this);
-
- }
-
- public void doHandleEvent(Event e)
- {
- if (e.widget == substGroupCombo)
- {
- if (e.type == SWT.Traverse) {
- if (e.detail == SWT.TRAVERSE_ARROW_NEXT || e.detail == SWT.TRAVERSE_ARROW_PREVIOUS)
- {
- isTraversing = true;
- return;
- }
- }
-
- XSDElementDeclaration eleDec = (XSDElementDeclaration) input;
- String value = substGroupCombo.getText();
- String oldValue = eleDec.getElement().getAttribute(XSDConstants.SUBSTITUTIONGROUP_ATTRIBUTE);
- if (oldValue == null)
- oldValue = EMPTY;
- if (value.equals(oldValue))
- return;
-
- UpdateAttributeValueCommand command = new UpdateAttributeValueCommand(eleDec.getElement(), XSDConstants.SUBSTITUTIONGROUP_ATTRIBUTE, value, org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_LABEL_SUBSTITUTION_GROUP);
- command.setDeleteIfEmpty(true);
- getCommandStack().execute(command);
- }
- }
-
- public void doWidgetDefaultSelected(SelectionEvent e)
- {
- if (e.widget == substGroupCombo)
- {
- String selection = substGroupCombo.getText();
- if (shouldPerformComboSelection(SWT.DefaultSelection, selection))
- handleWidgetSelection(e);
- } else
- {
- handleWidgetSelection(e);
- }
- }
-
- public void doWidgetSelected(SelectionEvent e)
- {
- if (e.widget == substGroupCombo)
- {
- String selection = substGroupCombo.getText();
- if (shouldPerformComboSelection(SWT.Selection, selection))
- handleWidgetSelection(e);
- } else
- {
- handleWidgetSelection(e);
- }
- }
-
- private void handleWidgetSelection(SelectionEvent e)
- {
- if (e.widget == blockCombo)
- {
- XSDElementDeclaration eleDec = (XSDElementDeclaration) input;
- String value = blockCombo.getText();
-
- UpdateAttributeValueCommand command = new UpdateAttributeValueCommand(eleDec.getElement(), XSDConstants.BLOCK_ATTRIBUTE, value, org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_LABEL_BLOCK);
- command.setDeleteIfEmpty(true);
- getCommandStack().execute(command);
- }
- else if (e.widget == finalCombo)
- {
- XSDElementDeclaration eleDec = (XSDElementDeclaration) input;
- String value = finalCombo.getText();
-
- UpdateAttributeValueCommand command = new UpdateAttributeValueCommand(eleDec.getElement(), XSDConstants.FINAL_ATTRIBUTE, value, org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_LABEL_FINAL);
- command.setDeleteIfEmpty(true);
- getCommandStack().execute(command);
- }
- else if (e.widget == abstractCombo)
- {
- XSDElementDeclaration eleDec = (XSDElementDeclaration) input;
- String value = abstractCombo.getText();
- UpdateAttributeValueCommand command = new UpdateAttributeValueCommand(eleDec.getElement(), XSDConstants.ABSTRACT_ATTRIBUTE, value, org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_LABEL_ABSTRACT);
- command.setDeleteIfEmpty(true);
- getCommandStack().execute(command);
- }
- else if (e.widget == substGroupCombo)
- {
- IEditorPart editor = getActiveEditor();
- if (editor == null) return;
- ComponentReferenceEditManager manager = (ComponentReferenceEditManager)editor.getAdapter(XSDSubstitutionGroupEditManager.class);
-
- String selection = substGroupCombo.getText();
- ComponentSpecification newValue;
- IComponentDialog dialog= null;
- if ( selection.equals(Messages._UI_COMBO_BROWSE))
- {
- dialog = manager.getBrowseDialog();
- }
- else if ( selection.equals(Messages._UI_COMBO_NEW))
- {
- dialog = manager.getNewDialog();
- }
-
- if (dialog != null)
- {
- if (dialog.createAndOpen() == Window.OK)
- {
- newValue = dialog.getSelectedComponent();
- manager.modifyComponentReference(input, newValue);
- }
- else
- {
- substGroupCombo.setText("");
- }
- }
- else //use the value from selected quickPick item
- {
- newValue = getComponentSpecFromQuickPickForValue(selection, manager);
- if (newValue != null)
- manager.modifyComponentReference(input, newValue);
- }
- }
- else if (e.widget == nillableCombo)
- {
- XSDElementDeclaration eleDec = (XSDElementDeclaration) input;
- String value = nillableCombo.getText();
-
- UpdateAttributeValueCommand command = new UpdateAttributeValueCommand(eleDec.getElement(), XSDConstants.NILLABLE_ATTRIBUTE, value, org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_LABEL_NILLABLE);
- command.setDeleteIfEmpty(true);
- getCommandStack().execute(command);
- }
- }
-
- public void refresh()
- {
- super.refresh();
- fillSubstitutionGroupCombo();
- setListenerEnabled(false);
- try
- {
- if (input instanceof XSDElementDeclaration)
- {
- XSDElementDeclaration eleDec = (XSDElementDeclaration) input;
-
- composite.setEnabled(!isReadOnly);
- if (eleDec.getContainer() instanceof XSDSchema) // global element
- {
- abstractCombo.setEnabled(true);
- finalCombo.setEnabled(true);
- substGroupCombo.setEnabled(true);
- nillableCombo.setEnabled(true);
- }
- else
- {
- abstractCombo.setEnabled(false);
- finalCombo.setEnabled(false);
- substGroupCombo.setEnabled(false);
-
- // Nillable when used in a local element declaration can't be set on
- // on elements that use @ref.
- nillableCombo.setEnabled(!eleDec.isElementDeclarationReference());
- }
-
- Element element = eleDec.getElement();
-
- if (element.hasAttribute(XSDConstants.BLOCK_ATTRIBUTE))
- {
- String blockAttValue = element.getAttribute(XSDConstants.BLOCK_ATTRIBUTE);
- blockCombo.setText(blockAttValue);
- }
- else
- {
- blockCombo.setText(EMPTY);
- }
- // We should show the value of the attribute regardless if it is invalid
- // ie. as the user starts typing 'true' in the source, the properties view
- // should show the value dynamically
- if (element.hasAttribute(XSDConstants.NILLABLE_ATTRIBUTE))
- {
- String attrValue = element.getAttribute(XSDConstants.NILLABLE_ATTRIBUTE);
- nillableCombo.setText(attrValue);
- }
- else
- {
- nillableCombo.setText(EMPTY);
- }
-
- if (element.hasAttribute(XSDConstants.FINAL_ATTRIBUTE))
- {
- String finalAttValue = element.getAttribute(XSDConstants.FINAL_ATTRIBUTE);
- finalCombo.setText(finalAttValue);
- }
- else
- {
- finalCombo.setText(EMPTY);
- }
-
- if (element.hasAttribute(XSDConstants.ABSTRACT_ATTRIBUTE))
- {
- abstractCombo.setText(element.getAttribute(XSDConstants.ABSTRACT_ATTRIBUTE));
- }
- else
- abstractCombo.setText(EMPTY);
-
- if (element.hasAttribute(XSDConstants.SUBSTITUTIONGROUP_ATTRIBUTE))
- {
- substGroupCombo.setText(element.getAttribute(XSDConstants.SUBSTITUTIONGROUP_ATTRIBUTE));
- }
- else
- {
- substGroupCombo.setText(EMPTY);
- }
- }
- }
- catch (Exception e)
- {
- }
- setListenerEnabled(true);
- }
-
- private void fillSubstitutionGroupCombo()
- {
- IEditorPart editor = getActiveEditor();
- ComponentReferenceEditManager manager = (ComponentReferenceEditManager)editor.getAdapter(XSDSubstitutionGroupEditManager.class);
- if (manager != null)
- {
- ComponentSpecification[] items = manager.getQuickPicks();
-
- substGroupCombo.removeAll();
- substGroupCombo.add(Messages._UI_COMBO_BROWSE);
- substGroupCombo.add(Messages._UI_COMBO_NEW);
- for (int i = 0; i < items.length; i++)
- {
- substGroupCombo.add(items[i].getName());
- }
- // Add the current substitution group if needed
- XSDElementDeclaration namedComponent = ((XSDElementDeclaration) input).getSubstitutionGroupAffiliation();
- if (namedComponent != null)
- {
- ComponentSpecification ret = getComponentSpecFromQuickPickForValue(namedComponent.getName(), manager);
- if (ret == null)
- {
- substGroupCombo.add(namedComponent.getQName(xsdSchema));
- }
- }
- }
- }
-
- private ComponentSpecification getComponentSpecFromQuickPickForValue(String value, ComponentReferenceEditManager editManager)
- {
- if (editManager != null)
- {
- ComponentSpecification[] quickPicks = editManager.getQuickPicks();
- if (quickPicks != null)
- {
- for (int i=0; i < quickPicks.length; i++)
- {
- ComponentSpecification componentSpecification = quickPicks[i];
- if (value != null && value.equals(componentSpecification.getName()))
- {
- return componentSpecification;
- }
- }
- }
- }
- return null;
- }
-
- public void dispose()
- {
- if (substGroupCombo != null && !substGroupCombo.isDisposed())
- {
- substGroupCombo.removeListener(SWT.Traverse, this);
- }
- super.dispose();
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDElementDeclarationSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDElementDeclarationSection.java
deleted file mode 100644
index 41223f0c27..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDElementDeclarationSection.java
+++ /dev/null
@@ -1,647 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections;
-
-import org.apache.xerces.util.XMLChar;
-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.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification;
-import org.eclipse.wst.xsd.ui.internal.adt.edit.ComponentReferenceEditManager;
-import org.eclipse.wst.xsd.ui.internal.adt.edit.IComponentDialog;
-import org.eclipse.wst.xsd.ui.internal.common.commands.UpdateNameCommand;
-import org.eclipse.wst.xsd.ui.internal.dialogs.NewTypeDialog;
-import org.eclipse.wst.xsd.ui.internal.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorCSHelpIds;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDElementReferenceEditManager;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDTypeReferenceEditManager;
-import org.eclipse.wst.xsd.ui.internal.editor.search.XSDSearchListDialogDelegate;
-import org.eclipse.xsd.XSDElementDeclaration;
-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 CCombo typeCombo;
- protected CCombo componentNameCombo;
- boolean isElementReference;
- protected String typeName = ""; //$NON-NLS-1$
-
- 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, org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_LABEL_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.setEnabled(!isElementReference);
- applyAllListeners(nameText);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(nameText,
- XSDEditorCSHelpIds.GENERAL_TAB__ELEMENT__NAME);
-
- // ------------------------------------------------------------------
- // Refactor/rename hyperlink
- // ------------------------------------------------------------------
- if (!hideHyperLink)
- {
- createRenameHyperlink(composite);
- setRenameHyperlinkEnabled(!isElementReference);
- }
- else
- {
- getWidgetFactory().createCLabel(composite, "");
- }
-
- // ------------------------------------------------------------------
- // Ref Label
- // ------------------------------------------------------------------
- if (isElementReference)
- {
- data = new GridData();
- data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
- data.grabExcessHorizontalSpace = false;
- CLabel refLabel = getWidgetFactory().createCLabel(composite, org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_LABEL_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.addListener(SWT.Traverse, this);
- componentNameCombo.setLayoutData(data);
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(componentNameCombo,
- XSDEditorCSHelpIds.GENERAL_TAB__ELEMENT__REFERENCE);
-
- // dummy
- getWidgetFactory().createCLabel(composite, ""); //$NON-NLS-1$
- }
-
- // ------------------------------------------------------------------
- // typeLabel
- // ------------------------------------------------------------------
- getWidgetFactory().createCLabel(composite, typeLabel);
-
- // ------------------------------------------------------------------
- // typeCombo
- // ------------------------------------------------------------------
- data = new GridData();
- data.grabExcessHorizontalSpace = true;
- data.horizontalAlignment = GridData.FILL;
-
- typeCombo = getWidgetFactory().createCCombo(composite); //$NON-NLS-1$
- typeCombo.setEditable(false);
- typeCombo.setLayoutData(data);
- typeCombo.addSelectionListener(this);
- typeCombo.addListener(SWT.Traverse, this);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(typeCombo,
- XSDEditorCSHelpIds.GENERAL_TAB__ELEMENT__TYPE);
-
- // ------------------------------------------------------------------
- // DummyLabel
- // ------------------------------------------------------------------
- data = new GridData();
- data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
- data.grabExcessHorizontalSpace = false;
- 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$
- applyAllListeners(minCombo);
- minCombo.addSelectionListener(this);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(minCombo,
- XSDEditorCSHelpIds.GENERAL_TAB__ELEMENT__MIN_OCCURENCE);
-
- // ------------------------------------------------------------------
- // 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$
- applyAllListeners(maxCombo);
- maxCombo.addSelectionListener(this);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(maxCombo,
- XSDEditorCSHelpIds.GENERAL_TAB__ELEMENT__MAX_OCCURENCE);
- }
-
- public void setInput(IWorkbenchPart part, ISelection selection)
- {
- super.setInput(part, selection);
- setListenerEnabled(false);
- init();
- relayout();
-
- setListenerEnabled(true);
- }
-
- protected void init()
- {
- if (input instanceof XSDElementDeclaration)
- {
- XSDElementDeclaration xsdElementDeclaration = (XSDElementDeclaration) input;
- isElementReference = xsdElementDeclaration.isElementDeclarationReference();
-
- hideHyperLink = !xsdElementDeclaration.isGlobal() || isElementReference;
- typeDefinition = xsdElementDeclaration.getResolvedElementDeclaration().getTypeDefinition();
- }
- }
-
- private void fillTypesCombo()
- {
- IEditorPart editor = getActiveEditor();
- ComponentReferenceEditManager manager = (ComponentReferenceEditManager)editor.getAdapter(XSDTypeReferenceEditManager.class);
- if (manager != null)
- {
- ComponentSpecification[] items = manager.getQuickPicks();
-
- typeCombo.removeAll();
- typeCombo.add(Messages._UI_COMBO_BROWSE);
- typeCombo.add(Messages._UI_COMBO_NEW);
- for (int i = 0; i < items.length; i++)
- {
- typeCombo.add(items[i].getName());
- }
- // Add the current Type of this element if needed
- XSDElementDeclaration namedComponent = ((XSDElementDeclaration) input).getResolvedElementDeclaration();
- XSDTypeDefinition td = namedComponent.getType();
- if (td != null)
- {
- String currentTypeName = td.getQName(xsdSchema);
- if (currentTypeName == null) // anonymous type
- currentTypeName = "**Anonymous**";
- ComponentSpecification ret = getComponentSpecFromQuickPickForValue(currentTypeName, manager);
- if (ret == null && currentTypeName != null) // not in quickPick
- {
- typeCombo.add(currentTypeName);
- }
- }
- }
- }
-
- private ComponentSpecification getComponentSpecFromQuickPickForValue(String value, ComponentReferenceEditManager editManager)
- {
- if (editManager != null)
- {
- ComponentSpecification[] quickPicks = editManager.getQuickPicks();
- if (quickPicks != null)
- {
- for (int i=0; i < quickPicks.length; i++)
- {
- ComponentSpecification componentSpecification = quickPicks[i];
- if (value != null && value.equals(componentSpecification.getName()))
- {
- return componentSpecification;
- }
- }
- }
- }
- return null;
- }
-
- /*
- * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh()
- */
- public void refresh()
- {
- setListenerEnabled(false);
-
- super.refresh();
-
- XSDElementDeclaration xsdElementDeclaration = ((XSDElementDeclaration) input).getResolvedElementDeclaration();
-
- // refresh name
- nameText.setText(""); //$NON-NLS-1$
- typeCombo.setText(""); //$NON-NLS-1$
- String name = xsdElementDeclaration.getName();
- if (name != null)
- {
- nameText.setText(name);
- }
-
- if (isElementReference)
- {
- refreshRefCombo();
- }
-
- // refresh type
- if (input != null)
- {
- if (input instanceof XSDElementDeclaration)
- {
- boolean isAnonymous = xsdElementDeclaration.getAnonymousTypeDefinition() != null;
- //XSDTypeDefinition typeDef = XSDUtils.getResolvedType(xsdElementDeclaration);
- XSDTypeDefinition typeDef = xsdElementDeclaration.getResolvedElementDeclaration().getTypeDefinition();
-
- if (typeDef != null)
- typeName = typeDef.getQName(xsdSchema);
-
- if (typeName == null)
- {
- typeName = ""; //$NON-NLS-1$
- }
-
- fillTypesCombo();
- if (isAnonymous)
- {
- typeCombo.setText("**Anonymous**");
- typeName = "**Anonymous**";
- }
- else
- {
- if (typeDefinition != null)
- {
- typeCombo.setText(typeName);
- }
- else
- {
- typeCombo.setText(Messages.UI_NO_TYPE); //$NON-NLS-1$
- }
- }
-
- maxCombo.setEnabled(!xsdElementDeclaration.isGlobal() || isElementReference);
- minCombo.setEnabled(!xsdElementDeclaration.isGlobal() || isElementReference);
- }
- }
-
- // refresh min max
- refreshMinMax();
-
- setListenerEnabled(true);
-
- }
-
- public boolean shouldUseExtraSpace()
- {
- return false;
- }
-
- public void doWidgetDefaultSelected(SelectionEvent e)
- {
- if (e.widget == typeCombo)
- {
- String selection = typeCombo.getText();
- if (shouldPerformComboSelection(SWT.DefaultSelection, selection))
- handleWidgetSelection(e);
- } else if (e.widget == componentNameCombo)
- {
- String selection = componentNameCombo.getText();
- if (shouldPerformComboSelection(SWT.DefaultSelection, selection))
- handleWidgetSelection(e);
- } else
- {
- handleWidgetSelection(e);
- }
- }
-
- public void doWidgetSelected(SelectionEvent e)
- {
- if (e.widget == typeCombo)
- {
- String selection = typeCombo.getText();
- if (shouldPerformComboSelection(SWT.Selection, selection))
- handleWidgetSelection(e);
- } else if (e.widget == componentNameCombo)
- {
- String selection = componentNameCombo.getText();
- if (shouldPerformComboSelection(SWT.Selection, selection))
- handleWidgetSelection(e);
- } else
- {
- handleWidgetSelection(e);
- }
- }
-
- private void handleWidgetSelection(SelectionEvent e)
- {
- if (e.widget == typeCombo)
- {
- IEditorPart editor = getActiveEditor();
- if (editor == null) return;
- ComponentReferenceEditManager manager = (ComponentReferenceEditManager)editor.getAdapter(XSDTypeReferenceEditManager.class);
- String selection = typeCombo.getText();
- ComponentSpecification newValue;
- IComponentDialog dialog= null;
- if ( selection.equals(Messages._UI_COMBO_BROWSE))
- {
- dialog = manager.getBrowseDialog();
- ((XSDSearchListDialogDelegate) dialog).showComplexTypes(true);
- }
- else if ( selection.equals(Messages._UI_COMBO_NEW))
- {
- dialog = manager.getNewDialog();
- ((NewTypeDialog) dialog).allowComplexType(true);
- }
-
- if (dialog != null)
- {
- if (dialog.createAndOpen() == Window.OK)
- {
- newValue = dialog.getSelectedComponent();
- XSDElementDeclaration elementDeclaration = ((XSDElementDeclaration) input).getResolvedElementDeclaration();
- manager.modifyComponentReference(elementDeclaration, newValue);
- }
- else
- {
- typeCombo.setText(typeName );
- }
- }
- else //use the value from selected quickPick item
- {
- newValue = getComponentSpecFromQuickPickForValue(selection, manager);
- if (newValue != null)
- manager.modifyComponentReference(input, newValue);
- }
- }
- else if (e.widget == componentNameCombo)
- {
- IEditorPart editor = getActiveEditor();
- if (editor == null) return;
- ComponentReferenceEditManager manager = (ComponentReferenceEditManager)editor.getAdapter(XSDElementReferenceEditManager.class);
-
- String selection = componentNameCombo.getText();
- ComponentSpecification newValue;
- IComponentDialog dialog= null;
- if ( selection.equals(Messages._UI_COMBO_BROWSE))
- {
- dialog = manager.getBrowseDialog();
- }
- else if ( selection.equals(Messages._UI_COMBO_NEW))
- {
- dialog = manager.getNewDialog();
- }
-
- if (dialog != null)
- {
- if (dialog.createAndOpen() == Window.OK)
- {
- newValue = dialog.getSelectedComponent();
- manager.modifyComponentReference(input, newValue);
- }
- else
- {
- componentNameCombo.setText("");
- }
- }
- else //use the value from selected quickPick item
- {
- newValue = getComponentSpecFromQuickPickForValue(selection, manager);
- if (newValue != null)
- manager.modifyComponentReference(input, 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)
- {
- if (event.type == SWT.Traverse) {
- if (event.detail == SWT.TRAVERSE_ARROW_NEXT || event.detail == SWT.TRAVERSE_ARROW_PREVIOUS) {
- isTraversing = true;
- return;
- }
- }
- 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(org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_ACTION_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(org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_ERROR_INVALID_NAME);
- return false;
- }
-
- return true;
- }
-
- public void dispose()
- {
- if (componentNameCombo != null && !componentNameCombo.isDisposed())
- {
- componentNameCombo.removeSelectionListener(this);
- componentNameCombo.removeListener(SWT.Traverse, this);
- }
- if (minCombo != null && !minCombo.isDisposed())
- minCombo.removeSelectionListener(this);
- if (maxCombo != null && !maxCombo.isDisposed())
- maxCombo.removeSelectionListener(this);
- if (typeCombo != null && !typeCombo.isDisposed())
- {
- typeCombo.removeSelectionListener(this);
- typeCombo.removeListener(SWT.Traverse, this);
- }
- if (nameText != null && !nameText.isDisposed())
- removeListeners(nameText);
- super.dispose();
- }
-
- protected void refreshRefCombo()
- {
- componentNameCombo.setText(""); //$NON-NLS-1$
- fillElementsCombo();
- }
-
- private void fillElementsCombo()
- {
- IEditorPart editor = getActiveEditor();
- ComponentReferenceEditManager manager = (ComponentReferenceEditManager)editor.getAdapter(XSDElementReferenceEditManager.class);
- if (manager != null)
- {
- componentNameCombo.removeAll();
- componentNameCombo.add(Messages._UI_COMBO_BROWSE);
- componentNameCombo.add(Messages._UI_COMBO_NEW);
- ComponentSpecification[] quickPicks = manager.getQuickPicks();
- if (quickPicks != null)
- {
- for (int i = 0; i < quickPicks.length; i++)
- {
- ComponentSpecification componentSpecification = quickPicks[i];
- componentNameCombo.add(componentSpecification.getName());
- }
- }
- ComponentSpecification[] history = manager.getHistory();
- if (history != null)
- {
- for (int i = 0; i < history.length; i++)
- {
- ComponentSpecification componentSpecification = history[i];
- componentNameCombo.add(componentSpecification.getName());
- }
- }
- }
- XSDElementDeclaration namedComponent = (XSDElementDeclaration) input;
- Element element = namedComponent.getElement();
-
- if (element != null)
- {
- String attrValue = element.getAttribute(XSDConstants.REF_ATTRIBUTE);
- if (attrValue == null)
- {
- attrValue = ""; //$NON-NLS-1$
- }
- ComponentSpecification ret = getComponentSpecFromQuickPickForValue(attrValue, manager);
- if (ret == null)
- {
- componentNameCombo.add(attrValue);
- }
- componentNameCombo.setText(attrValue);
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDEnumerationFacetSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDEnumerationFacetSection.java
deleted file mode 100644
index ab1b0061fd..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDEnumerationFacetSection.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections;
-
-import org.eclipse.gef.commands.Command;
-import org.eclipse.jface.viewers.ISelection;
-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.swt.widgets.Event;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-import org.eclipse.wst.xsd.ui.internal.common.commands.SetXSDFacetValueCommand;
-import org.eclipse.wst.xsd.ui.internal.common.util.Messages;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorCSHelpIds;
-import org.eclipse.xsd.XSDEnumerationFacet;
-
-public class XSDEnumerationFacetSection extends AbstractSection
-{
- CCombo finalCombo;
- Text valueText;
-
- public XSDEnumerationFacetSection()
- {
- 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);
-
- // ------------------------------------------------------------------
- // ValueLabel
- // ------------------------------------------------------------------
- data = new GridData();
- data = new GridData();
- data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
- data.grabExcessHorizontalSpace = false;
-
- CLabel valueLabel = getWidgetFactory().createCLabel(composite, Messages._UI_LABEL_VALUE);
- valueLabel.setLayoutData(data);
-
- // ------------------------------------------------------------------
- // ValueText
- // ------------------------------------------------------------------
- data = new GridData();
- data.grabExcessHorizontalSpace = true;
- data.horizontalAlignment = GridData.FILL;
- valueText = getWidgetFactory().createText(composite, ""); //$NON-NLS-1$
- valueText.setLayoutData(data);
- applyAllListeners(valueText);
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(valueText,
- XSDEditorCSHelpIds.GENERAL_TAB__SIMPLE_TYPE__NAME);
-
- }
-
- public void setInput(IWorkbenchPart part, ISelection selection)
- {
- super.setInput(part, selection);
- }
-
- public void refresh()
- {
- super.refresh();
-
- setListenerEnabled(false);
-
- valueText.setText(""); //$NON-NLS-1$
-
- if (input instanceof XSDEnumerationFacet)
- {
- XSDEnumerationFacet xsdEnumeration = (XSDEnumerationFacet)input;
-
- if(xsdEnumeration != null)
- {
- valueText.setText(xsdEnumeration.getLexicalValue());
- }
- }
- setListenerEnabled(true);
- }
-
- public void doHandleEvent(Event event)
- {
- if (event.widget == valueText)
- {
- if (!valueText.getEditable())
- return;
-
- String value = valueText.getText();
-
- if (input instanceof XSDEnumerationFacet)
- {
- XSDEnumerationFacet xsdEnumeration = (XSDEnumerationFacet)input;
-
- Command command = null;
- command = new SetXSDFacetValueCommand(Messages._UI_ACTION_CHANGE_ENUMERATION_VALUE,
- xsdEnumeration, value);
-
- if (command != null && getCommandStack() != null)
- {
- getCommandStack().execute(command);
- valueText.setText(value);
- }
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDFacetSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDFacetSection.java
deleted file mode 100644
index e0d0df400b..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDFacetSection.java
+++ /dev/null
@@ -1,1021 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections;
-
-import java.math.BigDecimal;
-import java.math.BigInteger;
-
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.CompoundCommand;
-import org.eclipse.jface.resource.JFaceResources;
-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.PlatformUI;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-import org.eclipse.wst.xsd.ui.internal.common.commands.ChangeToLocalSimpleTypeCommand;
-import org.eclipse.wst.xsd.ui.internal.common.commands.UpdateNumericBoundsFacetCommand;
-import org.eclipse.wst.xsd.ui.internal.common.commands.UpdateStringLengthFacetCommand;
-import org.eclipse.wst.xsd.ui.internal.common.commands.UpdateXSDWhiteSpaceFacetCommand;
-import org.eclipse.wst.xsd.ui.internal.common.util.Messages;
-import org.eclipse.wst.xsd.ui.internal.common.util.XSDCommonUIUtils;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorCSHelpIds;
-import org.eclipse.xsd.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.XSDVariety;
-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 = ""; //$NON-NLS-1$
- Button collapseWhitespaceButton;
- Button useEnumerationsButton, usePatternsButton;
- Button minimumInclusiveCheckbox;
- Button maximumInclusiveCheckbox;
- boolean isNumericBaseType;
- boolean isSimpleTypeRestriction;
- private XSDTypeDefinition typeDefinition;
- private XSDSimpleTypeDefinition xsdSimpleTypeDefinition;
- private XSDSimpleTypeDefinition currentPrimitiveType, previousPrimitiveType;
- private XSDElementDeclaration xsdElementDeclaration;
- private XSDAttributeDeclaration xsdAttributeDeclaration;
- private XSDFeature xsdFeature;
- boolean hasMaxMinFacets;
-
- SpecificConstraintsWidget constraintsWidget;
-
- private int constraintKind = SpecificConstraintsWidget.ENUMERATION;
-
- 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];
- title.setFont(JFaceResources.getFontRegistry().getBold(fontData.getName()));
- title.setText(titleString + (isReadOnly ? " - " + Messages._UI_LABEL_READONLY : "")); //$NON-NLS-1$ //$NON-NLS-2$
-
- 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)
- {
- boolean isLinux = java.io.File.separator.equals("/");
- minLengthLabel = factory.createLabel(simpleTypeModifierComposite, minLengthString);
- minLengthText = factory.createText(simpleTypeModifierComposite, ""); //$NON-NLS-1$
- if (isLinux)
- {
- minLengthText.addListener(SWT.Modify, customListener);
- minLengthText.addListener(SWT.KeyDown, customListener);
- minLengthText.addListener(SWT.FocusOut, customListener);
- }
- else
- applyAllListeners(minLengthText);
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(minLengthText,
- XSDEditorCSHelpIds.CONSTRAINTS_TAB__MINIMUM_LENGTH);
-
- GridData minGridData = new GridData();
- minGridData.widthHint = 100;
- minLengthText.setLayoutData(minGridData);
- minimumInclusiveCheckbox = factory.createButton(simpleTypeModifierComposite, Messages._UI_LABEL_INCLUSIVE, SWT.CHECK);
- minimumInclusiveCheckbox.addSelectionListener(this);
-
- maxLengthLabel = factory.createLabel(simpleTypeModifierComposite, maxLengthString);
- maxLengthText = factory.createText(simpleTypeModifierComposite, ""); //$NON-NLS-1$
- if (isLinux)
- {
- maxLengthText.addListener(SWT.Modify, customListener);
- maxLengthText.addListener(SWT.KeyDown, customListener);
- maxLengthText.addListener(SWT.FocusOut, customListener);
- }
- else
- applyAllListeners(maxLengthText);
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(maxLengthText,
- XSDEditorCSHelpIds.CONSTRAINTS_TAB__MAXIMUM_LENGTH);
-
- GridData maxGridData = new GridData();
- maxGridData.widthHint = 100;
- maxLengthText.setLayoutData(maxGridData);
-
- maximumInclusiveCheckbox = factory.createButton(simpleTypeModifierComposite, Messages._UI_LABEL_INCLUSIVE, SWT.CHECK);
- maximumInclusiveCheckbox.addSelectionListener(this);
-
- minimumInclusiveCheckbox.setVisible(isNumericBaseType);
- maximumInclusiveCheckbox.setVisible(isNumericBaseType);
- }
- collapseWhitespaceButton = factory.createButton(simpleTypeModifierComposite, Messages._UI_LABEL_COLLAPSE_WHITESPACE, SWT.CHECK);
- collapseWhitespaceButton.addSelectionListener(this);
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(collapseWhitespaceButton,
- XSDEditorCSHelpIds.CONSTRAINTS_TAB__COLLAPSE_WHITESPACE);
-
- Group specificValueConstraintsGroup = factory.createGroup(facetComposite, Messages._UI_LABEL_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, Messages._UI_LABEL_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, Messages._UI_LABEL_ENUMERATIONS, SWT.RADIO);
- useEnumerationsButton.addSelectionListener(this);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(useEnumerationsButton,
- XSDEditorCSHelpIds.CONSTRAINTS_TAB__ENUMERATIONS);
- usePatternsButton = factory.createButton(compositeForRadioButtons, Messages._UI_LABEL_PATTERNS, SWT.RADIO);
- usePatternsButton.addSelectionListener(this);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(usePatternsButton,
- XSDEditorCSHelpIds.CONSTRAINTS_TAB__PATTERNS);
-
- constraintsWidget = new SpecificConstraintsWidget(specificValueConstraintsGroup, factory, (input instanceof XSDFeature) ? (XSDFeature)input : null, xsdSimpleTypeDefinition, this, constraintKind);
- data = new GridData();
- data.grabExcessHorizontalSpace = true;
- data.grabExcessVerticalSpace = true;
- data.horizontalAlignment = GridData.FILL;
- data.verticalAlignment = GridData.FILL;
- constraintsWidget.getControl().setLayoutData(data);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(constraintsWidget.getControl(),
- XSDEditorCSHelpIds.CONSTRAINTS_TAB__NO_LABEL);
- }
-
- 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 ? " - " + Messages._UI_LABEL_READONLY : "")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- relayout();
- constraintsWidget.setCommandStack(getCommandStack());
- }
-
- protected void init()
- {
- hasMaxMinFacets = false;
- try
- {
- updateInput();
-
- if (xsdSimpleTypeDefinition != null)
- {
- isSimpleTypeRestriction = xsdSimpleTypeDefinition.getVariety().getValue() == XSDVariety.ATOMIC;
-
- XSDSimpleTypeDefinition targetST = xsdSimpleTypeDefinition;
-
- while (!XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001.equals(targetST.getTargetNamespace()) && targetST != null)
- {
- targetST = targetST.getBaseTypeDefinition();
- }
-
- minLengthString = ""; //$NON-NLS-1$
- maxLengthString = ""; //$NON-NLS-1$
- if (targetST.getValidFacets().contains("length")) //$NON-NLS-1$
- {
- minLengthString = Messages._UI_LABEL_MINIMUM_LENGTH;
- maxLengthString = Messages._UI_LABEL_MAXIMUM_LENGTH;
- simpleTypeModifierGroupTitle = Messages._UI_LABEL_CONSTRAINTS_ON_LENGTH_OF + targetST.getName();
- isNumericBaseType = false;
- hasMaxMinFacets = true;
- }
- else if (targetST.getValidFacets().contains("maxInclusive")) //$NON-NLS-1$
- {
- simpleTypeModifierGroupTitle = Messages._UI_LABEL_CONSTRAINTS_ON_VALUE_OF + targetST.getName();
- minLengthString = Messages._UI_LABEL_MINIMUM_VALUE;
- maxLengthString = Messages._UI_LABEL_MAXIMUM_VALUE;
- isNumericBaseType = true;
- hasMaxMinFacets = true;
- }
- else
- {
- simpleTypeModifierGroupTitle = Messages._UI_LABEL_CONTRAINTS_ON + (targetST != null ? targetST.getName() : "anyType"); //$NON-NLS-1$
- }
- }
- }
- catch(Exception e)
- {
- }
- }
-
- private void updateInput()
- {
- previousPrimitiveType = currentPrimitiveType;
- 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)
- {
- if (!XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001.equals(xsdSimpleTypeDefinition.getTargetNamespace()))
- {
- XSDSimpleTypeDefinition basePrimitiveType = xsdSimpleTypeDefinition.getBaseTypeDefinition();
- String basePrimitiveTypeString = basePrimitiveType != null ? basePrimitiveType.getName() : "";
- currentPrimitiveType = basePrimitiveType;
- titleString = Messages._UI_LABEL_TYPE + (anonymousTypeDefinition != null ? "(" + xsdFeature.getResolvedFeature().getName() + "Type)" : xsdSimpleTypeDefinition.getName()) + " , " + Messages._UI_LABEL_BASE + ": " + basePrimitiveTypeString; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- }
- else
- {
- currentPrimitiveType = xsdSimpleTypeDefinition;
- titleString = Messages._UI_LABEL_TYPE + (anonymousTypeDefinition != null ? "(" + xsdFeature.getResolvedFeature().getName() + "Type)" : xsdSimpleTypeDefinition.getName());
- }
- }
- }
- else if (input instanceof XSDSimpleTypeDefinition)
- {
- xsdSimpleTypeDefinition = (XSDSimpleTypeDefinition) input;
- currentPrimitiveType = xsdSimpleTypeDefinition;
- titleString = Messages._UI_LABEL_TYPE + (xsdSimpleTypeDefinition.getName() == null ? "(localType)" : xsdSimpleTypeDefinition.getName()) + " , " + Messages._UI_LABEL_BASE + ": " + xsdSimpleTypeDefinition.getBaseTypeDefinition().getName(); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- public void refresh()
- {
- super.refresh();
- init();
-
- if (currentPrimitiveType != previousPrimitiveType)
- {
- relayout();
- }
-
- setListenerEnabled(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);
- }
- else
- {
- collapseWhitespaceButton.setSelection(false);
- }
- }
- }
- }
-
- if (hasMaxMinFacets && !minLengthLabel.isDisposed() && !maxLengthLabel.isDisposed())
- {
- minLengthLabel.setText(minLengthString);
- maxLengthLabel.setText(maxLengthString);
-
- if (!isNumericBaseType)
- refreshStringLength();
- else
- refreshValueLengths();
- }
-
- if ((xsdSimpleTypeDefinition.getEnumerationFacets().size() > 0
- && constraintsWidget.getConstraintKind() == SpecificConstraintsWidget.ENUMERATION)
- || xsdSimpleTypeDefinition.getPatternFacets().size() == 0)
- {
- usePatternsButton.setSelection(false);
- useEnumerationsButton.setSelection(true);
- constraintsWidget.setConstraintKind(SpecificConstraintsWidget.ENUMERATION);
- constraintsWidget.addButton.setEnabled(true);
- }
- else if ((xsdSimpleTypeDefinition.getPatternFacets().size() > 0
- && constraintsWidget.getConstraintKind() == SpecificConstraintsWidget.PATTERN)
- || xsdSimpleTypeDefinition.getEnumerationFacets().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);
- }
- constraintKind = constraintsWidget.getConstraintKind();
- constraintsWidget.setInput(xsdSimpleTypeDefinition);
-
- setWidgetsEnabled(isSimpleTypeRestriction && !isReadOnly);
- composite.setEnabled(isSimpleTypeRestriction && !isReadOnly);
-
- setListenerEnabled(true);
- }
-
- private void setWidgetsEnabled(boolean isEnabled)
- {
- if (collapseWhitespaceButton != null && !collapseWhitespaceButton.isDisposed())
- collapseWhitespaceButton.setEnabled(isEnabled);
- if (useEnumerationsButton != null && !useEnumerationsButton.isDisposed())
- useEnumerationsButton.setEnabled(isEnabled);
- if (usePatternsButton != null && !usePatternsButton.isDisposed())
- usePatternsButton.setEnabled(isEnabled);
- if (minimumInclusiveCheckbox != null && !minimumInclusiveCheckbox.isDisposed())
- minimumInclusiveCheckbox.setEnabled(isEnabled);
- if (maximumInclusiveCheckbox != null && !maximumInclusiveCheckbox.isDisposed())
- maximumInclusiveCheckbox.setEnabled(isEnabled);
- if (constraintsWidget != null && !constraintsWidget.getControl().isDisposed())
- {
- if(constraintsWidget.getConstraintKind() == SpecificConstraintsWidget.PATTERN)
- {
- constraintsWidget.addButton.setEnabled(false);
- }
- else
- {
- constraintsWidget.addButton.setEnabled(isEnabled);
- }
- constraintsWidget.addUsingDialogButton.setEnabled(isEnabled);
- }
- }
-
- 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 && minLengthFacet.getRootContainer() == xsdSchema)
- {
- minLengthText.setText(Integer.toString(minLengthValue));
- }
- else
- {
- minLengthText.setText(""); //$NON-NLS-1$
- }
- }
- if (maxLengthFacet != null)
- {
- int maxLength = maxLengthFacet.getValue();
- if (maxLength >= 0 && maxLengthFacet.getRootContainer() == xsdSchema)
- {
- maxLengthText.setText(Integer.toString(maxLength));
- }
- else
- {
- maxLengthText.setText(""); //$NON-NLS-1$
- }
- }
- if (lengthFacet != null)
- {
- int length = lengthFacet.getValue();
- if (length >= 0 && lengthFacet.getRootContainer() == xsdSchema)
- {
- 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();
-
- if (minFacet != null && minFacet.getRootContainer() == xsdSchema)
- {
- if (minFacet.getElement().getLocalName().equals(XSDConstants.MINEXCLUSIVE_ELEMENT_TAG) || minFacet.getElement().getLocalName().equals(XSDConstants.MININCLUSIVE_ELEMENT_TAG))
- {
- minLengthText.setText(minFacet.getLexicalValue());
- minimumInclusiveCheckbox.setSelection(minFacet.isInclusive());
- minimumInclusiveCheckbox.setEnabled(true);
- }
- else
- {
- minLengthText.setText(""); //$NON-NLS-1$
- }
- }
- else
- {
- minimumInclusiveCheckbox.setSelection(false);
- minimumInclusiveCheckbox.setEnabled(false);
- }
-
- if (maxFacet != null && maxFacet.getRootContainer() == xsdSchema)
- {
- if (maxFacet.getElement().getLocalName().equals(XSDConstants.MAXEXCLUSIVE_ELEMENT_TAG) || maxFacet.getElement().getLocalName().equals(XSDConstants.MAXINCLUSIVE_ELEMENT_TAG))
- {
- maxLengthText.setText(maxFacet.getLexicalValue());
- maximumInclusiveCheckbox.setSelection(maxFacet.isInclusive());
- maximumInclusiveCheckbox.setEnabled(true);
- }
- else
- {
- maxLengthText.setText(""); //$NON-NLS-1$
- }
- }
- else
- {
- maximumInclusiveCheckbox.setSelection(false);
- maximumInclusiveCheckbox.setEnabled(false);
- }
- }
-
- protected void doHandleEvent(Event event)
- {
- super.doHandleEvent(event);
- Command command = null;
- boolean doUpdateMax = false, doUpdateMin = false;
- boolean doSetInput = 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.getBaseType()) || //$NON-NLS-1$
- xsdSchema.getSchemaForSchema().resolveSimpleTypeDefinition("float").equals(xsdSimpleTypeDefinition.getBaseType()) || //$NON-NLS-1$
- xsdSchema.getSchemaForSchema().resolveSimpleTypeDefinition("decimal").equals(xsdSimpleTypeDefinition.getBaseType())) //$NON-NLS-1$
- {
- 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.getBaseType()) || //$NON-NLS-1$
- xsdSchema.getSchemaForSchema().resolveSimpleTypeDefinition("float").equals(xsdSimpleTypeDefinition.getBaseType()) || //$NON-NLS-1$
- xsdSchema.getSchemaForSchema().resolveSimpleTypeDefinition("decimal").equals(xsdSimpleTypeDefinition.getBaseType())) //$NON-NLS-1$
- {
- 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(Messages._UI_ACTION_CONSTRAIN_LENGTH, (XSDFeature)input);
- changeToAnonymousCommand.setAnonymousSimpleType(anonymousSimpleType);
- compoundCommand.add(changeToAnonymousCommand);
- doSetInput = true;
- }
-
- if (!isNumericBaseType)
- {
- UpdateStringLengthFacetCommand updateCommand = new UpdateStringLengthFacetCommand("", anonymousSimpleType); //$NON-NLS-1$
- if (doUpdateMax)
- {
- updateCommand.setMax(maxValue);
- }
- if (doUpdateMin)
- {
- updateCommand.setMin(minValue);
- }
- compoundCommand.add(updateCommand);
- }
- else
- {
- UpdateNumericBoundsFacetCommand updateCommand = new UpdateNumericBoundsFacetCommand(Messages._UI_ACTION_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); //$NON-NLS-1$
- if (doUpdateMax)
- {
- updateCommand.setMax(maxValue);
- }
- if (doUpdateMin)
- {
- updateCommand.setMin(minValue);
- }
- command = updateCommand;
- }
- else
- {
- UpdateNumericBoundsFacetCommand updateCommand = new UpdateNumericBoundsFacetCommand(Messages._UI_ACTION_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); //$NON-NLS-1$
- if (doUpdateMax)
- {
- updateCommand.setMax(maxValue);
- }
- if (doUpdateMin)
- {
- updateCommand.setMin(minValue);
- }
- getCommandStack().execute(updateCommand);
- }
- else
- {
- UpdateNumericBoundsFacetCommand updateCommand = new UpdateNumericBoundsFacetCommand(Messages._UI_ACTION_UPDATE_BOUNDS, xsdSimpleTypeDefinition, minimumInclusiveCheckbox.getSelection(), maximumInclusiveCheckbox.getSelection());
- if (doUpdateMax)
- {
- updateCommand.setMax(maxValue);
- }
- if (doUpdateMin)
- {
- updateCommand.setMin(minValue);
- }
- getCommandStack().execute(updateCommand);
- }
-
- }
- refresh();
- if (doSetInput)
- 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(Messages._UI_ACTION_CONSTRAIN_LENGTH, (XSDFeature)input);
- changeToAnonymousCommand.setAnonymousSimpleType(anonymousSimpleType);
- compoundCommand.add(changeToAnonymousCommand);
- }
-
- UpdateXSDWhiteSpaceFacetCommand whiteSpaceCommand = new UpdateXSDWhiteSpaceFacetCommand(Messages._UI_ACTION_COLLAPSE_WHITESPACE, anonymousSimpleType, collapseWhitespaceButton.getSelection());
- compoundCommand.add(whiteSpaceCommand);
-
- getCommandStack().execute(compoundCommand);
- }
- setInput(getPart(), getSelection());
- }
- else
- {
- UpdateXSDWhiteSpaceFacetCommand whiteSpaceCommand = new UpdateXSDWhiteSpaceFacetCommand(Messages._UI_ACTION_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(Messages._UI_ACTION_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(Messages._UI_ACTION_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);
- constraintKind = constraintsWidget.getConstraintKind();
- }
- }
- else if (e.widget == usePatternsButton)
- {
- constraintsWidget.addButton.setEnabled(false);
- if (isListenerEnabled())
- {
- constraintsWidget.setConstraintKind(SpecificConstraintsWidget.PATTERN);
- constraintKind = constraintsWidget.getConstraintKind();
- }
- }
- }
-
- public boolean shouldUseExtraSpace()
- {
- return true;
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDFacetSectionFilter.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDFacetSectionFilter.java
deleted file mode 100644
index bdc57c5a8d..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDFacetSectionFilter.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * 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.internal.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/internal/common/properties/sections/XSDImportSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDImportSection.java
deleted file mode 100644
index 98263e197c..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDImportSection.java
+++ /dev/null
@@ -1,264 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections;
-
-import java.util.Map;
-
-import org.apache.xerces.util.XMLChar;
-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.Event;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.xsd.ui.internal.common.util.XSDDirectivesSchemaLocationUpdater;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorCSHelpIds;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-import org.eclipse.wst.xsd.ui.internal.util.TypesHelper;
-import org.eclipse.xsd.XSDImport;
-import org.eclipse.xsd.util.XSDConstants;
-import org.w3c.dom.Element;
-
-public class XSDImportSection extends SchemaLocationSection
-{
- protected Text namespaceText, prefixText;
- protected String oldPrefixValue;
-
- public XSDImportSection()
- {
- 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 namespaceLabel = getWidgetFactory().createCLabel(composite, XSDEditorPlugin.getXSDString("_UI_LABEL_NAMESPACE")); //$NON-NLS-1$
- data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
- data.grabExcessHorizontalSpace = false;
- namespaceLabel.setLayoutData(data);
-
- namespaceText = getWidgetFactory().createText(composite, "", SWT.NONE); //$NON-NLS-1$
- namespaceText.setEditable(false);
- data = new GridData();
- data.grabExcessHorizontalSpace = true;
- data.horizontalAlignment = GridData.FILL;
- applyAllListeners(namespaceText);
- namespaceText.setLayoutData(data);
-
- // ------------------------------------------------------------------
- // DummyLabel
- // ------------------------------------------------------------------
- data = new GridData();
- data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
- data.grabExcessHorizontalSpace = false;
- getWidgetFactory().createCLabel(composite, ""); //$NON-NLS-1$
-
- CLabel prefixLabel = getWidgetFactory().createCLabel(composite, XSDEditorPlugin.getXSDString("_UI_LABEL_PREFIX")); //$NON-NLS-1$
- data = new GridData();
- data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
- data.grabExcessHorizontalSpace = false;
- prefixLabel.setLayoutData(data);
-
- prefixText = getWidgetFactory().createText(composite, "", SWT.NONE); //$NON-NLS-1$
- prefixText.setEditable(true);
- applyAllListeners(prefixText);
- data = new GridData();
- data.grabExcessHorizontalSpace = true;
- data.horizontalAlignment = GridData.FILL;
- prefixText.setLayoutData(data);
-
- // ------------------------------------------------------------------
- // DummyLabel
- // ------------------------------------------------------------------
- data = new GridData();
- data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
- data.grabExcessHorizontalSpace = false;
- getWidgetFactory().createCLabel(composite, ""); //$NON-NLS-1$
-
- // Create Schema Location Label
- CLabel schemaLocationLabel = getWidgetFactory().createCLabel(composite, XSDEditorPlugin.getXSDString("_UI_LABEL_SCHEMA_LOCATION")); //$NON-NLS-1$
- data = new GridData();
- 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(""); //$NON-NLS-1$
-
- data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.horizontalSpan = 3;
- data.grabExcessHorizontalSpace = true;
- errorText.setLayoutData(data);
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(schemaLocationText,
- XSDEditorCSHelpIds.GENERAL_TAB__IMPORT__SCHEMALOCATION);
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(namespaceText,
- XSDEditorCSHelpIds.GENERAL_TAB__IMPORT__NAMESPACE);
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(prefixText,
- XSDEditorCSHelpIds.GENERAL_TAB__IMPORT__PREFIX);
-
- }
-
- public void refresh()
- {
- setListenerEnabled(false);
-
- errorText.setText("");
- Element element = null;
- if (input instanceof XSDImport)
- {
- element = ((XSDImport) input).getElement();
-
- String namespace = element.getAttribute("namespace"); //$NON-NLS-1$
- String schemaLocation = element.getAttribute("schemaLocation"); //$NON-NLS-1$
-
- TypesHelper helper = new TypesHelper(xsdSchema);
- String prefix = helper.getPrefix(element.getAttribute(XSDConstants.NAMESPACE_ATTRIBUTE), false);
-
- if (namespace == null)
- {
- namespace = ""; //$NON-NLS-1$
- }
-
- if (prefix == null)
- {
- prefix = ""; //$NON-NLS-1$
- }
-
- if (schemaLocation == null)
- {
- schemaLocation = ""; //$NON-NLS-1$
- }
-
- namespaceText.setText(namespace);
- prefixText.setText(prefix);
- schemaLocationText.setText(schemaLocation);
- oldPrefixValue = prefixText.getText();
- }
-
- setListenerEnabled(true);
- }
-
- public void widgetSelected(SelectionEvent event)
- {
- if (event.widget == wizardButton)
- {
- setListenerEnabled(false);
-
- XSDDirectivesSchemaLocationUpdater.updateSchemaLocation(xsdSchema,input,false);
- refresh();
- setListenerEnabled(true);
- prefixText.addListener(SWT.Modify, this);
- }
- }
-
- public void doHandleEvent(Event event)
- {
- setErrorMessage(null);
- super.doHandleEvent(event);
- if (event.widget == prefixText)
- {
- String newPrefix = prefixText.getText();
- if (oldPrefixValue.equals(newPrefix) || !isValidSchemaLocation)
- return;
- Map map = xsdSchema.getQNamePrefixToNamespaceMap();
- String key = prefixText.getText();
- if (key.length() == 0) key = null;
-
- if (validatePrefix(newPrefix) && schemaLocationText.getText().trim().length() > 0)
- {
- if (map.containsKey(key))
- {
- setErrorMessage(XSDEditorPlugin.getXSDString("_ERROR_LABEL_PREFIX_EXISTS"));
- }
- else
- {
- Element schemaElement = xsdSchema.getElement();
-
- if (key != null) {
- if (oldPrefixValue.length() == 0)
- schemaElement.removeAttribute("xmlns");
- else
- schemaElement.removeAttribute("xmlns:"+oldPrefixValue);
-
- schemaElement.setAttribute("xmlns:" + newPrefix, namespaceText.getText());
- }
- else {
- schemaElement.removeAttribute("xmlns:"+oldPrefixValue);
- schemaElement.setAttribute("xmlns", namespaceText.getText());
- }
- xsdSchema.updateElement();
- setErrorMessage(null);
- oldPrefixValue = newPrefix;
- }
- }
- else
- {
- setErrorMessage(XSDEditorPlugin.getXSDString("_ERROR_LABEL_INVALID_PREFIX"));
- }
- }
- }
-
- public void aboutToBeHidden()
- {
- setErrorMessage(null);
- super.aboutToBeHidden();
- }
-
- protected boolean validatePrefix(String prefix)
- {
- if (prefix.length() == 0) return true;
- return XMLChar.isValidNCName(prefix);
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDModelGroupDefinitionSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDModelGroupDefinitionSection.java
deleted file mode 100644
index fec1b37ad1..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDModelGroupDefinitionSection.java
+++ /dev/null
@@ -1,360 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections;
-
-import 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.ui.PlatformUI;
-import org.eclipse.wst.xsd.ui.internal.common.commands.UpdateNameCommand;
-import org.eclipse.wst.xsd.ui.internal.common.util.Messages;
-import org.eclipse.wst.xsd.ui.internal.common.util.XSDDirectivesManager;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorCSHelpIds;
-import org.eclipse.wst.xsd.ui.internal.util.TypesHelper;
-import org.eclipse.xsd.XSDConcreteComponent;
-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 MultiplicitySection
-{
- 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 = 3;
- 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;
- data.horizontalSpan = 2;
-
- componentNameCombo = getWidgetFactory().createCCombo(composite, SWT.FLAT);
- componentNameCombo.addSelectionListener(this);
- componentNameCombo.setLayoutData(data);
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(componentNameCombo,
- XSDEditorCSHelpIds.GENERAL_TAB__MODELGROUP_REFS__REF);
-
- // ------------------------------------------------------------------
- // min property
- // ------------------------------------------------------------------
- getWidgetFactory().createCLabel(composite,
- org.eclipse.wst.xsd.ui.internal.editor.Messages.UI_LABEL_MINOCCURS);
-
- data = new GridData();
- data.grabExcessHorizontalSpace = true;
- data.horizontalAlignment = GridData.FILL;
- data.horizontalSpan = 2;
-
- minCombo = getWidgetFactory().createCCombo(composite, SWT.FLAT);
- minCombo.setLayoutData(data);
- minCombo.add("0"); //$NON-NLS-1$
- minCombo.add("1"); //$NON-NLS-1$
- applyAllListeners(minCombo);
- minCombo.addSelectionListener(this);
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(minCombo,
- XSDEditorCSHelpIds.GENERAL_TAB__MODELGROUP__MIN_OCCURENCE);
-
- // ------------------------------------------------------------------
- // max property
- // ------------------------------------------------------------------
- getWidgetFactory().createCLabel(composite,
- org.eclipse.wst.xsd.ui.internal.editor.Messages.UI_LABEL_MAXOCCURS);
-
- data = new GridData();
- data.grabExcessHorizontalSpace = true;
- data.horizontalAlignment = GridData.FILL;
- data.horizontalSpan = 2;
-
- 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$
- applyAllListeners(maxCombo);
- maxCombo.addSelectionListener(this);
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(maxCombo,
- XSDEditorCSHelpIds.GENERAL_TAB__MODELGROUP__MAX_OCCURENCE);
-
- }
- else
- {
- // ------------------------------------------------------------------
- // NameLabel
- // ------------------------------------------------------------------
- GridData data = new GridData();
- data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
- data.grabExcessHorizontalSpace = false;
- CLabel nameLabel = getWidgetFactory().createCLabel(composite, Messages._UI_LABEL_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);
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(nameText,
- XSDEditorCSHelpIds.GENERAL_TAB__MODELGROUP_DEFINITION__NAME);
-
- // ------------------------------------------------------------------
- // Refactor/rename hyperlink
- // ------------------------------------------------------------------
- if (!hideHyperLink)
- {
- createRenameHyperlink(composite);
- setRenameHyperlinkEnabled(!isReference);
- }
- else
- {
- getWidgetFactory().createCLabel(composite, "");
- }
- }
- }
-
- 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 = ""; //$NON-NLS-1$
- }
- componentNameCombo.setText(attrValue);
-
- // refresh min max
- if (minCombo != null && maxCombo != null)
- {
- refreshMinMax();
- }
- }
- }
- else
- {
- // refresh name
- nameText.setText(""); //$NON-NLS-1$
-
- 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();
- if (input instanceof XSDModelGroupDefinition)
- {
- XSDModelGroupDefinition group = (XSDModelGroupDefinition) input;
- XSDConcreteComponent parent = group.getContainer();
- while (parent != null)
- {
- if (parent instanceof XSDModelGroupDefinition)
- {
- items.remove(((XSDModelGroupDefinition)parent).getQName());
- break;
- }
- parent = parent.getContainer();
- }
- }
- items.add(0, ""); //$NON-NLS-1$
- componentNameCombo.setItems((String [])items.toArray(new String[0]));
- }
- }
-
- protected void init()
- {
- if (input instanceof XSDModelGroupDefinition)
- {
- XSDModelGroupDefinition group = (XSDModelGroupDefinition) input;
- isReference = group.isModelGroupDefinitionReference();
- hideHyperLink = isReference;
- }
- }
-
- 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(Messages._UI_ACTION_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(Messages._UI_ERROR_INVALID_NAME);
- return false;
- }
-
- return true;
- }
-
- public void doWidgetSelected(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);
- XSDDirectivesManager.removeUnusedXSDImports(namedComponent.getSchema());
- }
- }
- }
- super.doWidgetSelected(e);
- }
-
- public void dispose()
- {
- if (nameText != null && !nameText.isDisposed())
- removeListeners(nameText);
- super.dispose();
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDModelGroupSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDModelGroupSection.java
deleted file mode 100644
index c695f7cd5f..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDModelGroupSection.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*******************************************************************************
- * 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.internal.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.ui.PlatformUI;
-import org.eclipse.wst.xsd.ui.internal.common.commands.UpdateContentModelCommand;
-import org.eclipse.wst.xsd.ui.internal.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorCSHelpIds;
-import org.eclipse.xsd.XSDCompositor;
-import org.eclipse.xsd.XSDModelGroup;
-import org.eclipse.xsd.XSDModelGroupDefinition;
-
-public class XSDModelGroupSection extends MultiplicitySection
-{
- protected CCombo modelGroupCombo;
- private String[] modelGroupComboValues = { "sequence", "choice", "all" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
- public XSDModelGroupSection()
- {
- super();
- }
-
- public void createContents(Composite parent)
- {
- composite = getWidgetFactory().createFlatFormComposite(parent);
-
- 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, Messages.UI_LABEL_KIND);
- 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);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(modelGroupCombo,
- XSDEditorCSHelpIds.GENERAL_TAB__MODELGROUP__KIND);
-
-
- // ------------------------------------------------------------------
- // 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$
- applyAllListeners(minCombo);
- minCombo.addSelectionListener(this);
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(minCombo,
- XSDEditorCSHelpIds.GENERAL_TAB__MODELGROUP__MIN_OCCURENCE);
-
- // ------------------------------------------------------------------
- // 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$
- applyAllListeners(maxCombo);
- maxCombo.addSelectionListener(this);
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(maxCombo,
- XSDEditorCSHelpIds.GENERAL_TAB__MODELGROUP__MAX_OCCURENCE);
- }
-
-
- 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);
-
- minCombo.setEnabled(!(particle.eContainer() instanceof XSDModelGroupDefinition));
- maxCombo.setEnabled(!(particle.eContainer() instanceof XSDModelGroupDefinition));
- }
- }
-
- 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(org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_ACTION_CHANGE_CONTENT_MODEL, particle, newValue);
- getCommandStack().execute(command);
- }
- super.doWidgetSelected(e);
- }
-
- public void dispose()
- {
- if (minCombo != null && !minCombo.isDisposed())
- minCombo.removeSelectionListener(this);
- if (maxCombo != null && !maxCombo.isDisposed())
- maxCombo.removeSelectionListener(this);
- super.dispose();
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDSchemaAdvancedSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDSchemaAdvancedSection.java
deleted file mode 100644
index 89029253ab..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDSchemaAdvancedSection.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.custom.CLabel;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.wst.xsd.ui.internal.common.commands.UpdateAttributeValueCommand;
-import org.eclipse.wst.xsd.ui.internal.common.util.Messages;
-import org.eclipse.wst.xsd.ui.internal.common.util.XSDCommonUIUtils;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorCSHelpIds;
-import org.eclipse.xsd.XSDForm;
-import org.eclipse.xsd.util.XSDConstants;
-
-public class XSDSchemaAdvancedSection extends AbstractSection
-{
- IWorkbenchPart part;
- protected CLabel elementFormLabel, attributeFormLabel, blockDefaultLabel, finalDefaultLabel;
- protected CCombo elementFormCombo, attributeFormCombo, blockDefaultCombo, finalDefaultCombo;
-
- protected static final String emptyOption = ""; //$NON-NLS-1$
-
- protected static final String [] formQualification = { emptyOption, XSDForm.QUALIFIED_LITERAL.getLiteral(),
- XSDForm.UNQUALIFIED_LITERAL.getLiteral() }; //$NON-NLS-1$
-
-
- protected static final String derivedByChoicesComboValues[] = { "", XSDConstants.RESTRICTION_ELEMENT_TAG, //$NON-NLS-1$
- XSDConstants.EXTENSION_ELEMENT_TAG };
-
- protected static final String blockDefaultValues[] = { emptyOption, "#" + XSDConstants.ALL_ELEMENT_TAG, //$NON-NLS-1$
- XSDConstants.EXTENSION_ELEMENT_TAG, XSDConstants.RESTRICTION_ELEMENT_TAG,
- "substitution"};
-
- protected static final String finalDefaultValues[] = { emptyOption, "#" + XSDConstants.ALL_ELEMENT_TAG, //$NON-NLS-1$
- XSDConstants.EXTENSION_ELEMENT_TAG, XSDConstants.RESTRICTION_ELEMENT_TAG,
- XSDConstants.LIST_ELEMENT_TAG, XSDConstants.UNION_ELEMENT_TAG};
-
- public XSDSchemaAdvancedSection()
- {
- super();
- }
-
- /**
- * @see org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite,
- * org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory)
- */
- public void createContents(Composite parent)
- {
- composite = getWidgetFactory().createFlatFormComposite(parent);
-
- GridLayout gridLayout = new GridLayout();
- gridLayout.marginTop = 0;
- gridLayout.marginBottom = 0;
- gridLayout.numColumns = 2;
- composite.setLayout(gridLayout);
-
- // Create elementFormDefault label and combo
- elementFormLabel = XSDCommonUIUtils.getNewPropertiesLabel(composite,getWidgetFactory(),
- Messages._UI_LABEL_ELEMENTFORMDEFAULT);
- elementFormCombo = XSDCommonUIUtils.getNewPropertiesCombo(composite,getWidgetFactory(),this,
- formQualification,XSDEditorCSHelpIds.ADVANCE_TAB__SCHEMA_ELEMENT_FORM_DEFAULT);
-
- // Create attributeFormDefault label and combo
- attributeFormLabel = XSDCommonUIUtils.getNewPropertiesLabel(composite,getWidgetFactory(),
- Messages._UI_LABEL_ATTRIBUTEFORMDEFAULT);
- attributeFormCombo = XSDCommonUIUtils.getNewPropertiesCombo(composite,getWidgetFactory(),this,
- formQualification,XSDEditorCSHelpIds.ADVANCE_TAB__SCHEMA_ATTRIBUTE_FORM_DEFAULT);
-
- // Create blockDefault label and combo
- blockDefaultLabel = XSDCommonUIUtils.getNewPropertiesLabel(composite,getWidgetFactory(),
- Messages._UI_LABEL_BLOCKDEFAULT);
- blockDefaultCombo = XSDCommonUIUtils.getNewPropertiesCombo(composite,getWidgetFactory(),this,
- blockDefaultValues,XSDEditorCSHelpIds.ADVANCE_TAB__SCHEMA_BLOCK_DEFAULT);
-
- // Create finalDefault label and combo
- finalDefaultLabel = XSDCommonUIUtils.getNewPropertiesLabel(composite,getWidgetFactory(),
- Messages._UI_LABEL_FINALDEFAULT);
- finalDefaultCombo = XSDCommonUIUtils.getNewPropertiesCombo(composite,getWidgetFactory(),this,
- finalDefaultValues,XSDEditorCSHelpIds.ADVANCE_TAB__SCHEMA_FINAL_DEFAULT);
-
- Dialog.applyDialogFont(parent);
- }
-
- /*
- * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh()
- */
- public void refresh()
- {
- super.refresh();
- setListenerEnabled(false);
-
- if (xsdSchema != null)
- {
- if (elementFormCombo != null)
- {
- String text;
- if (xsdSchema.getElement().hasAttribute(XSDConstants.ELEMENTFORMDEFAULT_ATTRIBUTE))
- {
- text = xsdSchema.getElementFormDefault().getName();
- }
- else
- {
- text = emptyOption;
- }
- elementFormCombo.setText(text);
- }
-
- if (attributeFormCombo != null)
- {
- String text;
- if (xsdSchema.getElement().hasAttribute(XSDConstants.ATTRIBUTEFORMDEFAULT_ATTRIBUTE))
- {
- text = xsdSchema.getAttributeFormDefault().getName();
- }
- else
- {
- text = emptyOption;
- }
- attributeFormCombo.setText(text);
- }
-
- if (blockDefaultCombo != null)
- {
- String text;
- if (xsdSchema.getElement().hasAttribute(XSDConstants.BLOCKDEFAULT_ATTRIBUTE))
- {
- text = xsdSchema.getElement().getAttribute(XSDConstants.BLOCKDEFAULT_ATTRIBUTE);
- }
- else
- {
- text = emptyOption;
- }
- blockDefaultCombo.setText(text);
- }
-
- if (finalDefaultCombo != null)
- {
- String text;
- if (xsdSchema.getElement().hasAttribute(XSDConstants.FINALDEFAULT_ATTRIBUTE))
- {
- text = xsdSchema.getElement().getAttribute(XSDConstants.FINALDEFAULT_ATTRIBUTE);
- }
- else
- {
- text = emptyOption;
- }
- finalDefaultCombo.setText(text);
- }
- }
- setListenerEnabled(true);
- }
-
- public void doWidgetSelected(SelectionEvent e)
- {
- if (xsdSchema != null)
- {
- if (e.widget == elementFormCombo && elementFormCombo != null)
- {
- String valueElementForm = elementFormCombo.getText();
- UpdateAttributeValueCommand command = new UpdateAttributeValueCommand(xsdSchema.getElement(),
- XSDConstants.ELEMENTFORMDEFAULT_ATTRIBUTE, valueElementForm,
- Messages._UI_LABEL_ELEMENTFORMDEFAULT);
- command.setDeleteIfEmpty(true);
- getCommandStack().execute(command);
- }
-
- if (e.widget == attributeFormCombo && attributeFormCombo != null)
- {
- String valueAttributeForm = attributeFormCombo.getText();
- UpdateAttributeValueCommand command = new UpdateAttributeValueCommand(xsdSchema.getElement(),
- XSDConstants.ATTRIBUTEFORMDEFAULT_ATTRIBUTE, valueAttributeForm,
- Messages._UI_LABEL_ATTRIBUTEFORMDEFAULT);
- command.setDeleteIfEmpty(true);
- getCommandStack().execute(command);
- }
-
- if (e.widget == blockDefaultCombo && blockDefaultCombo != null)
- {
- String valueBlockDefault = blockDefaultCombo.getText();
- UpdateAttributeValueCommand command = new UpdateAttributeValueCommand(xsdSchema.getElement(),
- XSDConstants.BLOCKDEFAULT_ATTRIBUTE, valueBlockDefault, Messages._UI_LABEL_BLOCKDEFAULT);
- command.setDeleteIfEmpty(true);
- getCommandStack().execute(command);
- }
-
- if(e.widget == finalDefaultCombo && finalDefaultCombo != null)
- {
- String finalBlockDefault = finalDefaultCombo.getText();
- UpdateAttributeValueCommand command = new UpdateAttributeValueCommand(xsdSchema.getElement(),
- XSDConstants.FINALDEFAULT_ATTRIBUTE, finalBlockDefault, Messages._UI_LABEL_FINALDEFAULT);
- command.setDeleteIfEmpty(true);
- getCommandStack().execute(command);
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDSchemaSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDSchemaSection.java
deleted file mode 100644
index dab2646974..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDSchemaSection.java
+++ /dev/null
@@ -1,319 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * David Schneider, david.schneider@unisys.com - [142500] WTP properties pages fonts don't follow Eclipse preferences
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.osgi.util.TextProcessor;
-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.ui.PlatformUI;
-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.xsd.ui.internal.actions.XSDEditNamespacesAction;
-import org.eclipse.wst.xsd.ui.internal.common.commands.UpdateNamespaceInformationCommand;
-import org.eclipse.wst.xsd.ui.internal.common.util.Messages;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorCSHelpIds;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-import org.eclipse.wst.xsd.ui.internal.nsedit.TargetNamespaceChangeHandler;
-import org.eclipse.wst.xsd.ui.internal.util.TypesHelper;
-import org.eclipse.xsd.util.XSDConstants;
-import org.w3c.dom.Element;
-
-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);
- applyAllListeners(prefixText);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(prefixText,
- XSDEditorCSHelpIds.GENERAL_TAB__SCHEMA__PREFIX);
-
- // 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);
- applyAllListeners(targetNamespaceText);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(targetNamespaceText,
- XSDEditorCSHelpIds.GENERAL_TAB__SCHEMA__TARGETNAMESPACE);
-
- // Advanced Button
- editButton = getWidgetFactory().createButton(composite, XSDEditorPlugin.getXSDString("_UI_ACTION_EDIT_NAMESPACES"), SWT.PUSH); //$NON-NLS-1$
- data = new GridData(SWT.END, SWT.CENTER, true, false);
- data.horizontalSpan = 2;
- editButton.setLayoutData(data);
- editButton.addSelectionListener(this);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(editButton,
- XSDEditorCSHelpIds.GENERAL_TAB__SCHEMA__ADVANCED);
-
- // error text
- errorText = new StyledText(composite, SWT.FLAT);
- errorText.setEditable(false);
- errorText.setEnabled(false);
- errorText.setText(""); //$NON-NLS-1$
- data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.horizontalSpan = 2;
- data.grabExcessHorizontalSpace = true;
- errorText.setLayoutData(data);
- Dialog.applyDialogFont(parent);
- }
-
- /*
- * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh()
- */
- public void refresh()
- {
- super.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
-
- if (element.hasAttribute(XSDConstants.TARGETNAMESPACE_ATTRIBUTE))
- {
- String tns = element.getAttribute(XSDConstants.TARGETNAMESPACE_ATTRIBUTE);
- String processedString = TextProcessor.process(tns);
- targetNamespaceText.setText(processedString);
- }
- else
- {
- targetNamespaceText.setText(""); //$NON-NLS-1$
- }
- errorText.setText(""); //$NON-NLS-1$
- }
- setListenerEnabled(true);
- }
-
- public void doHandleEvent(Event event)
- {
- errorText.setText(""); //$NON-NLS-1$
- String prefixValue = prefixText.getText();
- String tnsValue = targetNamespaceText.getText();
-
- Element element = xsdSchema.getElement();
- TypesHelper helper = new TypesHelper(xsdSchema);
- String currentPrefix = helper.getPrefix(element.getAttribute(XSDConstants.TARGETNAMESPACE_ATTRIBUTE), false);
- String currentNamespace = xsdSchema.getTargetNamespace();
-
- if (tnsValue.trim().length() == 0)
- {
- if (prefixValue.trim().length() > 0)
- {
- errorText.setText(XSDEditorPlugin.getXSDString("_ERROR_TARGET_NAMESPACE_AND_PREFIX")); //$NON-NLS-1$
- 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)
- {
- // If the prefix is the same, just return. This may happen if the
- // widget loses focus.
- if (prefixValue.equals(currentPrefix))
- return;
- updateNamespaceInfo(prefixValue, tnsValue);
- }
- else if (event.widget == targetNamespaceText)
- {
- // If the ns is the same, just return. This may happen if the
- // widget loses focus.
- if (tnsValue.equals(currentNamespace))
- return;
-
- DOMNamespaceInfoManager namespaceInfoManager = new DOMNamespaceInfoManager();
- List namespaceInfoList = namespaceInfoManager.getNamespaceInfoList(xsdSchema.getElement());
-
- Element xsdSchemaElement = xsdSchema.getElement();
- DocumentImpl doc = (DocumentImpl) xsdSchemaElement.getOwnerDocument();
-
- try
- {
- doc.getModel().beginRecording(this, XSDEditorPlugin.getXSDString("_UI_NAMESPACE_CHANGE"));
-
- if (tnsValue.trim().length() == 0 ) //remove the targetNamespace attribute
- {
- xsdSchemaElement.removeAttribute(XSDConstants.TARGETNAMESPACE_ATTRIBUTE);
- return;
- }
-
- // Now replace the namespace for the xmlns entry
- for (Iterator i = namespaceInfoList.iterator(); i.hasNext();)
- {
- NamespaceInfo info = (NamespaceInfo) i.next();
- if (info.uri.equals(currentNamespace))
- {
- info.uri = tnsValue;
- }
- }
-
- xsdSchema.setIncrementalUpdate(false);
- // set the new xmlns entries
- namespaceInfoManager.removeNamespaceInfo(element);
- namespaceInfoManager.addNamespaceInfo(element, namespaceInfoList, false);
- xsdSchema.setIncrementalUpdate(true);
-
- // set the targetNamespace attribute
- xsdSchema.setTargetNamespace(tnsValue);
-
- TargetNamespaceChangeHandler targetNamespaceChangeHandler = new TargetNamespaceChangeHandler(xsdSchema, currentNamespace, tnsValue);
- targetNamespaceChangeHandler.resolve();
- }
- catch (Exception e)
- {
-
- }
- finally
- {
- try
- {
- xsdSchema.update();
- }
- finally
- {
- doc.getModel().endRecording(this);
- }
- }
- }
- }
-
- 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)
- {
- UpdateNamespaceInformationCommand command = new UpdateNamespaceInformationCommand(Messages._UI_ACTION_NAMESPACE_INFORMATION_CHANGE, xsdSchema, newPrefix, newTargetNamespace);
- getCommandStack().execute(command);
- }
-
- public void dispose()
- {
- if (prefixText != null && !prefixText.isDisposed())
- removeListeners(prefixText);
- if (targetNamespaceText != null && !targetNamespaceText.isDisposed())
- removeListeners(targetNamespaceText);
-
- if (red != null)
- {
- red.dispose();
- red = null;
- }
- super.dispose();
- }
-
- /**
- * @deprecated
- */
- protected boolean validatePrefix(String prefix)
- {
- return true;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDSimpleTypeAdvancedSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDSimpleTypeAdvancedSection.java
deleted file mode 100644
index 0e2bb218bc..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDSimpleTypeAdvancedSection.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections;
-
-import org.eclipse.jface.viewers.ISelection;
-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.ui.IWorkbenchPart;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-import org.eclipse.wst.xsd.ui.internal.common.commands.UpdateAttributeValueCommand;
-import org.eclipse.wst.xsd.ui.internal.common.util.Messages;
-import org.eclipse.xsd.XSDSimpleTypeDefinition;
-import org.eclipse.xsd.util.XSDConstants;
-
-public class XSDSimpleTypeAdvancedSection extends AbstractSection
-{
- private static final String EMPTY = ""; //$NON-NLS-1$
- private String finalValues[] = { EMPTY, "#" + XSDConstants.ALL_ELEMENT_TAG, //$NON-NLS-1$
- XSDConstants.LIST_ELEMENT_TAG, XSDConstants.RESTRICTION_ELEMENT_TAG,
- XSDConstants.UNION_ELEMENT_TAG};
-
- CCombo finalCombo;
-
- public XSDSimpleTypeAdvancedSection()
- {
- 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);
-
- // ------------------------------------------------------------------
- // FinalLabel
- // ------------------------------------------------------------------
- data = new GridData();
- data = new GridData();
- data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
- data.grabExcessHorizontalSpace = false;
-
- CLabel finalLabel = getWidgetFactory().createCLabel(composite, Messages._UI_LABEL_FINAL);
- finalLabel.setLayoutData(data);
-
- // ------------------------------------------------------------------
- // FinalCombo
- // ------------------------------------------------------------------
- data = new GridData();
- data.grabExcessHorizontalSpace = true;
- data.horizontalAlignment = GridData.FILL;
- finalCombo = getWidgetFactory().createCCombo(composite);
- finalCombo.setLayoutData(data);
- finalCombo.setEditable(false);
-
- finalCombo.setItems(finalValues);
- finalCombo.addSelectionListener(this);
- }
-
- public void setInput(IWorkbenchPart part, ISelection selection)
- {
- super.setInput(part, selection);
- }
-
- public void refresh()
- {
- super.refresh();
-
- setListenerEnabled(false);
-
- finalCombo.setText(""); //$NON-NLS-1$);
-
- if (input instanceof XSDSimpleTypeDefinition)
- {
- XSDSimpleTypeDefinition simpleType = (XSDSimpleTypeDefinition) input;
-
-
- if (simpleType.getElement().hasAttribute(XSDConstants.FINAL_ATTRIBUTE))
- {
- String finalAttValue = simpleType.getElement().getAttribute(XSDConstants.FINAL_ATTRIBUTE);
- finalCombo.setText(finalAttValue);
- }
- else
- {
- finalCombo.setText(EMPTY);
- }
- }
- setListenerEnabled(true);
- }
-
- public void doWidgetSelected(SelectionEvent e)
- {
- if (e.widget == finalCombo && input != null && input instanceof XSDSimpleTypeDefinition)
- {
- XSDSimpleTypeDefinition simpleType = (XSDSimpleTypeDefinition) input;
- String value = finalCombo.getText();
- UpdateAttributeValueCommand command = new UpdateAttributeValueCommand(simpleType.getElement(), XSDConstants.FINAL_ATTRIBUTE, value, Messages._UI_LABEL_FINAL);
- command.setDeleteIfEmpty(true);
- getCommandStack().execute(command);
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDSimpleTypeSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDSimpleTypeSection.java
deleted file mode 100644
index e3275a3feb..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDSimpleTypeSection.java
+++ /dev/null
@@ -1,655 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.xerces.util.XMLChar;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.jface.action.Action;
-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.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification;
-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.adt.edit.ComponentReferenceEditManager;
-import org.eclipse.wst.xsd.ui.internal.adt.edit.IComponentDialog;
-import org.eclipse.wst.xsd.ui.internal.common.commands.UpdateNameCommand;
-import org.eclipse.wst.xsd.ui.internal.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.dialogs.NewTypeDialog;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDComplexTypeBaseTypeEditManager;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorCSHelpIds;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDTypeReferenceEditManager;
-import org.eclipse.wst.xsd.ui.internal.editor.search.XSDSearchListDialogDelegate;
-import org.eclipse.wst.xsd.ui.internal.util.XSDDOMHelper;
-import org.eclipse.xsd.XSDNamedComponent;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.XSDSimpleTypeDefinition;
-import org.eclipse.xsd.XSDTypeDefinition;
-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;
-
-import com.ibm.icu.util.StringTokenizer;
-
-public class XSDSimpleTypeSection extends RefactoringSection
-{
- protected Text nameText;
- CCombo varietyCombo;
- CCombo typesCombo;
- CLabel typesLabel;
-
- 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, Messages.UI_LABEL_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);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(nameText,
- XSDEditorCSHelpIds.GENERAL_TAB__SIMPLE_TYPE__NAME);
-
-
- // ------------------------------------------------------------------
- // Refactor/rename hyperlink
- // ------------------------------------------------------------------
- createRenameHyperlink(composite);
-
- // 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);
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(varietyCombo,
- XSDEditorCSHelpIds.GENERAL_TAB__SIMPLE_TYPE__VARIETY);
-
-
- // ------------------------------------------------------------------
- // DummyLabel
- // ------------------------------------------------------------------
- getWidgetFactory().createCLabel(composite, ""); //$NON-NLS-1$
-
- // ------------------------------------------------------------------
- // Types Label
- // ------------------------------------------------------------------
- typesLabel = getWidgetFactory().createCLabel(composite, XSDEditorPlugin.getXSDString("_UI_LABEL_MEMBERTYPES")); //$NON-NLS-1$
-
- // ------------------------------------------------------------------
- // Types Combo
- // ------------------------------------------------------------------
- typesCombo = getWidgetFactory().createCCombo(composite);
- typesCombo.setEditable(false);
- typesCombo.setLayoutData(data);
- typesCombo.addSelectionListener(this);
- typesCombo.addListener(SWT.Traverse, this);
-
-
- data = new GridData();
- data.grabExcessHorizontalSpace = true;
- data.horizontalAlignment = GridData.FILL;
- typesCombo.setLayoutData(data);
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(typesCombo,
- XSDEditorCSHelpIds.GENERAL_TAB__SIMPLE_TYPE__BASE_TYPE);
-
- }
-
- 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);
- showLink(!hideHyperLink);
-
- nameText.setText(""); //$NON-NLS-1$
- varietyCombo.setText(""); //$NON-NLS-1$
- typesCombo.setText(""); //$NON-NLS-1$
- fillTypesCombo();
- 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);
- nameText.setEditable(true);
- }
- else
- {
- nameText.setText("**anonymous**"); //$NON-NLS-1$);
- nameText.setEditable(false);
- }
-
- String variety = st.getVariety().getName();
- int intVariety = st.getVariety().getValue();
- XSDDOMHelper domHelper = new XSDDOMHelper();
- if(domHelper.getDerivedByElementFromSimpleType(st.getElement()) != null) {
- if (variety != null)
- {
- varietyCombo.setText(variety);
- if (intVariety == XSDVariety.ATOMIC)
- {
- baseTypeDefinition = st.getBaseTypeDefinition();
- String name = ""; //$NON-NLS-1$
- if (baseTypeDefinition != null)
- {
- name = baseTypeDefinition.getName();
- if (name == null) name = "";
- }
- typesCombo.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 = ""; //$NON-NLS-1$
- if (itemTypeDefinition != null)
- {
- name = itemTypeDefinition.getName();
- if (name == null) name = "";
- }
- typesCombo.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();
- typesCombo.setText(memberTypes);
- typesLabel.setText(XSDEditorPlugin.getXSDString("_UI_LABEL_MEMBERTYPES")); //$NON-NLS-1$
- }
- }
- }
- }
- setListenerEnabled(true);
-
- }
-
- public void doWidgetDefaultSelected(SelectionEvent e)
- {
- if (e.widget == typesCombo)
- {
- String selection = typesCombo.getText();
- if (shouldPerformComboSelection(SWT.DefaultSelection, selection))
- handleWidgetSelection(e);
- } else
- {
- handleWidgetSelection(e);
- }
- }
-
- public void doWidgetSelected(SelectionEvent e)
- {
- if (e.widget == typesCombo)
- {
- String selection = typesCombo.getText();
- if (shouldPerformComboSelection(SWT.Selection, selection))
- handleWidgetSelection(e);
- } else
- {
- handleWidgetSelection(e);
- }
- }
-
- private void handleWidgetSelection(SelectionEvent e)
- {
- if (e.widget == typesCombo)
- {
- IEditorPart editor = getActiveEditor();
- if (editor == null) return;
- ComponentReferenceEditManager manager = (ComponentReferenceEditManager)editor.getAdapter(XSDComplexTypeBaseTypeEditManager.class);
-
- String selection = typesCombo.getText();
- ComponentSpecification newValue;
- IComponentDialog dialog= null;
- if ( selection.equals(Messages._UI_COMBO_BROWSE))
- {
- dialog = manager.getBrowseDialog();
- ((XSDSearchListDialogDelegate) dialog).showComplexTypes(false);
- }
- else if ( selection.equals(Messages._UI_COMBO_NEW))
- {
- dialog = manager.getNewDialog();
- ((NewTypeDialog) dialog).allowComplexType(false);
- }
-
- if (dialog != null)
- {
- if (dialog.createAndOpen() == Window.OK)
- {
- newValue = dialog.getSelectedComponent();
- manager.modifyComponentReference(input, newValue);
- }
- }
- else //use the value from selected quickPick item
- {
- newValue = getComponentSpecFromQuickPickForValue(selection, manager);
- if (newValue != null)
- manager.modifyComponentReference(input, newValue);
- }
- }
- else 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$
- }
- }
- }
- }
- }
-
- 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)
- {
- if (listNode.hasAttribute(XSDConstants.ITEMTYPE_ATTRIBUTE))
- reuseType = listNode.getAttribute(XSDConstants.ITEMTYPE_ATTRIBUTE);
- XSDDOMHelper.removeNodeAndWhitespace(listNode);
- }
-
- Element unionNode = getFirstChildNodeIfExists(parent, XSDConstants.UNION_ELEMENT_TAG, false);
- if (unionNode != null)
- {
-
- if (unionNode.hasAttribute(XSDConstants.MEMBERTYPES_ATTRIBUTE))
- {
- String memberAttr = unionNode.getAttribute(XSDConstants.MEMBERTYPES_ATTRIBUTE);
- 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(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;
- }
-
- // TODO: Common this up with element declaration
- public void doHandleEvent(Event event)
- {
- if (event.type == SWT.Traverse) {
- if (event.detail == SWT.TRAVERSE_ARROW_NEXT || event.detail == SWT.TRAVERSE_ARROW_PREVIOUS) {
- isTraversing = true;
- return;
- }
- }
- 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(Messages._UI_ACTION_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(Messages._UI_ERROR_INVALID_NAME);
- return false;
- }
-
- return true;
- }
-
- public void setInput(IWorkbenchPart part, ISelection selection)
- {
- super.setInput(part, selection);
- setListenerEnabled(false);
- if (input instanceof XSDSimpleTypeDefinition)
- {
- XSDSimpleTypeDefinition simpleType = (XSDSimpleTypeDefinition) input;
- hideHyperLink = !(simpleType.getContainer() instanceof XSDSchema);
-
- }
- // Don't have to call relayout() here
- setListenerEnabled(true);
- }
-
- private void fillTypesCombo()
- {
- typesCombo.removeAll();
-
- IEditorPart editor = getActiveEditor();
- ComponentReferenceEditManager manager = (ComponentReferenceEditManager)editor.getAdapter(XSDTypeReferenceEditManager.class);
- if (manager != null)
- {
- ComponentSpecification[] items = manager.getQuickPicks();
-
- typesCombo.add(Messages._UI_COMBO_BROWSE);
- typesCombo.add(Messages._UI_COMBO_NEW);
-
- for (int i = 0; i < items.length; i++)
- {
- typesCombo.add(items[i].getName());
- }
-
- // Add the current Type of this attribute if needed
- XSDSimpleTypeDefinition simpleType = (XSDSimpleTypeDefinition) input;
- XSDTypeDefinition baseType = simpleType.getBaseType();
- if (baseType != null && baseType.getQName() != null)
- {
- String currentTypeName = baseType.getQName(xsdSchema); // no prefix
- ComponentSpecification ret = getComponentSpecFromQuickPickForValue(currentTypeName, manager);
- if (ret == null && currentTypeName != null) // not in quickPick
- {
- typesCombo.add(currentTypeName);
- }
- }
- }
- }
-
- // TODO: common this up with XSDElementDeclarationSection
- private ComponentSpecification getComponentSpecFromQuickPickForValue(String value, ComponentReferenceEditManager editManager)
- {
- if (editManager != null)
- {
- ComponentSpecification[] quickPicks = editManager.getQuickPicks();
- if (quickPicks != null)
- {
- for (int i=0; i < quickPicks.length; i++)
- {
- ComponentSpecification componentSpecification = quickPicks[i];
- if (value != null && value.equals(componentSpecification.getName()))
- {
- return componentSpecification;
- }
- }
- }
- }
- return null;
- }
-
- public void dispose()
- {
- if (typesCombo != null && !typesCombo.isDisposed())
- typesCombo.removeListener(SWT.Traverse, this);
- super.dispose();
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDTableTreeViewer.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDTableTreeViewer.java
deleted file mode 100644
index 0b04e7b5aa..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDTableTreeViewer.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*******************************************************************************
- * 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.internal.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 = ""; //$NON-NLS-1$
-
- 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;
- // 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/internal/common/properties/sections/appinfo/AddExtensionsComponentDialog.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/AddExtensionsComponentDialog.java
deleted file mode 100644
index 3b309bf7ee..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/AddExtensionsComponentDialog.java
+++ /dev/null
@@ -1,785 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import org.apache.xerces.dom.DocumentImpl;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.preference.IPreferenceStore;
-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.viewers.ViewerFilter;
-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.MessageBox;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.SelectionDialog;
-import org.eclipse.wst.xsd.contentmodel.internal.XSDImpl;
-import org.eclipse.wst.xsd.ui.internal.common.util.Messages;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorCSHelpIds;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-import org.eclipse.xsd.XSDAttributeDeclaration;
-import org.eclipse.xsd.XSDElementDeclaration;
-import org.eclipse.xsd.XSDSchema;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-public class AddExtensionsComponentDialog extends SelectionDialog implements ISelectionChangedListener, SelectionListener
-{
- protected static final Image DEFAULT_ELEMENT_ICON = XSDEditorPlugin.getXSDImage("icons/XSDElement.gif"); //$NON-NLS-1$
- protected static final Image DEFAULT_ATTRIBUTE_ICON = XSDEditorPlugin.getXSDImage("icons/XSDAttribute.gif"); //$NON-NLS-1$
-
- /** 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, editButton;
-
- public AddExtensionsComponentDialog(Shell parent, ExtensionsSchemasRegistry schemaRegistry)
- {
- super(parent);
- setTitle(Messages._UI_ACTION_ADD_EXTENSION_COMPONENTS);
- setShellStyle(SWT.APPLICATION_MODAL | SWT.RESIZE | SWT.CLOSE);
- }
-
- private List fInput;
-
- private TableViewer categoryTableViewer, elementTableViewer;
- private ArrayList existingNames;
-
- private ViewerFilter elementTableViewerFilter;
- private SpecificationForExtensionsSchema currentExtCategory;
- private HashMap specToComponentsList = new HashMap();
- private IPreferenceStore prefStore;
-
- public void setInput(List input)
- {
- this.fInput = input;
- }
-
- public SpecificationForExtensionsSchema getSelectedCategory(){
- return currentExtCategory;
- }
-
- public void setInitialCategorySelection(SpecificationForExtensionsSchema spec){
- currentExtCategory = spec;
- }
-
- protected IStructuredContentProvider getCategoryContentProvider()
- {
- return new CategoryContentProvider();
- }
-
- 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(Messages._UI_LABEL_EXTENSION_CATEGORIES);
-
- new Label(categoryComposite, SWT.NONE);
-
- categoryTableViewer = new TableViewer(categoryComposite, getTableStyle());
- categoryTableViewer.setContentProvider(getCategoryContentProvider());
- categoryTableViewer.setLabelProvider(new CategoryLabelProvider());
- categoryTableViewer.setInput(fInput);
- categoryTableViewer.addSelectionChangedListener(this);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(categoryTableViewer.getControl(), XSDEditorCSHelpIds.ADD_EXTENSIONS_COMPONENTS__EXTENSION_CATEGORIES);
-
- 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(Messages._UI_LABEL_ADD_WITH_DOTS);
- addButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- addButton.addSelectionListener(this);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(addButton,
- XSDEditorCSHelpIds.ADD_EXTENSIONS_COMPONENTS__ADD);
-
- removeButton = new Button(buttonComposite, SWT.PUSH);
- removeButton.setText(Messages._UI_LABEL_DELETE);
- removeButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- removeButton.addSelectionListener(this);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(removeButton,
- XSDEditorCSHelpIds.ADD_EXTENSIONS_COMPONENTS__DELETE);
-
-
- editButton = new Button(buttonComposite, SWT.PUSH);
- editButton.setText(Messages._UI_LABEL_EDIT);
- editButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- editButton.addSelectionListener(this);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(editButton,
- XSDEditorCSHelpIds.ADD_EXTENSIONS_COMPONENTS__EDIT);
-
-
- List initialSelection = getInitialElementSelections();
- if (initialSelection != null)
- categoryTableViewer.setSelection(new StructuredSelection(initialSelection));
-
- Label elementLabel = new Label(categoryComposite, SWT.LEFT);
- elementLabel.setText(Messages._UI_LABEL_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();
- }
- });
- if ( elementTableViewerFilter != null){
- elementTableViewer.addFilter(elementTableViewerFilter);
- }
-
- 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);
- }
- });
- PlatformUI.getWorkbench().getHelpSystem().setHelp(elementTableViewer.getControl(), XSDEditorCSHelpIds.ADD_EXTENSIONS_COMPONENTS__AVAILABLE_COMPONENTS_TO_ADD);
-
- return parent;
- }
-
- public void create()
- {
- super.create();
- if (categoryTableViewer.getTable().getItemCount() > 0)
- {
- categoryTableViewer.getTable().select(0);
-
- StructuredSelection structuredSelection;
- if (currentExtCategory != null){
- structuredSelection = new StructuredSelection(currentExtCategory);
- }
- else{
- structuredSelection =
- new StructuredSelection(categoryTableViewer.getElementAt(0));
- }
-
- categoryTableViewer.setSelection(structuredSelection);
- }
-
- // Setup the list of category names that already exist
- // and contructs the XSDSchema for each category
- existingNames = new ArrayList();
- TableItem[] categories = categoryTableViewer.getTable().getItems();
- for (int i = 0; i < categories.length; i++ ){
- existingNames.add(categories[i].getText());
-
- SpecificationForExtensionsSchema spec =
- (SpecificationForExtensionsSchema) categories[i].getData();
- XSDSchema schema = getASISchemaModel(spec);
-
- if (schema == null)
- {
- continue;
- }
-
- List components = buildInput(schema);
- specToComponentsList.put(spec, components);
-
- // mark category as gray/empty if applicable
- Object[] remains = components.toArray();
- if ( elementTableViewerFilter != null)
- remains = elementTableViewerFilter.filter(elementTableViewer,
- elementTableViewer.getTable(), remains);
- if ( remains.length == 0)
- {
- categories[i].setForeground(
- getShell().getDisplay().getSystemColor(SWT.COLOR_GRAY));
- }
- }
-
- getButton(IDialogConstants.OK_ID).setEnabled(false);
- }
-
- public void addElementsTableFilter(ViewerFilter filter){
- elementTableViewerFilter = filter;
- }
-
- public void setPrefStore(IPreferenceStore prefStore)
- {
- this.prefStore = prefStore;
- }
-
- 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 ){
- SpecificationForExtensionsSchema schemaSpec =
- new SpecificationForExtensionsSchema();
- schemaSpec.setDisplayName(addNewCategoryDialog.getNewCategoryName() );
- schemaSpec.setLocation(addNewCategoryDialog.getCategoryLocation() );
- schemaSpec.setSourceHint(addNewCategoryDialog.getSource());
- schemaSpec.setFromCatalog(addNewCategoryDialog.getFromCatalog() );
-
- 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);
-
- storeSpecInPref(schemaSpec); // must store after selection changed is called ie. 2 lines above (trung)
- }
- }
- else if (e.widget == removeButton)
- {
- TableItem[] selections = categoryTableViewer.getTable().getSelection();
- for (int i =0; i < selections.length; i++){
- SpecificationForExtensionsSchema spec =
- (SpecificationForExtensionsSchema) selections[i].getData();
-
- fInput.remove(spec );
- existingNames.remove(spec.getDisplayName());
- specToComponentsList.remove(spec);
-
- removeFromPref(spec);
- }
- 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);
- }
- else if (e.widget == editButton)
- {
- // use this dialog not for adding but for editing purpose.
- AddNewCategoryDialog dialog = new AddNewCategoryDialog(getShell(), Messages._UI_LABEL_EDIT_CATEGORY);
-
- TableItem[] selections = categoryTableViewer.getTable().getSelection();
- if (selections.length == 0)
- return;
-
- SpecificationForExtensionsSchema spec = (SpecificationForExtensionsSchema) selections[0].getData();
-
- String displayName = spec.getDisplayName();
-
- dialog.setCategoryName(displayName );
- dialog.setFromCatalog(spec.isFromCatalog() );
- dialog.setSource(spec.getSourceHint() );
- dialog.setCategoryLocation(spec.getLocation() );
-
- specToComponentsList.remove(spec);
- dialog.setUnavailableCategoryNames(existingNames);
-
- if ( dialog.open() == Window.OK){
- existingNames.remove(displayName);
- String newDisplayName = dialog.getNewCategoryName();
-
- spec.setDisplayName(newDisplayName);
- spec.setLocation(dialog.getCategoryLocation());
- spec.setSourceHint(dialog.getSource());
- spec.setFromCatalog(dialog.getFromCatalog());
- spec.setNamespaceURI(null);
-
- existingNames.add(newDisplayName);
-
- categoryTableViewer.update(spec, null);
- refreshElementsViewer(spec);
-
- editSpecInPref(displayName, spec);
- }
- }
- }
-
-/*
- * (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 SpecificationForExtensionsSchema)
- {
- SpecificationForExtensionsSchema spec = (SpecificationForExtensionsSchema) obj;
- currentExtCategory = spec;
- refreshElementsViewer(spec);
-
- if ( spec.isDefautSchema() ){
- editButton.setEnabled(false);
- removeButton.setEnabled(false);
- }
- else{
- editButton.setEnabled(true);
- removeButton.setEnabled(true);
- }
-
- getButton(IDialogConstants.OK_ID).setEnabled(false);
- }
- }
- }
- }
-
- private void refreshElementsViewer(SpecificationForExtensionsSchema spec) {
- List components = (List) specToComponentsList.get(spec);
- if ( components != null){
- elementTableViewer.setInput(components);
- return;
- }
-
- XSDSchema xsdSchema = getASISchemaModel(spec);
-
- if (xsdSchema == null){
- MessageBox errDialog = new MessageBox(getShell(), SWT.ICON_ERROR);
- errDialog.setText(Messages._UI_ERROR_INVALID_CATEGORY);
- // TODO (trung) I was forced to use a String in Messages to make the error clearer
- // When we are back to development phase, use another string: "Extension Category: "
- // not "Extension Categories:" + " " like we are using here
- errDialog.setMessage(Messages._UI_LABEL_EXTENSION_CATEGORIES + " " + spec.getDisplayName() //$NON-NLS-1$
- + "\n" //$NON-NLS-1$
- + Messages._UI_ERROR_FILE_CANNOT_BE_PARSED
- + "\n" + Messages._UI_ERROR_VALIDATE_THE_FILE); //$NON-NLS-1$
- errDialog.open();
-
- elementTableViewer.setInput(new ArrayList(0));
- return;
- }
-
- components = buildInput(xsdSchema);
- specToComponentsList.put(spec, components);
-
- List allItems = buildInput(xsdSchema);
- if ( allItems == null )
- return;
- elementTableViewer.setInput(allItems);
- }
-
- private static List buildInput(XSDSchema xsdSchema)
- {
- if ( xsdSchema ==null )
- return null;
-
- 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() != null)
- {
- if (currentElement.getTargetNamespace().equals(targetNamespace))
- allItems.add(currentElement);
- }
- else
- {
- if (targetNamespace == null)
- 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.getTargetNamespace() != null)
- {
- if (currentAttribute.isGlobal() && currentAttribute.getTargetNamespace().equals(targetNamespace))
- allItems.add(currentAttribute);
- }
- else
- {
- if (targetNamespace == null)
- allItems.add(currentAttribute);
- }
- }
- }
- return allItems;
- }
-
-
- private static XSDSchema getASISchemaModel(SpecificationForExtensionsSchema extensionsSchemaSpec)
- {
- String location = extensionsSchemaSpec.getLocation();
- if ( location == null)
- return null;
- XSDSchema xsdSchema = XSDImpl.buildXSDModel(location);
-
- // now that the .xsd file is read, we can retrieve the namespace of this xsd file
- // and set the namespace for 'properties'
- if ( extensionsSchemaSpec.getNamespaceURI() == null){
- extensionsSchemaSpec.setNamespaceURI( xsdSchema.getTargetNamespace());
- }
-
- return xsdSchema;
- }
-
- private void storeSpecInPref(SpecificationForExtensionsSchema schemaSpec) {
- if (prefStore == null)
- return;
-
- String currentValue = prefStore.getString(ExtensionsSchemasRegistry.USER_ADDED_EXT_SCHEMAS);
- String specDesc = " " + "\t" + schemaSpec.getDisplayName() + "\t"+
- schemaSpec.getNamespaceURI() + "\t" + schemaSpec.getLocation() + "\t" +
- schemaSpec.isDefautSchema() + "\t" + schemaSpec.getSourceHint() + "\t" +
- schemaSpec.isFromCatalog();
- currentValue += specDesc + "\n";
-
- prefStore.setValue(ExtensionsSchemasRegistry.USER_ADDED_EXT_SCHEMAS,
- currentValue);
- }
-
- private void editSpecInPref(String displayName, SpecificationForExtensionsSchema newSpec) {
- if (prefStore == null)
- return;
-
- String newValue = "";
- String currentValue = prefStore.getString(ExtensionsSchemasRegistry.USER_ADDED_EXT_SCHEMAS);
- StringTokenizer tokenizer = new StringTokenizer(currentValue, "\n");
-
- while (tokenizer.hasMoreTokens())
- {
- String oneSpecDesc = tokenizer.nextToken();
- // get the Display name
- StringTokenizer _tokenizer_2 = new StringTokenizer(oneSpecDesc, "\t");
- _tokenizer_2.nextToken();
- String dName = _tokenizer_2.nextToken();
-
- if ( dName.equals(displayName ) )
- {
- oneSpecDesc = " " + "\t" + newSpec.getDisplayName() + "\t"+
- newSpec.getNamespaceURI() + "\t" + newSpec.getLocation() + "\t" +
- newSpec.isDefautSchema() + "\t" + newSpec.getSourceHint() + "\t" +
- newSpec.isFromCatalog();
- }
-
- newValue += oneSpecDesc + "\n";
- }
- prefStore.setValue(ExtensionsSchemasRegistry.USER_ADDED_EXT_SCHEMAS, newValue);
-
- }
-
- private void removeFromPref(SpecificationForExtensionsSchema spec) {
- if (prefStore == null)
- return;
-
- String newValue = "";
- String currentValue = prefStore.getString(ExtensionsSchemasRegistry.USER_ADDED_EXT_SCHEMAS);
- StringTokenizer tokenizer = new StringTokenizer(currentValue, "\n");
-
- while (tokenizer.hasMoreTokens())
- {
- String oneSpecDesc = tokenizer.nextToken();
- // get the Display name
- StringTokenizer _tokenizer_2 = new StringTokenizer(oneSpecDesc, "\t");
- _tokenizer_2.nextToken();
- String dName = _tokenizer_2.nextToken();
-
- if ( dName.equals(spec.getDisplayName() ) )
- continue;
- newValue += oneSpecDesc + "\n";
- }
- prefStore.setValue(ExtensionsSchemasRegistry.USER_ADDED_EXT_SCHEMAS, newValue);
- }
-
-static class CategoryContentProvider implements IStructuredContentProvider
- {
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
- */
- public Object[] getElements(Object inputElement)
- {
- SpecificationForExtensionsSchema[] extensionsSchemaSpecs = null;
- try
- {
- List inputList = (List) inputElement;
- extensionsSchemaSpecs = (SpecificationForExtensionsSchema[]) inputList.toArray(new SpecificationForExtensionsSchema[0]);
- }
- catch (Exception e)
- {
- }
- return extensionsSchemaSpecs;
- }
-
- /*
- * (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-NLS-1$
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
- */
- public String getText(Object element)
- {
- if (element instanceof SpecificationForExtensionsSchema)
- return ((SpecificationForExtensionsSchema) 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 = XSDEditorPlugin.getDefault().getNodeCustomizationRegistry().getLabelProvider(namespace);
- 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();
- }
-
- protected void enableButtons(boolean value)
- {
- editButton.setEnabled(value);
- addButton.setEnabled(value);
- removeButton.setEnabled(value);
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/AddNewCategoryDialog.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/AddNewCategoryDialog.java
deleted file mode 100644
index 5356877a48..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/AddNewCategoryDialog.java
+++ /dev/null
@@ -1,370 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo;
-
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.Platform;
-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.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.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;
-import org.eclipse.swt.widgets.ToolBar;
-import org.eclipse.swt.widgets.ToolItem;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.common.ui.internal.dialogs.SelectSingleFileDialog;
-import org.eclipse.wst.xsd.ui.internal.common.util.Messages;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorCSHelpIds;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-
-public class AddNewCategoryDialog extends Dialog
-{
- private static final String SCHEMA_LABEL = Messages._UI_LABEL_SCHEMA;
- private static final String NAME_LABEL = Messages._UI_LABEL_NAME;
- private static final String SELECT_FROM_WORKSPACE = Messages._UI_LABEL_WORKSPACE;
- private static final String SELECT_FROM_CATALOG = Messages._UI_LABEL_CATALOG;
- private String dialogTitle = Messages._UI_LABEL_ADD_CATEGORY;
-
- protected MenuManager browseMenu;
- protected Label name;
- protected Text nameText;
- protected Label schema;
- protected CLabel schemaDisplayer;
- protected ToolBar browseToolBar;
- protected ToolItem browseItem;
- protected Button searchCatalog;
- protected Button searchWorkspace;
- protected Composite sourcesComposite;
-
- protected List invalidNames;
-
- // TODO (cs) rename this field to extensionSchemaLocation in WTP 2.0
- protected String appInfoSchemaLocation;
- protected String categoryName;
- protected CLabel errDisplayer;
- protected boolean isCategoryNameValid;
- protected boolean fromCatalog;
-
- private boolean canOK =false;
-
- /** Either the location if come from workspace or namespace if come from
- * XML Catalog */
- protected String source;
-
- public AddNewCategoryDialog(Shell parentShell)
- {
- super(parentShell);
- }
-
- public AddNewCategoryDialog(Shell parentShell, String dialogTitle)
- {
- super(parentShell);
- this.dialogTitle = dialogTitle;
- }
-
- /**
- * 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;
- }
-
- public String getNewCategoryName()
- {
- return categoryName.trim();
- }
-
- public String getCategoryLocation()
- {
- return appInfoSchemaLocation;
- }
-
- public void setCategoryLocation(String s){
- appInfoSchemaLocation = s;
- }
-
- /** @deprecated */
- public SpecificationForExtensionsSchema getExtensionsSchemaSpec(){
- SpecificationForExtensionsSchema schemaSpec = new SpecificationForExtensionsSchema();
- schemaSpec.setDisplayName(getNewCategoryName());
- schemaSpec.setLocation(getCategoryLocation());
-
- return schemaSpec;
- }
-
- public void setCategoryName(String categoryName) {
- this.categoryName = categoryName;
- }
-
- public boolean getFromCatalog() {
- return fromCatalog;
- }
-
- public void setFromCatalog(boolean b){
- fromCatalog = b;
- }
-
- public String getSource()
- {
- return source;
- }
-
- public void setSource(String source) {
- this.source = source;
- }
-
- protected Control createButtonBar(Composite parent)
- {
- Control result = super.createButtonBar(parent);
- getButton(IDialogConstants.OK_ID).setEnabled(canOK);
- return result;
- }
-
- // redundant method to improve speed (according to the compiler)
- protected Button getButton(int id) {
- return super.getButton(id);
- }
-
- protected Control createDialogArea(Composite parent)
- {
- getShell().setText(dialogTitle);
-
- Composite mainComposite = (Composite) super.createDialogArea(parent);
- GridLayout layout = new GridLayout(2, 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));
- if (categoryName != null)
- nameText.setText(categoryName);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(nameText,
- XSDEditorCSHelpIds.ADD_CATEGORY__NAME);
-
-
-
- // 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));
- if (source != null)
- {
- if (fromCatalog)
- schemaDisplayer.setImage(
- XSDEditorPlugin.getXSDImage("icons/xmlcatalog_obj.gif")); //$NON-NLS-1$
- else
- schemaDisplayer.setImage(
- XSDEditorPlugin.getXSDImage("icons/XSDFile.gif")); //$NON-NLS-1$
- schemaDisplayer.setText(source);
-
- }
- PlatformUI.getWorkbench().getHelpSystem().setHelp(schemaDisplayer,
- XSDEditorCSHelpIds.ADD_CATEGORY__SCHEMA);
-
- if (categoryName != null && source != null)
- canOK = true;
-
- // Line 3, schema selection buttons
- Button hidden = new Button(mainComposite, SWT.NONE);
- hidden.setVisible(false);
-
- sourcesComposite = new Composite(mainComposite, SWT.NONE);
- RowLayout sourcesLayout = new RowLayout();
-
- sourcesComposite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
- sourcesComposite.setLayout(sourcesLayout);
-
- searchWorkspace = new Button(sourcesComposite, SWT.NONE);
- searchWorkspace.setText(SELECT_FROM_WORKSPACE);
-
- searchCatalog = new Button(sourcesComposite, SWT.NONE);
- searchCatalog.setText(SELECT_FROM_CATALOG);
-
- searchWorkspace.addSelectionListener(new SelectionAdapter()
- {
- public void widgetSelected(SelectionEvent e)
- {
- final String XSD_FILE_EXTENSION = ".xsd"; //$NON-NLS-1$
-
- SelectSingleFileDialog dialog = new SelectSingleFileDialog(getShell(), null, true);
- dialog.addFilterExtensions(new String[] { XSD_FILE_EXTENSION });
- dialog.create();
- dialog.setTitle(Messages._UI_LABEL_SELECT_XSD_FILE);
- dialog.setMessage(Messages._UI_DESCRIPTION_CHOOSE_XSD_FILE);
-
- 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();
- source = uri;
- fromCatalog = false;
-
- appInfoSchemaLocation = "file://" + Platform.getLocation().toString() + "/" + appInfoSchemaLocation; //$NON-NLS-1$ //$NON-NLS-2$
- // TODO... be careful how we construct the location
- // UNIX related issues here
-
- schemaDisplayer.setImage(XSDEditorPlugin.getXSDImage("icons/XSDFile.gif")); //$NON-NLS-1$
- schemaDisplayer.setText(uri);
-
- // Enable the OK button if we should..
- if (isCategoryNameValid)
- {
- getButton(IDialogConstants.OK_ID).setEnabled(true);
- errDisplayer.setText(""); //$NON-NLS-1$
- errDisplayer.setImage(null);
- }
- }
- }
- }
- }
-
- );
-
- searchCatalog.addSelectionListener(new SelectionAdapter()
- {
- public void widgetSelected(SelectionEvent e)
- {
- SelectFromCatalogDialog dialog = new SelectFromCatalogDialog(getShell());
- // dialog.open();
- if (dialog.open() == Window.OK)
- {
- appInfoSchemaLocation = dialog.getCurrentSelectionLocation();
- source = dialog.getCurrentSelectionNamespace();
- fromCatalog = true;
-
- schemaDisplayer.setImage(XSDEditorPlugin.getXSDImage("icons/xmlcatalog_obj.gif")); //$NON-NLS-1$
- schemaDisplayer.setText(dialog.getCurrentSelectionNamespace());
-
- // Enable the OK button if we should..
- if (isCategoryNameValid && !appInfoSchemaLocation.equals("")) //$NON-NLS-1$
- {
- getButton(IDialogConstants.OK_ID).setEnabled(true);
- errDisplayer.setText(""); //$NON-NLS-1$
- errDisplayer.setImage(null);
- }
- }
- }
- });
-
-
- // TODO: Should be able to get the image from the XML plugin. Don't need
- // to copy to XSDEditor icons folder like this.
-
-
- // 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(Messages._UI_ERROR_NAME_ALREADY_USED);
- errDisplayer.setImage(XSDEditorPlugin.getXSDImage("icons/error_st_obj.gif")); //$NON-NLS-1$
- return;
- }
- }
- // name is empty string
- if (categoryName.equals("")) //$NON-NLS-1$
- {
- isCategoryNameValid = false;
-
- getButton(IDialogConstants.OK_ID).setEnabled(false);
- errDisplayer.setText(""); //$NON-NLS-1$
- errDisplayer.setImage(null);
- return;
- }
-
- /*
- * Enable the Ok button if the location field AND the name field are not
- * empty
- */
- if (!categoryName.equals("")) //$NON-NLS-1$
- {
- isCategoryNameValid = true;
- errDisplayer.setText(""); //$NON-NLS-1$
- errDisplayer.setImage(null);
- }
- if (appInfoSchemaLocation != null && !appInfoSchemaLocation.equals("")) //$NON-NLS-1$
- {
- getButton(IDialogConstants.OK_ID).setEnabled(true);
- }
- }
- });
-
- return parent;
- }
-
- protected void okPressed()
- {
- super.okPressed();
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/CategoryProvider.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/CategoryProvider.java
deleted file mode 100644
index a3eb64a376..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/CategoryProvider.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo;
-
-import java.util.ArrayList;
-import java.util.List;
-
-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;
-
-public class CategoryProvider
-{
- private ICatalog systemCatalog;
-
- public CategoryProvider()
- {
-
- }
-
- /**
- * Extenders should implement and return a list of
- * SpecificationForExtensionsSchema
- * @return
- */
- public List getCategories()
- {
- return new ArrayList();
- }
-
- /**
- * Helper method to find the physical location of the schema
- * in the XML Catalog
- * @param namespaceURI
- * @return physical location of the schema
- */
- public 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/internal/common/properties/sections/appinfo/DOMExtensionDetailsContentProvider.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionDetailsContentProvider.java
deleted file mode 100644
index f28e18acbe..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionDetailsContentProvider.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/*******************************************************************************
- * 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.internal.common.properties.sections.appinfo;
-
-import java.text.Collator;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.wst.xml.core.internal.contentmodel.CMAttributeDeclaration;
-import org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration;
-import org.eclipse.wst.xml.core.internal.contentmodel.modelquery.ModelQuery;
-import org.eclipse.wst.xml.core.internal.modelquery.ModelQueryUtil;
-import org.eclipse.wst.xml.ui.internal.tabletree.TreeContentHelper;
-import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.custom.DefaultListNodeEditorConfiguration;
-import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.custom.NodeCustomizationRegistry;
-import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.custom.NodeEditorConfiguration;
-import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.custom.NodeEditorProvider;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-
-public class DOMExtensionDetailsContentProvider implements ExtensionDetailsContentProvider
-{
- private static final Object[] EMPTY_ARRAY = {};
- private static final String[] EMPTY_STRING_ARRAY = {};
- private static final String XMLNS = "xmlns"; //$NON-NLS
- private static final String TEXT_NODE_KEY = "text()"; //$NON-NLS
-
- public Object[] getItems(Object input)
- {
- HashMap resultMap = new HashMap();
- if (input instanceof Element)
- {
- Element element = (Element) input;
-
- // here we compute items for the attributes that physically in the document
- //
- NamedNodeMap attributes = element.getAttributes();
- for (int i = 0; i < attributes.getLength(); i++)
- {
- Attr attr = (Attr) attributes.item(i);
- if (!XMLNS.equals(attr.getName()) && !XMLNS.equals(attr.getPrefix())) //$NON-NLS-1$ //$NON-NLS-2$
- {
- resultMap.put(attr.getName(), DOMExtensionItem.createItemForElementAttribute(element, attr));
- }
- }
-
- // here we compute an item for the text node that is physically in the document
- //
- String textNodeValue = new TreeContentHelper().getNodeValue(element);
- if (textNodeValue != null)
- {
- resultMap.put(TEXT_NODE_KEY, DOMExtensionItem.createItemForElementText(element));
- }
-
- ModelQuery modelQuery = ModelQueryUtil.getModelQuery(element.getOwnerDocument());
- if (modelQuery != null)
- {
- CMElementDeclaration ed = modelQuery.getCMElementDeclaration(element);
- if (ed != null)
- {
- // here we compute items for the attributes that may be added to the document according to the grammar
- //
- List list = modelQuery.getAvailableContent(element, ed, ModelQuery.INCLUDE_ATTRIBUTES);
- for (Iterator i = list.iterator(); i.hasNext(); )
- {
- CMAttributeDeclaration ad = (CMAttributeDeclaration)i.next();
- if (ad != null && resultMap.get(ad.getNodeName()) == null)
- {
- resultMap.put(ad.getNodeName(), DOMExtensionItem.createItemForElementAttribute(element, ad));
- }
- }
- if (resultMap.get(TEXT_NODE_KEY) == null)
- {
- // here we compute an item for the text node that may be added to the document according to the grammar
- //
- int contentType = ed.getContentType();
- if (contentType == CMElementDeclaration.PCDATA || contentType == CMElementDeclaration.MIXED)
- {
- resultMap.put(TEXT_NODE_KEY, DOMExtensionItem.createItemForElementText(element));
- }
- }
- }
- }
- Collection collection = resultMap.values();
- // initialize the editor information for each item
- //
- for (Iterator i = collection.iterator(); i.hasNext();)
- {
- initPropertyEditorConfiguration((DOMExtensionItem) i.next());
- }
- DOMExtensionItem[] items = new DOMExtensionItem[collection.size()];
- resultMap.values().toArray(items);
-
- // here we sort the list alphabetically
- //
- if (items.length > 0)
- {
- Comparator comparator = new Comparator()
- {
- public int compare(Object arg0, Object arg1)
- {
- DOMExtensionItem a = (DOMExtensionItem)arg0;
- DOMExtensionItem b = (DOMExtensionItem)arg1;
-
- // begin special case to ensure 'text nodes' come last
- if (a.isTextValue() && !b.isTextValue())
- {
- return 1;
- }
- else if (b.isTextValue() && !a.isTextValue())
- {
- return -1;
- }
- // end special case
- else
- {
- return Collator.getInstance().compare(a.getName(), b.getName());
- }
- }
- };
- Arrays.sort(items, comparator);
- }
- return items;
- }
- else if (input instanceof Attr)
- {
- Attr attr = (Attr) input;
- DOMExtensionItem item = DOMExtensionItem.createItemForAttributeText(attr.getOwnerElement(), attr);
- DOMExtensionItem[] items = {item};
- return items;
- }
- return EMPTY_ARRAY;
- }
-
- public String getName(Object item)
- {
- if (item instanceof DOMExtensionItem)
- {
- return ((DOMExtensionItem) item).getName();
- }
- return ""; //$NON-NLS-1$
- }
-
- public String getValue(Object item)
- {
- if (item instanceof DOMExtensionItem)
- {
- return ((DOMExtensionItem) item).getValue();
- }
- return ""; //$NON-NLS-1$
- }
-
- public String[] getPossibleValues(Object item)
- {
- if (item instanceof DOMExtensionItem)
- {
- return ((DOMExtensionItem) item).getPossibleValues();
- }
- return EMPTY_STRING_ARRAY;
- }
-
- protected void initPropertyEditorConfiguration(DOMExtensionItem item)
- {
- String namespace = item.getNamespace();
- String name = item.getName();
- String parentName = item.getParentName();
- NodeEditorConfiguration configuration = null;
- if (namespace != null)
- {
- // TODO (cs) remove reference to XSDEditorPlugin... make generic
- // perhaps push down the xml.ui ?
- //
- NodeCustomizationRegistry registry = XSDEditorPlugin.getDefault().getNodeCustomizationRegistry();
- NodeEditorProvider provider= registry.getNodeEditorProvider(namespace);
- if (provider != null)
- {
- configuration = provider.getNodeEditorConfiguration(parentName, name);
- if (configuration != null)
- {
- configuration.setParentNode(item.getParentNode());
- if (item.getNode() != null)
- {
- configuration.setNode(item.getNode());
- }
- }
- }
- }
- String[] values = item.getPossibleValues();
- if (values != null && values.length > 1)
- {
- configuration = new DefaultListNodeEditorConfiguration(values);
- }
-
- // Note that it IS expected that the configaration may be null
- //
- item.setPropertyEditorConfiguration(configuration);
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionItem.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionItem.java
deleted file mode 100644
index 52505251b2..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionItem.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/*******************************************************************************
- * 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.internal.common.properties.sections.appinfo;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.wst.xml.core.internal.contentmodel.CMAttributeDeclaration;
-import org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration;
-import org.eclipse.wst.xml.core.internal.contentmodel.CMNode;
-import org.eclipse.wst.xml.core.internal.contentmodel.modelquery.ModelQuery;
-import org.eclipse.wst.xml.core.internal.modelquery.ModelQueryUtil;
-import org.eclipse.wst.xml.ui.internal.tabletree.TreeContentHelper;
-import org.eclipse.wst.xsd.ui.internal.common.commands.UpdateAttributeValueCommand;
-import org.eclipse.wst.xsd.ui.internal.common.commands.UpdateTextValueCommand;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-class DOMExtensionItem extends ExtensionItem
-{
- private final static int KIND_ELEMENT_ATTR = 1;
- private final static int KIND_ELEMENT_TEXT = 2;
- private final static int KIND_ELEMENT_CMATTRIBUTE = 3;
- private final static int KIND_ATTR_TEXT = 4;
- int kind;
- Attr attribute;
- Element parent;
- CMNode cmNode;
-
- private DOMExtensionItem(int kind, Element parent, Attr node, CMNode cmNode)
- {
- this.kind = kind;
- this.parent = parent;
- this.attribute = node;
- this.cmNode = cmNode;
- }
-
- public boolean isTextValue()
- {
- return kind == KIND_ELEMENT_TEXT || kind == KIND_ATTR_TEXT;
- }
-
- static DOMExtensionItem createItemForElementText(Element parent)
- {
- return new DOMExtensionItem(KIND_ELEMENT_TEXT, parent, null, null);
- }
-
- static DOMExtensionItem createItemForElementAttribute(Element parent, Attr attribute)
- {
- return new DOMExtensionItem(KIND_ELEMENT_ATTR, parent, attribute, null);
- }
-
- static DOMExtensionItem createItemForElementAttribute(Element parent, CMAttributeDeclaration ad)
- {
- if (ad == null)
- {
- System.out.println("null!");
- }
- return new DOMExtensionItem(KIND_ELEMENT_CMATTRIBUTE, parent, null, ad);
- }
-
- static DOMExtensionItem createItemForAttributeText(Element parent, Attr attribute)
- {
- return new DOMExtensionItem(KIND_ATTR_TEXT, parent, attribute, null);
- }
-
- public String getName()
- {
- String result = null;
- switch (kind)
- {
- case KIND_ATTR_TEXT : {
- result = "value";
- break;
- }
- case KIND_ELEMENT_ATTR : {
- result = attribute.getName();
- break;
- }
- case KIND_ELEMENT_CMATTRIBUTE : {
- CMAttributeDeclaration ad = (CMAttributeDeclaration) cmNode;
- result = ad.getNodeName();
- break;
- }
- case KIND_ELEMENT_TEXT : {
- result = "text value";
- break;
- }
- }
- return result != null ? result : "";
- }
-
- public String getValue()
- {
- switch (kind)
- {
- case KIND_ATTR_TEXT :
- case KIND_ELEMENT_ATTR : {
- // note intentional fall-thru!!
- return attribute.getNodeValue();
- }
- case KIND_ELEMENT_CMATTRIBUTE : {
- // CS : one would think that we'd just need to return "" here
- // but after editing a item of this kind and giving it value
- // the list of item's doesn't get recomputed.. so we need to trick
- // one of these items to behave like the KIND_ELEMENT_ATTR case
- //
- String value = parent.getAttribute(cmNode.getNodeName());
- return (value != null) ? value : "";
- }
- case KIND_ELEMENT_TEXT : {
- return new TreeContentHelper().getElementTextValue(parent);
- }
- }
- return "";
- }
-
-
- public String[] getPossibleValues()
- {
- String[] result = {};
-
- switch (kind)
- {
- case KIND_ATTR_TEXT :
- case KIND_ELEMENT_ATTR : {
- // note intentional fall-thru!!
- ModelQuery modelQuery = ModelQueryUtil.getModelQuery(parent.getOwnerDocument());
- if (modelQuery != null)
- {
- CMAttributeDeclaration ad = modelQuery.getCMAttributeDeclaration(attribute);
- if (ad != null)
- {
- result = modelQuery.getPossibleDataTypeValues(parent, ad);
- }
- }
- break;
- }
- case KIND_ELEMENT_CMATTRIBUTE : {
- ModelQuery modelQuery = ModelQueryUtil.getModelQuery(parent.getOwnerDocument());
- if (modelQuery != null && cmNode != null)
- {
- result = modelQuery.getPossibleDataTypeValues(parent, cmNode);
- }
- break;
- }
- case KIND_ELEMENT_TEXT : {
- ModelQuery modelQuery = ModelQueryUtil.getModelQuery(parent.getOwnerDocument());
- if (modelQuery != null)
- {
- CMElementDeclaration ed = modelQuery.getCMElementDeclaration(parent);
- if (ed != null)
- {
- result = modelQuery.getPossibleDataTypeValues(parent, ed);
- }
- }
- break;
- }
- }
- return result;
- }
-
- public Command getUpdateValueCommand(String newValue)
- {
- switch (kind)
- {
- case KIND_ATTR_TEXT :
- case KIND_ELEMENT_ATTR : {
- // note intentional fall-thru!!
- return new UpdateAttributeValueCommand(parent, attribute.getNodeName(), newValue, true);
- }
- case KIND_ELEMENT_CMATTRIBUTE : {
- final CMAttributeDeclaration ad = (CMAttributeDeclaration) cmNode;
- return new UpdateAttributeValueCommand(parent, ad.getAttrName(), newValue, true);
- }
- case KIND_ELEMENT_TEXT : {
- return new UpdateTextValueCommand(parent, newValue);
- }
- }
- return null;
- }
-
- public String getNamespace()
- {
- String namespace = null;
- if (kind == KIND_ATTR_TEXT)
- {
- namespace = attribute.getNamespaceURI();
- }
- else if (parent != null)
- {
- namespace = parent.getNamespaceURI();
- }
- return namespace;
- }
-
- public Node getParentNode()
- {
- Node parentNode = null;
- if (attribute != null)
- {
- parentNode = attribute.getOwnerElement();
- }
- else if (parent != null)
- {
- parentNode = parent;
- }
- return parentNode;
- }
-
- public String getParentName()
- {
- Node parentNode = getParentNode();
- return parentNode != null ? parentNode.getLocalName() : "";
- }
-
- public Node getNode()
- {
- return attribute;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionItemEditManager.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionItemEditManager.java
deleted file mode 100644
index aac70ea719..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionItemEditManager.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * 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.internal.common.properties.sections.appinfo;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Widget;
-
-
-/**
- * @deprecated
- */
-public class DOMExtensionItemEditManager implements ExtensionItemEditManager
-{
- public void handleEdit(Object item, Widget widget)
- {
- }
-
- public Control createCustomButtonControl(Composite composite, Object item)
- {
- Button button = new Button(composite, SWT.NONE);
- button.setText("..."); //$NON-NLS-1$
- return button;
- }
-
- public Control createCustomTextControl(Composite composite, Object item)
- {
- return null;
- }
-
- public String getButtonControlStyle(Object object)
- {
- return ExtensionItemEditManager.STYLE_NONE;
- }
-
- public String getTextControlStyle(Object object)
- {
- return ExtensionItemEditManager.STYLE_NONE;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionItemMenuListener.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionItemMenuListener.java
deleted file mode 100644
index fc30c94d0e..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionItemMenuListener.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*******************************************************************************
- * 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.internal.common.properties.sections.appinfo;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration;
-import org.eclipse.wst.xml.core.internal.contentmodel.modelquery.ModelQuery;
-import org.eclipse.wst.xml.core.internal.document.ElementImpl;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
-import org.eclipse.wst.xml.ui.internal.contentoutline.XMLNodeActionManager;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-public class DOMExtensionItemMenuListener implements IMenuListener
-{
- TreeViewer treeViewer;
-
- public DOMExtensionItemMenuListener(TreeViewer treeViewer)
- {
- this.treeViewer = treeViewer;
- }
-
- public void menuAboutToShow(IMenuManager manager)
- {
- manager.removeAll();
- ISelection selection = treeViewer.getSelection();
- if (selection instanceof IStructuredSelection)
- {
- IStructuredSelection structuredSelection = (IStructuredSelection) selection;
- if (structuredSelection.getFirstElement() instanceof ElementImpl)
- {
- ElementImpl elementImpl = (ElementImpl) structuredSelection.getFirstElement();
- IDOMDocument domDocument = (IDOMDocument) elementImpl.getOwnerDocument();
- InternalNodeActionManager actionManager = new InternalNodeActionManager(domDocument.getModel(), treeViewer);
- actionManager.fillContextMenu(manager, structuredSelection);
- }
- }
- }
-
-
- class InternalNodeActionManager extends XMLNodeActionManager
- {
- public InternalNodeActionManager(IStructuredModel model, Viewer viewer)
- {
- super(model, viewer);
- }
-
- public void contributeActions(IMenuManager menu, List selection)
- {
- //menu.add(new Action("there"){});
- try
- {
- int editMode = modelQuery.getEditMode();
- int ic = ModelQuery.INCLUDE_CHILD_NODES;
- int vc = (editMode == ModelQuery.EDIT_MODE_CONSTRAINED_STRICT) ? ModelQuery.VALIDITY_STRICT : ModelQuery.VALIDITY_NONE;
- List implicitlySelectedNodeList = null;
-
- if (selection.size() == 1)
- {
- Node node = (Node) selection.get(0);
- // contribute add child actions
- contributeAddChildActions(menu, node, ic, vc);
- }
- if (selection.size() > 0)
- {
- implicitlySelectedNodeList = getSelectedNodes(selection, true);
- // contribute delete actions
- contributeDeleteActions(menu, implicitlySelectedNodeList, ic, vc);
- }
- }
- catch(Exception e)
- {
- menu.add(new Action(e.getMessage()){});
- }
- /*
- if (selection.size() > 0)
- {
- // contribute replace actions
- contributeReplaceActions(menu, implicitlySelectedNodeList, ic, vc);
- }*/
- }
-
- protected void contributeAddChildActions(IMenuManager menu, Node node, int ic, int vc)
- {
- int nodeType = node.getNodeType();
- if (nodeType == Node.ELEMENT_NODE)
- {
- // 'Add Child...' and 'Add Attribute...' actions
- //
- Element element = (Element) node;
- MyMenuManager newMenu = new MyMenuManager("New"){
- public boolean isVisible() { return true; }
- };//$NON-NLS-1$
- newMenu.setVisible(true);
- menu.add(newMenu);
-
- CMElementDeclaration ed = modelQuery.getCMElementDeclaration(element);
- if (ed != null)
- {
- List modelQueryActionList = new ArrayList();
- // add insert child node actions
- //
- modelQueryActionList = new ArrayList();
- modelQuery.getInsertActions(element, ed, -1, ic, vc, modelQueryActionList);
- addActionHelper(newMenu, modelQueryActionList);
- }
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionTreeContentProvider.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionTreeContentProvider.java
deleted file mode 100644
index bc90293694..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionTreeContentProvider.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * 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.internal.common.properties.sections.appinfo;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.wst.sse.core.internal.provisional.INodeAdapter;
-import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-public class DOMExtensionTreeContentProvider implements ITreeContentProvider, INodeAdapter
-{
- protected String facet;
- protected Viewer viewer;
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
- {
- this.viewer = viewer;
- }
-
- public Object[] getChildren(Object parentElement)
- {
- if (parentElement instanceof Element)
- {
- Element element = (Element)parentElement;
- ArrayList list = new ArrayList();
- for (Node node = element.getFirstChild(); node != null; node = node.getNextSibling())
- {
- if (node.getNodeType() == Node.ELEMENT_NODE)
- {
- list.add(node);
- }
- }
- return list.toArray();
- }
- return Collections.EMPTY_LIST.toArray();
- }
-
- public boolean hasChildren(Object element)
- {
- Object[] children = getChildren(element);
- return children.length > 0;
- }
-
- public Object getParent(Object element)
- {
- return null;
- }
-
- public java.lang.Object[] getElements(java.lang.Object inputElement)
- {
- return getChildren(inputElement);
- }
-
- public void dispose()
- {
- }
-
- public void notifyChanged(INodeNotifier notifier, int eventType, Object changedFeature, Object oldValue, Object newValue, int pos)
- {
- if (viewer != null)
- {
- viewer.refresh();
- }
- }
-
- public boolean isAdapterForType(Object type)
- {
- // this method is not used
- return false;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionTreeLabelProvider.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionTreeLabelProvider.java
deleted file mode 100644
index d173548205..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/DOMExtensionTreeLabelProvider.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo;
-
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.custom.NodeCustomizationRegistry;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-import org.w3c.dom.Attr;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.Text;
-
-public class DOMExtensionTreeLabelProvider extends LabelProvider
-{
- protected static final Image DEFAULT_ELEMENT_ICON = XSDEditorPlugin.getXSDImage("icons/XSDElement.gif"); //$NON-NLS-1$
- protected static final Image DEFAULT_ATTR_ICON = XSDEditorPlugin.getXSDImage("icons/XSDAttribute.gif"); //$NON-NLS-1$
-
- public DOMExtensionTreeLabelProvider()
- {
- }
-
- public Image getImage(Object element)
- {
- NodeCustomizationRegistry registry = XSDEditorPlugin.getDefault().getNodeCustomizationRegistry();
- if (element instanceof Element)
- {
- Element domElement = (Element) element;
- String namespace = domElement.getNamespaceURI();
- if (namespace != null)
- {
- ILabelProvider lp = registry.getLabelProvider(namespace);
- 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 getText(Object input)
- {
- if (input instanceof Element)
- {
- Element domElement = (Element) input;
- String textVal = "";
-
- if (domElement.hasChildNodes())
- {
- Node node = domElement.getChildNodes().item(0);
- if (node instanceof Text)
- {
- Text textNode = (Text) node;
- try
- {
- if (!textNode.getNodeValue().contains("\n"))
- textVal = " [" + textNode.getNodeValue() + "]";
- }
- catch (DOMException e)
- {
- textVal = "";
- }
- }
- }
- return domElement.getLocalName() + textVal;
- }
- if ( input instanceof Attr){
- return ((Attr) input).getLocalName();
- }
- return ""; //$NON-NLS-1$
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionDetailsContentProvider.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionDetailsContentProvider.java
deleted file mode 100644
index 6cfaac1e48..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionDetailsContentProvider.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*******************************************************************************
- * 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.internal.common.properties.sections.appinfo;
-
-public interface ExtensionDetailsContentProvider
-{
- Object[] getItems(Object input);
- String getName(Object item);
- String getValue(Object item);
- String[] getPossibleValues(Object item);
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionDetailsViewer.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionDetailsViewer.java
deleted file mode 100644
index 8a62a5a0b8..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionDetailsViewer.java
+++ /dev/null
@@ -1,336 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Jesse Valianes - Seneca College https://bugs.eclipse.org/bugs/show_bug.cgi?id=235381
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.CommandStack;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.FocusListener;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-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.Text;
-import org.eclipse.swt.widgets.Widget;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.custom.DialogNodeEditorConfiguration;
-import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.custom.ListNodeEditorConfiguration;
-import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.custom.NodeEditorConfiguration;
-
-public class ExtensionDetailsViewer extends Viewer
-{
- private final static String ITEM_DATA = "ITEM_DATA"; //$NON-NLS-1$
- private final static String EDITOR_CONFIGURATION_DATA = "EDITOR_CONFIGURATION_DATA"; //$NON-NLS-1$
-
- Composite control;
- Composite composite;
- ExtensionDetailsContentProvider contentProvider;
- TabbedPropertySheetWidgetFactory widgetFactory;
- InternalControlListener internalControlListener;
- CommandStack commandStack;
-
- public ExtensionDetailsViewer(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory)
- {
- this.widgetFactory = widgetFactory;
- control = widgetFactory.createComposite(parent);
- internalControlListener = new InternalControlListener();
- control.setLayout(new GridLayout());
- }
- public Control getControl()
- {
- return control;
- }
-
- public void setCommandStack(CommandStack commandStack)
- {
- this.commandStack = commandStack;
- }
-
- public Object getInput()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public ISelection getSelection()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public void refresh()
- {
- Control[] children = composite.getChildren();
- for (int i = 0; i < children.length; i++)
- {
- Control control = children[i];
- if (control instanceof Text)
- {
- ExtensionItem item = (ExtensionItem)control.getData(ITEM_DATA);
- String value = contentProvider.getValue(item);
- ((Text)control).setText(value);
- }
- }
- }
-
- private void createTextOrComboControl(ExtensionItem item, Composite composite)
- {
- Control control = null;
- String value = contentProvider.getValue(item);
- NodeEditorConfiguration editorConfiguration = item.getPropertyEditorConfiguration();
-
- if (editorConfiguration != null && hasStyle(editorConfiguration, NodeEditorConfiguration.STYLE_COMBO))
- {
- ListNodeEditorConfiguration configuration = (ListNodeEditorConfiguration)editorConfiguration;
- CCombo combo = widgetFactory.createCCombo(composite);
- combo.setText(value);
- Object[] values = configuration.getValues(item);
- LabelProvider labelProvider = configuration.getLabelProvider();
- for (int j = 0; j < values.length; j++)
- {
- Object o = values[j];
- String displayName = labelProvider != null ?
- labelProvider.getText(o) :
- o.toString();
- combo.add(displayName);
- }
- combo.addSelectionListener(internalControlListener);
- control = combo;
- }
- if (control == null)
- {
- Text text = widgetFactory.createText(composite,value);
- text.addKeyListener(internalControlListener);
- control = text;
- }
- control.setData(ITEM_DATA, item);
- control.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- control.addFocusListener(internalControlListener);
- }
-
- private void createButtonControl(ExtensionItem item, Composite composite)
- {
- NodeEditorConfiguration editorConfiguration = item.getPropertyEditorConfiguration();
- if (editorConfiguration != null && hasStyle(editorConfiguration, NodeEditorConfiguration.STYLE_DIALOG))
- {
- DialogNodeEditorConfiguration configuration = (DialogNodeEditorConfiguration)editorConfiguration;
- Button button = new Button(composite, SWT.NONE);
- GridData gridData = new GridData();
- gridData.heightHint = 17;
- button.setLayoutData(gridData);
- button.addSelectionListener(internalControlListener);
- button.setData(ITEM_DATA, item);
- button.setData(EDITOR_CONFIGURATION_DATA, configuration);
- String text = configuration.getButonText();
- if (text != null)
- {
- button.setText(text); //$NON-NLS-1$
- }
- button.setImage(configuration.getButtonImage());
- }
- else
- {
- Control placeHolder = new Label(composite, SWT.NONE);
- placeHolder.setVisible(false);
- placeHolder.setEnabled(false);
- placeHolder.setLayoutData(new GridData());
- }
- }
-
- public void setInput(Object input)
- {
- // TODO (cs) add assertions
- //
- if (contentProvider == null)
- return;
-
- if (composite != null)
- {/*
- for (Iterator i = controlsThatWeAreListeningTo.iterator(); i.hasNext(); )
- {
- Control control = (Control)i.next();
- if (control != null)
- {
- control.removeFocusListener(internalFocusListener);
- }
- } */
- removeListeners();
- composite.dispose();
- }
-
- composite = widgetFactory.createComposite(control);
- composite.setBackground(ColorConstants.white);
- GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 3;
- composite.setLayout(gridLayout);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- Object[] items = contentProvider.getItems(input);
-
- for (int i = 0; i < items.length; i++)
- {
- ExtensionItem item = (ExtensionItem)items[i];
- String name = contentProvider.getName(item);
- Label label = widgetFactory.createLabel(composite, name + ":"); //$NON-NLS-1$
- label.setLayoutData(new GridData());
- createTextOrComboControl(item, composite);
- createButtonControl(item, composite);
- }
- control.layout(true);
- }
-
- private boolean hasStyle(NodeEditorConfiguration configuration, int style)
- {
- return (configuration.getStyle() & style) != 0;
- }
-
-
- public void setSelection(ISelection selection, boolean reveal)
- {
- // TODO Auto-generated method stub
-
- }
- public ExtensionDetailsContentProvider getContentProvider()
- {
- return contentProvider;
- }
- public void setContentProvider(ExtensionDetailsContentProvider contentProvider)
- {
- this.contentProvider = contentProvider;
- }
-
- private void applyEdit(ExtensionItem item, Widget widget)
- {
- if (item != null)
- {
- String value = null;
- if (widget instanceof Text)
- {
- Text text = (Text)widget;
- value = text.getText();
- }
- else if (widget instanceof CCombo)
- {
- CCombo combo = (CCombo)widget;
- int index = combo.getSelectionIndex();
- if (index != -1)
- {
- value = combo.getItem(index);
- }
- }
- if (value != null)
- {
- Command command = item.getUpdateValueCommand(value);
- if (command != null)
- {
- if (commandStack != null)
- commandStack.execute(command);
- else
- command.execute();
- }
- }
- }
- }
-
- class InternalControlListener implements FocusListener, SelectionListener, KeyListener
- {
- public void widgetSelected(SelectionEvent e)
- {
- // for button controls we handle selection events
- //
- Object item = e.widget.getData(EDITOR_CONFIGURATION_DATA);
- if (item == null)
- item = e.widget.getData(ITEM_DATA);
- if (item instanceof DialogNodeEditorConfiguration)
- {
- DialogNodeEditorConfiguration dialogNodeEditorConfiguration = (DialogNodeEditorConfiguration)item;
- dialogNodeEditorConfiguration.invokeDialog();
- refresh();
- }
- else if (item instanceof ExtensionItem)
- {
- applyEdit((ExtensionItem)item, e.widget);
- }
- }
-
- public void widgetDefaultSelected(SelectionEvent e)
- {
- // do nothing
- }
-
- public void focusGained(FocusEvent e)
- {
- }
-
- public void focusLost(FocusEvent e)
- {
- // apply edits for text and combo box controls
- // via the focusLost event
- Object item = e.widget.getData(ITEM_DATA);
- if (item instanceof ExtensionItem)
- {
- applyEdit((ExtensionItem)item, e.widget);
- }
- }
-
- public void keyPressed(KeyEvent e)
- {
- // handle explict ENTER key
- Object item = e.widget.getData(ITEM_DATA);
- if (item instanceof ExtensionItem)
- {
- if (e.character == SWT.CR)
- applyEdit((ExtensionItem)item, e.widget);
- }
- }
-
- public void keyReleased(KeyEvent e)
- {
- // Ignore these events
- }
- }
-
- public void removeListeners()
- {
- if (composite != null && !composite.isDisposed())
- {
- Control [] children = composite.getChildren();
- int length = children.length;
- for (int i = 0; i < length; i++)
- {
- Control o = children[i];
- if (o instanceof CCombo)
- {
- ((CCombo)o).removeSelectionListener(internalControlListener);
- o.removeFocusListener(internalControlListener);
- }
- else if (o instanceof Text)
- {
- ((Text)o).removeKeyListener(internalControlListener);
- o.removeFocusListener(internalControlListener);
- }
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionItem.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionItem.java
deleted file mode 100644
index 4b67808305..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionItem.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * 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.internal.common.properties.sections.appinfo;
-
-import org.eclipse.gef.commands.Command;
-import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.custom.NodeEditorConfiguration;
-
-public abstract class ExtensionItem
-{
- NodeEditorConfiguration propertyEditorConfiguration;
-
- public NodeEditorConfiguration getPropertyEditorConfiguration()
- {
- return propertyEditorConfiguration;
- }
-
- public void setPropertyEditorConfiguration(NodeEditorConfiguration propertyEditorConfiguration)
- {
- this.propertyEditorConfiguration = propertyEditorConfiguration;
- }
-
- public abstract Command getUpdateValueCommand(String newValue);
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionItemEditManager.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionItemEditManager.java
deleted file mode 100644
index b84ad1c2ea..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionItemEditManager.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * 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.internal.common.properties.sections.appinfo;
-
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Widget;
-
-/**
- * @deprecated
- */
-public interface ExtensionItemEditManager
-{
- public final static String STYLE_NONE = "none"; //$NON-NLS-1$
- public final static String STYLE_TEXT = "text"; //$NON-NLS-1$
- public final static String STYLE_COMBO = "combo"; //$NON-NLS-1$
- public final static String STYLE_CUSTOM = "custom"; //$NON-NLS-1$
-
- void handleEdit(Object item, Widget widget);
- String getTextControlStyle(Object item);
- String getButtonControlStyle(Object item);
- Control createCustomTextControl(Composite composite, Object item);
- Control createCustomButtonControl(Composite composite, Object item);
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionItemFilter.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionItemFilter.java
deleted file mode 100644
index b199c37c60..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionItemFilter.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo;
-
-import org.eclipse.xsd.XSDConcreteComponent;
-
-// cs: This interface is intended to suppliment the NodeFilter class
-// that can be specified via the customization extensions point.
-// When the initial list of a category's objects is displayed
-// we'll use a NodeFilter to prune the list. If the NodeFilter
-// implements this interface we'll call this interface's isApplicableContext
-// method instead of the NodeFilter's DOM node based method. This provides
-// are a more convenient interface for clients who are only interested in
-// filter the list presented via the AddExtensionComponentDialog.
-// See the class ExtensionsSection for more details.
-//
-public interface ExtensionItemFilter
-{
- public boolean isApplicableContext(XSDConcreteComponent parent, XSDConcreteComponent candidate);
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionsSchemasRegistry.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionsSchemasRegistry.java
deleted file mode 100644
index 8fc3af68bc..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/ExtensionsSchemasRegistry.java
+++ /dev/null
@@ -1,330 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.wst.common.uriresolver.internal.provisional.URIResolver;
-import org.eclipse.wst.common.uriresolver.internal.provisional.URIResolverPlugin;
-import org.eclipse.wst.xsd.ui.internal.common.commands.ExtensibleAddExtensionCommand;
-import org.eclipse.wst.xsd.ui.internal.common.commands.ExtensibleRemoveExtensionNodeCommand;
-import org.w3c.dom.Element;
-
-public class ExtensionsSchemasRegistry
-{
- public static final String USER_ADDED_EXT_SCHEMAS = "USER-ADDED-EXT-SCHEMAS"; // TODO externalize
- private static final String LOCATION_PREFIX = "platform:/plugin/"; //$NON-NLS-1$
- public static final String DESCRIPTION = "description"; //$NON-NLS-1$
- public static final String DISPLAYNAME = "displayName"; //$NON-NLS-1$
- public static final String NAMESPACEURI = "namespaceURI"; //$NON-NLS-1$
- public static final String XSDFILEURL = "xsdFileURL"; //$NON-NLS-1$
- public static final String LABELPROVIDER = "labelProviderClass"; //$NON-NLS-1$
- public static final String ADD_COMMAND_CLASS = "addCommandClass"; //$NON-NLS-1$
- public static final String DELETE_COMMAND_CLASS = "deleteCommandClass"; //$NON-NLS-1$
- public static final String CATEGORY_PROVIDER_CLASS = "class"; //$NON-NLS-1$
-
- protected IPreferenceStore prefStore;
- protected String extensionId;
-
- protected ArrayList nsURIProperties, categoryProviderList;
- private String deprecatedExtensionId;
-
- public ExtensionsSchemasRegistry(String appinfo_extensionid)
- {
- extensionId = appinfo_extensionid;
- }
-
- public void __internalSetDeprecatedExtensionId(String deprecatedId)
- {
- deprecatedExtensionId = deprecatedId;
- }
-
- public void setPrefStore(IPreferenceStore store)
- {
- prefStore = store;
- }
-
- public List getAllExtensionsSchemasContribution()
- {
- // If we read the registry, then let's not do it again.
- if (nsURIProperties != null)
- {
- return nsURIProperties;
- }
-
- nsURIProperties = new ArrayList();
- categoryProviderList = new ArrayList();
-
- getAllExtensionsSchemasContribution(extensionId);
- if (deprecatedExtensionId != null)
- {
- getAllExtensionsSchemasContribution(deprecatedExtensionId);
- }
-
- // get user-added schemas stored in preference
- if (prefStore != null)
- {
- String value = prefStore.getString(USER_ADDED_EXT_SCHEMAS);
- StringTokenizer tokenizer = new StringTokenizer(value, "\n");
-
- while ( tokenizer.hasMoreTokens() )
- {
- nsURIProperties.add( new SpecificationForExtensionsSchema( tokenizer.nextToken() ) );
- }
- }
-
- return nsURIProperties;
- }
-
- private List getAllExtensionsSchemasContribution(String id)
- {
- IConfigurationElement[] asiPropertiesList = Platform.getExtensionRegistry().getConfigurationElementsFor(id);
-
- boolean hasASIProperties = (asiPropertiesList != null) && (asiPropertiesList.length > 0);
-
- if (hasASIProperties)
- {
- for (int i = 0; i < asiPropertiesList.length; i++)
- {
- IConfigurationElement asiPropertiesElement = asiPropertiesList[i];
- String elementName = asiPropertiesElement.getName();
-
- if ("category".equals(elementName))
- {
- 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);
- String addCommandClass = asiPropertiesElement.getAttribute(ADD_COMMAND_CLASS);
- String deleteCommandClass = asiPropertiesElement.getAttribute(DELETE_COMMAND_CLASS);
-
- 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.
- continue;
- }
-
- if (xsdFileURL == null)
- {
- xsdFileURL = locateFileUsingCatalog(namespaceURI);
- }
-
- SpecificationForExtensionsSchema extensionsSchemaSpec = createEntry();
- extensionsSchemaSpec.setDescription(description);
- extensionsSchemaSpec.setDisplayName(displayName);
- extensionsSchemaSpec.setNamespaceURI(namespaceURI);
- extensionsSchemaSpec.setDefautSchema();
-
- String pluginId = asiPropertiesElement.getDeclaringExtension().getContributor().getName();
-
- if (labelProviderClass != null)
- {
- ILabelProvider labelProvider = null;
- try
- {
- Class theClass = Platform.getBundle(pluginId).loadClass(labelProviderClass);
- if (theClass != null)
- {
- labelProvider = (ILabelProvider) theClass.newInstance();
- if (labelProvider != null)
- {
- extensionsSchemaSpec.setLabelProvider(labelProvider);
- }
- }
- }
- catch (Exception e)
- {
-
- }
- }
-
- if (addCommandClass != null)
- {
- try
- {
- ExtensibleAddExtensionCommand addCommand = (ExtensibleAddExtensionCommand)asiPropertiesElement.createExecutableExtension(ADD_COMMAND_CLASS);
- if (addCommand != null)
- {
- extensionsSchemaSpec.setExtensibleAddExtensionCommand(addCommand);
- }
- }
- catch (Exception e)
- {
- }
- }
-
- if (deleteCommandClass != null)
- {
- try
- {
- ExtensibleRemoveExtensionNodeCommand deleteCommand = (ExtensibleRemoveExtensionNodeCommand)asiPropertiesElement.createExecutableExtension(DELETE_COMMAND_CLASS);
- if (deleteCommand != null)
- {
- extensionsSchemaSpec.setExtensibleRemoveExtensionNodeCommand(deleteCommand);
- }
- }
- catch (Exception e)
- {
- }
- }
-
- extensionsSchemaSpec.setLocation(LOCATION_PREFIX + pluginId + "/" + xsdFileURL); //$NON-NLS-1$
-
- nsURIProperties.add(extensionsSchemaSpec);
-
- }
- else if ("categoryProvider".equals(elementName))
- {
- String categoryProviderClass = asiPropertiesElement.getAttribute(CATEGORY_PROVIDER_CLASS);
-
- if (categoryProviderClass != null)
- {
- try
- {
- CategoryProvider categoryProvider = (CategoryProvider)asiPropertiesElement.createExecutableExtension(CATEGORY_PROVIDER_CLASS);
- if (categoryProvider != null)
- {
- categoryProviderList.add(categoryProvider);
- }
- }
- catch (Exception e)
- {
- }
- }
-
- }
-
- }
-
- }
-
- return nsURIProperties;
- }
-
- public ExtensibleAddExtensionCommand getAddExtensionCommand(String namespace)
- {
- // Didn't retrieve the config elements yet.
- if (nsURIProperties == null)
- {
- getAllExtensionsSchemasContribution();
- }
-
- for (Iterator i = nsURIProperties.iterator(); i.hasNext(); )
- {
- SpecificationForExtensionsSchema spec = (SpecificationForExtensionsSchema)i.next();
- String nsURI = spec.getNamespaceURI();
- if (nsURI != null && nsURI.equals(namespace))
- {
- return spec.getExtensibleAddExtensionCommand();
- }
- }
-
- for (Iterator i = categoryProviderList.iterator(); i.hasNext(); )
- {
- CategoryProvider categoryProvider = (CategoryProvider)i.next();
- for (Iterator j = categoryProvider.getCategories().iterator(); j.hasNext(); )
- {
- SpecificationForExtensionsSchema spec = (SpecificationForExtensionsSchema) j.next();
- String namespaceURI = spec.getNamespaceURI();
- if (namespaceURI != null && namespaceURI.equals(namespace))
- {
- return spec.getExtensibleAddExtensionCommand();
- }
- }
- }
-
- return null;
- }
-
- public ExtensibleRemoveExtensionNodeCommand getRemoveExtensionNodeCommand(String namespace)
- {
- // Didn't retrieve the config elements yet.
- if (nsURIProperties == null)
- {
- getAllExtensionsSchemasContribution();
- }
-
- for (Iterator i = nsURIProperties.iterator(); i.hasNext(); )
- {
- SpecificationForExtensionsSchema spec = (SpecificationForExtensionsSchema)i.next();
- String nsURI = spec.getNamespaceURI();
- if (nsURI != null && nsURI.equals(namespace))
- {
- return spec.getExtensibleRemoveExtensionNodeCommand();
- }
- }
-
- for (Iterator i = categoryProviderList.iterator(); i.hasNext(); )
- {
- CategoryProvider categoryProvider = (CategoryProvider)i.next();
- for (Iterator j = categoryProvider.getCategories().iterator(); j.hasNext(); )
- {
- SpecificationForExtensionsSchema spec = (SpecificationForExtensionsSchema) j.next();
- String namespaceURI = spec.getNamespaceURI();
- if (namespaceURI != null && namespaceURI.equals(namespace))
- {
- return spec.getExtensibleRemoveExtensionNodeCommand();
- }
- }
- }
-
- return null;
- }
-
- public List getCategoryProviders()
- {
- if (nsURIProperties == null)
- {
- getAllExtensionsSchemasContribution();
- }
-
- return categoryProviderList;
- }
-
- /**
- * @deprecated
- */
- public ILabelProvider getLabelProvider(Element element)
- {
- return null;
- }
-
- public SpecificationForExtensionsSchema createEntry()
- {
- return new SpecificationForExtensionsSchema();
- }
-
- /**
- * 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)
- {
- URIResolver resolver = URIResolverPlugin.createResolver();
- String result = resolver.resolve("", namespaceURI, "");
- return resolver.resolvePhysicalLocation("", namespaceURI, result);
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/SelectFromCatalogDialog.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/SelectFromCatalogDialog.java
deleted file mode 100644
index 9b5daf0a65..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/SelectFromCatalogDialog.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/*******************************************************************************
- * 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.internal.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 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/internal/common/properties/sections/appinfo/SpecificationForExtensionsSchema.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/SpecificationForExtensionsSchema.java
deleted file mode 100644
index 8b4a9a5518..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/SpecificationForExtensionsSchema.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo;
-
-import java.util.StringTokenizer;
-
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.wst.xsd.ui.internal.common.commands.ExtensibleAddExtensionCommand;
-import org.eclipse.wst.xsd.ui.internal.common.commands.ExtensibleRemoveExtensionNodeCommand;
-import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.custom.NodeFilter;
-
-public class SpecificationForExtensionsSchema
-{
- private String description;
- private String displayName;
- private String namespaceURI;
- private String location;
- private ILabelProvider labelProvider;
- private boolean isDefaultSchema = false;
- private ExtensibleAddExtensionCommand addCommand;
- private ExtensibleRemoveExtensionNodeCommand removeCommand;
- private NodeFilter nodeFilter;
- private String classification;
-
- /**
- * Either the workspace-relative path of the xsd file or the namespace
- * of the xsd file (if it come from the Catalog)
- */
- private String sourceHint;
- private boolean fromCatalog;
-
- public SpecificationForExtensionsSchema()
- {
- super();
- }
-
- public SpecificationForExtensionsSchema(String desc) {
- StringTokenizer tokenizer = new StringTokenizer(desc, "\t");
-
- // we must be sure that each 'desc' contains info in correct format
- // no error checking here
- description = tokenizer.nextToken();
- displayName = tokenizer.nextToken();
- namespaceURI = tokenizer.nextToken();
- location = tokenizer.nextToken();
- isDefaultSchema = tokenizer.nextToken().equals("true");
- sourceHint = tokenizer.nextToken();
- fromCatalog = tokenizer.nextToken().equals("true");
- }
-
-/**
- * @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;
- }
-
- public ExtensibleAddExtensionCommand getExtensibleAddExtensionCommand()
- {
- return addCommand;
- }
-
- public void setExtensibleAddExtensionCommand(ExtensibleAddExtensionCommand addCommand)
- {
- this.addCommand = addCommand;
- }
-
- public ExtensibleRemoveExtensionNodeCommand getExtensibleRemoveExtensionNodeCommand()
- {
- return removeCommand;
- }
-
- public void setExtensibleRemoveExtensionNodeCommand(ExtensibleRemoveExtensionNodeCommand removeCommand)
- {
- this.removeCommand = removeCommand;
- }
-
- public boolean isDefautSchema(){
- return isDefaultSchema ;
- }
-
- public void setDefautSchema(){
- isDefaultSchema = true;
- }
-
- public void setSourceHint(String s){
- sourceHint = s;
- }
-
- public String getSourceHint(){
- return sourceHint;
- }
-
- public boolean isFromCatalog() {
- return fromCatalog;
- }
-
- public void setFromCatalog(boolean fromCatalog) {
- this.fromCatalog = fromCatalog;
- }
-
- /**
- * There is no support for setting this via the extension point defined in the plugin.xml
- * This allows extenders to provide a filter for a category that has been added
- * dynamically (programmatically)
- * @param nodeFilter
- */
- public void setNodeFilter(NodeFilter nodeFilter)
- {
- this.nodeFilter = nodeFilter;
- }
-
- /**
- * Get the node filter
- * @return NodeFilter
- */
- public NodeFilter getNodeFilter()
- {
- return nodeFilter;
- }
-
- /**
- * There is no support for setting this via the extension point defined in the plugin.xml
- * This allows extenders to group categories into groups or classificationss
- * @param classification
- */
- public void setClassification(String classification)
- {
- this.classification = classification;
- }
-
- /**
- * Get the classification
- * @return String
- */
- public String getClassification()
- {
- return classification;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/XSDExtensionTreeContentProvider.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/XSDExtensionTreeContentProvider.java
deleted file mode 100644
index d0e4255561..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/XSDExtensionTreeContentProvider.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.wst.xsd.ui.internal.common.util.XSDCommonUIUtils;
-import org.eclipse.xsd.XSDAnnotation;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.util.XSDConstants;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-public class XSDExtensionTreeContentProvider extends DOMExtensionTreeContentProvider
-{
- public Object[] getElements(Object inputElement)
- {
- if (inputElement instanceof XSDConcreteComponent)
- {
- XSDConcreteComponent component = (XSDConcreteComponent) inputElement;
- List elementsAndAttributes = new ArrayList();
- XSDAnnotation xsdAnnotation = XSDCommonUIUtils.getInputXSDAnnotation(component, false);
- if (xsdAnnotation != null)
- {
- // Bug 137856 - Extension page of properties shouldn't display imported elements
- // Added this if statement
- if (xsdAnnotation.getSchema() == component.getSchema())
- {
- 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 = appInfoElement.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); //$NON-NLS-1$
- }
- else
- {
- // this handles the xmlns="blah" case
- return "xmlns".equals(attribute.getNodeName()); //$NON-NLS-1$
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/DefaultListNodeEditorConfiguration.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/DefaultListNodeEditorConfiguration.java
deleted file mode 100644
index 584ad71494..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/DefaultListNodeEditorConfiguration.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * 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.internal.common.properties.sections.appinfo.custom;
-
-
-public class DefaultListNodeEditorConfiguration extends ListNodeEditorConfiguration
-{
- private String[] values;
-
- public DefaultListNodeEditorConfiguration(String[] values)
- {
- this.values = values;
- }
-
- public Object[] getValues(Object propertyObject)
- {
- return values;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/DialogNodeEditorConfiguration.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/DialogNodeEditorConfiguration.java
deleted file mode 100644
index ead530daf5..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/DialogNodeEditorConfiguration.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * 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.internal.common.properties.sections.appinfo.custom;
-
-import org.eclipse.swt.graphics.Image;
-
-public abstract class DialogNodeEditorConfiguration extends NodeEditorConfiguration
-{
- public int getStyle()
- {
- return STYLE_DIALOG;
- }
-
- public String getButonText()
- {
- return null;
- }
-
- public Image getButtonImage()
- {
- return null;
- }
-
- public abstract void invokeDialog();
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/ListNodeEditorConfiguration.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/ListNodeEditorConfiguration.java
deleted file mode 100644
index fdfbce6822..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/ListNodeEditorConfiguration.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * 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.internal.common.properties.sections.appinfo.custom;
-
-import org.eclipse.jface.viewers.LabelProvider;
-
-public abstract class ListNodeEditorConfiguration extends NodeEditorConfiguration
-{
- private LabelProvider labelProvider;
-
- public LabelProvider getLabelProvider()
- {
- return labelProvider;
- }
-
- public int getStyle()
- {
- return STYLE_COMBO;
- }
-
- public void setLabelProvider(LabelProvider labelProvider)
- {
- this.labelProvider = labelProvider;
- }
-
- public abstract Object[] getValues(Object propertyObject);
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/NodeCustomizationRegistry.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/NodeCustomizationRegistry.java
deleted file mode 100644
index e4df63d1e5..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/NodeCustomizationRegistry.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.custom;
-
-import java.util.HashMap;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.viewers.ILabelProvider;
-
-public class NodeCustomizationRegistry
-{
- private static final String NAMESPACE = "namespace"; //$NON-NLS-1$
- private static final String LABEL_PROVIDER_CLASS_ATTRIBUTE_NAME = "labelProviderClass";
- private static final String NODE_EDITOR_PROVIDER_CLASS_ATTRIBUTE_NAME = "nodeEditorProviderClass"; //$NON-NLS-1$
- private static final String FILTER_CLASS_ATTRIBUTE_NAME = "filterClass";
-
-
- protected String extensionId;
- protected HashMap map;
-
- public NodeCustomizationRegistry(String propertyEditorExtensionId)
- {
- extensionId = "org.eclipse.wst.xsd.ui.extensibilityNodeCustomizations";//propertyEditorExtensionId;
- }
-
- private class Descriptor
- {
- IConfigurationElement configurationElement;
- NodeEditorProvider nodeEditorProvider;
- NodeFilter nodeFilter;
- boolean nodeEditorProviderFailedToLoad = false;
- boolean labelProviderFailedToLoad = false;
-
- Descriptor(IConfigurationElement element)
- {
- this.configurationElement = element;
- }
-
- NodeEditorProvider lookupOrCreateNodeEditorProvider()
- {
- if (nodeEditorProvider == null && !nodeEditorProviderFailedToLoad)
- {
- try
- {
- nodeEditorProvider = (NodeEditorProvider)configurationElement.createExecutableExtension(NODE_EDITOR_PROVIDER_CLASS_ATTRIBUTE_NAME);
- }
- catch (Exception e)
- {
- nodeEditorProviderFailedToLoad = true;
- }
- }
- return nodeEditorProvider;
- }
-
- ILabelProvider createLabelProvider()
- {
- if (!labelProviderFailedToLoad)
- {
- try
- {
- return (ILabelProvider)configurationElement.createExecutableExtension(LABEL_PROVIDER_CLASS_ATTRIBUTE_NAME);
- }
- catch (Exception e)
- {
- labelProviderFailedToLoad = true;
- }
- }
- return null;
- }
-
- public NodeFilter getNodeFilter()
- {
- if (!nodeEditorProviderFailedToLoad)
- {
- try
- {
- nodeFilter = (NodeFilter)configurationElement.createExecutableExtension(FILTER_CLASS_ATTRIBUTE_NAME);
- }
- catch (Exception e)
- {
- nodeEditorProviderFailedToLoad = true;
- }
- }
- return nodeFilter;
- }
- }
-
-
- private HashMap initMap()
- {
- HashMap theMap = new HashMap();
- IConfigurationElement[] extensions = Platform.getExtensionRegistry().getConfigurationElementsFor("org.eclipse.wst.xsd.ui.extensibilityNodeCustomizations");
- for (int i = 0; i < extensions.length; i++)
- {
- IConfigurationElement configurationElement = extensions[i];
- String namespace = configurationElement.getAttribute(NAMESPACE);
- if (namespace != null)
- {
- theMap.put(namespace, new Descriptor(configurationElement));
- }
- }
- return theMap;
- }
-
- private Descriptor getDescriptor(String namespace)
- {
- map = null;
- if (namespace != null)
- {
- if (map == null)
- {
- map = initMap();
- }
- return (Descriptor)map.get(namespace);
- }
- return null;
- }
-
- public NodeEditorProvider getNodeEditorProvider(String namespace)
- {
- Descriptor descriptor = getDescriptor(namespace);
- if (descriptor != null)
- {
- return descriptor.lookupOrCreateNodeEditorProvider();
- }
- return null;
- }
-
- public ILabelProvider getLabelProvider(String namespace)
- {
- Descriptor descriptor = getDescriptor(namespace);
- if (descriptor != null)
- {
- return descriptor.createLabelProvider();
- }
- return null;
- }
-
- public NodeFilter getNodeFilter(String namespace)
- {
- Descriptor descriptor = getDescriptor(namespace);
- if (descriptor != null)
- {
- return descriptor.getNodeFilter();
- }
- return null;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/NodeEditorConfiguration.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/NodeEditorConfiguration.java
deleted file mode 100644
index 1506ad222f..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/NodeEditorConfiguration.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * 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.internal.common.properties.sections.appinfo.custom;
-
-import org.w3c.dom.Node;
-
-public abstract class NodeEditorConfiguration
-{
- public final static int STYLE_NONE = 0;
- public final static int STYLE_TEXT = 1;
- public final static int STYLE_COMBO = 2;
- public final static int STYLE_DIALOG = 4;
-
- public abstract int getStyle();
-
- private Node node;
- private Node parentNode;
-
- public Node getNode()
- {
- return node;
- }
- public void setNode(Node node)
- {
- this.node = node;
- }
- public Node getParentNode()
- {
- return parentNode;
- }
- public void setParentNode(Node parentNode)
- {
- this.parentNode = parentNode;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/NodeEditorProvider.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/NodeEditorProvider.java
deleted file mode 100644
index 07d1c63909..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/NodeEditorProvider.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/*******************************************************************************
- * 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.internal.common.properties.sections.appinfo.custom;
-
-
-public abstract class NodeEditorProvider
-{
- public abstract NodeEditorConfiguration getNodeEditorConfiguration(String parentName, String nodeName);
- //public abstract NodeEditorConfiguration getNodeEditorConfiguration(Node node);
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/NodeFilter.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/NodeFilter.java
deleted file mode 100644
index 5cabbc7622..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/appinfo/custom/NodeFilter.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.custom;
-
-import org.w3c.dom.Node;
-
-public class NodeFilter
-{
- public boolean isApplicableContext(Node parentNode, int nodeType, String namespace, String name)
- {
- return true;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/util/Messages.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/util/Messages.java
deleted file mode 100644
index e5180f09a8..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/util/Messages.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.util;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS
-{
- static
- {
- NLS.initializeMessages("org.eclipse.wst.xsd.ui.internal.common.util.messages", Messages.class); //$NON-NLS-1$
- }
-
- public Messages()
- {
- super();
- }
-
- public static String _UI_ACTION_OPEN_IN_NEW_EDITOR;
- public static String _UI_ACTION_ADD_ATTRIBUTE_GROUP;
- public static String _UI_ACTION_ADD_ATTRIBUTE_GROUP_REF;
- public static String _UI_ACTION_ADD_ATTRIBUTE_GROUP_DEFINITION;
- public static String _UI_ACTION_ADD_GROUP_REF;
- public static String _UI_ACTION_ADD_GROUP;
- public static String _UI_ACTION_DELETE;
- public static String _UI_ACTION_ADD_COMPLEX_TYPE;
- public static String _UI_ACTION_ADD_ATTRIBUTE;
- public static String _UI_ACTION_ADD_SIMPLE_TYPE;
- public static String _UI_ACTION_UPDATE_ELEMENT_REFERENCE;
- public static String _UI_LABEL_NO_ITEMS_SELECTED;
- public static String _UI_ACTION_ADD;
- public static String _UI_ACTION_ADD_WITH_DOTS;
- public static String _UI_ACTION_EDIT_WITH_DOTS;
- public static String _UI_ACTION_CHANGE_PATTERN;
- public static String _UI_ACTION_ADD_ENUMERATION;
- public static String _UI_ACTION_INSERT_ENUMERATION;
- public static String _UI_ACTION_ADD_PATTERN;
- public static String _UI_ACTION_ADD_ENUMERATIONS;
- public static String _UI_ACTION_DELETE_CONSTRAINTS;
- public static String _UI_ACTION_DELETE_PATTERN;
- public static String _UI_ACTION_DELETE_ENUMERATION;
- public static String _UI_ACTION_SET_ENUMERATION_VALUE;
- public static String _UI_LABEL_PATTERN;
- public static String _UI_ACTION_CHANGE_MAXIMUM_OCCURRENCE;
- public static String _UI_ERROR_INVALID_VALUE_FOR_MAXIMUM_OCCURRENCE;
- public static String _UI_ACTION_CHANGE_MINIMUM_OCCURRENCE;
- public static String _UI_ACTION_ADD_APPINFO_ELEMENT;
- public static String _UI_ACTION_ADD_APPINFO_ATTRIBUTE;
- public static String _UI_ACTION_DELETE_APPINFO_ELEMENT;
- public static String _UI_ACTION_DELETE_APPINFO_ATTRIBUTE;
- public static String _UI_ACTION_CHANGE_CONTENT_MODEL;
- public static String _UI_ACTION_RENAME;
- public static String _UI_ACTION_CHANGE_ENUMERATION_VALUE;
- public static String _UI_ERROR_INVALID_NAME;
- public static String _UI_LABEL_NAME;
- public static String _UI_LABEL_REFERENCE;
- public static String _UI_ACTION_UPDATE_MAXIMUM_OCCURRENCE;
- public static String _UI_ACTION_UPDATE_MINIMUM_OCCURRENCE;
- public static String _UI_LABEL_READONLY;
- public static String _UI_LABEL_INCLUSIVE;
- public static String _UI_LABEL_COLLAPSE_WHITESPACE;
- public static String _UI_LABEL_SPECIFIC_CONSTRAINT_VALUES;
- public static String _UI_LABEL_RESTRICT_VALUES_BY;
- public static String _UI_LABEL_ENUMERATIONS;
- public static String _UI_LABEL_PATTERNS;
- public static String _UI_LABEL_MINIMUM_LENGTH;
- public static String _UI_LABEL_MAXIMUM_LENGTH;
- public static String _UI_LABEL_CONSTRAINTS_ON_LENGTH_OF;
- public static String _UI_LABEL_CONSTRAINTS_ON_VALUE_OF;
- public static String _UI_LABEL_MINIMUM_VALUE;
- public static String _UI_LABEL_MAXIMUM_VALUE;
- public static String _UI_LABEL_CONTRAINTS_ON;
- public static String _UI_LABEL_TYPE;
- public static String _UI_LABEL_BLOCKDEFAULT;
- public static String _UI_LABEL_FINALDEFAULT;
- public static String _UI_ACTION_CONSTRAIN_LENGTH;
- public static String _UI_ACTION_UPDATE_BOUNDS;
- public static String _UI_ACTION_COLLAPSE_WHITESPACE;
- public static String _UI_LABEL_BASE;
- public static String _UI_ERROR_INVALID_FILE;
- public static String _UI_LABEL_EXTENSIONS;
- public static String _UI_ACTION_ADD_EXTENSION_COMPONENT;
- public static String _UI_ACTION_DELETE_EXTENSION_COMPONENT;
- public static String _UI_LABEL_UP;
- public static String _UI_LABEL_DOWN;
- public static String _UI_LABEL_EXTENSION_DETAILS;
- public static String _UI_ACTION_ADD_DOCUMENTATION;
- public static String _UI_ACTION_ADD_EXTENSION_COMPONENTS;
- public static String _UI_LABEL_EXTENSION_CATEGORIES;
- public static String _UI_LABEL_ADD_WITH_DOTS;
- public static String _UI_LABEL_DELETE;
- public static String _UI_LABEL_EDIT;
- public static String _UI_LABEL_AVAILABLE_COMPONENTS_TO_ADD;
- public static String _UI_LABEL_EDIT_CATEGORY;
- public static String _UI_ERROR_INVALID_CATEGORY;
- public static String _UI_ERROR_FILE_CANNOT_BE_PARSED;
- public static String _UI_ERROR_VALIDATE_THE_FILE;
- public static String _UI_LABEL_SCHEMA;
- public static String _UI_LABEL_ADD_CATEGORY;
- public static String _UI_ERROR_NAME_ALREADY_USED;
- public static String _UI_ACTION_BROWSE_WORKSPACE;
- public static String _UI_LABEL_SELECT_XSD_FILE;
- public static String _UI_DESCRIPTION_CHOOSE_XSD_FILE;
- public static String _UI_ACTION_BROWSE_CATALOG;
- public static String _UI_ACTION_ADD_ANY_ELEMENT;
- public static String _UI_ACTION_ADD_ANY_ATTRIBUTE;
- public static String _UI_ACTION_SET_BASE_TYPE;
- public static String _UI_TOOLTIP_RENAME_REFACTOR;
- public static String _UI_VALUE_COLON;
- public static String _UI_ID;
- public static String _UI_REF;
- public static String _UI_FIXED;
- public static String _UI_DEFAULT;
- public static String _UI_FORM;
- public static String _UI_USAGE;
- public static String _UI_ACTION_CHANGE;
- public static String _UI_ACTION_CLOSE_SCHEMA_PREVIEW_POPUP;
- public static String _UI_ACTION_NAMESPACE_INFORMATION_CHANGE;
- public static String _UI_LABEL_ABSTRACT;
- public static String _UI_LABEL_BLOCK;
- public static String _UI_LABEL_FINAL;
- public static String _UI_LABEL_SUBSTITUTION_GROUP;
- public static String _UI_LABEL_MIXED;
- public static String _UI_LABEL_VALUE;
- public static String _UI_LABEL_FORM;
- public static String _UI_LABEL_NILLABLE;
- public static String _UI_LABEL_ELEMENTFORMDEFAULT;
- public static String _UI_LABEL_ATTRIBUTEFORMDEFAULT;
- public static String _UI_LABEL_WORKSPACE;
- public static String _UI_LABEL_CATALOG;
- public static String _UI_DELETE_BUTTON;
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/util/XSDCommonUIUtils.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/util/XSDCommonUIUtils.java
deleted file mode 100644
index 9510888c09..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/util/XSDCommonUIUtils.java
+++ /dev/null
@@ -1,622 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Naoki Akiyama, Fujitsu - Bug 244901 - Cannot set xsd:annotation to
- * xsd:redefine by Properties view.
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.util;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Stack;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.DecorationOverlayIcon;
-import org.eclipse.jface.viewers.IDecoration;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.custom.CLabel;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-import org.eclipse.wst.sse.core.internal.format.IStructuredFormatProcessor;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
-import org.eclipse.wst.xml.core.internal.provisional.format.FormatProcessorXML;
-import org.eclipse.wst.xsd.ui.internal.adt.design.ImageOverlayDescriptor;
-import org.eclipse.wst.xsd.ui.internal.common.properties.sections.AbstractSection;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-import org.eclipse.xsd.XSDAnnotation;
-import org.eclipse.xsd.XSDAttributeDeclaration;
-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.XSDEnumerationFacet;
-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.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-public class XSDCommonUIUtils
-{
- public XSDCommonUIUtils()
- {
- super();
- }
-
- public static Image getUpdatedImage(XSDConcreteComponent input, Image baseImage, boolean isReadOnly)
- {
- XSDAnnotation xsdAnnotation = getInputXSDAnnotation(input, false);
-
- if (xsdAnnotation != null)
- {
- if (xsdAnnotation.getApplicationInformation().size() > 0)
- {
- // Will use the class name appended by the read only state as the name of the image.
- // There is a disabled and an enabled version of each baseImage, so we can't simply
- // use the component name as the name of the image
- String imageName = input.getClass().getName() + isReadOnly;
- Image newImage = XSDEditorPlugin.getDefault().getImageRegistry().get(imageName);
- if (newImage == null)
- {
- ImageOverlayDescriptor ovr = new ImageOverlayDescriptor(baseImage, isReadOnly);
- newImage = ovr.getImage();
- XSDEditorPlugin.getDefault().getImageRegistry().put(imageName, newImage);
- }
- return newImage;
- }
- }
- return baseImage;
- }
-
- 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 contents = xsdComp.getContents();
- for (int i = 0; i < contents.size(); i++)
- {
- Object content = contents.get(i);
- if (content instanceof XSDAnnotation)
- {
- xsdAnnotation = (XSDAnnotation) content;
- break;
- }
- }
- if (createIfNotExist && xsdAnnotation == null)
- {
- xsdAnnotation = factory.createXSDAnnotation();
- contents.add(0, xsdAnnotation);
- }
- 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;
- while (usedNames.contains(testName))
- {
- testName = prefix + i++;
- }
- return testName;
- }
-
- public static String createUniqueEnumerationValue(String prefix, List elements)
- {
- ArrayList usedNames = new ArrayList();
- for (Iterator i = elements.iterator(); i.hasNext();)
- {
- usedNames.add(((XSDEnumerationFacet) i.next()).getLexicalValue());
- }
-
- int i = 1;
- String testName = prefix;
- 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 && !XSDConstants.isAnySimpleType(baseType) && !XSDConstants.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;
- }
-
- // bug246036 - check for cyclic groups. We should refactor out this static class.
- private static Stack visitedGroups = new Stack();
-
- public static void resetVisitedGroupsStack()
- {
- visitedGroups.clear();
- }
-
- public static List getChildElements(XSDModelGroup group)
- {
- List children = new ArrayList();
- visitedGroups.push(group);
- if (group == null) return children;
-
- for (Iterator i = group.getContents().iterator(); i.hasNext();)
- {
- XSDParticle next = (XSDParticle) i.next();
- if (next.getContent() instanceof XSDFeature)
- {
- if (children.contains(next.getContent())) break;
- children.add(next.getContent());
- }
- else if (next.getTerm() instanceof XSDModelGroup)
- {
- if (!visitedGroups.contains(group))
- children.addAll(getChildElements((XSDModelGroup) next.getTerm()));
- }
- }
- visitedGroups.pop();
- return children;
- }
-
- public static List getAllAttributes(XSDComplexTypeDefinition xsdComplexType)
- {
- List attributes = getChildElements(xsdComplexType);
- attributes.addAll(getChildAttributes(xsdComplexType));
-
- return attributes;
- }
-
- public static List getAllAttributes(XSDModelGroupDefinition xsdModelGroupDefinition)
- {
- List attributes = getChildElements(xsdModelGroupDefinition);
-
- 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));
- if (! ct.isCircular()) attrs.addAll(getInheritedAttributes((XSDComplexTypeDefinition) parent));
- }
-
- return attrs;
- }
-
- public static List getChildElements(XSDComplexTypeDefinition ct)
- {
- return getChildElements(getModelGroup(ct));
- }
-
- public static List getChildElements(XSDModelGroupDefinition xsdModelGroupDefinition)
- {
- return getChildElements(xsdModelGroupDefinition.getModelGroup());
- }
-
- 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;
- }
-
- public static Image getImageWithErrorOverlay(XSDConcreteComponent input, Image baseImage, boolean isReadOnly)
- {
- Image extensionImage = getUpdatedImage(input, baseImage, isReadOnly);
- ImageDescriptor errorOverlay = XSDEditorPlugin.getImageDescriptor("icons/ovr16/error_ovr.gif"); //$NON-NLS-1$
- if (baseImage == extensionImage)
- {
- String imageName = input.getClass().getName() + "_error_" + isReadOnly;
- Image newImage = XSDEditorPlugin.getDefault().getImageRegistry().get(imageName);
- if (newImage == null)
- {
- DecorationOverlayIcon ovr = new DecorationOverlayIcon(baseImage, errorOverlay, IDecoration.TOP_LEFT);
- newImage = ovr.createImage();
- XSDEditorPlugin.getDefault().getImageRegistry().put(imageName, newImage);
- }
- return newImage;
- }
- else
- {
- String imageName = input.getClass().getName() + "_extension_error_" + isReadOnly;
- Image newImage = XSDEditorPlugin.getDefault().getImageRegistry().get(imageName);
- if (newImage == null)
- {
- DecorationOverlayIcon ovr = new DecorationOverlayIcon(extensionImage, errorOverlay, IDecoration.TOP_LEFT);
- newImage = ovr.createImage();
- XSDEditorPlugin.getDefault().getImageRegistry().put(imageName, newImage);
- }
- return newImage;
- }
- }
-
- public static CCombo getNewPropertiesCombo(Composite composite, TabbedPropertySheetWidgetFactory widgetFactory,
- AbstractSection listener, String[] items, String helpID)
- {
- CCombo combo = widgetFactory.createCCombo(composite);
- combo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- combo.setEditable(false);
- combo.setItems(items);
- combo.addSelectionListener(listener);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(combo, helpID);
- return combo;
- }
-
- public static CLabel getNewPropertiesLabel(Composite composite, TabbedPropertySheetWidgetFactory widgetFactory,
- String labelText)
- {
- // Create label
- CLabel label;
- label = widgetFactory.createCLabel(composite, labelText);
- GridData data = new GridData();
- data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
- data.grabExcessHorizontalSpace = false;
- label.setLayoutData(data);
-
- return label;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/util/XSDDirectivesManager.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/util/XSDDirectivesManager.java
deleted file mode 100644
index 39a1d8b6c9..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/util/XSDDirectivesManager.java
+++ /dev/null
@@ -1,815 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.common.util;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.StringTokenizer;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.emf.ecore.EStructuralFeature.Setting;
-import org.eclipse.wst.sse.core.StructuredModelManager;
-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.internal.editor.XSDEditorPlugin;
-import org.eclipse.wst.xsd.ui.internal.text.XSDModelAdapter;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDImport;
-import org.eclipse.xsd.XSDInclude;
-import org.eclipse.xsd.XSDNamedComponent;
-import org.eclipse.xsd.XSDRedefine;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.XSDSchemaDirective;
-import org.eclipse.xsd.XSDTypeDefinition;
-import org.eclipse.xsd.impl.XSDSchemaImpl;
-import org.eclipse.xsd.util.XSDConstants;
-import org.eclipse.xsd.util.XSDUtil;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * This class performs cleanup/removal of unused XSD imports and includes from XML Schemas
- * and xmlns entries in the namespace table
- */
-public class XSDDirectivesManager
-{
- protected static final String XMLNS = "xmlns"; //$NON-NLS-1$
- // List of all the unused directives. These will be removed
- protected List unusedDirectives = new ArrayList();
- // List of all the included XSDSchema's
- protected List usedIncludeSchemas = new ArrayList();
- // List of all the XSDInclude's that are indirectly used
- protected List usedIndirectIncludes = new ArrayList();
- // List of the XSDInclude's that are directly used
- protected List usedDirectIncludes = new ArrayList();
- // Used to track the included schemas that were analyzed to avoid circular loop
- protected List analyzedIncludeSchemas = new ArrayList();
- // List of all the imported used schemas
- protected List usedSchemas = new ArrayList();
- // List of all the indirectly used includes
- protected Map usedIndirectIncludesMap = new HashMap();
- // Keep track of all the unused prefixes
- protected Set unusedPrefixes;
- // Keep track of all the used prefixes
- protected Set usedPrefixes;
- // Map of each schema's unused prefixes
- protected Map schemaToPrefixMap;
-
- public static void removeUnusedXSDImports(XSDSchema schema)
- {
- // Only do the removal if the preference is turned on
- if (XSDEditorPlugin.getDefault().getRemoveImportSetting())
- {
- XSDDirectivesManager mgr = new XSDDirectivesManager();
- mgr.performRemoval(schema);
- mgr.cleanup();
- }
- }
-
- /**
- * Main method to do the cleanup
- * @param schema
- */
- public void performRemoval(XSDSchema schema)
- {
- // Compute unused imports and unused prefixes
- computeUnusedImports(schema);
- // Remove the imports
- removeUnusedImports();
- // Remove the prefixes
- removeUnusedPrefixes();
- }
-
- /**
- * Clients can manually clean the lists
- */
- public void cleanup()
- {
- clearMaps();
- }
-
- /**
- * After performing the cleanup, return the list of unused XSD directives
- *
- * @return list of unused XSD directives
- */
- public List getUnusedXSDDirectives()
- {
- return unusedDirectives;
- }
-
- /**
- * After performing the cleanup, return the map of each schemas unused prefixes
- *
- * @return map of each schemas unused prefixes
- */
- public Map getSchemaToPrefixMap()
- {
- return schemaToPrefixMap;
- }
-
- /**
- * Returns the set of unused prefixes from the XML namespace table
- *
- * @return set of unused prefixes
- */
- public Set getUnusedPrefixes()
- {
- return unusedPrefixes;
- }
-
- /**
- * Returns the set of used prefixes from the XML namespace table
- *
- * @return set of used prefixes
- */
- public Set getUsedPrefixes()
- {
- return usedPrefixes;
- }
-
- /**
- * Perform any cleanup after computing and removing the unused imports.
- */
- protected void clearMaps()
- {
- if (schemaToPrefixMap != null)
- {
- schemaToPrefixMap.clear();
- }
- }
-
- /**
- * Remove the list of all unused imports. Imports is used in the generic term here.
- */
- protected void removeUnusedImports()
- {
- Iterator iter = unusedDirectives.iterator();
- while (iter.hasNext())
- {
- XSDSchemaDirective xsdDirective = (XSDSchemaDirective) iter.next();
- removeXSDDirective(xsdDirective);
- }
- }
-
- /**
- * Removes the directive from the model
- * @param xsdImport
- */
- protected void removeXSDDirective(XSDSchemaDirective xsdImport)
- {
- XSDSchema schema = xsdImport.getSchema();
-
- Element element = xsdImport.getElement();
-
- Document doc = element.getOwnerDocument();
-
- if (doc instanceof IDOMNode)
- ((IDOMNode)doc).getModel().aboutToChangeModel();
-
- try
- {
- if (!removeTextNodesBetweenNextElement(element))
- {
- removeTextNodeBetweenPreviousElement(element);
- }
- element.getParentNode().removeChild(element);
- }
- finally
- {
- if (doc instanceof IDOMNode)
- {
- ((IDOMNode)doc).getModel().changedModel();
- }
- schema.update(true);
- }
-
- }
-
- /**
- * This computes the list of unused imports for a schema
- * @param schema
- */
- protected void computeUnusedImports(XSDSchema schema)
- {
- unusedDirectives = new ArrayList();
- usedSchemas = new ArrayList();
- usedPrefixes = new HashSet();
- schemaToPrefixMap = new HashMap();
-
- try
- {
- // Step One. Find unused imports using cross referencer
- Map xsdNamedComponentUsage = TopLevelComponentCrossReferencer.find(schema);
-
- doCrossReferencer(schema, usedSchemas, xsdNamedComponentUsage);
-
- // Step Two. Update the unusedImport list given the list of used schemas obtained from cross referencing
- addToUnusedImports(schema, usedSchemas);
-
- // Step Three. Compute unused prefixes to be removed
- computeUnusedPrefixes(schema);
- }
- catch (Exception e)
- {
- unusedDirectives.clear();
- schemaToPrefixMap.clear();
- }
- }
-
- /**
- * Computes the list of unused prefixes from the XML namespace table given a schema
- * @param schema
- */
- protected void computeUnusedPrefixes(XSDSchema schema)
- {
- Map prefixMap = schema.getQNamePrefixToNamespaceMap();
- Set definedPrefixes = prefixMap.keySet();
- Set actualSet = new HashSet();
- NamedNodeMap attributes = schema.getElement().getAttributes();
- Iterator iter = definedPrefixes.iterator();
- while (iter.hasNext())
- {
- String pref = (String)iter.next();
- if (pref == null)
- {
- if (attributes.getNamedItem(XMLNS) != null)
- actualSet.add(null);
- }
- else
- {
- if (attributes.getNamedItem(XMLNS + ":" + pref) != null) //$NON-NLS-1$
- actualSet.add(pref);
- }
- }
-
- unusedPrefixes = new HashSet(actualSet);
-
- usedPrefixes.add(schema.getSchemaForSchemaQNamePrefix());
-
- Element element = schema.getElement();
-
- NodeList childElements = element.getChildNodes();
- int length = childElements.getLength();
- for (int i = 0; i < length; i++)
- {
- Node node = childElements.item(i);
- if (node instanceof Element)
- {
- traverseDOMElement((Element)node, schema);
- }
- }
-
- // compute the used prefixes
- computeUsedXSDPrefixes(schema);
-
- // remove the used prefixes from the unused to get the list of unused prefixes
- unusedPrefixes.removeAll(usedPrefixes);
-
- // perform additional process from extenders
- doAdditionalProcessing(schema);
-
- schemaToPrefixMap.put(schema, unusedPrefixes);
- }
-
- /**
- * Remove unused prefixes from the XML namespace table
- */
- protected void removeUnusedPrefixes()
- {
- Set schemaSet = schemaToPrefixMap.keySet();
- Iterator iter = schemaSet.iterator();
- while (iter.hasNext())
- {
- XSDSchema schema = (XSDSchema)iter.next();
- Map prefixMap = schema.getQNamePrefixToNamespaceMap();
- Set prefixesToRemove = (Set)schemaToPrefixMap.get(schema);
- Iterator iter2 = prefixesToRemove.iterator();
- while (iter2.hasNext())
- {
- String string = (String)iter2.next();
- if (prefixMap.containsKey(string))
- prefixMap.remove(string);
- }
- }
- }
-
- /**
- * Extenders can customize
- * @param schema
- */
- protected void doAdditionalProcessing(XSDSchema schema)
- {
- // Do nothing for XSD
- }
-
- /**
- *
- * @param schema
- */
- private void computeUsedXSDPrefixes(XSDSchema schema)
- {
- Map prefixMap = schema.getQNamePrefixToNamespaceMap();
- Set definedPrefixes = prefixMap.keySet();
-
- boolean foundEntryForTargetNamespace = false;
- String targetNamespace = schema.getTargetNamespace();
- for (Iterator iter = usedPrefixes.iterator(); iter.hasNext(); )
- {
- String key = (String) iter.next();
- String value = (String) prefixMap.get(key);
- if (targetNamespace == null && value == null)
- {
- foundEntryForTargetNamespace = true;
- break;
- }
- else if (targetNamespace != null && value != null)
- {
- if (targetNamespace.equals(value))
- {
- foundEntryForTargetNamespace = true;
- break;
- }
- }
- }
-
- if (!foundEntryForTargetNamespace)
- {
- for (Iterator iter = definedPrefixes.iterator(); iter.hasNext();)
- {
- String key = (String) iter.next();
- String value = (String) prefixMap.get(key);
- if (targetNamespace == null && value == null)
- {
- usedPrefixes.add(null);
- break;
- }
- else if (targetNamespace != null && value != null)
- {
- if (targetNamespace.equals(value))
- {
- usedPrefixes.add(key);
- break;
- }
- }
- }
- }
- }
-
- /**
- * Find prefixes that are in the document.
- * @param element
- * @param schema
- */
- private void traverseDOMElement(Element element, XSDSchema schema)
- {
- String prefix = element.getPrefix();
- usedPrefixes.add(prefix);
-
- NamedNodeMap attrs = element.getAttributes();
- int numOfAttrs = attrs.getLength();
- for (int i = 0; i < numOfAttrs; i++)
- {
- Node node = attrs.item(i);
- String attrPrefix = node.getPrefix();
- if (attrPrefix != null)
- {
- usedPrefixes.add(attrPrefix);
- }
-
- String attr = node.getLocalName();
- if (attr != null)
- {
- String value = node.getNodeValue();
- if (value == null) continue;
- if (attr.equals(XSDConstants.REF_ATTRIBUTE) ||
- attr.equals(XSDConstants.REFER_ATTRIBUTE) ||
- attr.equals(XSDConstants.TYPE_ATTRIBUTE) ||
- attr.equals(XSDConstants.BASE_ATTRIBUTE) ||
- attr.equals(XSDConstants.SUBSTITUTIONGROUP_ATTRIBUTE) ||
- attr.equals(XSDConstants.ITEMTYPE_ATTRIBUTE))
- {
- try
- {
- usedPrefixes.add(extractPrefix(value));
- }
- catch (IndexOutOfBoundsException e)
- {
- }
- }
- else if (attr.equals(XSDConstants.MEMBERTYPES_ATTRIBUTE))
- {
- StringTokenizer tokenizer = new StringTokenizer(value);
- while (tokenizer.hasMoreTokens())
- {
- try
- {
- String token = tokenizer.nextToken();
- usedPrefixes.add(extractPrefix(token));
- }
- catch (IndexOutOfBoundsException e)
- {
- }
- }
- }
- }
- }
-
- NodeList childElements = element.getChildNodes();
- int length = childElements.getLength();
- for (int i = 0; i < length; i++)
- {
- Node node = childElements.item(i);
- if (node instanceof Element)
- {
- traverseDOMElement((Element)node, schema);
- }
- }
- }
-
- /**
- * Extract the prefix from the given string. For example, pref:attr returns pref.
- * @param value
- * @return the prefix
- */
- protected String extractPrefix(String value)
- {
- int index = value.indexOf(':');
- if (index < 0)
- return null;
- else
- return value.substring(0, index);
- }
-
- /**
- * This determines the list of referenced components and hence the used schemas from which
- * we can determine what are the unused directives
- *
- * @param schema
- * @param unusedImportList
- * @param usedSchemas
- */
- protected void doCrossReferencer(XSDSchema schema, List usedSchemas, Map xsdNamedComponentUsage)
- {
- // Calculate additional unused imports that may have the same
- // namespace that did not get added in the initial pass
- Iterator iterator = xsdNamedComponentUsage.keySet().iterator();
- // First determine the used schemas from the cross referencer
- while (iterator.hasNext())
- {
- XSDNamedComponent namedComponent = (XSDNamedComponent) iterator.next();
- XSDSchema namedComponentSchema = namedComponent.getSchema();
- // If the named component belongs to the same schema, then continue...we
- // want to check the external references
- if (namedComponentSchema == schema)
- {
- continue;
- }
- Collection collection = (Collection) xsdNamedComponentUsage.get(namedComponent);
- Iterator iterator2 = collection.iterator();
- while (iterator2.hasNext())
- {
- Setting setting = (Setting) iterator2.next();
- Object obj = setting.getEObject();
- if (isComponentUsed(obj, schema, namedComponentSchema))
- {
- if (!usedSchemas.contains(namedComponentSchema))
- usedSchemas.add(namedComponentSchema);
- }
- }
- }
- }
-
- /**
- * Determines if the object to be analyzed is referenced by the schema
- * @param obj
- * @param schema
- * @param targetSchema
- * @return true if the component is referenced by the schema, false if not referenced
- */
- protected boolean isComponentUsed(Object obj, XSDSchema schema, XSDSchema targetSchema)
- {
- if (obj instanceof XSDConcreteComponent)
- {
- XSDConcreteComponent component = (XSDConcreteComponent) obj;
- if (component == schema || component instanceof XSDSchema)
- {
- return false;
- }
- if (!usedIncludeSchemas.contains(targetSchema))
- usedIncludeSchemas.add(targetSchema);
- return true;
- }
- return false;
- }
-
- /**
- * From a list of used schemas, update the unusedImports list for the given schema
- *
- * @param schema
- * @param unusedImports
- * @param usedSchemas
- */
- protected void addToUnusedImports(XSDSchema schema, List usedSchemas)
- {
- // now that we have the list of usedSchemas, get the list of unused
- // schemas by comparing this list to what is actually in the schema
- Iterator iter = schema.getContents().iterator();
- while(iter.hasNext())
- {
- Object o = iter.next();
- if (o instanceof XSDSchemaDirective)
- {
- XSDSchemaDirective directive = (XSDSchemaDirective) o;
- boolean isUsed = false;
- Iterator iter2 = usedSchemas.iterator();
- while (iter2.hasNext())
- {
- XSDSchema usedSchema = (XSDSchema) iter2.next();
- if (directive instanceof XSDImport && directive.getResolvedSchema() == usedSchema)
- {
- isUsed = true;
- break;
- }
- if (directive instanceof XSDInclude && ((XSDInclude)directive).getIncorporatedSchema() == usedSchema)
- {
- isUsed = true;
- usedDirectIncludes.add(usedSchema);
- break;
- }
- // blindly accept redefines as used
- if (directive instanceof XSDRedefine)
- {
- isUsed = true;
- break;
- }
- }
-
- // If it is an include, we need to check if it is used indirectly
- if (directive instanceof XSDInclude && !isUsed)
- {
- XSDInclude inc = (XSDInclude)directive;
- XSDSchema incSchema = inc.getIncorporatedSchema();
- if (incSchema != null)
- {
- XSDSchema usedSchema = getUsedIncludeSchema(incSchema, inc);
- if (usedSchema != null)
- {
- usedIndirectIncludes.add(directive);
- usedIndirectIncludesMap.put(directive, usedSchema);
- isUsed = true;
- }
- else
- {
- isUsed = false;
- }
- }
- }
-
- // If resolved directives are determined unused
- // If resolved directives are not already in the unused list
- // Also any redefines should be considered used
- if (!isUsed && !unusedDirectives.contains(directive) && !(directive instanceof XSDRedefine))
- {
- unusedDirectives.add(directive);
- }
- }
- }
- Iterator iter3 = usedIndirectIncludes.iterator();
- while (iter3.hasNext())
- {
- Object o = iter3.next();
- if (o instanceof XSDInclude)
- {
- XSDInclude inc = (XSDInclude)o;
- XSDSchema targetSchema = (XSDSchema)usedIndirectIncludesMap.get(inc);
- if (usedIncludeSchemas.contains(targetSchema) && usedDirectIncludes.contains(targetSchema))
- {
- unusedDirectives.add(inc);
- }
- else
- {
- usedDirectIncludes.add(targetSchema);
- }
- }
- }
- }
-
- /**
- * Includes can be used indirectly. If the schema includes A which includes B, but the schema
- * references something in B, then A is indirectly used, and hence A cannot be removed.
- *
- * @param schema
- * @param xsdInclude
- * @return the referenced schema if used, null if not used
- */
- private XSDSchema getUsedIncludeSchema(XSDSchema schema, XSDInclude xsdInclude)
- {
- XSDSchema refSchema = null;
- boolean isUsed = false;
- Iterator iter = schema.getContents().iterator();
- while (iter.hasNext())
- {
- Object o = iter.next();
- if (o instanceof XSDInclude)
- {
- XSDInclude inc = (XSDInclude)o;
- XSDSchema incSchema = inc.getIncorporatedSchema();
- if (incSchema != null)
- {
- Iterator iter2 = usedIncludeSchemas.iterator();
- while (iter2.hasNext())
- {
- XSDSchema xsdSch = (XSDSchema)iter2.next();
- if (incSchema == xsdSch)
- {
- isUsed = true;
- refSchema = incSchema;
- break;
- }
- }
-
- if (!isUsed)
- {
- if (!analyzedIncludeSchemas.contains(incSchema)) // To prevent infinite cycle
- {
- analyzedIncludeSchemas.add(incSchema);
- refSchema = getUsedIncludeSchema(incSchema, inc);
- }
- }
- if (isUsed || refSchema != null)
- {
- return refSchema;
- }
- }
- }
- else
- {
- break;
- }
- }
- return refSchema;
- }
-
- /**
- * See cross reference for more details.
- */
- protected static class TopLevelComponentCrossReferencer extends XSDUtil.XSDNamedComponentCrossReferencer
- {
- private static final long serialVersionUID = 1L;
-
- XSDSchema schemaForSchema = XSDUtil.getSchemaForSchema(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001);
- XSDSchema schemaForXSI = XSDSchemaImpl.getSchemaInstance(XSDConstants.SCHEMA_INSTANCE_URI_2001);
-
- protected TopLevelComponentCrossReferencer(EObject arg0)
- {
- super(arg0);
- }
-
- /**
- * Returns a map of all XSDNamedComponent cross references in the content
- * tree.
- */
- public static Map find(EObject eObject)
- {
- TopLevelComponentCrossReferencer result = new TopLevelComponentCrossReferencer(eObject);
- result.crossReference();
- result.done();
- return result;
- }
-
- protected boolean crossReference(EObject eObject, EReference eReference, EObject crossReferencedEObject)
- {
- if (crossReferencedEObject instanceof XSDNamedComponent)
- {
- XSDNamedComponent namedComponent = (XSDNamedComponent) crossReferencedEObject;
-
- if (namedComponent.getContainer() == schemaForSchema ||
- namedComponent.getContainer() == schemaForXSI ||
- crossReferencedEObject.eContainer() == eObject ||
- namedComponent.getName() == null)
- {
- return false;
- }
-
- if (namedComponent instanceof XSDTypeDefinition)
- {
- XSDTypeDefinition typeDefinition = (XSDTypeDefinition) namedComponent;
- if (!(typeDefinition.getContainer() instanceof XSDSchema))
- {
- return false;
- }
- if (typeDefinition.getName() == null)
- {
- return false;
- }
- }
- return true;
- }
- return false;
- }
- }
-
- /**
- * Helper method to remove Text nodes
- * @param element
- * @return
- */
- protected boolean removeTextNodesBetweenNextElement(Element element)
- {
- List nodesToRemove = new ArrayList();
- for (Node node = element.getNextSibling(); node != null; node = node.getNextSibling())
- {
- if (node.getNodeType() == Node.TEXT_NODE)
- {
- nodesToRemove.add(node);
- }
- else if (node.getNodeType() == Node.ELEMENT_NODE)
- {
- for (Iterator j = nodesToRemove.iterator(); j.hasNext();)
- {
- Node nodeToRemove = (Node) j.next();
- nodeToRemove.getParentNode().removeChild(nodeToRemove);
- }
- return true;
- }
- }
- return false;
- }
-
- /**
- * Helper method to remove Text nodes.
- * @param element
- * @return
- */
- protected boolean removeTextNodeBetweenPreviousElement(Element element)
- {
- List nodesToRemove = new ArrayList();
- for (Node node = element.getPreviousSibling(); node != null; node = node.getPreviousSibling())
- {
- if (node.getNodeType() == Node.TEXT_NODE)
- {
- nodesToRemove.add(node);
- }
- else if (node.getNodeType() == Node.ELEMENT_NODE)
- {
- for (Iterator j = nodesToRemove.iterator(); j.hasNext();)
- {
- Node nodeToRemove = (Node) j.next();
- nodeToRemove.getParentNode().removeChild(nodeToRemove);
- }
- return true;
- }
- }
- return false;
- }
-
- /**
- *
- * @param iFile
- * @param checkPreference - if false, ignore checking the preference setting
- * @throws CoreException
- * @throws IOException
- */
-
- public static void removeUnusedXSDImports(IFile iFile, boolean checkPreference) throws CoreException, IOException
- {
- if (!checkPreference || XSDEditorPlugin.getDefault().getRemoveImportSetting())
- {
- IDOMModel model = (IDOMModel) StructuredModelManager.getModelManager().getModelForEdit(iFile);
- if (model != null)
- {
- Document document = model.getDocument();
- if (document != null)
- {
- XSDSchema schema = XSDModelAdapter.lookupOrCreateSchema(document);
- XSDDirectivesManager mgr = new XSDDirectivesManager();
- mgr.performRemoval(schema);
- mgr.cleanup();
- model.save();
- }
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/util/XSDDirectivesSchemaLocationUpdater.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/util/XSDDirectivesSchemaLocationUpdater.java
deleted file mode 100644
index 1f8c19d636..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/util/XSDDirectivesSchemaLocationUpdater.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.wst.xsd.ui.internal.common.util;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.common.ui.internal.viewers.ResourceFilter;
-import org.eclipse.wst.common.uriresolver.internal.util.URIHelper;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-import org.eclipse.wst.xsd.ui.internal.util.TypesHelper;
-import org.eclipse.wst.xsd.ui.internal.wizards.XSDSelectIncludeFileWizard;
-import org.eclipse.xsd.XSDImport;
-import org.eclipse.xsd.XSDInclude;
-import org.eclipse.xsd.XSDRedefine;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.impl.XSDImportImpl;
-import org.w3c.dom.Element;
-
-public class XSDDirectivesSchemaLocationUpdater
-{
- /**
- * Modifies the schema location by opening the schema location dialog and
- * processing the results. This method refactors the code in
- * XSDImportSection$widgetSelected and SchemaLocationSection$widgetSelected
- * and the processing in handleSchemaLocationChange()
- */
- public static void updateSchemaLocation(XSDSchema xsdSchema, Object selection, boolean isInclude)
- {
- Shell shell = Display.getCurrent().getActiveShell();
- IFile currentIFile = null;
- IEditorInput editorInput = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor().getEditorInput();
- ViewerFilter filter;
-
- if (editorInput instanceof IFileEditorInput)
- {
- currentIFile = ((IFileEditorInput) editorInput).getFile();
- filter = new ResourceFilter(new String[] { ".xsd" }, //$NON-NLS-1$
- new IFile[] { currentIFile }, null);
- }
- else
- {
- filter = new ResourceFilter(new String[] { ".xsd" }, //$NON-NLS-1$
- null, null);
- }
-
- XSDSelectIncludeFileWizard fileSelectWizard = new XSDSelectIncludeFileWizard(xsdSchema, isInclude, XSDEditorPlugin.getXSDString("_UI_FILEDIALOG_SELECT_XML_SCHEMA"), //$NON-NLS-1$
- XSDEditorPlugin.getXSDString("_UI_FILEDIALOG_SELECT_XML_DESC"), //$NON-NLS-1$
- filter, new StructuredSelection(selection));
-
- WizardDialog wizardDialog = new WizardDialog(shell, fileSelectWizard);
- wizardDialog.create();
- wizardDialog.setBlockOnOpen(true);
- int result = wizardDialog.open();
-
- if (result == Window.OK)
- {
- IFile selectedIFile = fileSelectWizard.getResultFile();
- String schemaFileString;
- if (selectedIFile != null && currentIFile != null)
- {
- schemaFileString = URIHelper.getRelativeURI(selectedIFile.getLocation(), currentIFile.getLocation());
- }
- else if (selectedIFile != null && currentIFile == null)
- {
- schemaFileString = selectedIFile.getLocationURI().toString();
- }
- else
- {
- schemaFileString = fileSelectWizard.getURL();
- }
-
- String attributeSchemaLocation = "schemaLocation"; //$NON-NLS-1$
- if (selection instanceof XSDImport)
- {
- XSDImport xsdImport = (XSDImport) selection;
- xsdImport.getElement().setAttribute(attributeSchemaLocation, schemaFileString); //$NON-NLS-1$
-
- String namespace = fileSelectWizard.getNamespace();
- if (namespace == null)
- namespace = ""; //$NON-NLS-1$
-
- XSDSchema externalSchema = fileSelectWizard.getExternalSchema();
- java.util.Map map = xsdSchema.getQNamePrefixToNamespaceMap();
- Element schemaElement = xsdSchema.getElement();
-
- // update the xmlns in the schema element first, and then update the
- // import element next so that the last change will be in the import element. This keeps the
- // selection on the import element
- TypesHelper helper = new TypesHelper(externalSchema);
- String prefix = helper.getPrefix(namespace, false);
-
- if (map.containsKey(prefix))
- {
- prefix = null;
- }
-
- if (prefix == null || (prefix != null && prefix.length() == 0))
- {
- StringBuffer newPrefix = new StringBuffer("pref"); //$NON-NLS-1$
- int prefixExtension = 1;
- while (map.containsKey(newPrefix.toString()) && prefixExtension < 100)
- {
- newPrefix = new StringBuffer("pref" + String.valueOf(prefixExtension)); //$NON-NLS-1$
- prefixExtension++;
- }
- prefix = newPrefix.toString();
- }
-
- String attributeNamespace = "namespace"; //$NON-NLS-1$
- if (namespace.length() > 0)
- {
- // if ns already in map, use its corresponding prefix
- if (map.containsValue(namespace))
- {
- TypesHelper typesHelper = new TypesHelper(xsdSchema);
- prefix = typesHelper.getPrefix(namespace, false);
- }
- else
- // otherwise add to the map
- {
- schemaElement.setAttribute("xmlns:" + prefix, namespace); //$NON-NLS-1$
- }
- // prefixText.setText(prefix);
- xsdImport.getElement().setAttribute(attributeNamespace, namespace);
- }
-
- // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=155885
- // Need to import otherwise the external schema is never
- // resolved. One problem is that the schema location is still null,
- // so the set types dialog will show types that belong to that schema
- // with a null schema location. This should load resource
- // into the resource set
- if (selection instanceof XSDImportImpl) // redundant
- {
- XSDImportImpl xsdImportImpl = (XSDImportImpl) selection;
- xsdImportImpl.importSchema();
- }
-
- }
- else if (selection instanceof XSDInclude)
- {
- XSDInclude xsdInclude = (XSDInclude) selection;
- xsdInclude.getElement().setAttribute(attributeSchemaLocation, schemaFileString);
- }
- else if (selection instanceof XSDRedefine)
- {
- XSDRedefine xsdRedefine = (XSDRedefine) selection;
- xsdRedefine.getElement().setAttribute(attributeSchemaLocation, schemaFileString);
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/util/messages.properties b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/util/messages.properties
deleted file mode 100644
index a5bdc10340..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/util/messages.properties
+++ /dev/null
@@ -1,123 +0,0 @@
-###############################################################################
-# Copyright (c) 2001, 2010 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.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_ACTION_OPEN_IN_NEW_EDITOR=&Open In New Editor
-_UI_ACTION_DELETE_CONSTRAINTS=Delete Constraints
-_UI_ACTION_DELETE_ENUMERATION=Delete Enumeration
-_UI_ACTION_DELETE_APPINFO_ELEMENT=Delete AppInfo Element
-_UI_ACTION_DELETE_APPINFO_ATTRIBUTE=Delete AppInfo Attribute
-_UI_ACTION_DELETE_EXTENSION_COMPONENT=Delete Extension Component
-_UI_ACTION_ADD_ATTRIBUTE_GROUP=Add Attribute &Group
-_UI_ACTION_ADD_APPINFO_ELEMENT=Add AppInfo Element
-_UI_ACTION_ADD_ATTRIBUTE=Add &Attribute
-_UI_ACTION_ADD_GROUP_REF=Add &Group Ref
-_UI_ACTION_ADD_ANY_ELEMENT=Add An&y
-_UI_ACTION_ADD_ANY_ATTRIBUTE=Add A&ny Attribute
-_UI_ACTION_ADD_WITH_DOTS=&Add...
-_UI_ACTION_UPDATE_BOUNDS=Update bounds
-_UI_ACTION_ADD_COMPLEX_TYPE=Add &Complex Type
-_UI_ACTION_ADD_ENUMERATIONS=Add Enumerations
-_UI_ACTION_ADD_DOCUMENTATION=Add Documentation
-_UI_ACTION_CONSTRAIN_LENGTH=Constrain length
-_UI_ACTION_BROWSE_WORKSPACE=Workspace
-_UI_DELETE_BUTTON=&Delete
-_UI_LABEL_NO_ITEMS_SELECTED=No items selected
-_UI_LABEL_ELEMENTFORMDEFAULT=Prefix for &Elements:
-_UI_LABEL_ATTRIBUTEFORMDEFAULT=Prefix for &Attributes:
-_UI_LABEL_BLOCKDEFAULT=&Block default:
-_UI_LABEL_EXTENSION_DETAILS=Extension Details
-_UI_LABEL_EXTENSION_CATEGORIES=Extension &Categories:
-_UI_LABEL_FINALDEFAULT=&Final default:
-_UI_LABEL_COLLAPSE_WHITESPACE=Collapse &whitespace
-_UI_LABEL_RESTRICT_VALUES_BY=&Restrict values by:
-_UI_LABEL_MINIMUM_LENGTH=Mi&nimum length:
-_UI_LABEL_MAXIMUM_LENGTH=Ma&ximum length:
-_UI_LABEL_SELECT_XSD_FILE=Select XSD file
-_UI_LABEL_CONSTRAINTS_ON_VALUE_OF=Constraints on value of
-_UI_ACTION_ADD_SIMPLE_TYPE=Add &Simple Type
-_UI_ACTION_EDIT_WITH_DOTS=&Edit...
-_UI_ACTION_CHANGE_PATTERN=Change pattern
-_UI_ACTION_ADD_ENUMERATION=Add &Enumeration
-_UI_ACTION_INSERT_ENUMERATION=&Insert Enumeration
-_UI_ACTION_CHANGE_ENUMERATION_VALUE=Change Enumeration value
-_UI_ACTION_DELETE_PATTERN=Delete Pattern
-_UI_ACTION_BROWSE_CATALOG=Catalog
-_UI_ACTION_ADD_GROUP=Add &Group
-_UI_ACTION_ADD_PATTERN=Add pattern
-_UI_ACTION_SET_BASE_TYPE=Set &Base Type
-_UI_ERROR_INVALID_NAME=Invalid name
-_UI_ERROR_INVALID_FILE=Invalid file
-_UI_ERROR_INVALID_CATEGORY=Invalid Category
-_UI_ACTION_DELETE=&Delete
-_UI_ACTION_ADD=A&dd
-_UI_ACTION_RENAME=Rename
-_UI_LABEL_PATTERN=Pattern
-_UI_LABEL_PATTERNS=&Patterns
-_UI_LABEL_NAME=&Name:
-_UI_LABEL_TYPE=&Type:
-_UI_LABEL_BASE=&Base:
-_UI_LABEL_UP=Up
-_UI_LABEL_DOWN=Down
-_UI_LABEL_DELETE=&Delete
-_UI_LABEL_SCHEMA=&Schema:
-_UI_LABEL_EDIT=&Edit...
-_UI_LABEL_REFERENCE=Reference:
-_UI_LABEL_READONLY=ReadOnly
-_UI_LABEL_INCLUSIVE=Inclusive
-_UI_LABEL_ENUMERATIONS=&Enumerations
-_UI_LABEL_EXTENSIONS=Extensions
-_UI_LABEL_MINIMUM_VALUE=&Minimum value:
-_UI_LABEL_MAXIMUM_VALUE=Ma&ximum value:
-_UI_LABEL_CONTRAINTS_ON=Constraints on
-_UI_LABEL_ADD_WITH_DOTS=&Add...
-_UI_LABEL_ADD_CATEGORY=Add Category
-_UI_LABEL_EDIT_CATEGORY=Edit Category
-_UI_ACTION_ADD_ATTRIBUTE_GROUP_REF=Add Attribute &Group Ref
-_UI_ACTION_ADD_EXTENSION_COMPONENT=Add Extension Component
-_UI_ACTION_ADD_EXTENSION_COMPONENTS=Add Extension Components
-_UI_LABEL_CONSTRAINTS_ON_LENGTH_OF=Constraints on length of
-_UI_ACTION_ADD_APPINFO_ATTRIBUTE=Add AppInfo Attribute
-_UI_ACTION_SET_ENUMERATION_VALUE=Set Enumeration Value
-_UI_ACTION_UPDATE_ELEMENT_REFERENCE=Update Element Reference
-_UI_ACTION_UPDATE_MAXIMUM_OCCURRENCE=Update Maximum Occurrence
-_UI_ACTION_UPDATE_MINIMUM_OCCURRENCE=Update Minimum Occurrence
-_UI_ACTION_CHANGE_MAXIMUM_OCCURRENCE=Maximum Occurrence Change
-_UI_ACTION_CHANGE_MINIMUM_OCCURRENCE=Minimum Occurrence Change
-_UI_LABEL_SPECIFIC_CONSTRAINT_VALUES=Specific constraint values
-_UI_LABEL_AVAILABLE_COMPONENTS_TO_ADD=Available com&ponents to Add:
-_UI_ACTION_CHANGE_CONTENT_MODEL=Change Content Model
-_UI_ERROR_FILE_CANNOT_BE_PARSED=The xsd file of the selected category cannot be parsed.
-_UI_DESCRIPTION_CHOOSE_XSD_FILE=Choose an XSD file containing schema for your extensible components
-_UI_ERROR_VALIDATE_THE_FILE=Please validate the file.
-_UI_ERROR_NAME_ALREADY_USED=The name is already being used.
-_UI_ACTION_COLLAPSE_WHITESPACE=Collapse whitespace
-_UI_ACTION_ADD_ATTRIBUTE_GROUP_DEFINITION=Add Attribute Group Definition
-_UI_ERROR_INVALID_VALUE_FOR_MAXIMUM_OCCURRENCE=Invalid value for maximum occurrence
-_UI_TOOLTIP_RENAME_REFACTOR=Click here to invoke the Rename refactoring.
-_UI_VALUE_COLON=Value:
-_UI_ID=ID:
-_UI_REF=Reference:
-_UI_FIXED=Fixed
-_UI_DEFAULT=Default
-_UI_FORM=Form qualification:
-_UI_LABEL_CATALOG=&XML Catalog...
-_UI_LABEL_WORKSPACE=&Workspace...
-_UI_ACTION_CHANGE={0} Change
-_UI_ACTION_CLOSE_SCHEMA_PREVIEW_POPUP=&Close
-_UI_ACTION_NAMESPACE_INFORMATION_CHANGE=Namespace Information Change
-_UI_LABEL_ABSTRACT=&Abstract:
-_UI_LABEL_BLOCK=&Block:
-_UI_LABEL_FINAL=&Final:
-_UI_LABEL_SUBSTITUTION_GROUP=&Substitution Group:
-_UI_LABEL_MIXED=&Mixed:
-_UI_LABEL_VALUE=&Value
-_UI_USAGE=Usage
-_UI_LABEL_FORM=Form
-_UI_LABEL_NILLABLE=&Nillable: \ No newline at end of file
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
deleted file mode 100644
index 243aa72790..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/Checks.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * 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.getString("Checks_Choose_name")); //$NON-NLS-1$
- 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))
- return RefactoringStatus.createFatalErrorStatus(RefactoringMessages.getString("Checks_Choose_name")); //$NON-NLS-1$
-
- 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
deleted file mode 100644
index af89666c4e..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/INameUpdating.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * 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
deleted file mode 100644
index 1ff48fe733..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/IReferenceUpdating.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * 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/IXSDRefactorConstants.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/IXSDRefactorConstants.java
deleted file mode 100644
index 79dfec10a0..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/IXSDRefactorConstants.java
+++ /dev/null
@@ -1,15 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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 IXSDRefactorConstants {
- String REFACTOR_CONTEXT_MENU_ID = "org.eclipse.wst.xsd.ui.refactorMenuId"; //$NON-NLS-1$
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/MakeAnonymousTypsGlobalEnablementTester.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/MakeAnonymousTypsGlobalEnablementTester.java
deleted file mode 100644
index a257bb7162..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/MakeAnonymousTypsGlobalEnablementTester.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.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;
-
-
-public class MakeAnonymousTypsGlobalEnablementTester extends RefactorEnablementTester
-{
-
- protected boolean canEnable(XSDConcreteComponent selectedObject, XSDSchema schema)
- {
- if (selectedObject == null)
- {
- return false;
- }
-
- XSDSchema selectedComponentSchema = null;
- boolean enable = false;
- selectedComponentSchema = selectedObject.getSchema();
-
- if (selectedComponentSchema != null && selectedComponentSchema == schema)
- {
- enable = true;
- }
-
- if (enable && selectedObject instanceof XSDComplexTypeDefinition)
- {
- XSDComplexTypeDefinition typeDef = (XSDComplexTypeDefinition)selectedObject;
- XSDConcreteComponent parent = typeDef.getContainer();
- if (parent instanceof XSDElementDeclaration)
- {
- return true;
- }
- }
- else if (enable && selectedObject instanceof XSDSimpleTypeDefinition)
- {
- XSDSimpleTypeDefinition typeDef = (XSDSimpleTypeDefinition)selectedObject;
- XSDConcreteComponent parent = typeDef.getContainer();
- if (parent instanceof XSDElementDeclaration)
- {
- return true;
- }
- else if (parent instanceof XSDAttributeDeclaration)
- {
- return true;
- }
- }
- return false;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/MakeLocalElementGlobalEnablementTester.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/MakeLocalElementGlobalEnablementTester.java
deleted file mode 100644
index e4f4696d53..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/MakeLocalElementGlobalEnablementTester.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDElementDeclaration;
-import org.eclipse.xsd.XSDSchema;
-
-
-public class MakeLocalElementGlobalEnablementTester extends RefactorEnablementTester
-{
- protected boolean canEnable(XSDConcreteComponent selectedObject, XSDSchema schema)
- {
- if (selectedObject == null)
- {
- return false;
- }
-
- boolean enable = false;
- XSDSchema selectedComponentSchema = null;
- selectedComponentSchema = selectedObject.getSchema();
- if (selectedComponentSchema != null && selectedComponentSchema == schema)
- {
- enable = true;
- }
-
- if (enable && selectedObject instanceof XSDElementDeclaration)
- {
- XSDElementDeclaration element = (XSDElementDeclaration)selectedObject;
- if (!element.isElementDeclarationReference() && !element.isGlobal())
- {
- return true;
- }
- }
-
- return false;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/PerformUnsavedRefactoringOperation.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/PerformUnsavedRefactoringOperation.java
deleted file mode 100644
index 10739ece9b..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/PerformUnsavedRefactoringOperation.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * 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.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.ltk.core.refactoring.Change;
-import org.eclipse.ltk.core.refactoring.CompositeChange;
-import org.eclipse.ltk.core.refactoring.TextFileChange;
-import org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring;
-
-public class PerformUnsavedRefactoringOperation implements IWorkspaceRunnable
-{
- private ProcessorBasedRefactoring refactoring;
-
- public PerformUnsavedRefactoringOperation(ProcessorBasedRefactoring refactoring)
- {
- this.refactoring = refactoring;
- }
-
- public void run(IProgressMonitor pm)
- {
- if (pm == null)
- {
- pm = new NullProgressMonitor();
- }
- try
- {
- refactoring.checkAllConditions(pm);
- Change change = refactoring.createChange(pm);
- if (change instanceof CompositeChange)
- {
- CompositeChange compositeChange = (CompositeChange)change;
- setSaveMode(compositeChange);
- }
- change.perform(pm);
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
-
- private void setSaveMode(CompositeChange composite)
- {
- Change[] children = composite.getChildren();
- for (int i = 0; i < children.length; i++)
- {
- Change child = children[i];
- if (child instanceof TextFileChange)
- {
- ((TextFileChange)child).setSaveMode(TextFileChange.LEAVE_DIRTY);
- }
- else if (child instanceof CompositeChange)
- {
- setSaveMode((CompositeChange)child);
- }
- }
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/RefactorEnablementTester.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/RefactorEnablementTester.java
deleted file mode 100644
index b912ca0ea3..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/RefactorEnablementTester.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.core.expressions.PropertyTester;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDSchema;
-import org.w3c.dom.Node;
-
-
-public abstract class RefactorEnablementTester extends PropertyTester
-{
-
- public boolean test(Object receiver, String property, Object[] args, Object expectedValue)
- {
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window == null)
- {
- return false;
- }
-
- IWorkbenchPage activePage = window.getActivePage();
- if (activePage == null)
- {
- return false;
- }
-
- IEditorPart editor = activePage.getActiveEditor();
- if (editor == null)
- {
- return false;
- }
-
- XSDSchema schema = (XSDSchema)editor.getAdapter(XSDSchema.class);
-
- if (receiver instanceof IStructuredSelection)
- {
- IStructuredSelection fStructuredSelection = (IStructuredSelection)receiver;
- receiver = fStructuredSelection.getFirstElement();
-
- if (receiver instanceof XSDBaseAdapter)
- {
- receiver = ((XSDBaseAdapter)receiver).getTarget();
- }
-
- if (receiver instanceof XSDConcreteComponent)
- {
- return canEnable((XSDConcreteComponent)receiver, schema);
- }
- else if (receiver instanceof Node)
- {
- Node node = (Node)receiver;
- if (schema != null)
- {
- XSDConcreteComponent concreteComponent = schema.getCorrespondingComponent(node);
- return canEnable(concreteComponent, schema);
- }
- }
-
- return true;
- }
- return false;
- }
-
- protected abstract boolean canEnable(XSDConcreteComponent selectedObject, XSDSchema schema);
-
-} \ 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
deleted file mode 100644
index 554bc8a7d8..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/RefactoringComponent.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * 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
deleted file mode 100644
index 68ed4b23d5..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/RefactoringMessages.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * 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.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);
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/RenameEnablementTester.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/RenameEnablementTester.java
deleted file mode 100644
index 99bb97e0a9..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/RenameEnablementTester.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.xsd.XSDAttributeDeclaration;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDElementDeclaration;
-import org.eclipse.xsd.XSDNamedComponent;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.XSDTypeDefinition;
-
-
-public class RenameEnablementTester extends RefactorEnablementTester
-{
- protected boolean canEnable(XSDConcreteComponent selectedObject, XSDSchema schema)
- {
- if (selectedObject == null)
- {
- return false;
- }
-
- XSDNamedComponent selectedComponent = null;
- boolean enable = false;
-
- XSDSchema selectedComponentSchema = null;
- selectedComponentSchema = selectedObject.getSchema();
- if (selectedComponentSchema != null && selectedComponentSchema == schema)
- {
- enable = true;
- }
-
- if (enable && selectedObject instanceof XSDNamedComponent)
- {
- selectedComponent = (XSDNamedComponent)selectedObject;
-
- if (selectedComponent instanceof XSDElementDeclaration)
- {
- XSDElementDeclaration element = (XSDElementDeclaration)selectedComponent;
- if (element.isElementDeclarationReference())
- {
- return false;
- }
- if (!element.isGlobal())
- {
- return false;
- }
- }
- 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))
- {
- return false;
- }
- }
- else if (parent instanceof XSDAttributeDeclaration)
- {
- XSDAttributeDeclaration element = (XSDAttributeDeclaration)parent;
- if (element.getAnonymousTypeDefinition().equals(type))
- {
- return false;
- }
- }
- }
- return true;
- }
- return false;
- }
-} \ 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
deleted file mode 100644
index e1c53e8e26..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/TextChangeManager.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*******************************************************************************
- * 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.core.runtime.NullProgressMonitor;
-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);
- result.initializeValidationData(new NullProgressMonitor());
- 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
deleted file mode 100644
index ad779b1ee4..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/XMLRefactoringComponent.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*******************************************************************************
- * 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
deleted file mode 100644
index 891476461f..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/MakeAnonymousTypeGlobalAction.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.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.ui.internal.editor.XSDEditorPlugin;
-import org.eclipse.wst.xsd.ui.internal.refactor.handlers.MakeAnonymousTypeGobalHandler;
-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;
-
-/**
- * @deprecated Use {@link MakeAnonymousTypeGobalHandler}
- */
-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)){ //$NON-NLS-1$
- if(isComplexType){
- return fParentName + "ComplexType"; //$NON-NLS-1$
- }
- else{
- return fParentName + "SimpleType"; //$NON-NLS-1$
- }
- }
- else{
- if(isComplexType){
- return "NewComplexType"; //$NON-NLS-1$
- }
- else{
- return "NewSimpleType"; //$NON-NLS-1$
- }
- }
-
- }
- 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) && super.canEnable(selectedObject);
- }
- else if (selectedObject instanceof Node) {
- Node node = (Node) selectedObject;
- XSDConcreteComponent concreteComponent = getSchema().getCorrespondingComponent(node);
- return canEnable(concreteComponent) && super.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
deleted file mode 100644
index 49d877c8c8..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/MakeLocalElementGlobalAction.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 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.wst.xml.core.internal.document.DocumentImpl;
-import org.eclipse.wst.xsd.ui.internal.refactor.RefactoringMessages;
-import org.eclipse.wst.xsd.ui.internal.refactor.handlers.MakeLocalElementGlobalHandler;
-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;
-
-/**
- * @deprecated Use {@link MakeLocalElementGlobalHandler}
- */
-public class MakeLocalElementGlobalAction extends XSDSelectionDispatchAction {
-
- XSDElementDeclaration fSelectedComponent;
-
- public MakeLocalElementGlobalAction(ISelection selection, XSDSchema schema) {
- super(selection, schema);
- 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) && super.canEnable(selectedObject);
- }
- else if (selectedObject instanceof Node) {
- Node node = (Node) selectedObject;
- XSDConcreteComponent concreteComponent = getSchema()
- .getCorrespondingComponent(node);
- return canEnable(concreteComponent) && super.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
deleted file mode 100644
index 01d2fb7546..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/RenameAction.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*******************************************************************************
- * 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.ui.internal.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
deleted file mode 100644
index e0447ef2de..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/RenameComponentAction.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 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.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.common.ui.internal.dialogs.SaveDirtyFilesDialog;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
-import org.eclipse.wst.xsd.ui.internal.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.handlers.RenameHandler;
-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;
-
-/**
- * @deprecated Use {@link RenameHandler}
- */
-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) && super.canEnable(selectedObject);
- } else if (selectedObject instanceof Node)
- {
- Node node = (Node) selectedObject;
- if (getSchema() != null)
- {
- XSDConcreteComponent concreteComponent = getSchema()
- .getCorrespondingComponent(node);
- return canEnable(concreteComponent) && super.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);
- }
-
- }
-
- boolean rc = SaveDirtyFilesDialog.saveDirtyFiles();
- if (!rc)
- {
- return;
- }
- 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());
-
- // TODO (cs) I'm not sure why we need to do this. See bug 145700
- //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
deleted file mode 100644
index 17d7d9fa8a..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/RenameResourceAction.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 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.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.ui.internal.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
deleted file mode 100644
index 444a5abbf9..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/RenameResourceActionDelegate.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 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.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
deleted file mode 100644
index 58ceedc9ac..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/RenameTargetNamespaceAction.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 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.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.ui.internal.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 super.canEnable(selectedObject);
-
- }
-
- 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
deleted file mode 100644
index 7a2aaca5e4..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/SelectionDispatchAction.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 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.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) {
-
- }
-
- /* (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
deleted file mode 100644
index 0169f2625e..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/XSDRefactorActionGroup.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * 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
deleted file mode 100644
index a0873fc8cb..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/XSDRefactorGroupActionDelegate.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * 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.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.ui.internal.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
deleted file mode 100644
index ba28df9f87..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/actions/XSDSelectionDispatchAction.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * 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.XSDConcreteComponent;
-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;
- }
-
- protected boolean canEnable(Object selectedComponent)
- {
- XSDSchema selectedComponentSchema = null;
- if (selectedComponent instanceof XSDConcreteComponent)
- {
- selectedComponentSchema = ((XSDConcreteComponent)selectedComponent).getSchema();
- }
-
- if (selectedComponentSchema != null && selectedComponentSchema == getSchema() )
- {
- return true;
- }
- return false;
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/handlers/MakeAnonymousTypeGobalHandler.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/handlers/MakeAnonymousTypeGobalHandler.java
deleted file mode 100644
index efd80873a7..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/handlers/MakeAnonymousTypeGobalHandler.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.handlers;
-
-
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.wst.xml.core.internal.document.DocumentImpl;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter;
-import org.eclipse.wst.xsd.ui.internal.refactor.structure.MakeAnonymousTypeGlobalCommand;
-import org.eclipse.wst.xsd.ui.internal.refactor.wizard.RefactoringWizardMessages;
-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 MakeAnonymousTypeGobalHandler extends RefactoringHandler
-{
- private String parentName;
- private boolean isComplexType = true;
-
- public Object doExecute(ISelection selection, XSDSchema schema)
- {
- if (selection != null)
- {
- Object selectedObject = ((StructuredSelection)selection).getFirstElement();
-
- if (selectedObject instanceof XSDBaseAdapter)
- {
- selectedObject = ((XSDBaseAdapter)selectedObject).getTarget();
- }
-
- XSDConcreteComponent concreteComp = null;
-
- if (selectedObject instanceof Node)
- {
- Node node = (Node)selectedObject;
- concreteComp = schema.getCorrespondingComponent(node);
- }
- else if (selectedObject instanceof XSDConcreteComponent)
- {
- concreteComp = ((XSDConcreteComponent)selectedObject);
- }
-
- if (concreteComp != null)
- {
- if (concreteComp instanceof XSDComplexTypeDefinition)
- {
-
- isComplexType = true;
- XSDComplexTypeDefinition typeDef = (XSDComplexTypeDefinition)concreteComp;
- XSDConcreteComponent parent = typeDef.getContainer();
- if (parent instanceof XSDElementDeclaration)
- {
- parentName = ((XSDElementDeclaration)parent).getName();
- run(selection, schema, typeDef);
- }
- else if (concreteComp instanceof XSDSimpleTypeDefinition)
- {
- isComplexType = false;
- XSDSimpleTypeDefinition simpleTypeDef = (XSDSimpleTypeDefinition)concreteComp;
- XSDConcreteComponent parentComp = simpleTypeDef.getContainer();
- if (parentComp instanceof XSDElementDeclaration)
- {
- parentName = ((XSDElementDeclaration)parent).getName();
-
- }
- else if (parent instanceof XSDAttributeDeclaration)
- {
- parentName = ((XSDAttributeDeclaration)parent).getName();
-
- }
- run(selection, schema, simpleTypeDef);
- }
- }
- }
- }
-
- return null;
- }
-
- private String getNewDefaultName()
- {
- if (parentName != null && !"".equals(parentName)) { //$NON-NLS-1$
- if (isComplexType)
- {
- return parentName + "ComplexType"; //$NON-NLS-1$
- }
- else
- {
- return parentName + "SimpleType"; //$NON-NLS-1$
- }
- }
- else
- {
- if (isComplexType)
- {
- return "NewComplexType"; //$NON-NLS-1$
- }
- else
- {
- return "NewSimpleType"; //$NON-NLS-1$
- }
- }
-
- }
-
- public void run(ISelection selection, XSDSchema schema, XSDTypeDefinition selectedComponent)
- {
- if (selectedComponent == null)
- {
- return;
- }
-
- if (selectedComponent.getSchema() == null)
- {
- schema.updateElement(true);
- }
- DocumentImpl doc = (DocumentImpl)selectedComponent.getElement().getOwnerDocument();
- doc.getModel().beginRecording(this, RefactoringWizardMessages.MakeAnonymousTypeGlobalAction_text);
- MakeAnonymousTypeGlobalCommand command = new MakeAnonymousTypeGlobalCommand(selectedComponent, getNewDefaultName());
- command.run();
- doc.getModel().endRecording(this);
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/handlers/MakeLocalElementGlobalHandler.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/handlers/MakeLocalElementGlobalHandler.java
deleted file mode 100644
index 8578d88c01..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/handlers/MakeLocalElementGlobalHandler.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.handlers;
-
-
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.wst.xml.core.internal.document.DocumentImpl;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter;
-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 MakeLocalElementGlobalHandler extends RefactoringHandler
-{
-
- public Object doExecute(ISelection selection, XSDSchema schema)
- {
- if (selection != null)
- {
- Object selectedObject = ((StructuredSelection)selection).getFirstElement();
- if (selectedObject instanceof XSDBaseAdapter)
- {
- selectedObject = ((XSDBaseAdapter)selectedObject).getTarget();
- }
- if (selectedObject instanceof XSDElementDeclaration)
- {
- run(selection, (XSDElementDeclaration)selectedObject);
- }
- else if (selectedObject instanceof Node)
- {
- Node node = (Node)selectedObject;
- XSDConcreteComponent concreteComponent = schema.getCorrespondingComponent(node);
- if (concreteComponent instanceof XSDElementDeclaration)
- run(selection, (XSDElementDeclaration)concreteComponent);
- }
-
- }
- return null;
- }
-
- public void run(ISelection selection, XSDElementDeclaration selectedComponent)
- {
- DocumentImpl doc = (DocumentImpl)selectedComponent.getElement().getOwnerDocument();
- doc.getModel().beginRecording(this, "MakeLocalElementGlobalHandler.text");
- MakeLocalElementGlobalCommand command = new MakeLocalElementGlobalCommand(selectedComponent);
- command.run();
- doc.getModel().endRecording(this);
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/handlers/RefactoringHandler.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/handlers/RefactoringHandler.java
deleted file mode 100644
index bbe02fc7ea..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/handlers/RefactoringHandler.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.handlers;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.handlers.HandlerUtil;
-import org.eclipse.xsd.XSDSchema;
-
-public abstract class RefactoringHandler extends AbstractHandler
-{
- public Object execute(ExecutionEvent event) throws ExecutionException {
-
- IWorkbenchWindow workbenchWindow = HandlerUtil.getActiveWorkbenchWindow(event);
- if (workbenchWindow == null) return null;
-
- IWorkbenchPage activePage = workbenchWindow.getActivePage();
- if (activePage == null) return null;
-
- IEditorPart editor = activePage.getActiveEditor();
- if (editor == null) return null;
- XSDSchema schema = (XSDSchema)editor.getAdapter(XSDSchema.class);
-
- ISelection selection = activePage.getSelection();
-
- return doExecute(selection, schema);
- }
-
- protected abstract Object doExecute(ISelection selection, XSDSchema schema);
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/handlers/RenameHandler.java b/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/handlers/RenameHandler.java
deleted file mode 100644
index c06bd43d09..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/handlers/RenameHandler.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.handlers;
-
-
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-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.common.ui.internal.dialogs.SaveDirtyFilesDialog;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
-import org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter;
-import org.eclipse.wst.xsd.ui.internal.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.XSDConcreteComponent;
-import org.eclipse.xsd.XSDNamedComponent;
-import org.eclipse.xsd.XSDSchema;
-import org.w3c.dom.Node;
-
-
-public class RenameHandler extends RefactoringHandler
-{
-
- protected Object doExecute(ISelection selection, XSDSchema schema)
- {
- return execute(selection, schema);
- }
-
- public Object execute(ISelection selection, XSDSchema schema)
- {
- if (selection != null)
- {
-
- Object selectedObject = ((StructuredSelection)selection).getFirstElement();
- if (selectedObject instanceof XSDBaseAdapter)
- {
- selectedObject = ((XSDBaseAdapter)selectedObject).getTarget();
- }
-
- if (selectedObject instanceof XSDNamedComponent)
- {
- run(selection, schema, (XSDNamedComponent)selectedObject);
- }
- else if (selectedObject instanceof Node)
- {
- Node node = (Node)selectedObject;
- if (schema != null)
- {
- XSDConcreteComponent concreteComponent = schema.getCorrespondingComponent(node);
- if (concreteComponent instanceof XSDNamedComponent)
- {
- run(selection, schema, (XSDNamedComponent)concreteComponent);
- }
- }
- }
- }
- return null;
-
- }
-
- public void run(ISelection selection, XSDSchema schema, XSDNamedComponent selectedComponent)
- {
- if (selectedComponent.getName() == null)
- {
- selectedComponent.setName(new String());
- }
- if (selectedComponent.getSchema() == null)
- {
- if (schema != null)
- {
- schema.updateElement(true);
- }
-
- }
-
- boolean rc = SaveDirtyFilesDialog.saveDirtyFiles();
- if (!rc)
- {
- return;
- }
- 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());
-
- }
- catch (InterruptedException e)
- {
- // do nothing. User action got canceled
- }
- }
-}
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
deleted file mode 100644
index 9c8b012e1c..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/messages.properties
+++ /dev/null
@@ -1,55 +0,0 @@
-###############################################################################
-# Copyright (c) 2001, 2010 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.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
-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
-RenameComponentRefactoring_checking=Checking...
-RenameComponentRefactoring_searching=Searching...
-Checks_Choose_name=Invalid name
-RenameComponentRefactoring_another_name=Name already used
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
deleted file mode 100644
index ebdf3d03ec..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/rename/ComponentRenameArguments.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * 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
deleted file mode 100644
index b49d4fbe6d..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/rename/RenameComponentProcessor.java
+++ /dev/null
@@ -1,519 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.refactor.rename;
-
-//import com.ibm.icu.text.Collator;
-import java.util.ArrayList;
-import java.util.Arrays;
-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.jface.text.Position;
-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.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.provisional.document.IDOMElement;
-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$
- private boolean singleFileOnly = false;
-
- 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(selectedComponent, newName, false);
- }
-
- public RenameComponentProcessor(RefactoringComponent selectedComponent, String newName, boolean singleFileOnly) {
- this.newName = newName;
- this.selectedComponent = selectedComponent;
- this.singleFileOnly = singleFileOnly;
- }
-
- 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();
- HashMap map = new HashMap();
- if (singleFileOnly)
- {
- map.put("searchDirtyContent", Boolean.TRUE);
- }
- searchEngine.search(pattern, requestor, scope, map, new NullProgressMonitor());
- List results = requestor.getResults();
-
- // more than one declaration found, so use offset as additional check
- Position offsetPosition = null;
- if (results.size() > 1) {
- IDOMElement selectedElement = selectedComponent.getElement();
- if (selectedElement != null) {
- int startOffset = selectedElement.getStartOffset();
- offsetPosition = new Position(startOffset, (selectedElement.getEndOffset() - startOffset));
- }
- }
-
- for (Iterator iter = results.iterator(); iter.hasNext();) {
- SearchMatch match = (SearchMatch) iter.next();
- if (match != null) {
- boolean addTextChange = true;
- // additional check to verify correct declaration is changed
- if (offsetPosition != null) {
- addTextChange = offsetPosition.overlapsWith(match.getOffset(), match.getLength());
- }
- if (addTextChange) {
- 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();
- SearchScope scope = null;
- HashMap map = new HashMap();
- if (singleFileOnly)
- {
- map.put("searchDirtyContent", Boolean.TRUE);
- scope = new SelectionSearchScope(new IResource[]{file});
- }
- else
- {
- scope = new WorkspaceSearchScope();
- }
- SortingSearchRequestor requestor = new SortingSearchRequestor();
- SearchPattern pattern = new XMLComponentReferencePattern(file, elementQName, typeQName);
-
- searchEngine.search(pattern, requestor, scope, map, 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.getString("RenameComponentRefactoring_checking")); //$NON-NLS-1$
- status.merge(checkNewElementName(getNewElementName()));
- monitor.worked(1);
- monitor.setTaskName(RefactoringMessages.getString("RenameComponentRefactoring_searching")); //$NON-NLS-1$
- 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.getString("RenameComponentRefactoring_another_name")); //$NON-NLS-1$
- 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();
- // only one declaration gets updated
- addDeclarationUpdate(manager);
- if (getUpdateReferences()) {
- 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.getString("RenameComponentRefactoring_searching"), 1); //$NON-NLS-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();
-// 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
deleted file mode 100644
index e817083664..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/rename/RenameResourceProcessor.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 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.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
deleted file mode 100644
index 4cd3c85c65..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/rename/RenameTargetNamespaceProcessor.java
+++ /dev/null
@@ -1,419 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 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.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
deleted file mode 100644
index e213e2af3b..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/rename/ResourceRenameChange.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 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 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 {
- 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
deleted file mode 100644
index ec2bf8e350..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/rename/ResourceRenameParticipant.java
+++ /dev/null
@@ -1,296 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 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.List;
-
-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.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
deleted file mode 100644
index d140a8c9e5..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/rename/SortingSearchRequestor.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * 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
deleted file mode 100644
index 4aba3206ff..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/rename/XMLComponentRenameParticipant.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*******************************************************************************
- * 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 {
- 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");
- 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
deleted file mode 100644
index 3d169fdd79..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/rename/XSDComponentRenameParticipant.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * 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
deleted file mode 100644
index a39ebafae5..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/structure/AbstractCommand.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * 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.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
deleted file mode 100644
index d9fc1b022c..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/structure/MakeAnonymousTypeGlobalCommand.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
- * 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.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
deleted file mode 100644
index d7eb8a7177..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/structure/MakeLocalElementGlobalCommand.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, 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.emf.common.util.EList;
-import org.eclipse.wst.xsd.ui.internal.common.util.XSDCommonUIUtils;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDElementDeclaration;
-import org.eclipse.xsd.XSDModelGroup;
-import org.eclipse.xsd.XSDSchema;
-
-
-public final class MakeLocalElementGlobalCommand extends AbstractCommand
-{
- public MakeLocalElementGlobalCommand(XSDConcreteComponent element)
- {
- super(element.getContainer());
- setModelObject(element);
- }
-
- public void run()
- {
- if (getModelObject() instanceof XSDElementDeclaration)
- {
-
- XSDElementDeclaration localElementDeclaration = (XSDElementDeclaration)getModelObject();
- XSDConcreteComponent parent = getParent();
- XSDConcreteComponent container = parent.getContainer();
-
- // Clone the local element with its content and set it global
-
- XSDElementDeclaration globalElementDeclaration = (XSDElementDeclaration)localElementDeclaration.cloneConcreteComponent(true, false);
-
- // The schema may already have a global element declaration with this name. In that case, ensure the name of the newly created
- // element does not collide with an existing one.
-
- XSDSchema schema = container.getSchema();
- String localElementName = localElementDeclaration.getName();
- XSDElementDeclaration existingGlobalElement = schema.resolveElementDeclaration(localElementName);
- boolean elementExists = existingGlobalElement != null && existingGlobalElement.getSchema() != null;
- if (elementExists)
- {
- String newElementName = XSDCommonUIUtils.createUniqueElementName(localElementName, schema.getElementDeclarations());
- globalElementDeclaration.setName(newElementName);
- }
-
- EList schemaContents = schema.getContents();
- schemaContents.add(globalElementDeclaration);
-
- // Modify the local element to become a reference to the global element.
-
- localElementDeclaration.setName(null);
- localElementDeclaration.setTypeDefinition(null);
- localElementDeclaration.setAnonymousTypeDefinition(null);
- localElementDeclaration.setResolvedElementDeclaration(globalElementDeclaration);
- XSDModelGroup modelGroup = (XSDModelGroup)container;
-
- // Format the markup.
-
- formatChild(modelGroup.getElement());
- formatChild(globalElementDeclaration.getElement());
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.xsd.ui.internal.commands.AbstractCommand#adopt(org.eclipse.xsd.XSDConcreteComponent)
- */
- protected boolean adopt(XSDConcreteComponent model)
- {
- return true;
- }
-} \ No newline at end of file
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
deleted file mode 100644
index 23b1d23b88..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/structure/MakeTypeGlobalChange.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 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.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
deleted file mode 100644
index 0b793f3716..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/structure/MakeTypeGlobalProcessor.java
+++ /dev/null
@@ -1,220 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 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.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
deleted file mode 100644
index 04a75e8ada..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/util/TextChangeCompatibility.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * 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
deleted file mode 100644
index 7318d093ef..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/RefactorActionGroup.java
+++ /dev/null
@@ -1,215 +0,0 @@
-/*******************************************************************************
- * 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.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) {
- 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
deleted file mode 100644
index 29c56783ab..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/RefactorGroupActionDelegate.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*******************************************************************************
- * 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
deleted file mode 100644
index 77780e100f..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/RefactorGroupSubMenu.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * 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
deleted file mode 100644
index 6bac54b55e..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/RefactoringWizardMessages.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * 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.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);
- }
-}
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
deleted file mode 100644
index 10bf304d09..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/RenameInputWizardPage.java
+++ /dev/null
@@ -1,257 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 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.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.ui.PlatformUI;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorCSHelpIds;
-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());
- }
- });
- PlatformUI.getWorkbench().getHelpSystem().setHelp(fTextField, XSDEditorCSHelpIds.RENAME_NEW_NAME);
- 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);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(text, XSDEditorCSHelpIds.RENAME_NEW_NAME);
-
- 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);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(fUpdateReferences, XSDEditorCSHelpIds.RENAME_UPDATE_REFERENCES);
- 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
deleted file mode 100644
index e24977b91d..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/RenameRefactoringWizard.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 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.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
deleted file mode 100644
index f10fccce6a..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-refactor/org/eclipse/wst/xsd/ui/internal/refactor/wizard/messages.properties
+++ /dev/null
@@ -1,55 +0,0 @@
-###############################################################################
-# Copyright (c) 2001, 2010 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.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
deleted file mode 100644
index 5c465b3ce0..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/IXSDSearchConstants.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * 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/SearchMessages.java b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/SearchMessages.java
deleted file mode 100644
index a7077a8ff2..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/SearchMessages.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 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.osgi.util.NLS;
-
-public final class SearchMessages extends NLS {
-
- private static final String BUNDLE_NAME= "org.eclipse.wst.common.ui.internal.search.SearchMessages";//$NON-NLS-1$
-
- private SearchMessages() {
- // Do not instantiate
- }
-
- public static String group_references;
- public static String Search_FindDeclarationAction_label;
- public static String Search_FindDeclarationsInProjectAction_label;
- public static String Search_FindDeclarationsInWorkingSetAction_label;
-
- static {
- NLS.initializeMessages(BUNDLE_NAME, SearchMessages.class);
- }
-}
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
deleted file mode 100644
index f589b57552..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/XSDSearchContributor.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * 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);
-
- patterns = new ArrayList();
- patterns.add(new XMLSearchPattern( ns, XSDConstants.GROUP_ELEMENT_TAG, XSDConstants.REF_ATTRIBUTE));
- references.put(IXSDSearchConstants.GROUP_META_NAME, patterns);
-
- patterns = new ArrayList();
- patterns.add(new XMLSearchPattern( ns, XSDConstants.ATTRIBUTEGROUP_ELEMENT_TAG, XSDConstants.REF_ATTRIBUTE));
- references.put(IXSDSearchConstants.ATTRIBUTE_GROUP_META_NAME, patterns);
-
- patterns = new ArrayList();
- patterns.add(new XMLSearchPattern( ns, XSDConstants.ATTRIBUTE_ELEMENT_TAG, XSDConstants.REF_ATTRIBUTE));
- references.put(IXSDSearchConstants.ATTRIBUTE_META_NAME, patterns);
- }
-
- protected void initializeDeclarations(){
-
- declarations = new HashMap();
- String ns = IXSDSearchConstants.XMLSCHEMA_NAMESPACE;
-
- SearchPattern pattern = new XMLSearchPattern( ns, XSDConstants.SCHEMA_ELEMENT_TAG, XSDConstants.ELEMENT_ELEMENT_TAG, XSDConstants.NAME_ATTRIBUTE);
- declarations.put(IXSDSearchConstants.ELEMENT_META_NAME, pattern);
-
- pattern = new XMLSearchPattern(ns, XSDConstants.COMPLEXTYPE_ELEMENT_TAG, XSDConstants.NAME_ATTRIBUTE);
- declarations.put(IXSDSearchConstants.COMPLEX_TYPE_META_NAME, pattern);
-
- pattern = new XMLSearchPattern(ns, XSDConstants.SIMPLETYPE_ELEMENT_TAG, XSDConstants.NAME_ATTRIBUTE);
- declarations.put(IXSDSearchConstants.SIMPLE_TYPE_META_NAME, pattern);
-
- pattern = new XMLSearchPattern(ns, XSDConstants.ATTRIBUTE_ELEMENT_TAG, XSDConstants.NAME_ATTRIBUTE);
- declarations.put(IXSDSearchConstants.ATTRIBUTE_META_NAME, pattern);
-
- pattern = new XMLSearchPattern(ns, XSDConstants.ATTRIBUTEGROUP_ELEMENT_TAG, XSDConstants.NAME_ATTRIBUTE);
- declarations.put(IXSDSearchConstants.ATTRIBUTE_GROUP_META_NAME, pattern);
-
- pattern = new XMLSearchPattern(ns, XSDConstants.GROUP_ELEMENT_TAG, XSDConstants.NAME_ATTRIBUTE);
- 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
deleted file mode 100644
index 2051804c7e..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/XSDSearchParticipant.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * 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
deleted file mode 100644
index 4dfefbde7f..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/XSDSearchQuery.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * 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
deleted file mode 100644
index 1ac668fb78..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/BaseGroupActionDelegate.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*******************************************************************************
- * 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;
-
-//TODO (trung) should be in common.ui this one ??
-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()
- {
-
- }
-
- /*
- * @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
deleted file mode 100644
index e0f936af6b..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/CompositeActionGroup.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 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
- *******************************************************************************/
-// 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();
- }
- }
-}
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
deleted file mode 100644
index 05308e26c2..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/DeclarationsSearchGroup.java
+++ /dev/null
@@ -1,17 +0,0 @@
-/*******************************************************************************
- * 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
deleted file mode 100644
index ac5a175e19..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/FindAction.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * 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
-{
- protected IEditorPart editor;
-
- protected FindAction(IEditorPart editor)
- {
- this.editor = editor;
- }
-
- public void selectionChanged(SelectionChangedEvent event)
- {
- // TODO Auto-generated method stub
- }
-} \ 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/FindReferencesAction.java b/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/FindReferencesAction.java
deleted file mode 100644
index ad53351e99..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/FindReferencesAction.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*******************************************************************************
- * 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.ui.internal.editor.ISelectionMapper;
-import org.eclipse.wst.xsd.ui.internal.search.IXSDSearchConstants;
-import org.eclipse.wst.xsd.ui.internal.search.XSDSearchQuery;
-import org.eclipse.xsd.XSDAttributeDeclaration;
-import org.eclipse.xsd.XSDAttributeGroupDefinition;
-import org.eclipse.xsd.XSDComplexTypeDefinition;
-import org.eclipse.xsd.XSDElementDeclaration;
-import org.eclipse.xsd.XSDModelGroupDefinition;
-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;
- }
- else if (component instanceof XSDModelGroupDefinition)
- {
- metaName = IXSDSearchConstants.GROUP_META_NAME;
- }
- else if (component instanceof XSDAttributeGroupDefinition)
- {
- metaName = IXSDSearchConstants.ATTRIBUTE_GROUP_META_NAME;
- }
- else if (component instanceof XSDAttributeDeclaration)
- {
- metaName = IXSDSearchConstants.ATTRIBUTE_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
deleted file mode 100644
index c94f256c4d..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/FindReferencesInProjectAction.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * 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 = file.getFullPath();
- ProjectSearchScope scope = new ProjectSearchScope(fullPath);
- String scopeDescription = "Project";
- 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
deleted file mode 100644
index 4c710efa17..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/FindReferencesInWorkingSetAction.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * 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.ui.internal.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 = "Working Set";
- 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
deleted file mode 100644
index 0efc8ff10a..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/ImplementorsSearchGroup.java
+++ /dev/null
@@ -1,17 +0,0 @@
-/*******************************************************************************
- * 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
deleted file mode 100644
index 463e241e49..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/OccurrencesSearchGroup.java
+++ /dev/null
@@ -1,17 +0,0 @@
-/*******************************************************************************
- * 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
deleted file mode 100644
index d6984b3a05..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/ReferencesSearchGroup.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*******************************************************************************
- * 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.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.wst.xsd.ui.internal.search.SearchMessages;
-
-public class ReferencesSearchGroup extends SearchGroup {
- protected static final String MENU_TEXT= SearchMessages.group_references;
-
- protected IEditorPart fEditor;
- private IWorkbenchSite fSite;
- private IActionBars fActionBars;
-
-// private String fGroupId;
-
- protected FindAction fFindReferencesAction;
- protected FindAction fFindReferencesInProjectAction;
- protected FindAction 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();
-
- initialize();
- }
-
- protected void initialize() {
-// fGroupId= ITextEditorActionConstants.GROUP_FIND;
-
- fFindReferencesAction= new FindReferencesAction(fEditor);
- fFindReferencesAction.setText(SearchMessages.Search_FindDeclarationAction_label);
- fFindReferencesAction.setActionDefinitionId("SEARCH_REFERENCES_IN_WORKSPACE");
- //fEditor.setAction("SearchReferencesInWorkspace", fFindReferencesAction); //$NON-NLS-1$
-
- fFindReferencesInProjectAction= new FindReferencesInProjectAction(fEditor);
- fFindReferencesInProjectAction.setText(SearchMessages.Search_FindDeclarationsInProjectAction_label);
- fFindReferencesInProjectAction.setActionDefinitionId("SEARCH_REFERENCES_IN_PROJECT");
- //fEditor.setAction("SearchReferencesInProject", fFindReferencesInProjectAction); //$NON-NLS-1$
-
- fFindReferencesInWorkingSetAction= new FindReferencesInWorkingSetAction(fEditor);
- fFindReferencesInWorkingSetAction.setText(SearchMessages.Search_FindDeclarationsInWorkingSetAction_label);
- 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
deleted file mode 100644
index 18071ba221..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/SearchGroup.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*******************************************************************************
- * 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
deleted file mode 100644
index ec6846db85..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/XSDSearchActionGroup.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * 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
deleted file mode 100644
index 91c55c61d1..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/XSDSearchDeclarationsGroupActionDelegate.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * 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
deleted file mode 100644
index 5ec359fb81..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/XSDSearchGroupSubMenu.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * 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;
-
-// TODO should be in common.ui
-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") //TODO wrong string here ??
- {
- // 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
deleted file mode 100644
index be947bc397..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-search/org/eclipse/wst/xsd/ui/internal/search/actions/XSDSearchReferencesGroupActionDelegate.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * 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;
-import org.eclipse.ui.IWorkbenchPartSite;
-
-//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 != null)
- {
- IWorkbenchPartSite site = workbenchPart.getSite();
- if (site == null)
- return;
-
- IEditorPart editor = site.getPage().getActiveEditor();
- if ( editor != null ){
- ReferencesSearchGroup referencesGroup = new ReferencesSearchGroup(editor);
- XSDSearchGroupSubMenu subMenu = new XSDSearchGroupSubMenu(referencesGroup);
- subMenu.fill(menu, -1);
- }
- }
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
-}

Back to the top