Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal')
-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.java197
-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.java155
-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
208 files changed, 0 insertions, 27751 deletions
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 69f7b79e9d..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/layouts/ModelGroupLayout.java
+++ /dev/null
@@ -1,197 +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.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();
-
- int rx = 0;
- Dimension dimension = new Dimension();
-
- for (int i = 0; i < children.size(); i++)
- {
- IFigure child = (IFigure) children.get(i);
- Dimension childSize = child.getPreferredSize();
- if (isHorizontal)
- {
- dimension.height = Math.max(dimension.height, childSize.height);
- rx += childSize.width;
- }
- else
- {
- dimension.width = Math.max(dimension.width, childSize.width);
- }
- }
-
- if (isHorizontal)
- {
- dimension.height += border * 2;
- dimension.width += border;
- }
- else
- {
- dimension.width += border * 2;
- dimension.height += border;
- }
-
- Rectangle r = container.getClientArea();
- dimension = new Dimension(r.width, r.height);
- Point p = new Point(0, 0);
-
- for (Iterator i = children.iterator(); i.hasNext();)
- {
- IFigure child = (IFigure) i.next();
- Dimension childSize = child.getPreferredSize();
-
- if (isHorizontal)
- {
- Rectangle rectangle = new Rectangle(p.x, 0, childSize.width, childSize.height);
-
- // last child
- if (!i.hasNext())
- {
- rectangle.width = dimension.width - rectangle.x;
- }
-
- if (p.x == 0)
- {
- rectangle.y = r.height / 2 - childSize.height / 2;
- }
- else
- {
- rectangle.y = r.height / 2 - childSize.height / 2;
- }
-
- rectangle.translate(container.getClientArea().getLocation());
- child.setBounds(rectangle);
- p.x += childSize.width;
- p.x += spacing;
-
- }
- else
- {
- Rectangle rectangle = new Rectangle(0, p.y, childSize.width, childSize.height);
-
- if (child instanceof SpacingFigure)
- {
- rectangle.x = dimension.width + 6;
- }
- else if (child instanceof ModelGroupFigure)
- {
- rectangle.width = dimension.width - rectangle.x;
- }
- else
- {
- rectangle.width = dimension.width - rectangle.x;
- }
-
- rectangle.translate(container.getClientArea().getLocation());
- child.setBounds(rectangle);
- p.y += childSize.height;
- p.y += spacing;
- }
- }
- }
-
- public void setSpacing(int spacing)
- {
- this.spacing = spacing;
- }
-
- protected int alignFigure(IFigure parent, IFigure child)
- {
- return -1;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/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 0035915908..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDTabbedPropertySheetPage.java
+++ /dev/null
@@ -1,155 +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
- * 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.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 = ((StructuredSelection)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 b37841030e..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, 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 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().getString(XSDEditorPlugin.CONST_DEFAULT_TARGET_NAMESPACE));
- }
-
- /**
- * Initializes states of the controls from the preference store.
- */
- private void initializeValues()
- {
- IPreferenceStore store = getPreferenceStore();
- schemaNsPrefixField.setText(store.getString(XSDEditorPlugin.CONST_XSD_DEFAULT_PREFIX_TEXT));
- qualifyXSDLanguage.setSelection(store.getBoolean(XSDEditorPlugin.CONST_XSD_LANGUAGE_QUALIFY));
- defaultTargetNamespaceText.setText(store.getString(XSDEditorPlugin.CONST_DEFAULT_TARGET_NAMESPACE));
- }
-
- /**
- * Stores the values of the controls back to the preference store.
- */
- private void storeValues()
- {
- IPreferenceStore store = getPreferenceStore();
-
- store.setValue(XSDEditorPlugin.CONST_XSD_DEFAULT_PREFIX_TEXT, getXMLSchemaPrefix());
- store.setValue(XSDEditorPlugin.CONST_XSD_LANGUAGE_QUALIFY, getQualify());
- store.setValue(XSDEditorPlugin.CONST_DEFAULT_TARGET_NAMESPACE, getXMLSchemaTargetNamespace());
-
- XSDEditorPlugin.getPlugin().savePluginPreferences();
- }
-
- public String getXMLSchemaPrefix()
- {
- String prefix = schemaNsPrefixField.getText();
- if (prefix == null || prefix.equals(""))
- {
- return "xsd";
- }
- return prefix;
- }
-
- public boolean getQualify()
- {
- return qualifyXSDLanguage.getSelection();
- }
-
- /**
- * Get the xml schema default target namespace
- */
- public String getXMLSchemaTargetNamespace()
- {
- String targetNamespace = defaultTargetNamespaceText.getText();
- if (targetNamespace == null || targetNamespace.equals(""))
- {
- return XSDEditorPlugin.DEFAULT_TARGET_NAMESPACE;
- }
- return targetNamespace;
- }
-
- public boolean checkValues()
- {
-// KCPort TODO String errorMessage = ValidateHelper.checkXMLName(schemaNsPrefixField.getText());
- String errorMessage = null;
-
- if (errorMessage == null || errorMessage.length() == 0)
- {
- setErrorMessage(null);
- setValid(true);
- return true;
- }
- else
- {
- setErrorMessage(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();
- }
- }
-}

Back to the top