Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'tests/org.eclipse.wst.wsdl.tests.performance/data/1000WSDLsNoDepends/sample625.wsdl')
-rw-r--r--tests/org.eclipse.wst.wsdl.tests.performance/data/1000WSDLsNoDepends/sample625.wsdl36
1 files changed, 0 insertions, 36 deletions
diff --git a/tests/org.eclipse.wst.wsdl.tests.performance/data/1000WSDLsNoDepends/sample625.wsdl b/tests/org.eclipse.wst.wsdl.tests.performance/data/1000WSDLsNoDepends/sample625.wsdl
deleted file mode 100644
index fd8490dcb..000000000
--- a/tests/org.eclipse.wst.wsdl.tests.performance/data/1000WSDLsNoDepends/sample625.wsdl
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<wsdl:definitions name="sample" targetNamespace="http://www.example.org/sample625" xmlns:tns="http://www.example.org/sample625" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
-<wsdl:types>
-<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/sample625">
-<xsd:element name="NewOperationResponse" type="xsd:string"/><xsd:element name="NewOperationRequest" type="xsd:string"/></xsd:schema>
-</wsdl:types>
-<wsdl:message name="NewOperationResponse">
-<wsdl:part name="NewOperationResponse" element="tns:NewOperationResponse"/>
-</wsdl:message>
-<wsdl:message name="NewOperationRequest">
-<wsdl:part name="NewOperationRequest" element="tns:NewOperationRequest"/>
-</wsdl:message>
-<wsdl:portType name="sample">
-<wsdl:operation name="NewOperation">
-<wsdl:input message="tns:NewOperationRequest"/>
-<wsdl:output message="tns:NewOperationResponse"/>
-</wsdl:operation>
-</wsdl:portType>
-<wsdl:binding name="sampleSOAP" type="tns:sample">
-<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
-<wsdl:operation name="NewOperation">
-<soap:operation soapAction="http://www.example.org/sample/NewOperation"/>
-<wsdl:input>
-<soap:body use="literal" parts=" NewOperationRequest"/>
-</wsdl:input>
-<wsdl:output>
-<soap:body use="literal" parts=" NewOperationResponse"/>
-</wsdl:output>
-</wsdl:operation>
-</wsdl:binding>
-<wsdl:service name="sample">
-<wsdl:port name="sampleSOAP" binding="tns:sampleSOAP">
-<soap:address location="http://www.example.org/"/>
-</wsdl:port>
-</wsdl:service>
-</wsdl:definitions> \ No newline at end of file

Back to the top

sourceediting.git/diff/bundles/org.eclipse.wst.xsd.ui/icons/ovr16/attributeoverlay.gif?h=v20050124_2315'>bundles/org.eclipse.wst.xsd.ui/icons/ovr16/attributeoverlay.gifbin117 -> 0 bytes-rw-r--r--bundles/org.eclipse.wst.xsd.ui/icons/ovr16/textoverlay.gifbin167 -> 0 bytes-rw-r--r--bundles/org.eclipse.wst.xsd.ui/plugin.properties1047
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/plugin.xml205
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/AbstractXSDDataTypeValueExtension.java195
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/AbstractXSDModelQueryContributor.java79
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDActionBarContributor.java183
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDContentOutlinePage.java378
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDEditor.java1148
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDEditorAdapter.java27
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDEditorContextIds.java460
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDEditorPlugin.java353
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDMenuListener.java2052
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDMultiPageEditorPart.java726
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDSelectionManager.java96
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDTextEditor.java405
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDURIConverter.java87
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/AbstractAction.java68
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/AddAttributeAction.java40
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/AddEnumsAction.java92
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/AddModelGroupAction.java57
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/AddSchemaNodeAction.java61
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/BackAction.java90
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/CreateAnnotationAction.java55
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/CreateAttributeAndRequired.java115
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/CreateElementAction.java365
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/CreateGroupAction.java76
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/CreateIdentityConstraintsAction.java74
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/CreateLocalComplexTypeAction.java68
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/CreateLocalSimpleTypeAction.java85
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/CreateSimpleContentAction.java162
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/CreateSimpleTypeAction.java68
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/DOMAttribute.java76
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/DeleteAction.java237
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/GraphRenameAction.java23
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/ISchemaEditorActionConstants.java20
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/MakeAnonymousGlobal.java66
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/ModelMessage.java36
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/MoveAction.java182
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/OpenSchemaAction.java64
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/ReloadDependenciesAction.java58
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/SetBaseTypeAction.java384
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/XSDEditNamespacesAction.java221
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/commands/AbstractCommand.java71
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/commands/AddAttributeDeclarationCommand.java141
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/commands/AddComplexTypeDefinitionCommand.java53
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/commands/AddElementDeclarationCommand.java53
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/commands/AddModelGroupCommand.java103
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/commands/AddSimpleTypeDefinitionCommand.java56
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/commands/RenameCommand.java66
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/dialogs/types/ImportTypesDialog.java276
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/dialogs/types/LoadAvaliableItems.java25
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/dialogs/types/NewComponentDialog.java187
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/dialogs/types/NewTypeDialog.java125
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/dialogs/types/SetTypeDialog.java354
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/dialogs/types/SetTypeTreeView.java237
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/dialogs/types/TypesDialogTreeObject.java197
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/dialogs/types/XSDSetTypeDialog.java679
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/dnd/BaseDragNodesCommand.java102
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/dnd/DragNodesCommand.java77
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/dnd/XSDDragAndDropManager.java61
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/gef/util/editparts/AbstractComponentViewerRootEditPart.java63
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/gef/util/figures/ConnectedEditPartFigure.java138
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/gef/util/figures/ConnectionRenderingFigure.java215
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/gef/util/figures/ContainerFigure.java60
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/gef/util/figures/ContainerLayout.java218
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/gef/util/figures/FillLayout.java162
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/gef/util/figures/IConnectedEditPartFigure.java30
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/gef/util/figures/IConnectedFigure.java18
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/gef/util/figures/IConnectionRenderingViewer.java16
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/gef/util/figures/IExpandable.java19
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/gef/util/figures/SpacingFigure.java27
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/BaseGraphicalViewer.java198
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/FigureCanvasKeyboardHandler.java125
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/GraphContextMenuProvider.java58
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/GraphicsConstants.java36
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/LinkedGraphViewer.java163
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/PrintGraphAction.java84
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/XSDChildUtility.java285
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/XSDComponentViewer.java105
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/XSDGraphUtil.java35
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/XSDGraphViewer.java598
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/XSDGraphicalViewerKeyHandler.java352
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/XSDInheritanceViewer.java98
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/XSDSubstitutionGroupChildUtility.java46
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/XSDSubstitutionGroupsViewer.java99
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/BaseEditPart.java86
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/CategoryEditPart.java187
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/ComplexTypeDefinitionEditPart.java215
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/ComplexTypeInheritedContentEditPart.java150
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/ComponentViewerRootEditPart.java76
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/ElementDeclarationEditPart.java425
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/ExpandableGraphNodeEditPart.java189
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/GraphNodeEditPart.java144
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/IFeedbackHandler.java17
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/MessageEditPart.java38
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/ModelGroupDefinitionEditPart.java204
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/ModelGroupEditPart.java187
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/RepeatableGraphNodeEditPart.java72
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/RootComplexTypeDefinitionEditPart.java121
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/RootModelGroupDefinitionEditPart.java105
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/SchemaDirectiveEditPart.java60
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/SchemaEditPart.java207
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/SimpleTypeDefinitionEditPart.java103
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/SubstitutionGroupViewerRootEditPart.java76
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/TopLevelComponentEditPart.java316
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/TypeEditPart.java72
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/WildcardEditPart.java85
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/XSDEditPartFactory.java102
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editpolicies/ComboBoxCellEditorManager.java205
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editpolicies/ComponentNameDirectEditManager.java104
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editpolicies/DirectEditPolicyDelegate.java18
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editpolicies/DragAndDropCommand.java154
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editpolicies/DragAndDropEditPolicy.java47
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editpolicies/GraphNodeDragTracker.java34
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editpolicies/SelectionHandlesEditPolicyImpl.java257
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editpolicies/SimpleDirectEditPolicy.java58
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editpolicies/TextCellEditorManager.java74
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editpolicies/TypeReferenceDirectEditManager.java118
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/BogusLayout.java61
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/CenterLayout.java118
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/CenteredIconFigure.java39
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/ConnectionFigure.java210
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/ContainerFigure.java71
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/ContainerLayout.java249
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/ExpandableGraphNodeFigure.java133
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/FillLayout.java161
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/FloatableFigure.java29
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/GraphNodeContainerFigure.java29
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/GraphNodeFigure.java184
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/Interactor.java54
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/LabelFigure.java88
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/PostLayoutManager.java19
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/RepeatableGraphNodeFigure.java85
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/RoundedLineBorder.java67
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/model/Category.java266
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/model/ModelAdapter.java27
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/model/ModelAdapterListener.java18
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/model/XSDModelAdapterFactory.java511
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/GenerateDtd.gifbin605 -> 0 bytes-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/GenerateJava.gifbin609 -> 0 bytes-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/GraphViewElementRef.gifbin860 -> 0 bytes-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/NewXSD.gifbin3261 -> 0 bytes-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/RegexWizardArrow.gifbin54 -> 0 bytes-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/ValidateXSD.gifbin558 -> 0 bytes-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDAll.gifbin88 -> 0 bytes-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDAnnotate.gifbin594 -> 0 bytes-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDAny.gifbin613 -> 0 bytes-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDAnyAttribute.gifbin384 -> 0 bytes-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDAppInfo.gifbin121 -> 0 bytes-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDAttribute.gifbin167 -> 0 bytes-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDAttributeGroup.gifbin235 -> 0 bytes-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDAttributeGroupRef.gifbin361 -> 0 bytes-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDAttributeRef.gifbin350 -> 0 bytes-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDChoice.gifbin145 -> 0 bytes-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDComplexContent.gifbin211 -> 0 bytes-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDComplexType.gifbin155 -> 0 bytes-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDDoc.gifbin368 -> 0 bytes-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDElement.gifbin351 -> 0 bytes-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDElementRef.gifbin585 -> 0 bytes-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDExtension.gifbin101 -> 0 bytes-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDField.gifbin227 -> 0 bytes-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDFile.gifbin361 -> 0 bytes-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDGlobalAttribute.gifbin167 -> 0 bytes-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDGlobalElement.gifbin351 -> 0 bytes-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDGroup.gifbin205 -> 0 bytes-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDGroupRef.gifbin347 -> 0 bytes-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDImport.gifbin114 -> 0 bytes-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDInclude.gifbin324 -> 0 bytes-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDKey.gifbin323 -> 0 bytes-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDKeyRef.gifbin558 -> 0 bytes-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDNotation.gifbin177 -> 0 bytes-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDRedefine.gifbin373 -> 0 bytes-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDSelector.gifbin136 -> 0 bytes-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDSequence.gifbin91 -> 0 bytes-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDSimpleContent.gifbin210 -> 0 bytes-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDSimpleEnum.gifbin105 -> 0 bytes-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDSimpleList.gifbin347 -> 0 bytes-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDSimplePattern.gifbin120 -> 0 bytes-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDSimpleRestrict.gifbin141 -> 0 bytes-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDSimpleType.gifbin150 -> 0 bytes-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDSimpleUnion.gifbin138 -> 0 bytes-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDUnique.gifbin210 -> 0 bytes-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/back.gifbin873 -> 0 bytes-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/browsebutton.gifbin825 -> 0 bytes-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/forward.gifbin874 -> 0 bytes-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/generate_xml.gifbin612 -> 0 bytes-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/regx_wiz.gifbin3241 -> 0 bytes-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/reloadgrammar.gifbin365 -> 0 bytes-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/sort.gifbin159 -> 0 bytes-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/preferences/XSDPreferencePage.java256
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/AnyAttributePropertySource.java173
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/AnyContentPropertyDescriptor.java155
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/AnyElementPropertySource.java228
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/AppInfoPropertySource.java216
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/AttributeGroupRefPropertySource.java172
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/AttributePropertySource.java294
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/AttributesTable.java331
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/BasePropertySource.java126
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/ComplexTypePropertySource.java380
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/DocumentationPropertySource.java243
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/DynamicCellEditor.java1174
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/ElementPropertySource.java546
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/EnumerationPropertySource.java131
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/FixedOrDefaultTextPropertyDescriptor.java307
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/GroupRefPropertySource.java229
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/ImportPropertySource.java335
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/IncludePropertySource.java238
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/KeyrefPropertySource.java210
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/ModelGroupPropertySource.java266
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/NamePropertySource.java219
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/NotationPropertySource.java186
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/OptionsTextCellEditor.java241
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/PatternPropertySource.java272
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/ReadOnlyPropertySource.java76
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/SchemaDirectiveHelperPropertySource.java191
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/SchemaPropertySource.java530
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/SimpleContentPropertyDescriptor.java209
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/SimpleContentPropertySource.java230
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/SimpleRestrictPropertySource.java362
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/SimpleTypeListPropertySource.java143
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/SimpleTypePropertySource.java183
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/SimpleTypeUnionPropertySource.java494
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/TypesPropertyDescriptor.java1160
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/XPathPropertySource.java150
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/XSDComboBoxPropertyDescriptor.java304
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/XSDPropertySheetPage.java119
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/XSDPropertySourceProvider.java285
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/section/AbstractSection.java495
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/section/AbstractSectionDescriptor.java108
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/section/AnnotationSection.java595
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/section/AnnotationSectionDescriptor.java109
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/section/AttributesViewContentProvider.java289
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/section/AttributesViewSection.java460
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/section/AttributesViewSectionDescriptor.java101
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/section/ComplexTypeSection.java222
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/section/ComplexTypeSectionDescriptor.java82
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/section/EnumerationsSection.java434
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/section/EnumerationsSectionDescriptor.java87
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/section/FacetViewer.java498
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/section/FacetsSection.java802
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/section/FacetsSectionDescriptor.java87
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/section/MinMaxSection.java286
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/section/MinMaxSectionDescriptor.java145
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/section/ModelGroupSection.java144
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/section/ModelGroupSectionDescriptor.java102
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/section/NameSection.java444
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/section/NameSectionDescriptor.java169
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/section/NamespaceAndSchemaLocationDescriptor.java87
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/section/NamespaceAndSchemaLocationSection.java345
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/section/NamespaceProcessContentsSection.java196
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/section/NamespaceProcessContentsSectionDescriptor.java84
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/section/NamespaceSection.java432
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/section/NamespaceSectionDescriptor.java86
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/section/OtherAttributesSection.java125
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/section/OtherAttributesSectionDescriptor.java145
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/section/PatternSection.java165
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/section/PatternSectionDescriptor.java85
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/section/ReferenceSection.java290
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/section/ReferenceSectionDescriptor.java174
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/section/SchemaLocationDescriptor.java88
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/section/SchemaLocationSection.java183
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/section/SimpleContentBaseTypeOptionsDialog.java158
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/section/SimpleContentUnionMemberTypesDialog.java314
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/section/SimpleTypeSection.java541
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/section/SimpleTypeSectionDescriptor.java91
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/section/SimpleTypeUnionSection.java185
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/section/SimpleTypeUnionSectionDescriptor.java87
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/section/TextChangeHelper.java102
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/section/TypesDialog.java726
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/section/TypesSection.java326
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/section/TypesSectionDescriptor.java134
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/section/ValueSection.java118
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/section/ValueSectionDescriptor.java82
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/section/XSDSectionDescriptorProvider.java57
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/section/XSDSectionLabelProvider.java169
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/section/XSDTabbedPropertySheetPage.java140
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/section/XSDWorkbook.java97
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/section/XSDWorkbookPage.java51
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/provider/CategoryAdapter.java168
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/provider/XSDAbstractAdapter.java165
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/provider/XSDAdapterFactoryLabelProvider.java160
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/provider/XSDAnnotationAdapter.java83
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/provider/XSDAttributeDeclarationAdapter.java113
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/provider/XSDAttributeGroupDefinitionAdapter.java100
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/provider/XSDAttributeUseAdapter.java90
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/provider/XSDComplexTypeDefinitionAdapter.java182
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/provider/XSDContentProvider.java305
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/provider/XSDElementDeclarationAdapter.java193
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/provider/XSDModelAdapterFactoryImpl.java422
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/provider/XSDModelGroupAdapter.java141
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/provider/XSDModelGroupDefinitionAdapter.java96
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/provider/XSDNotationDeclarationAdapter.java44
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/provider/XSDParticleAdapter.java61
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/provider/XSDSchemaAdapter.java405
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/provider/XSDSchemaDirectiveAdapter.java102
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/provider/XSDSimpleTypeDefinitionAdapter.java193
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/provider/XSDWildcardAdapter.java112
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/refactor/XSDVisitor.java217
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/refactor/delete/BaseCleanup.java107
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/refactor/delete/BaseGlobalCleanup.java29
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/refactor/delete/GlobalAttributeCleanup.java106
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/refactor/delete/GlobalAttributeGroupCleanup.java102
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/refactor/delete/GlobalElementCleanup.java84
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/refactor/delete/GlobalGroupCleanup.java84
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/refactor/delete/GlobalSimpleOrComplexTypeCleanup.java152
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/refactor/delete/XSDExternalFileCleanup.java299
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/refactor/rename/BaseRenamer.java61
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/refactor/rename/GlobalAttributeGroupRenamer.java57
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/refactor/rename/GlobalAttributeRenamer.java66
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/refactor/rename/GlobalElementRenamer.java41
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/refactor/rename/GlobalGroupRenamer.java43
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/refactor/rename/GlobalSimpleOrComplexTypeRenamer.java91
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/refactor/rename/SchemaPrefixChangeHandler.java212
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/refactor/rename/TargetNamespaceChangeHandler.java154
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/util/OpenOnSelectionHelper.java322
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/util/SelectionAdapter.java83
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/util/TypesHelper.java815
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/util/ViewUtility.java429
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/util/XSDDOMHelper.java1103
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/util/XSDSchemaHelper.java72
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/widgets/EnumerationsDialog.java106
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/widgets/SetBaseTypeDialog.java180
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/widgets/TypeSection.java340
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/widgets/XSDEditSchemaInfoDialog.java84
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/wizards/NewXSDWizard.java168
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/wizards/RegexCompositionPage.java965
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/wizards/RegexNode.java421
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/wizards/RegexTestingPage.java161
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/wizards/RegexWizard.java65
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/wizards/XSDLocationChoicePage.java71
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/wizards/XSDNewFilePage.java130
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/wizards/XSDSelectIncludeFileWizard.java371
351 files changed, 0 insertions, 57086 deletions
diff --git a/bundles/org.eclipse.wst.xsd.ui/.classpath b/bundles/org.eclipse.wst.xsd.ui/.classpath
deleted file mode 100644
index 275b34c699..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src/"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/bundles/org.eclipse.wst.xsd.ui/.cvsignore b/bundles/org.eclipse.wst.xsd.ui/.cvsignore
deleted file mode 100644
index 7ba51e6360..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/.cvsignore
+++ /dev/null
@@ -1,5 +0,0 @@
-bin
-xsdeditor.jar
-build.xml
-temp.folder
-org.eclipse.wst.xsd.ui_1.0.0.jar
diff --git a/bundles/org.eclipse.wst.xsd.ui/.project b/bundles/org.eclipse.wst.xsd.ui/.project
deleted file mode 100644
index aab3824094..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.wst.xsd.ui</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
diff --git a/bundles/org.eclipse.wst.xsd.ui/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.wst.xsd.ui/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index efba9c05d4..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,69 +0,0 @@
-#Fri Dec 10 00:29:03 EST 2004
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=error
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
-org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
-org.eclipse.jdt.core.compiler.problem.unsafeTypeOperation=error
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
-org.eclipse.jdt.core.compiler.problem.unusedImport=error
-org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
-org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
-org.eclipse.jdt.core.builder.invalidClasspath=abort
-org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
-org.eclipse.jdt.core.compiler.problem.unusedLocal=ignore
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.problem.deprecation=warning
-org.eclipse.jdt.core.compiler.source=1.3
-org.eclipse.jdt.core.compiler.problem.finalParameterBound=error
-org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
-org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
-org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
-org.eclipse.jdt.core.builder.cleanOutputFolder=clean
-org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
-org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
-org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
-org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
-org.eclipse.jdt.core.incompatibleJDKLevel=ignore
-eclipse.preferences.version=1
-org.eclipse.jdt.core.circularClasspath=error
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled
-org.eclipse.jdt.core.compiler.maxProblemPerUnit=100
-org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
-org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
-org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.doc.comment.support=enabled
-org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
-org.eclipse.jdt.core.incompleteClasspath=error
-org.eclipse.jdt.core.compiler.problem.invalidJavadoc=ignore
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.builder.duplicateResourceTask=warning
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
diff --git a/bundles/org.eclipse.wst.xsd.ui/.settings/org.eclipse.pde.prefs b/bundles/org.eclipse.wst.xsd.ui/.settings/org.eclipse.pde.prefs
deleted file mode 100644
index 179abb3822..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/.settings/org.eclipse.pde.prefs
+++ /dev/null
@@ -1,12 +0,0 @@
-#Fri Dec 10 00:50:26 EST 2004
-compilers.p.unused-element-or-attribute=0
-compilers.p.unresolved-ex-points=0
-compilers.p.unknown-element=0
-compilers.p.unknown-resource=0
-compilers.p.unknown-class=0
-compilers.p.unknown-attribute=0
-compilers.p.no-required-att=0
-eclipse.preferences.version=1
-compilers.p.unresolved-import=0
-compilers.p.illegal-att-value=0
-compilers.use-project=true
diff --git a/bundles/org.eclipse.wst.xsd.ui/build.properties b/bundles/org.eclipse.wst.xsd.ui/build.properties
deleted file mode 100644
index bb73afbbd6..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/build.properties
+++ /dev/null
@@ -1,33 +0,0 @@
-###############################################################################
-# Copyright (c) 2001, 2004 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-source.xsdeditor.jar = src/
-bin.includes = xsdeditor.jar,\
- plugin.xml,\
- icons/,\
- image/,\
- doc/,\
- plugin.properties,\
- samples/,\
- w3c/
-src.includes = w3c/,\
- samples/,\
- plugin.xml,\
- plugin.properties,\
- image/,\
- icons/,\
- doc/,\
- src/,\
- test/,\
- build.xml,\
- build.properties,\
- .project,\
- .classpath,\
- xsdeditor.jar
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/XSDFile.gif b/bundles/org.eclipse.wst.xsd.ui/icons/XSDFile.gif
deleted file mode 100644
index 3900f1b55d..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/XSDFile.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/annotationsheader.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/annotationsheader.gif
deleted file mode 100644
index 9bfb682d28..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/annotationsheader.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/attributegroupsheader.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/attributegroupsheader.gif
deleted file mode 100644
index e618a25cd9..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/attributegroupsheader.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/attributesheader.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/attributesheader.gif
deleted file mode 100644
index 9254879842..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/attributesheader.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/directivesheader.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/directivesheader.gif
deleted file mode 100644
index 6000cb80f4..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/directivesheader.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/elementsheader.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/elementsheader.gif
deleted file mode 100644
index 26f720648d..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/elementsheader.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/groupsheader.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/groupsheader.gif
deleted file mode 100644
index c9745f0f39..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/groupsheader.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/notationsheader.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/notationsheader.gif
deleted file mode 100644
index e05c6455ea..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/notationsheader.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/smpl_list_obj.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/smpl_list_obj.gif
deleted file mode 100644
index 6e2cd9355f..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/smpl_list_obj.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/smpl_restrict_obj.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/smpl_restrict_obj.gif
deleted file mode 100644
index 1ebd546c5b..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/smpl_restrict_obj.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/smpl_union_obj.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/smpl_union_obj.gif
deleted file mode 100644
index 0b01f8c04f..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/smpl_union_obj.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/typesheader.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/typesheader.gif
deleted file mode 100644
index 3267542eac..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/typesheader.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/ovr16/attributeoverlay.gif b/bundles/org.eclipse.wst.xsd.ui/icons/ovr16/attributeoverlay.gif
deleted file mode 100644
index 1931f929b2..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/ovr16/attributeoverlay.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/ovr16/textoverlay.gif b/bundles/org.eclipse.wst.xsd.ui/icons/ovr16/textoverlay.gif
deleted file mode 100644
index d455c2b53f..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/icons/ovr16/textoverlay.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/plugin.properties b/bundles/org.eclipse.wst.xsd.ui/plugin.properties
deleted file mode 100644
index 8bcb7ec0e9..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/plugin.properties
+++ /dev/null
@@ -1,1047 +0,0 @@
-###############################################################################
-# Copyright (c) 2001, 2004 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-! Properties file for component: XMSCH - XML Tools - XML Schema Editor
-! Packaged for translation in: xml.zip
-
-!
-! Plugin
-!
-_UI_PLUGIN_NAME = XML Schema Editor
-_UI_EDITOR_NAME = XML Schema Editor
-
-_UI_ACTION_EXT_GENERATE = &Generate
-_UI_ACTION_EXT_GENERATE_DDL = &DDL...
-_UI_ACTION_EXT_GENERATE_DTD = D&TD...
-_UI_ACTION_EXT_GENERATE_JAVA = &Java Beans...
-
-_UI_ACTION_EXT_GENERATE_XSD = &Generate XML Schema
-_UI_WIZARD_NAME_NEW_XSD = XML Schema
-
-_UI_XML_TOOLS_PREFERENCE_PAGE = XML
-_UI_XML_SCHEMA_PREFERENCE = XML Schema Files
-
-_UI_WIZARD_NEW_XSD = XML Schema
-_UI_CREATE_A_NEW_SCHEMA = Create a new XML schema file
-
-! New property tabs
-_UI_LABEL_GENERAL = General
-_UI_LABEL_OTHER = Other
-_UI_LABEL_ATTRIBUTES = Attributes
-_UI_LABEL_DOCUMENTATION = Documentation
-_UI_LABEL_FACETS = Facets
-_UI_LABEL_ENUMERATIONS = Enumerations
-_UI_LABEL_NAMESPACE = Namespace
-
-_UI_LABEL_READ_ONLY = read-only
-_UI_LABEL_KIND = Kind:
-_UI_LABEL_VARIETY = Variety:
-
-!
-! Schema File Window
-!
-_UI_LABEL_FILE_NAME = File name:
-_UI_LABEL_VERSION = Version:
-_UI_TOOLTIP_VERSION = Convenient attribute to store version number
-_UI_LABEL_LANGUAGE = Language:
-_UI_TOOLTIP_LANGUAGE = Represents natural language identifiers
-_UI_GROUP_NAMESPACE = Namespace
-_UI_LABEL_SCHEMA_PREFIX = Prefix:
-_UI_TOOLTIP_SCHEMA_PREFIX = The prefix associated with the current namespace.
-_UI_LABEL_TARGET_NAME_SPACE = Target namespace:
-_UI_TOOLTIP_TARGET_NAME_SPACE = The namespace for this schema.
-_UI_BUTTON_APPLY = Apply
-_UI_LABEL_ATTRIBUTE_FORM_DEFAULT = Attribute form default:
-_UI_TOOLTIP_ATTRIBUTE_FORM = Indicates if all attributes in a schema must be qualified or not in the instance document
-_UI_LABEL_ELEMENT_FORM_DEFAULT = Element form default:
-_UI_TOOLTIP_ELEMENT_FORM_DEFAULT = Indicates if all elements in a schema must be qualified or not in the instance document
-_UI_LABEL_BLOCK_DEFAULT = Block default:
-_UI_TOOLTIP_BLOCK_DEFAULT = Control derivations for every type and element in the schema
-_UI_LABEL_FINAL_DEFAULT = Final default:
-_UI_TOOLTIP_FINAL_DEFAULT = Control derivations for every type and element in the schema
-_UI_ACTION_DELETE_INCLUDE = Delete
-_UI_ACTION_DELETE_NODES = Delete Nodes
-! Note to translators: The following is the acronym for Uniform Resource Indicator
-_UI_LABEL_URI = URI:
-
-
-_UI_LABEL_ADD = Add...
-_UI_LABEL_EDIT = Edit...
-_UI_LABEL_PATTERNS = Patterns
-_ERROR_FILE_ALREADY_EXISTS = The file name already exists: {0}
-
-!
-! Any Section
-!
-! Note to translators - translate only the word and
-_UI_LABEL_NAMESPACE_AND_PROCESS_CONTENTS = namespace and processContents
-
-!
-! minOccurs and maxOccurs section
-!
-! Note to translators - translate only the word and
-_UI_LABEL_MINOCCURS_AND_MAXOCCURS = minOccurs and maxOccurs
-
-!
-! Value Information Section
-!
-_UI_LABEL_VALUE_INFORMATION = Value Information
-
-!
-! Notation window
-!
-_UI_NOTATION_NAME = Name:
-_UI_NOTATION_PUBLIC = Public:
-_UI_NOTATION_SYSTEM = System:
-_UI_TOOLTIP_PUBLIC = An optional public identifier
-_UI_TOOLTIP_SYSTEM = An optional URI reference
-
-!
-! Complex Type Window
-!
-_UI_NAME = Name:
-_UI_ABSTRACT = Abstract:
-_UI_MIXED = Mixed:
-_UI_BLOCK = Block:
-_UI_FINAL = Final:
-
-_UI_CT_TOOLTIP_MIXED = Indicates if type may contain mixed content
-_UI_CT_TOOLTIP_ABSTRACT = When a complex type is declared abstract, it cannot be used in an instance document
-_UI_CT_TOOLTIP_FINAL = You can use this to prevent further derivations
-_UI_CT_TOOLTIP_BLOCK = You can use this to block any derivations
-
-!
-! SimpleContent and ComplexContent Window
-!
-_UI_LABEL_DERIVED_BY = Derived by:
-_UI_TOOLTIP_DERIVED_BY = Derive by extension to inherit from a base type content model and add to it. Derive by restriction to restrict the content model of an existing type.
-
-!
-! Combo box items - no need to translate
-!
-_UI_COMBO_RESTRICTION = restriction
-_UI_COMBO_EXTENSION = extension
-
-!
-! Element & Element Ref Window
-!
-_UI_ELEMENT_NAME = Name:
-_UI_CHECKBOX_NILLABLE = Nillable
-_UI_CHECKBOX_ABSTRACT = Abstract
-_UI_SUBSTITUTION = Substitution group:
-_UI_MINIMUM = Minimum:
-_UI_MAXIMUM = Maximum:
-_UI_REFERENCE_NAME = Reference name:
-
-_UI_TOOLTIP_ELEMENT_MINIMUM = A non-negative integer that specifies the minimum number of times an element can occur.
-_UI_TOOLTIP_ELEMENT_MAXIMUM = A non-negative integer or unbounded if there is no upper limit on the number of times the element can occur.
-_UI_TOOLTIP_ELEMENT_ABSTRACT = When an element is declared abstract, a member of its equivalent class must appear in the instance document,
-_UI_TOOLTIP_ELEMENT_NIL = If selected, an attribute can be included in the instance document to indicate that the element has a nil value.
-_UI_TOOLTIP_ELEMENT_SUBSTITUTION = Select the element that can be substituted by this element
-_UI_TOOLTIP_ELEMENT_FORM = Indicates if the element is qualifed in the instance document
-_UI_TOOLTIP_ELEMENT_VALUE = Provides a default or fixed value for the element.
-
-
-!
-! Attribute Window
-! _UI_COMBO_BOX strings are used in code generation.
-! Probably don't need to be translated
-!
-_UI_COMBO_BOX_REQUIRED = required
-_UI_COMBO_BOX_OPTIONAL = optional
-_UI_COMBO_BOX_PROHIBITED = prohibited
-
-_UI_FIXED = Fixed
-_UI_DEFAULT = Default
-_UI_ATTRIBUTE_NAME = Attribute name:
-_UI_USAGE = Usage:
-_UI_FORM = Form qualification:
-_UI_VALUE = Value
-
-_UI_LABEL_OTHER_ATTRIBUTES = Other Attributes
-
-_UI_TOOLTIP_ATTRIBUTE_USE = Indicates if the attribute is required, optional, or prohibited
-_UI_TOOLTIP_ATTRIBUTE_FORM = Indicates if the attribute is qualifed or not in the instance document
-_UI_TOOLTIP_ATTRIBUTE_VALUE = Provides default or fixed value for the attribute. Default value only valid if Usage value is set to optional.
-
-_UI_PROCESS_CONTENTS = Process contents:
-
-!
-! Annotation - Doc & AppInfo Window
-!
-_UI_COMMENT = Comment
-_UI_TOOLTIP_COMMENT = Information useful to the user or application
-_UI_SOURCE = Source:
-_UI_TOOLTIP_SOURCE = An optional URI reference to supplement the local information
-_UI_LANGUAGE = Language:
-_UI_TOOLTIP_LANGUAGE_ANNOTATION = Indicate the language in which the annotation is expressed
-
-!
-! Group
-!
-_UI_CONTENT_MODEL = Content model
-_UI_SEQUENCE = Sequence
-_UI_CHOICE = Choice
-_UI_ALL = All
-
-
-!
-! Simple Type Related Facets - appear as entries in a table - restriction on simple type
-!
-_UI_GROUP_FACETS = Facets
-_UI_LENGTH = Length
-_UI_MINIMUM_LENGTH = Minimum Length
-_UI_MAXIMUM_LENGTH = Maximum Length
-_UI_MINIMUM_INCLUSIVE = Minimum Inclusive
-_UI_MAXIMUM_INCLUSIVE = Maximum Inclusive
-_UI_MINIMUM_EXCLUSIVE = Minimum Exclusive
-_UI_MAXIMUM_EXCLUSIVE = Maximum Exclusive
-_UI_TOTAL_DIGITS = Total Digits
-_UI_FRACTION_DIGITS = Fraction Digits
-_UI_WHITE_SPACE = White Space
-_UI_FACET_NAME = Name
-_UI_FACET_VALUE = Value
-_UI_FACET_FIXED = Fixed
-
-_UI_TOOLTIP_LENGTH = The number of units of length. Must be a non-negative integer.
-_UI_TOOLTIP_MIN_LEN = The minimum number of units of length. Must be a non-negative integer.
-_UI_TOOLTIP_MAX_LEN = The maximum number of units of length. Must be a non-negative integer.
-_UI_TOOLTIP_MAX_INCLUSIVE = The upper bound of the value space. The value is itself included.
-_UI_TOOLTIP_MAX_EXCLUSIVE = The upper bound of the value space. The value is itself excluded.
-_UI_TOOLTIP_MIN_INCLUSIVE = The lower bound of the value space. The value is itself included.
-_UI_TOOLTIP_MIN_EXCLUSIVE = The lower bound of the value space. The value is itself excluded.
-_UI_TOOLTIP_TOTAL_DIGITS = The maximum number of decimal digits. Must be a positive integer.
-_UI_TOOLTIP_FRACTION_DIGITS = The maximum number of decimal digits in the fractional part. Must be a non-negative integer.
-_UI_TOOLTIP_WHITE_SPACE = Indicates if white space should be preserved, replaced or collapsed.
-
-_UI_TOOLTIP_PATTERN = Constrains the value to match a specific pattern. The pattern must be a regular expression.
-_UI_TOOLTIP_ENUM = Constrains the value to a specified set of values.
-
-!
-! Simple/Complex Type Selection
-!
-_UI_LABEL_TYPE_INFORMATION = Type information
-_UI_LABEL_BASE_TYPE = Base type
-_UI_LABEL_BASE_TYPE_WITH_COLON = Base type:
-_UI_LABEL_SET_BASE_TYPE = Set Base Type
-_UI_ACTION_SET_BASE_TYPE = Set Base Type...
-_UI_RADIO_NONE = None
-_UI_RADIO_BUILT_IN_SIMPLE_TYPE = Built-in simple type
-_UI_RADIO_USER_DEFINED_SIMPLE_TYPE = User-defined simple type
-_UI_RADIO_USER_DEFINED_COMPLEX_TYPE = User-defined complex type
-_UI_NO_TYPE = **none**
-
-!
-! Combo-box value
-! NOTE TO TRANSLATOR: Do not translate following line
-_UI_DEFAULT_ANONYMOUS = **anonymous**
-
-!
-! Unique, Key and KeyRef window
-!
-_UI_REFERENCE_KEY = Reference key
-_UI_SELECTOR = Selector
-_UI_FIELDS = Fields
-
-_UI_TOOLTIP_SELECTOR_TEXT = Specifies an XPath expression relative to instances of the current element
-_UI_TOOLTIP_FIELD_TEXT = Specifies an XPath expression relative to each element selected by the selector
-
-_UI_ADD_BUTTON = Add>>
-_UI_REMOVE_BUTTON = <<Remove
-
-!
-! Include & Imports
-!
-_UI_LABEL_PREFIX = Prefix:
-_UI_LABEL_NAMESPACE = Namespace:
-
-_UI_SCHEMA_INCLUDE_DESC = Select a schema file so that the definitions in the schema file will be available in the current schema. The target namespace of the included schema must be the same as the target namespace of the current schema.
-_UI_LABEL_SCHEMA_IMPORT_DESC = Select a schema file from a different namespace so that its definitions can be referenced by the current schema. You must associate a prefix with the new namespace for use in the current schema.
-
-_UI_LABEL_SCHEMA_LOCATION = Schema location:
-_UI_BUTTON_SELECT = Select
-_UI_FILEDIALOG_SELECT_XML_SCHEMA = Select XML schema file
-_UI_FILEDIALOG_SELECT_XML_DESC = Select an XML schema file from the Workbench projects
-_UI_FILEDIALOG_SELECT_XML_URL = Select an XML schema file from HTTP
-
-_UI_LABEL_LOADING_XML_SCHEMA = Loading XML Schema
-_UI_LABEL_FINISH_LOADING = Finish Loading
-_UI_LABEL_NO_LOCATION_SPECIFIED = No Location Specified
-
-!
-! XSD Editor
-!
-_UI_TAB_SOURCE = Source
-_UI_TAB_DESIGN = Design
-! Note to translators: Graph is the graphic view of the XML schema
-_UI_TAB_GRAPH = Graph
-_UI_MENU_UNDO = &Undo @Ctrl+Z
-_UI_MENU_REDO = &Redo @Ctrl+Y
-
-!
-! Task List Related Message
-!
-_UI_REF_FILE_ERROR_DESCRIPTION = The errors below were detected when validating the file '{0}' via the file '{1}'. In most cases these errors can be detected by validating '{2}' directly. However it is possible that errors will only occur when {2} is validated in the context of {3}.
-_UI_REF_FILE_ERROR_PUSH_HELP = Push the help button below to read more.
-_UI_REF_FILE_ERROR_MESSAGE = Referenced file contains errors ({0}). For more information, right click on the message and select "Show Details..."
-_UI_REF_FILE_SHOW_DETAILS = Show Details...
-
-
-!
-! XSDEditor Menu bar contributor
-!
-_UI_MENU_GENERATE_JAVA = Generate &Java Beans...
-_UI_MENU_GENERATE_DTD = Generate &DTD...
-_UI_MENU_GENERATE_SAMPLE_XML = Generate XM&L...
-_UI_MENU_XSD_EDITOR = &XSD
-_UI_MENU_VALIDATE_XML = &Validate XML Schema
-_UI_MENU_VALIDATE_XML_TOOLTIP = Validate the current state of the XML Schema
-_UI_MENU_GENERATE_JAVA_TOOLTIP = Generate Java beans for the XML Schema
-_UI_MENU_GENERATE_DTD_TOOLTIP = Generate a DTD from the XML Schema
-_UI_MENU_GENERATE_SAMPLE_XML_TOOLTIP = Generate an XML from the XML Schema
-_UI_MENU_RELOAD_DEPENDENCIES_TOOLTIP = Reload Dependencies
-_UI_MENU_RELOAD_DEPENDENCIES = &Reload Dependencies
-
-!
-! Preference Page
-!
-_UI_TEXT_INDENT_LABEL = Indentation
-_UI_TEXT_INDENT_SPACES_LABEL = &Number of spaces:
-_UI_TEXT_XSD_NAMESPACE_PREFIX = XML schema language
-_UI_TEXT_XSD_DEFAULT_PREFIX = XML schema language constructs &prefix:
-_UI_QUALIFY_XSD = &Qualify XML schema language constructs
-_UI_SEPARATE_DESIGN_AND_SOURCE_VIEW = Separate Source, Design and Graph view
-_UI_COMBINED_DESIGN_AND_SOURCE_VIEW = Combined Source or Graph view with Design view
-_UI_LABEL_EDITOR_LAYOUT = Editor Layout
-_UI_PREF_DESIGN_VIEW_LAYOUT = Design View Location
-_UI_PREF_DESIGN_BOTTOM = Below
-_UI_PREF_DESIGN_RIGHT = Right
-_UI_TEXT_XSD_DEFAULT_TARGET_NAMESPACE = Default Target Namespace:
-
-!
-! Content Outline View action
-! NOTE TO TRANSLATOR: Do not translate the word(s) following "Add" on each line in
-! this section i.e. Annotation, Documentation, AppInfo These words are XML Schema keywords.
-_UI_ACTION_DELETE = D&elete
-_UI_ACTION_ADD_ANNOTATION = Add &Annotation
-_UI_ACTION_ADD_DOC = Add &Documentation
-_UI_ACTION_ADD_APP_INFO = Add A&ppInfo
-_UI_ACTION_ADD_GLOBAL_ELEMENT = Add Glob&al Element
-_UI_ACTION_ADD_KEY = Add &Key
-_UI_ACTION_ADD_KEY_REF = Add Key Re&f
-_UI_ACTION_ADD_UNIQUE = Add Uni&que
-_UI_ACTION_ADD_GROUP = Add G&roup
-_UI_ADD_GROUP_REF = Add Gr&oup Ref
-_UI_ACTION_ADD_CONTENT_MODEL = Add Content &Model
-_UI_ACTION_ADD_ELEMENT = Add &Element
-_UI_ACTION_ADD_ELEMENT_REF = Add E&lement Ref
-_UI_ACTION_ADD_SIMPLE_TYPE = Add &Simple Type
-_UI_ACTION_ADD_PATTERN = Add &Pattern
-_UI_ACTION_ADD_ENUM = Add En&umeration
-_UI_ACTION_ADD_ENUMS = Add Enu&merations...
-_UI_ACTION_ADD_COMPLEX_TYPE = Add Complex &Type
-_UI_ACTION_ADD_COMPLEX_CONTENT = Add Comple&x Content
-_UI_ACTION_ADD_SIMPLE_CONTENT = Add Simple &Content
-_UI_ACTION_ADD_ATTRIBUTE = Add Attri&bute
-_UI_ACTION_ADD_ATTRIBUTE_GROUP = Add Attr&ibute Group
-_UI_ACTION_ADD_ATTRIBUTE_GROUP_REF = Add A&ttribute Group Ref
-_UI_ACTION_ADD_INCLUDE = Add In&clude
-_UI_ACTION_ADD_IMPORT = Add &Import
-_UI_ACTION_ADD_REDEFINE = Add Re&define
-_UI_ACTION_ADD_NOTATION = Add &Notation
-_UI_ACTION_ADD_ANY_ELEMENT = Add An&y
-_UI_ACTION_ADD_ANY_ATTRIBUTE = Add &Any Attribute
-_UI_ACTION_ADD_GLOBAL_ATTRIBUTE = Add &Global Attribute
-_UI_ACTION_ADD_ATTRIBUTE_REFERENCE = Add Attrib&ute Ref
-_UI_ACTION_ADD_RESTRICTION = Add Re&striction
-_UI_ACTION_ADD_UNION = Add U&nion
-_UI_ACTION_ADD_LIST = Add &List
-_UI_ACTION_DELETE_GROUP_SCOPE = D&elete
-_UI_ACTION_ADD_CHOICE = Add &Choice
-_UI_ACTION_ADD_SEQUENCE = Add Se&quence
-_UI_ACTION_ADD_ALL = Add &All
-_UI_ACTION_ADD_EXTENSION = Add E&xtension
-_UI_ACTION_ADD_SELECTOR = Add &Selector
-_UI_ACTION_ADD_FIELD = Add &Field
-! NOTE TO TRANSLATOR: Translate Add and Node
-_UI_ACTION_ADD_SCHEMA_NODE = Add &Schema Node
-! NOTE TO TRANSLATOR: TRANSLATE Add and Local
-_UI_ACTION_ADD_LOCAL_SIMPLE_TYPE = Add Local &Simple Type
-_UI_ACTION_ADD_LOCAL_COMPLEX_TYPE = Add Local &Complex Type
-_UI_ACTION_BACK_TO_SCHEMA_VIEW = Back To Schema
-_UI_HOVER_BACK_TO_SCHEMA_VIEW = Back to schema
-
-_UI_ACTION_MAKE_ANONYMOUS_TYPE_GLOBAL = Make Anonymous Type Global
-_UI_ACTION_OPEN_SCHEMA = Open Schema
-
-_UI_ACTION_INSERT_BEFORE = Insert Before
-_UI_ACTION_INSERT_AFTER = Insert After
-
-_UI_OUTLINE_SORT = Sort alphabetically
-_UI_OUTLINE_DO_NOT_SORT = Do not sort alphabetically
-
-_UI_OUTLINE_SHOW_COMPLEX_TYPE = Show Complex Types Only
-_UI_OUTLINE_SHOW_SIMPLE_TYPE = Show Simple Types Only
-_UI_OUTLINE_SHOW_ATTRIBUTE_GROUP = Show Attribute Groups Only
-_UI_OUTLINE_SHOW_GROUP = Show Groups Only
-_UI_OUTLINE_SHOW_GLOBAL_ELEMENT = Show Global Elements Only
-_UI_OUTLINE_SHOW_REFERENCES = Show Reference Content
-_UI_OUTLINE_SHOW_INHERITED = Show Inherited Content
-
-!
-! New XML Schema Wizard
-!
-_UI_WIZARD_CREATE_XSD_MODEL_TITLE = Create XML Schema
-
-! NOTE TO TRANSLATOR: Do not translate following line
-_UI_CREATEXSD = createXSD
-_UI_NEW_XML_SCHEMA_TITLE = New XML Schema
-_UI_CREATE_A_NEW_XML_SCHEMA_DESC = Create a new XML schema.
-
-! NOTE TO TRANSLATOR: Do not translate following line
-_UI_NEW_XML_SCHEMA_FILENAME = NewXMLSchema.xsd
-
-!
-! XSD From RDB Schema Wizard
-!
-_UI_WIZARD_CREATE_XSD_FROM_RDB_TITLE = Create XSD from RDB Table
-
-
-!
-! Regular Expression Wizard
-!
-_UI_REGEX_WIZARD_CREATE_BUTTON = Create Regular Expression...
-_UI_TOOLTIP_REGEX_WIZARD_BUTTON = Launch the Regular Expression Wizard
-_UI_REGEX_WIZARD_TITLE = Regular Expression Wizard
-_UI_REGEX_WIZARD_COMPOSITION_PAGE_TITLE = Compose Regular Expression
-_UI_REGEX_WIZARD_COMPOSITION_PAGE_DESCRIPTION = To add a token, specify its contents and occurrence, then click Add.
-_UI_REGEX_WIZARD_INVALID_REGEX_ERROR_PREFIX = The current regular expression is not valid. Reason:
-_UI_REGEX_WIZARD_INVALID_TOKEN_ERROR_PREFIX = The current token is not valid. Reason:
-_UI_REGEX_WIZARD_INVALID_REGEX_ERROR = The current regular expression is not valid.
-_UI_REGEX_WIZARD_INVALID_TOKEN_ERROR = The current token is not valid.
-_UI_REGEX_WIZARD_INVALID_MIN_ERROR_SUFFIX = Invalid minimum range value. The value must be a positive integer less than the maximum value.
-_UI_REGEX_WIZARD_MISSING_MIN_ERROR_SUFFIX = Invalid minimum range value. A minimum range must be specified if a maximum range is specified.
-_UI_REGEX_WIZARD_INVALID_MAX_ERROR_SUFFIX = Invalid maximum range value. The value must be a positive integer greater than the minimum value.
-_UI_REGEX_WIZARD_INVALID_REPEAT_ERROR_SUFFIX = Invalid repeat value. The value must be a positive integer.
-_UI_REGEX_WIZARD_INVALID_SELECTION_ERROR = Nothing is currently selected. Either make a selection or choose a different token.
-_UI_REGEX_WIZARD_TOKEN_LABEL = Token contents:
-_UI_REGEX_WIZARD_AUTO_ESCAPE_CHECKBOX_LABEL = Auto escape
-_UI_REGEX_WIZARD_OCCURENCE_LABEL = Occurrence
-! Instructions for translators: The following label is used in a phrase to identify a range of values.
-! For example: 5 to 10.
-! The values are text fields that are initially blank so the user has to enter in values
-! For example: _______ to ________
-_UI_REGEX_WIZARD_TO_LABEL = to
-_UI_REGEX_WIZARD_ADD_BUTTON_LABEL = Add
-_UI_REGEX_WIZARD_CURRENT_REGEX_LABEL = Current regular expression:
-_UI_TOOLTIP_REGEX_WIZARD_TERMS = Content of new token
-_UI_TOOLTIP_REGEX_WIZARD_AUTO_ESCAPE_CHECKBOX = Insert escape characters to match metacharacter literals (e.g. converts \"*\" to \"\\*\")
-_UI_TOOLTIP_REGEX_WIZARD_ADD_BUTTON = Add this token to the regular expression
-_UI_TOOLTIP_REGEX_WIZARD_CURRENT_REGEX = The current regular expression
-_UI_TOOLTIP_REGEX_WIZARD_REPEAT = The number of times that the token must occur.
-_UI_TOOLTIP_REGEX_WIZARD_MIN = The minimum number of times that the token can occur.
-_UI_TOOLTIP_REGEX_WIZARD_MAX = The maximum number of times that the token can occur.
-_UI_TOOLTIP_REGEX_WIZARD_CARET_LABEL = The location where the new token will be inserted.
-_UI_REGEX_WIZARD_TESTING_PAGE_TITLE = Test Regular Expression
-_UI_REGEX_WIZARD_TESTING_PAGE_DESCRIPTION = To test the regular expression, enter sample text that you wish to match. The success of the match will be indicated above.
-_UI_REGEX_WIZARD_REGEX_LABEL = Regular expression:
-_UI_REGEX_WIZARD_SAMPLE_TEXT = Sample text:
-_UI_REGEX_WIZARD_MATCHES = The text matches the regular expression.
-_UI_REGEX_WIZARD_DOES_NOT_MATCH = The text does not match the regular expression.
-_UI_REGEX_WIZARD_TERM_ANY_CHAR = Any character
-_UI_REGEX_WIZARD_TERM_ALPHANUMERIC_CHAR = Alphanumeric character
-_UI_REGEX_WIZARD_TERM_WHITESPACE = Whitespace
-_UI_REGEX_WIZARD_TERM_DIGIT = Digit
-_UI_REGEX_WIZARD_TERM_UPPER = Upper case
-_UI_REGEX_WIZARD_TERM_LOWER = Lower case
-_UI_REGEX_WIZARD_TERM_SELECTION = Current selection
-_UI_REGEX_WIZARD_QUANTIFIER_SINGLE = Just once
-_UI_REGEX_WIZARD_QUANTIFIER_STAR = Zero or more
-_UI_REGEX_WIZARD_QUANTIFIER_PLUS = One or more
-_UI_REGEX_WIZARD_QUANTIFIER_OPTIONAL = Optional
-_UI_REGEX_WIZARD_QUANTIFIER_REPEAT = Repeat
-_UI_REGEX_WIZARD_QUANTIFIER_RANGE = Range
-
-!
-! Select Include File Wizard
-_UI_LABEL_INCLUDE_URL_FILE = Select schema from:
-_UI_RADIO_URL = HTTP
-_UI_RADIO_FILE = Workbench projects
-_UI_WIZARD_INCLUDE_FILE_TITLE = Include Another Schema
-_UI_WIZARD_INCLUDE_FILE_DESC = Select another schema from workbench projects or from HTTP.
-_UI_LABEL_URL = URL:
-_UI_URL_START_WITH = The URL must start with http://
-_UI_SPECIFY_URL = Please specify a URL
-
-!
-! Enumerations Dialog
-_UI_ENUMERATIONS_DIALOG_TITLE = Add Enumerations
-_UI_LABEL_DELIMITER_CHAR = &Delimiter characters:
-_UI_LABEL_PRESERVE_WHITESPACE = &Preserve leading and trailing whitespace
-
-_UI_ACTION_DELETE_ENUMERATION = Delete Enumeration
-
-!
-! Validate Schema
-!
-_UI_DIALOG_XML_SCHEMA_INVALID_TITLE = Validation Failed
-_UI_DIALOG_XML_SCHEMA_VALID_TITLE = Validation Succeeded
-_UI_DIALOG_XML_SCHEMA_VALID_TEXT = The XML schema file is valid.
-_UI_DIALOG_XML_SCHEMA_LIMITE_EXCEEDED = The XML schema file is not valid. The message limit for the Tasks view has been exceeded. Please increase the limit and try again.
-
-!
-! Combo-box choices
-!
-! NOTE TO TRANSLATOR: Do not translate following 10 lines
-_UI_COMBO_QUALIFIED = qualified
-_UI_COMBO_UNQUALIFIED = unqualified
-_UI_COMBO_EXTENSION = extension
-_UI_COMBO_RESTRICTION = restriction
-_UI_COMBO_ALL = all
-_UI_COMBO_TRUE = true
-_UI_COMBO_FALSE = false
-_UI_COMBO_LAX = lax
-_UI_COMBO_SKIP = skip
-_UI_COMBO_STRICT = strict
-
-! Generate DTD - pass as title and description for wizard page
-_UI_GENERATE_DTD_TITLE = Generate DTD
-_UI_GENERATE_DTD_DESCRIPTION = Generate a DTD from the selected XML schema file.
-
-! Generate DDL - pass as title and description for wizard page
-_UI_GENERATE_DDL_TITLE = Generate DDL
-_UI_GENERATE_DDL_DESCRIPTION = Generate DDL from the selected XML schema file.
-
-_UI_XML_SCHEMA_VALIDATOR = XML Schema Validator
-
-! Generation from the Schema model - pre-condition check
-_UI_DIALOG_TITLE_GRAMMAR_ERROR = Invalid Grammar
-_UI_DIALOG_INFO_SCHEMA_INVALID = The schema file contains errors. Open it in the XML Schema editor and validate it for details.
-_UI_DIALOG_TITLE_NO_GLOBAL_ELEMENTS = No Global Elements
-_UI_DIALOG_INFO_NO_GLOBAL_ELEMENTS = The selected schema has no global elements. Global elements are required to generate anything from an XML schema.
-
-! Section title for other attributes
-_UI_SECTION_ADVANCED_ATTRIBUTES = Advanced
-
-! For undo action menus
-! Note to Translators: For the following "Change" phrases,
-! maxOccurs, minOccurs, lang, xpath are keywords so please
-! do no translate them. These are for the undo action menus.
-! For example, if the user makes a change in the name of an
-! element, then the undo action would be Undo Element Name Change
-_UI_NAMESPACE_CHANGE = Namespace Change
-_UI_PROCESSCONTENTS_CHANGE = Process Contents Change
-_UI_MAXOCCURS_CHANGE = maxOccurs Change
-_UI_MINOCCURS_CHANGE = minOccurs Change
-_UI_SOURCE_ATTRIBUTE_CHANGE = Source Change
-_UI_COMMENT_CHANGE = Comment Change
-_UI_PREFIX_CHANGE = Prefix Change
-_UI_ATTRIBUTEGROUP_REF_CHANGE = Attribute Group Reference Change
-_UI_ATTRIBUTEGROUP_NAME_CHANGE = Attribute Group Name Change
-_UI_ATTRIBUTE_FIXED_CHANGE = Attribute Fixed Change
-_UI_ATTRIBUTE_DEFAULT_CHANGE = Attribute Default Change
-_UI_ATTRIBUTE_NAME_CHANGE = Attribute Name Change
-_UI_ATTRIBUTE_VALUE_CHANGE = Attribute Value Change
-_UI_ATTRIBUTE_USE_CHANGE = Attribute Use Change
-_UI_ATTRIBUTE_FORM_CHANGE = Attribute Form Change
-_UI_COMPLEXTYPE_NAME_CHANGE = Complex Type Name Change
-_UI_COMPLEXTYPE_ABSTRACT_CHANGE = Complex Type Abstract Change
-_UI_COMPLEXTYPE_MIXED_CHANGE = Complex Type Mixed Change
-_UI_COMPLEXTYPE_BLOCK_CHANGE = Complex Type Block Change
-_UI_COMPLEXTYPE_FINAL_CHANGE = Complex Type Final Change
-_UI_DOCUMENTATION_SOURCE_CHANGE = Documentation Source Change
-_UI_DOCUMENTATION_LANG_CHANGE = Documentation lang Change
-_UI_DOCUMENTATION_COMMENT_CHANGE = Documentation Comment Change
-_UI_ELEMENT_NAME_CHANGE = Element Name Change
-_UI_ELEMENT_VALUE_CHANGE = Element Value Change
-_UI_ELEMENT_TYPE_CHANGE = Element Type Change
-_UI_ENUM_VALUE_CHANGE = Enum Value Change
-_UI_FIELD_XPATH_CHANGE = Field xpath Change
-_UI_GROUP_REF_CHANGE = Group Reference Change
-_UI_GROUP_SCOPE_CHANGE = Content Model Change
-_UI_GROUP_NAME_CHANGE = Group Name Change
-_UI_IMPORT_CHANGE = Import Change
-_UI_KEY_NAME_CHANGE = Key Name Change
-_UI_KEYREF_NAME_CHANGE = Key Reference Name Change
-! Note to translators
-! For the following item, Refer is the keyref attribute to refer to some other key
-_UI_KEYREF_REFER_CHANGE = Key Reference Refer Change
-_UI_NOTATION_NAME_CHANGE = Notation Name Change
-_UI_NOTATION_PUBLIC_CHANGE = Notation Public Change
-_UI_NOTATION_SYSTEM_CHANGE = Notation System Change
-_UI_PATTERN_VALUE_CHANGE = Pattern Value Change
-_UI_SCHEMA_VERSION_CHANGE = Schema Version Change
-_UI_SCHEMA_LANG_CHANGE = Schema lang Change
-_UI_SELECTOR_XPATH_CHANGE = Selector xpath Change
-_UI_TYPE_CHANGE = Type Change
-_UI_DERIVEDBY_CHANGE = Derivation Change
-_UI_FACET_CHANGE = Facet Change
-_UI_SIMPLETYPE_NAME_CHANGE = SimpleType Name Change
-_UI_UNIQUE_NAME_CHANGE = Unique Name Change
-_UI_SCHEMA_ATTRIBUTEFORMDEFAULT_CHANGE = Attribute Form Default Change
-_UI_SCHEMA_ELEMENTFORMDEFAULT_CHANGE = Element Form Default Change
-_UI_SCHEMA_BLOCKDEFAULT_CHANGE = Block Default Change
-_UI_SCHEMA_FINALDEFAULT_CHANGE = Final Default Change
-_UI_ELEMENT_SUBSTITUTIONGROUP_CHANGE = Substitution Group Change
-_UI_ELEMENT_FORM_CHANGE = Form Change
-_UI_ELEMENT_BLOCK_CHANGE = Block Change
-_UI_ELEMENT_FINAL_CHANGE = Final Change
-_UI_ELEMENT_ABSTRACT_CHANGE = Abstract Change
-_UI_ELEMENT_NILLABLE_CHANGE = Nillable Change
-_UI_TARGETNAMESPACE_CHANGE = Target Namespace Change
-
-! Window Headings for Flat View
-_UI_PAGE_HEADING_ANYATTRIBUTE = Any Attribute
-_UI_PAGE_HEADING_ANYELEMENT = Any Element
-_UI_PAGE_HEADING_APPINFO = AppInfo
-_UI_PAGE_HEADING_ATTRIBUTEGROUP_REF = Attribute Group Reference
-_UI_PAGE_HEADING_ATTRIBUTEGROUP = Attribute Group
-_UI_PAGE_HEADING_ATTRIBUTE_REF = Attribute Reference
-_UI_PAGE_HEADING_ATTRIBUTE = Attribute
-_UI_PAGE_HEADING_COMPLEXTYPE = Complex Type
-_UI_PAGE_HEADING_DOCUMENTATION = Documentation
-_UI_PAGE_HEADING_ELEMENT = Element
-_UI_PAGE_HEADING_ELEMENT_REF = Element Reference
-_UI_PAGE_HEADING_ENUM = Enumeration
-_UI_PAGE_HEADING_FIELD = Field
-_UI_PAGE_HEADING_GROUP_REF = Group Reference
-_UI_PAGE_HEADING_CONTENTMODEL = Content Model
-_UI_PAGE_HEADING_GROUP = Group
-_UI_PAGE_HEADING_IMPORT = Import
-_UI_PAGE_HEADING_INCLUDE = Include
-_UI_PAGE_HEADING_KEYREF = Key Reference
-_UI_PAGE_HEADING_KEY = Key
-_UI_PAGE_HEADING_NOTATION = Notation
-_UI_PAGE_HEADING_PATTERN = Pattern
-_UI_PAGE_HEADING_REDEFINE = Redefine
-_UI_PAGE_HEADING_SCHEMA = Schema
-_UI_PAGE_HEADING_SELECTOR = Selector
-_UI_PAGE_HEADING_LIST = List
-_UI_PAGE_HEADING_UNION = Union
-_UI_PAGE_HEADING_SIMPLECONTENT = Simple Content
-_UI_PAGE_HEADING_COMPLEXCONTENT = Complex Content
-_UI_PAGE_HEADING_RESTRICTION = Restriction
-_UI_PAGE_HEADING_EXTENSION = Extension
-_UI_PAGE_HEADING_SIMPLETYPE = Simple Type
-_UI_PAGE_HEADING_UNIQUE = Unique
-_UI_PAGE_HEADING_REFERENCE = reference
-
-!
-! Graph page
-!
-_UI_GRAPH_SIMPLE_TYPES = Simple Types
-_UI_GRAPH_COMPLEX_TYPES = Complex Types
-_UI_GRAPH_GROUPS = Groups
-_UI_GRAPH_GLOBAL_ATTRIBUTES = Global Attributes
-_UI_GRAPH_GLOBAL_ELEMENTS = Global Elements
-_UI_GRAPH_XSDSCHEMA = Schema
-_UI_GRAPH_XSDSCHEMA_NO_NAMESPACE = (no target namespace specified)
-_UI_GRAPH_XSDCOMPLEXTYPEDEFINITION = XSD Complex Type Definition:
-_UI_GRAPH_XSDMODELGROUP = XSD Model Group
-_UI_GRAPH_XSDPARTICLE = XSD Particle
-_UI_GRAPH_VIEW_NOT_AVAILABLE = View is not available for selected object.
-_UI_GRAPH_UNKNOWN_OBJECT = Unknown object
-
-! Additional Categories
-_UI_GRAPH_TYPES = Types
-_UI_GRAPH_ELEMENTS = Elements
-_UI_GRAPH_ATTRIBUTES = Attributes
-_UI_GRAPH_ATTRIBUTE_GROUPS = Attribute Groups
-_UI_GRAPH_NOTATIONS = Notations
-_UI_GRAPH_IDENTITY_CONSTRAINTS = Identity Constraints
-_UI_GRAPH_ANNOTATIONS = Annotations
-_UI_GRAPH_DIRECTIVES = Directives
-
-! For Union MemberTypes Dialog
-_UI_LABEL_SELECT_MEMBERTYPES = Select from the available types and add to the memberTypes list
-_UI_LABEL_MEMBERTYPES_CHANGE = Member Types Change
-_UI_LABEL_MEMBERTYPES_VALUE = Member Types Value:
-_UI_LABEL_MEMBERTYPES = Member types:
-
-_UI_LABEL_VARIETY_CHANGE = Variety Change
-
-_UI_LABEL_FIXEDORDEFAULT_VALUE = Fixed/Default Value
-
-_UI_LABEL_ITEM_TYPE_CHANGE = Item Type Change
-
-_UI_LABEL_AVAILABLE_TYPES = Available Types
-
-_UI_LABEL_INCLUDE_CHANGE = Include Change
-
-_UI_LABEL_ITEM_TYPE = Item type:
-_UI_LABEL_BASE_TYPE = Base Type
-_UI_LABEL_TYPE = Type
-_UI_LABEL_MODEL_GROUP = Model Group
-
-_UI_LABEL_ABSENT = absent
-
-_UI_WARNING_RESET_ATTRGRP_REF = Reset attribute group reference <{0}>
-_UI_WARNING_REMOVE_ATTRGRP_REF = Remove attribute group reference <{0}>
-_UI_WARNING_RESET_ATTR_REF = Reset attribute reference <{0}>
-_UI_WARNING_REMOVE_ATTR_REF = Remove attribute reference <{0}>
-
-!======================================================================================
-!
-! Here is the list of Error string that have message IDs - make sure they are unique
-! Range for XSDEditor messageIDs: IWAX1001E - IWAX1200E
-!
-!======================================================================================
-! These three errors appear in the select include wizard
-! The name of the file will be substituted in
-_UI_DIFFERENT_NAME_SPACE = {0} is in a different namespace
-_UI_SAME_NAME_SPACE = {0} is in the same namespace
-_UI_INCORRECT_XML_SCHEMA = {0} is an invalid XML schema file
-
-_ERROR_SCHEMA_NOT_EXIST = IWAX1003E does not exist.
-_ERROR_LABEL_INVALID_PREFIX = IWAX1004E Invalid prefix. A prefix must not be empty or contain any space.
-
-! The name of the file will be substituted in
-_ERROR_SCHEMA_NAME_THE_SAME = IWAX1005E {0} is the current schema. A schema cannot include itself. Reset to the last valid schema.
-
-_ERROR_XSD_GENERATION = IWAX1006E Error generating XML schema
-_ERROR_NO_CONTAINER = IWAX1007E No folder selected
-_ERROR_NO_FILE_NAME = IWAX1008E No file name provided
-_ERROR_FILENAME_MUST_END_XSD = IWAX1011E The file name must end in .xsd
-
-
-!
-! For schema that has too many errors, an extended message.
-!
-_ERROR_DIALOG_XML_SCHEMA_INVALID_TEXT = IWAX100d9E The XML schema file is not valid.
-_ERROR_MORE_ERRORS = There are more errors in the schema than are displayed in the Tasks view. Correct the first {0} errors and re-validate the schema file.
-
-! DDL Generation Failed Dialog
-_UI_DIALOG_DDL_GEN_FAILED_TITLE = DDL Generation Failed
-_ERROR_DIALOG_DDL_NOT_GENEREATED = IWAX1010E DDL has not been generated
-_UI_DIALOG_DDL_GEN_FAILED_REASON = The selected schema has no global elements
-_UI_DIALOG_DDL_GEN_FAILED_REASON2 = None of the global elements in the schema have a complex type or they reference complex types that cannot be found.
-
-_EXC_OPEN_XSD = IWAX1011E Cannot open XML Schema editor
-
-_ERROR_LABEL_PREFIX_EXISTS = IWAX1012E Prefix already exists
-
-_ERROR_REMOVE_LOCAL_SIMPLETYPE = IWAX1013E Remove local simple type from extension
-
-_WARN_INVALID_TARGET_NAMESPACE = IWAX1014E The target namespace is not well-formed
-
-_ERROR_TARGET_NAMESPACE_AND_PREFIX = IWAX1015E A target namespace must be associated with a prefix
-
-
-_UI_CONTAINMENT = Containment
-_UI_INHERITANCE = Inheritance
-_UI_SUBSTITUTION_GROUPS = Substitution Groups
-_UI_ANONYMOUS = **anonymous**
-_UI_VALUE = Value
-_UI_ANY_ELEMENT = Any Element
-_UI_SORT = Sort
-
-_UI_ACTION_EDIT_NAMESPACES = Edit Namespaces...
-
-
-_UI_CreateChild_text = {0}
-_UI_CreateChild_text2 = {1} {0}
-_UI_CreateChild_tooltip = Create New {0} Under {1} Feature
-_UI_CreateChild_description = Create a new child of type {0} for the {1} feature of the selected {2}.
-_UI_CreateSibling_description = Create a new sibling of type {0} for the selected {2}, under the {1} feature of their parent.
-
-_UI_PropertyDescriptor_description = The {0} of the {1}
-
-_UI_XSDAnnotation_type = Annotation
-_UI_XSDAttributeDeclaration_type = Attribute Declaration
-_UI_XSDAttributeGroupContent_type = Attribute Group Content
-_UI_XSDAttributeGroupDefinition_type = Attribute Group Definition
-_UI_XSDAttributeUse_type = Attribute Use
-_UI_XSDBoundedFacet_type = Bounded Facet
-_UI_XSDCardinalityFacet_type = Cardinality Facet
-_UI_XSDComplexTypeContent_type = Complex Type Content
-_UI_XSDComplexTypeDefinition_type = Complex Type Definition
-_UI_XSDComponent_type = Component
-_UI_XSDConcreteComponent_type = Concrete Component
-_UI_XSDConstrainingFacet_type = Constraining Facet
-_UI_XSDDiagnostic_type = Diagnostic
-_UI_XSDElementDeclaration_type = Element Declaration
-_UI_XSDEnumerationFacet_type = Enumeration Facet
-_UI_XSDFacet_type = Facet
-_UI_XSDFeature_type = Feature
-_UI_XSDFixedFacet_type = Fixed Facet
-_UI_XSDFractionDigitsFacet_type = Fraction Digits Facet
-_UI_XSDFundamentalFacet_type = Fundamental Facet
-_UI_XSDIdentityConstraintDefinition_type = Identity Constraint Definition
-_UI_XSDImport_type = Import
-_UI_XSDInclude_type = Include
-_UI_XSDLengthFacet_type = Length Facet
-_UI_XSDMaxExclusiveFacet_type = Max Exclusive Facet
-_UI_XSDMaxFacet_type = Max Facet
-_UI_XSDMaxInclusiveFacet_type = Max Inclusive Facet
-_UI_XSDMaxLengthFacet_type = Max Length Facet
-_UI_XSDMinExclusiveFacet_type = Min Exclusive Facet
-_UI_XSDMinFacet_type = Min Facet
-_UI_XSDMinInclusiveFacet_type = Min Inclusive Facet
-_UI_XSDMinLengthFacet_type = Min Length Facet
-_UI_XSDModelGroup_type = Model Group
-_UI_XSDModelGroupDefinition_type = Model Group Definition
-_UI_XSDNamedComponent_type = Named Component
-_UI_XSDNotationDeclaration_type = Notation Declaration
-_UI_XSDNumericFacet_type = Numeric Facet
-_UI_XSDOrderedFacet_type = Ordered Facet
-_UI_XSDParticle_type = Particle
-_UI_XSDParticleContent_type = Particle Content
-_UI_XSDPatternFacet_type = Pattern Facet
-_UI_XSDRedefinableComponent_type = Redefinable Component
-_UI_XSDRedefineContent_type = Redefine Content
-_UI_XSDRedefine_type = Redefine
-_UI_XSDRepeatableFacet_type = Repeatable Facet
-_UI_XSDSchema_type = Schema
-_UI_XSDSchemaCompositor_type = Schema Compositor
-_UI_XSDSchemaContent_type = Schema Content
-_UI_XSDSchemaDirective_type = Schema Directive
-_UI_XSDScope_type = Scope
-_UI_XSDSimpleTypeDefinition_type = Simple Type Definition
-_UI_XSDTerm_type = Term
-_UI_XSDTotalDigitsFacet_type = Total Digits Facet
-_UI_XSDTypeDefinition_type = Type Definition
-_UI_XSDWhiteSpaceFacet_type = White Space Facet
-_UI_XSDWildcard_type = Wildcard
-_UI_XSDXPathDefinition_type = XPath Definition
-_UI_Unknown_type = Object
-
-_UI_XSDAnnotation_applicationInformation_feature = Application Information
-_UI_XSDAnnotation_userInformation_feature = User Information
-_UI_XSDAnnotation_attributes_feature = Attributes
-_UI_XSDAttributeDeclaration_attributeDeclarationReference_feature = Attribute Declaration Reference
-_UI_XSDAttributeDeclaration_annotation_feature = Annotation
-_UI_XSDAttributeDeclaration_anonymousTypeDefinition_feature = Anonymous Type Definition
-_UI_XSDAttributeDeclaration_typeDefinition_feature = Type Definition
-_UI_XSDAttributeDeclaration_resolvedAttributeDeclaration_feature = Resolved Attribute Declaration
-_UI_XSDAttributeGroupDefinition_attributeGroupDefinitionReference_feature = Attribute Group Definition Reference
-_UI_XSDAttributeGroupDefinition_annotation_feature = Annotation
-_UI_XSDAttributeGroupDefinition_contents_feature = Contents
-_UI_XSDAttributeGroupDefinition_attributeUses_feature = Attribute Uses
-_UI_XSDAttributeGroupDefinition_attributeWildcardContent_feature = Attribute Wildcard Content
-_UI_XSDAttributeGroupDefinition_attributeWildcard_feature = Attribute Wildcard
-_UI_XSDAttributeGroupDefinition_resolvedAttributeGroupDefinition_feature = Resolved Attribute Group Definition
-_UI_XSDAttributeGroupDefinition_syntheticWildcard_feature = Synthetic Wildcard
-_UI_XSDAttributeUse_required_feature = Required
-_UI_XSDAttributeUse_value_feature = Value
-_UI_XSDAttributeUse_constraint_feature = Constraint
-_UI_XSDAttributeUse_use_feature = Use
-_UI_XSDAttributeUse_lexicalValue_feature = Lexical Value
-_UI_XSDAttributeUse_attributeDeclaration_feature = Attribute Declaration
-_UI_XSDAttributeUse_content_feature = Content
-_UI_XSDBoundedFacet_value_feature = Value
-_UI_XSDCardinalityFacet_value_feature = Value
-_UI_XSDComplexTypeDefinition_derivationMethod_feature = Derivation Method
-_UI_XSDComplexTypeDefinition_final_feature = Final
-_UI_XSDComplexTypeDefinition_abstract_feature = Abstract
-_UI_XSDComplexTypeDefinition_contentTypeCategory_feature = Content Type Category
-_UI_XSDComplexTypeDefinition_prohibitedSubstitutions_feature = Prohibited Substitutions
-_UI_XSDComplexTypeDefinition_lexicalFinal_feature = Lexical Final
-_UI_XSDComplexTypeDefinition_block_feature = Block
-_UI_XSDComplexTypeDefinition_mixed_feature = Mixed
-_UI_XSDComplexTypeDefinition_contentAnnotation_feature = Content Annotation
-_UI_XSDComplexTypeDefinition_baseTypeDefinition_feature = Base Type Definition
-_UI_XSDComplexTypeDefinition_content_feature = Content
-_UI_XSDComplexTypeDefinition_contentType_feature = Content Type
-_UI_XSDComplexTypeDefinition_attributeUses_feature = Attribute Uses
-_UI_XSDComplexTypeDefinition_attributeContents_feature = Attribute Contents
-_UI_XSDComplexTypeDefinition_attributeWildcard_feature = Attribute Wildcard
-_UI_XSDComplexTypeDefinition_attributeWildcardContent_feature = Attribute Wildcard Content
-_UI_XSDComplexTypeDefinition_rootTypeDefinition_feature = Root Type Definition
-_UI_XSDComplexTypeDefinition_syntheticParticle_feature = Synthetic Particle
-_UI_XSDComplexTypeDefinition_syntheticWildcard_feature = Synthetic Wildcard
-_UI_XSDConcreteComponent_element_feature = Element
-_UI_XSDConcreteComponent_container_feature = Container
-_UI_XSDConcreteComponent_rootContainer_feature = Root Container
-_UI_XSDConcreteComponent_schema_feature = Schema
-_UI_XSDConcreteComponent_diagnostics_feature = Diagnostics
-_UI_XSDDiagnostic_severity_feature = Severity
-_UI_XSDDiagnostic_message_feature = Message
-_UI_XSDDiagnostic_locationURI_feature = Location URI
-_UI_XSDDiagnostic_line_feature = Line
-_UI_XSDDiagnostic_column_feature = Column
-_UI_XSDDiagnostic_node_feature = Node
-_UI_XSDDiagnostic_annotationURI_feature = Annotation URI
-_UI_XSDDiagnostic_components_feature = Components
-_UI_XSDDiagnostic_primaryComponent_feature = Primary Component
-_UI_XSDElementDeclaration_nillable_feature = Nillable
-_UI_XSDElementDeclaration_disallowedSubstitutions_feature = Disallowed Substitutions
-_UI_XSDElementDeclaration_substitutionGroupExclusions_feature = Substitution Group Exclusions
-_UI_XSDElementDeclaration_abstract_feature = Abstract
-_UI_XSDElementDeclaration_lexicalFinal_feature = Lexical Final
-_UI_XSDElementDeclaration_block_feature = Block
-_UI_XSDElementDeclaration_elementDeclarationReference_feature = Element Declaration Reference
-_UI_XSDElementDeclaration_circular_feature = Circular
-_UI_XSDElementDeclaration_annotation_feature = Annotation
-_UI_XSDElementDeclaration_anonymousTypeDefinition_feature = Anonymous Type Definition
-_UI_XSDElementDeclaration_typeDefinition_feature = Type Definition
-_UI_XSDElementDeclaration_identityConstraintDefinitions_feature = Identity Constraint Definitions
-_UI_XSDElementDeclaration_resolvedElementDeclaration_feature = Resolved Element Declaration
-_UI_XSDElementDeclaration_substitutionGroupAffiliation_feature = Substitution Group Affiliation
-_UI_XSDElementDeclaration_substitutionGroup_feature = Substitution Group
-_UI_XSDEnumerationFacet_value_feature = Value
-_UI_XSDFacet_lexicalValue_feature = Lexical Value
-_UI_XSDFacet_facetName_feature = Facet Name
-_UI_XSDFacet_effectiveValue_feature = Effective Value
-_UI_XSDFacet_annotation_feature = Annotation
-_UI_XSDFacet_simpleTypeDefinition_feature = Simple Type Definition
-_UI_XSDFeature_value_feature = Value
-_UI_XSDFeature_constraint_feature = Constraint
-_UI_XSDFeature_form_feature = Form
-_UI_XSDFeature_lexicalValue_feature = Lexical Value
-_UI_XSDFeature_global_feature = Global
-_UI_XSDFeature_featureReference_feature = Feature Reference
-_UI_XSDFeature_scope_feature = Scope
-_UI_XSDFeature_resolvedFeature_feature = Resolved Feature
-_UI_XSDFeature_type_feature = Type
-_UI_XSDFixedFacet_fixed_feature = Fixed
-_UI_XSDFractionDigitsFacet_value_feature = Value
-_UI_XSDIdentityConstraintDefinition_identityConstraintCategory_feature = Identity Constraint Category
-_UI_XSDIdentityConstraintDefinition_annotation_feature = Annotation
-_UI_XSDIdentityConstraintDefinition_referencedKey_feature = Referenced Key
-_UI_XSDIdentityConstraintDefinition_selector_feature = Selector
-_UI_XSDIdentityConstraintDefinition_fields_feature = Fields
-_UI_XSDImport_namespace_feature = Namespace
-_UI_XSDImport_annotation_feature = Annotation
-_UI_XSDInclude_annotation_feature = Annotation
-_UI_XSDLengthFacet_value_feature = Value
-_UI_XSDMaxFacet_value_feature = Value
-_UI_XSDMaxFacet_inclusive_feature = Inclusive
-_UI_XSDMaxFacet_exclusive_feature = Exclusive
-_UI_XSDMaxLengthFacet_value_feature = Value
-_UI_XSDMinFacet_value_feature = Value
-_UI_XSDMinFacet_inclusive_feature = Inclusive
-_UI_XSDMinFacet_exclusive_feature = Exclusive
-_UI_XSDMinLengthFacet_value_feature = Value
-_UI_XSDModelGroup_compositor_feature = Compositor
-_UI_XSDModelGroup_annotation_feature = Annotation
-_UI_XSDModelGroup_contents_feature = Contents
-_UI_XSDModelGroup_particles_feature = Particles
-_UI_XSDModelGroupDefinition_modelGroupDefinitionReference_feature = Model Group Definition Reference
-_UI_XSDModelGroupDefinition_annotation_feature = Annotation
-_UI_XSDModelGroupDefinition_modelGroup_feature = Model Group
-_UI_XSDModelGroupDefinition_resolvedModelGroupDefinition_feature = Resolved Model Group Definition
-_UI_XSDNamedComponent_name_feature = Name
-_UI_XSDNamedComponent_targetNamespace_feature = Target Namespace
-_UI_XSDNamedComponent_aliasName_feature = Alias Name
-_UI_XSDNamedComponent_uRI_feature = URI
-_UI_XSDNamedComponent_aliasURI_feature = Alias URI
-_UI_XSDNamedComponent_qName_feature = QName
-_UI_XSDNotationDeclaration_systemIdentifier_feature = System Identifier
-_UI_XSDNotationDeclaration_publicIdentifier_feature = Public Identifier
-_UI_XSDNotationDeclaration_annotation_feature = Annotation
-_UI_XSDNumericFacet_value_feature = Value
-_UI_XSDOrderedFacet_value_feature = Value
-_UI_XSDParticle_minOccurs_feature = Min Occurs
-_UI_XSDParticle_maxOccurs_feature = Max Occurs
-_UI_XSDParticle_content_feature = Content
-_UI_XSDParticle_term_feature = Term
-_UI_XSDPatternFacet_value_feature = Value
-_UI_XSDRedefinableComponent_circular_feature = Circular
-_UI_XSDRedefine_annotations_feature = Annotations
-_UI_XSDRedefine_contents_feature = Contents
-_UI_XSDRepeatableFacet_annotations_feature = Annotations
-_UI_XSDSchema_document_feature = Document
-_UI_XSDSchema_schemaLocation_feature = Schema Location
-_UI_XSDSchema_targetNamespace_feature = Target Namespace
-_UI_XSDSchema_attributeFormDefault_feature = Attribute Form Default
-_UI_XSDSchema_elementFormDefault_feature = Element Form Default
-_UI_XSDSchema_finalDefault_feature = Final Default
-_UI_XSDSchema_blockDefault_feature = Block Default
-_UI_XSDSchema_version_feature = Version
-_UI_XSDSchema_contents_feature = Contents
-_UI_XSDSchema_elementDeclarations_feature = Element Declarations
-_UI_XSDSchema_attributeDeclarations_feature = Attribute Declarations
-_UI_XSDSchema_attributeGroupDefinitions_feature = Attribute Group Definitions
-_UI_XSDSchema_typeDefinitions_feature = Type Definitions
-_UI_XSDSchema_modelGroupDefinitions_feature = Model Group Definitions
-_UI_XSDSchema_identityConstraintDefinitions_feature = Identity Constraint Definitions
-_UI_XSDSchema_notationDeclarations_feature = Notation Declarations
-_UI_XSDSchema_annotations_feature = Annotations
-_UI_XSDSchema_allDiagnostics_feature = All Diagnostics
-_UI_XSDSchema_referencingDirectives_feature = Referencing Directives
-_UI_XSDSchema_rootVersion_feature = Root Version
-_UI_XSDSchema_originalVersion_feature = Original Version
-_UI_XSDSchema_incorporatedVersions_feature = Incorporated Versions
-_UI_XSDSchema_schemaForSchema_feature = Schema For Schema
-_UI_XSDSchemaCompositor_incorporatedSchema_feature = Incorporated Schema
-_UI_XSDSchemaDirective_schemaLocation_feature = Schema Location
-_UI_XSDSchemaDirective_resolvedSchema_feature = Resolved Schema
-_UI_XSDSimpleTypeDefinition_variety_feature = Variety
-_UI_XSDSimpleTypeDefinition_final_feature = Final
-_UI_XSDSimpleTypeDefinition_lexicalFinal_feature = Lexical Final
-_UI_XSDSimpleTypeDefinition_validFacets_feature = Valid Facets
-_UI_XSDSimpleTypeDefinition_contents_feature = Contents
-_UI_XSDSimpleTypeDefinition_facetContents_feature = Facet Contents
-_UI_XSDSimpleTypeDefinition_facets_feature = Facets
-_UI_XSDSimpleTypeDefinition_memberTypeDefinitions_feature = Member Type Definitions
-_UI_XSDSimpleTypeDefinition_fundamentalFacets_feature = Fundamental Facets
-_UI_XSDSimpleTypeDefinition_baseTypeDefinition_feature = Base Type Definition
-_UI_XSDSimpleTypeDefinition_primitiveTypeDefinition_feature = Primitive Type Definition
-_UI_XSDSimpleTypeDefinition_itemTypeDefinition_feature = Item Type Definition
-_UI_XSDSimpleTypeDefinition_rootTypeDefinition_feature = Root Type Definition
-_UI_XSDSimpleTypeDefinition_minFacet_feature = Min Facet
-_UI_XSDSimpleTypeDefinition_maxFacet_feature = Max Facet
-_UI_XSDSimpleTypeDefinition_maxInclusiveFacet_feature = Max Inclusive Facet
-_UI_XSDSimpleTypeDefinition_minInclusiveFacet_feature = Min Inclusive Facet
-_UI_XSDSimpleTypeDefinition_minExclusiveFacet_feature = Min Exclusive Facet
-_UI_XSDSimpleTypeDefinition_maxExclusiveFacet_feature = Max Exclusive Facet
-_UI_XSDSimpleTypeDefinition_lengthFacet_feature = Length Facet
-_UI_XSDSimpleTypeDefinition_whiteSpaceFacet_feature = White Space Facet
-_UI_XSDSimpleTypeDefinition_enumerationFacets_feature = Enumeration Facets
-_UI_XSDSimpleTypeDefinition_patternFacets_feature = Pattern Facets
-_UI_XSDSimpleTypeDefinition_cardinalityFacet_feature = Cardinality Facet
-_UI_XSDSimpleTypeDefinition_numericFacet_feature = Numeric Facet
-_UI_XSDSimpleTypeDefinition_maxLengthFacet_feature = Max Length Facet
-_UI_XSDSimpleTypeDefinition_minLengthFacet_feature = Min Length Facet
-_UI_XSDSimpleTypeDefinition_totalDigitsFacet_feature = Total Digits Facet
-_UI_XSDSimpleTypeDefinition_fractionDigitsFacet_feature = Fraction Digits Facet
-_UI_XSDSimpleTypeDefinition_orderedFacet_feature = Ordered Facet
-_UI_XSDSimpleTypeDefinition_boundedFacet_feature = Bounded Facet
-_UI_XSDSimpleTypeDefinition_effectiveMaxFacet_feature = Effective Max Facet
-_UI_XSDSimpleTypeDefinition_effectiveWhiteSpaceFacet_feature = Effective White Space Facet
-_UI_XSDSimpleTypeDefinition_effectiveMaxLengthFacet_feature = Effective Max Length Facet
-_UI_XSDSimpleTypeDefinition_effectiveFractionDigitsFacet_feature = Effective Fraction Digits Facet
-_UI_XSDSimpleTypeDefinition_effectivePatternFacet_feature = Effective Pattern Facet
-_UI_XSDSimpleTypeDefinition_effectiveEnumerationFacet_feature = Effective Enumeration Facet
-_UI_XSDSimpleTypeDefinition_effectiveTotalDigitsFacet_feature = Effective Total Digits Facet
-_UI_XSDSimpleTypeDefinition_effectiveMinLengthFacet_feature = Effective Min Length Facet
-_UI_XSDSimpleTypeDefinition_effectiveLengthFacet_feature = Effective Length Facet
-_UI_XSDSimpleTypeDefinition_effectiveMinFacet_feature = Effective Min Facet
-_UI_XSDSimpleTypeDefinition_syntheticFacets_feature = Synthetic Facets
-_UI_XSDTotalDigitsFacet_value_feature = Value
-_UI_XSDTypeDefinition_annotation_feature = Annotation
-_UI_XSDTypeDefinition_derivationAnnotation_feature = Derivation Annotation
-_UI_XSDTypeDefinition_annotations_feature = Annotations
-_UI_XSDTypeDefinition_rootType_feature = Root Type
-_UI_XSDTypeDefinition_baseType_feature = Base Type
-_UI_XSDTypeDefinition_simpleType_feature = Simple Type
-_UI_XSDTypeDefinition_complexType_feature = Complex Type
-_UI_XSDWhiteSpaceFacet_value_feature = Value
-_UI_XSDWildcard_namespaceConstraintCategory_feature = Namespace Constraint Category
-_UI_XSDWildcard_namespaceConstraint_feature = Namespace Constraint
-_UI_XSDWildcard_processContents_feature = Process Contents
-_UI_XSDWildcard_lexicalNamespaceConstraint_feature = Lexical Namespace Constraint
-_UI_XSDWildcard_annotation_feature = Annotation
-_UI_XSDWildcard_annotations_feature = Annotations
-_UI_XSDXPathDefinition_variety_feature = Variety
-_UI_XSDXPathDefinition_value_feature = Value
-_UI_XSDXPathDefinition_annotation_feature = Annotation
-_UI_Unknown_feature = Unspecified
-
-!======================================================================================
-!
-! Used by org.eclipse.wst.common.ui.viewers.SelectSingleFileView
-!
-!======================================================================================
-_UI_LABEL_SOURCE_FILES = Workbench Files
-_UI_LABEL_SELECTED_FILES = Selected Files
-
-_UI_IMPORT_BUTTON = Import Files...
-_UI_IMPORT_BUTTON_TOOL_TIP = Import files from file system
diff --git a/bundles/org.eclipse.wst.xsd.ui/plugin.xml b/bundles/org.eclipse.wst.xsd.ui/plugin.xml
deleted file mode 100644
index 4a1797cf54..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/plugin.xml
+++ /dev/null
@@ -1,205 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin
- id="org.eclipse.wst.xsd.ui"
- name="%_UI_PLUGIN_NAME"
- version="1.0.0"
- provider-name="Eclipse.org"
- class="org.eclipse.wst.xsd.ui.internal.XSDEditorPlugin">
-
- <runtime>
- <library name="xsdeditor.jar">
- <export name="*"/>
- </library>
- </runtime>
- <requires>
- <import plugin="org.eclipse.core.runtime.compatibility"/>
-
- <import plugin="org.eclipse.wst.xml.uriresolver"/>
- <import plugin="org.eclipse.wst.sse.ui"/>
- <import plugin="org.eclipse.wst.sse.core"/>
- <import plugin="org.eclipse.wst.xml.core"/>
- <import plugin="org.eclipse.wst.xml.ui"/>
- <import plugin="org.eclipse.wst.common.contentmodel"/>
- <import plugin="org.eclipse.wst.common.ui"/>
-
- <import plugin="org.eclipse.jface.text"/>
- <import plugin="org.eclipse.xsd"/>
- <import plugin="org.eclipse.gef"/>
- <import plugin="org.eclipse.jface"/>
- <import plugin="org.eclipse.ui.editors"/>
- <import plugin="org.eclipse.ui.workbench.texteditor"/>
- <import plugin="org.eclipse.ui"/>
- <import plugin="org.eclipse.ui.views"/>
- <import plugin="org.eclipse.ui.ide"/>
- <import plugin="org.eclipse.core.resources"/>
- <import plugin="org.eclipse.wst.common.ui.properties"/>
- <import plugin="org.eclipse.xsd.edit"/>
- <import plugin="org.eclipse.emf.edit"/>
- <import plugin="org.eclipse.emf.edit.ui"/>
- </requires>
-
-
- <extension
- point="org.eclipse.ui.editors">
- <editor
- name="%_UI_EDITOR_NAME"
- default="true"
- icon="icons/XSDFile.gif"
- extensions="xsd"
- contributorClass="org.eclipse.wst.xsd.ui.internal.XSDActionBarContributor"
- class="org.eclipse.wst.xsd.ui.internal.XSDEditor"
- id="org.eclipse.wst.xsd.ui.XSDEditor">
- </editor>
- </extension>
-<!-- drop targets for XSDTextEditor-->
- <extension
- point="org.eclipse.wst.sse.ui.dropTargetTransfers">
- <dropTargetContribution
- targetID="org.eclipse.wst.xsd.ui.internal.XSDTextEditor"
- id="org.eclipse.wst.xsd.ui.ExtendedTransfers">
- <transfer
- priority="mid"
- singleton="true"
- class="org.eclipse.swt.dnd.FileTransfer"
- method="getInstance"
- id="org.eclipse.swt.dnd.FileTransfer">
- </transfer>
- <dropAction
- class="org.eclipse.wst.sse.ui.extension.FileDropAction"
- transferID="org.eclipse.swt.dnd.FileTransfer"
- id="org.eclipse.wst.sse.ui.extension.FileDropAction">
- </dropAction>
- <transfer
- priority="low"
- singleton="true"
- class="org.eclipse.swt.dnd.TextTransfer"
- method="getInstance"
- id="org.eclipse.swt.dnd.TextTransfer">
- </transfer>
- <dropAction
- class="org.eclipse.wst.sse.ui.extension.TextDropAction"
- transferID="org.eclipse.swt.dnd.TextTransfer"
- id="corg.eclipse.wst.sse.ui.extension.TextDropAction">
- </dropAction>
- </dropTargetContribution>
- </extension>
-
- <extension point="org.eclipse.ui.newWizards">
- <wizard id = "org.eclipse.wst.xsd.ui.internal.wizards.NewXSDWizard"
- name = "%_UI_WIZARD_NEW_XSD"
- class = "org.eclipse.wst.xsd.ui.internal.wizards.NewXSDWizard"
- category = "org.eclipse.wst.XMLCategory"
- icon = "icons/XSDFile.gif">
- <description>%_UI_CREATE_A_NEW_SCHEMA</description>
- <selection class = "org.eclipse.core.resources.IResource" />
- </wizard>
- </extension>
-
- <extension point="org.eclipse.ui.preferencePages">
- <page
- name="%_UI_XML_SCHEMA_PREFERENCE"
- category="org.eclipse.wst.sse.ui.preferences"
- class="org.eclipse.wst.xsd.ui.internal.preferences.XSDPreferencePage"
- id="org.eclipse.wst.xsd.ui.internal.preferences.XSDPreferencePage">
- </page>
- </extension>
- <extension point="org.eclipse.wst.sse.ui.extendedconfiguration">
- <definition
- type="preferencepages"
- value="org.eclipse.wst.sse.ui.preferences/org.eclipse.wst.xsd.ui.internal.preferences.XSDPreferencePage"
- target="org.eclipse.wst.xsd.ui.internal.XSDEditor.source" />
- </extension>
-
- <!-- ==================================================== -->
-<!-- Support help on the tags -->
-<!-- ==================================================== -->
-<!-- <extension
- point="org.eclipse.wst.common.contentmodel.annotationFiles">
- <annotationFile
- location="/w3c/schemaForCodeAssist-annotations.xml"
- publicId="http://www.w3.org/2001/XMLSchema">
- </annotationFile>
- </extension>
--->
- <extension
- point="org.eclipse.wst.common.ui.properties.propertyContributor">
- <propertyContributor
- contributorId="org.eclipse.wst.xsd.ui.internal.XSDEditor"
- sectionDescriptorProvider="org.eclipse.wst.xsd.ui.internal.properties.section.XSDSectionDescriptorProvider"
- labelProvider="org.eclipse.wst.xsd.ui.internal.properties.section.XSDSectionLabelProvider">
- <propertyCategory
- category="general">
- </propertyCategory>
- <propertyCategory
- category="namespace">
- </propertyCategory>
- <propertyCategory
- category="other">
- </propertyCategory>
- <propertyCategory
- category="attributes">
- </propertyCategory>
- <propertyCategory
- category="enumerations">
- </propertyCategory>
- <propertyCategory
- category="documentation">
- </propertyCategory>
- <propertyCategory
- category="facets">
- </propertyCategory>
- </propertyContributor>
- </extension>
- <extension
- point="org.eclipse.wst.common.ui.properties.propertyTabs">
- <propertyTabs
- contributorId="org.eclipse.wst.xsd.ui.internal.XSDEditor">
- <propertyTab
- label="%_UI_LABEL_GENERAL"
- category="general"
- id="com.ibm.xmlwebservices.general">
- </propertyTab>
- <propertyTab
- label="%_UI_LABEL_NAMESPACE"
- category="namespace"
- afterTab="com.ibm.xmlwebservices.general"
- id="com.ibm.xmlwebservices.namespace">
- </propertyTab>
- <propertyTab
- label="%_UI_LABEL_OTHER"
- category="other"
- id="com.ibm.xmlwebservices.other">
- </propertyTab>
- <propertyTab
- label="%_UI_LABEL_ATTRIBUTES"
- category="attributes"
- id="com.ibm.xmlwebservices.attributes">
- </propertyTab>
- <propertyTab
- label="%_UI_LABEL_ENUMERATIONS"
- category="enumerations"
- id="com.ibm.xmlwebservices.enumerations">
- </propertyTab>
- <propertyTab
- label="%_UI_LABEL_DOCUMENTATION"
- category="documentation"
- id="com.ibm.xmlwebservices.documentation">
- </propertyTab>
- <propertyTab
- label="%_UI_SECTION_ADVANCED_ATTRIBUTES"
- category="facets"
- id="com.ibm.xmlwebservices.facets">
- </propertyTab>
- </propertyTabs>
- </extension>
-
- <!--
- <extension point="org.eclipse.wst.xml.uriresolver.catalogContributor">
- <catalogContributor catalogId="default">
- <mappingInfo key="http://www.w3.org/2001/XMLSchema" uri="w3c/XMLSchema.xsd"/>
- </catalogContributor>
- </extension>
- -->
-
-</plugin>
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/AbstractXSDDataTypeValueExtension.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/AbstractXSDDataTypeValueExtension.java
deleted file mode 100644
index 323cb9480f..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/AbstractXSDDataTypeValueExtension.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal;
-import java.util.Vector;
-
-import org.eclipse.wst.common.contentmodel.CMNode;
-import org.eclipse.wst.common.contentmodel.modelquery.ModelQuery;
-import org.eclipse.wst.common.contentmodel.modelquery.extension.DataTypeValueExtension;
-import org.eclipse.wst.xsd.ui.internal.util.TypesHelper;
-import org.eclipse.xsd.XSDSchema;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-
- /**
- * This class is used to extend the ModelQuery behaviour so that we can contribute our own
- * 'allowed values' for attributes or elements (e.g. the 'type' attribute).
- */
- public abstract class AbstractXSDDataTypeValueExtension implements DataTypeValueExtension
- {
- protected ModelQuery modelQuery;
-
- public int getType()
- {
- return DATA_TYPE_VALUE_EXTENSION;
- }
-
- public abstract String getId();
-
- public AbstractXSDDataTypeValueExtension(ModelQuery modelQuery)
- {
- this.modelQuery = modelQuery;
- if (modelQuery != null && modelQuery.getExtensionManager() != null)
- {
- modelQuery.getExtensionManager().addExtension(this);
- }
- }
-
- public void dispose()
- {
- if (modelQuery != null && modelQuery.getExtensionManager() != null)
- {
- modelQuery.getExtensionManager().removeExtension(this);
- }
- }
-
- protected abstract XSDSchema getEnclosingXSDSchema(Element element);
-
-
- protected TypesHelper createTypesHelper(XSDSchema schema)
- {
- return new TypesHelper(schema);
- }
-
- public java.util.List getDataTypeValues(Element element, CMNode cmNode)
- {
- java.util.List list = new Vector();
- if (cmNode.getNodeType() == CMNode.ATTRIBUTE_DECLARATION)
- {
- TypesHelper typesHelper = createTypesHelper(getEnclosingXSDSchema(element));
- String name = cmNode.getNodeName();
- String currentElementName = element.getLocalName();
- Node parentNode = element.getParentNode();
- String parentName = "";
- if (parentNode != null)
- {
- parentName = parentNode.getLocalName();
- }
-
- if (checkName(name, "type"))
- {
- if (checkName(currentElementName, "attribute"))
- {
- list = typesHelper.getBuiltInTypeNamesList();
- list.addAll(typesHelper.getUserSimpleTypeNamesList());
- }
- else if (checkName(currentElementName, "element"))
- {
- list = typesHelper.getBuiltInTypeNamesList2();
- list.addAll(typesHelper.getUserSimpleTypeNamesList());
- list.addAll(typesHelper.getUserComplexTypeNamesList());
- }
- }
- else if (checkName(name, "itemType"))
- {
- if (checkName(currentElementName, "list"))
- {
- if (checkName(parentName, "simpleType"))
- {
- list = typesHelper.getBuiltInTypeNamesList();
- list.addAll(typesHelper.getUserSimpleTypeNamesList());
- }
- }
- }
- else if (checkName(name, "memberTypes"))
- {
- if (checkName(currentElementName, "union"))
- {
- if (checkName(parentName, "simpleType"))
- {
- list = typesHelper.getBuiltInTypeNamesList();
- list.addAll(typesHelper.getUserSimpleTypeNamesList());
- }
- }
- }
- else if (checkName(name, "base"))
- {
- if (checkName(currentElementName, "restriction"))
- {
- if (checkName(parentName, "simpleType"))
- {
- list = typesHelper.getBuiltInTypeNamesList();
- list.addAll(typesHelper.getUserSimpleTypeNamesList());
- }
- else if (checkName(parentName, "simpleContent"))
- {
- list = typesHelper.getBuiltInTypeNamesList();
- list.addAll(typesHelper.getUserComplexTypeNamesList());
- }
- else if (checkName(parentName, "complexContent"))
- {
- list = typesHelper.getBuiltInTypeNamesList();
- list.addAll(typesHelper.getUserComplexTypeNamesList());
- }
- }
- else if (checkName(currentElementName, "extension"))
- {
- if (checkName(parentName, "simpleContent"))
- {
- list = typesHelper.getBuiltInTypeNamesList();
- list.addAll(typesHelper.getUserComplexTypeNamesList());
- }
- else if (checkName(parentName, "complexContent"))
- {
- list = typesHelper.getBuiltInTypeNamesList();
- list.addAll(typesHelper.getUserComplexTypeNamesList());
- }
- }
- }
- else if (checkName(name, "ref"))
- {
- if (checkName(currentElementName, "element"))
- {
- list = typesHelper.getGlobalElements();
- }
- else if (checkName(currentElementName, "attribute"))
- {
- list = typesHelper.getGlobalAttributes();
- }
- else if (checkName(currentElementName, "attributeGroup"))
- {
- list = typesHelper.getGlobalAttributeGroups();
- }
- else if (checkName(currentElementName, "group"))
- {
- list = typesHelper.getModelGroups();
- }
- }
- else if (checkName(name, "substitutionGroup"))
- {
- if (checkName(currentElementName, "element"))
- {
- list = typesHelper.getGlobalElements();
- }
- }
-/* else if (checkName(name, "refer"))
- {
- if (checkName(currentElementName, "keyref"))
- {
- list = typesHelper.getKeys();
- }
- } */
-
-
- }
- return list;
- }
-
- 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/org/eclipse/wst/xsd/ui/internal/AbstractXSDModelQueryContributor.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/AbstractXSDModelQueryContributor.java
deleted file mode 100644
index 717afe0c59..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/AbstractXSDModelQueryContributor.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal;
-import java.net.URL;
-import java.util.Vector;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.wst.common.contentmodel.modelquery.ModelQuery;
-import org.eclipse.wst.common.contentmodel.util.NamespaceInfo;
-import org.eclipse.wst.xml.core.document.XMLModel;
-import org.eclipse.wst.xml.core.modelquery.ModelQueryUtil;
-import org.w3c.dom.Document;
-
-public abstract class AbstractXSDModelQueryContributor
-{
- protected AbstractXSDDataTypeValueExtension xsdDataTypeValueExtension;
-
- public void setModel(XMLModel model)
- {
- // remove our old DataTypeValueExtension
- //
- if (xsdDataTypeValueExtension != null)
- {
- xsdDataTypeValueExtension.dispose();
- xsdDataTypeValueExtension = null;
- }
-
- setImplicitGrammar(model.getDocument());
-
- // add a new DataTypeValueExtension
- //
- ModelQuery modelQuery = ModelQueryUtil.getModelQuery(model.getDocument());
- xsdDataTypeValueExtension = createXSDDataTypeValueExtension(modelQuery);
- }
-
- protected void setImplicitGrammar(Document document)
- {
-// DOMExtension domExtension = DOMExtensionProviderRegistry.getInstance().getDOMExtension(document);
-// if (domExtension != null)
-// {
- String uri = "platform:/plugin/org.eclipse.wst.xsd.ui/w3c/schemaForCodeAssist.xsd";
- uri = resolvePlatformUrl(uri);
- if (uri != null)
- {
- Vector list = new Vector();
- NamespaceInfo info = new NamespaceInfo("http://www.w3.org/2001/XMLSchema", "xsd", uri);
- info.setProperty("isImplied", "true");
- list.add(info);
-// domExtension.setImplictNamespaceInfoList(list);
- }
-// }
- }
-
- protected static String resolvePlatformUrl(String urlspec)
- {
- String result = null;
- try
- {
- urlspec = urlspec.replace('\\', '/');
- URL url = new URL(urlspec);
- URL resolvedURL = Platform.resolve(url);
- result = resolvedURL.toString();
- }
- catch (Exception e)
- {
- }
- return result;
- }
-
- public abstract AbstractXSDDataTypeValueExtension createXSDDataTypeValueExtension(ModelQuery modelQuery);
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDActionBarContributor.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDActionBarContributor.java
deleted file mode 100644
index f66de6e8b2..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDActionBarContributor.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-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.jface.resource.ImageDescriptor;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.actions.RetargetAction;
-import org.eclipse.ui.part.MultiPageEditorActionBarContributor;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.ui.texteditor.ITextEditorActionConstants;
-import org.eclipse.wst.xsd.ui.internal.actions.ISchemaEditorActionConstants;
-import org.eclipse.wst.xsd.ui.internal.actions.ReloadDependenciesAction;
-
-public class XSDActionBarContributor extends MultiPageEditorActionBarContributor
-{
- protected XSDEditor xsdEditor;
- protected XSDTextEditor textEditor;
-
- protected ReloadDependenciesAction reloadDependenciesAction;
-
- protected List fPartListeners= new ArrayList();
-
- protected RetargetAction retargetReloadDependenciesAction;
-
- /**
- * Constructor for XSDActionBarContributor.
- */
- public XSDActionBarContributor()
- {
- super();
-
- // Reload Dependencies
- reloadDependenciesAction = new ReloadDependenciesAction(XSDEditorPlugin.getXSDString("_UI_MENU_RELOAD_DEPENDENCIES"));
- retargetReloadDependenciesAction = new RetargetAction(ISchemaEditorActionConstants.RETARGET_RELOAD_DEPENDENCIES_ACTION_ID, XSDEditorPlugin.getXSDString("_UI_MENU_RELOAD_DEPENDENCIES"));
- retargetReloadDependenciesAction.setToolTipText(XSDEditorPlugin.getXSDString("_UI_MENU_RELOAD_DEPENDENCIES_TOOLTIP"));
- retargetReloadDependenciesAction.setImageDescriptor(
- ImageDescriptor.createFromFile(XSDEditorPlugin.getPlugin().getClass(), "icons/reloadgrammar.gif"));
- fPartListeners.add(retargetReloadDependenciesAction);
- }
-
- protected void updateActions()
- {
- if (xsdEditor != null && xsdEditor.getCurrentPageType().equals(XSDEditorPlugin.GRAPH_PAGE))
- {
- IAction deleteAction = xsdEditor.getGraphViewer().getComponentViewer().getMenuListener().getDeleteAction();
- getActionBars().setGlobalActionHandler(ActionFactory.DELETE.getId(), deleteAction);
-
- IAction printGraphAction = xsdEditor.getGraphViewer().getPrintGraphAction();
- getActionBars().setGlobalActionHandler(ActionFactory.PRINT.getId(), printGraphAction);
- }
- else
- {
- getActionBars().setGlobalActionHandler(ActionFactory.DELETE.getId(), null);
- // always enable print regardless of whether we are on source or design
- updateAction(ActionFactory.PRINT.getId(), ITextEditorActionConstants.PRINT, true);
- }
- }
-
- public void setActivePage(IEditorPart activeEditor)
- {
- updateActions();
- getActionBars().updateActionBars();
- }
-
- protected void updateAction(String globalActionId, String textEditorActionId, boolean enable)
- {
- getActionBars().setGlobalActionHandler(globalActionId,
- enable ? getAction(textEditor, textEditorActionId) :
- null);
- }
-
- /**
- * Returns the action registed with the given text editor.
- * @return IAction or null if editor is null.
- */
- protected IAction getAction(ITextEditor editor, String actionID)
- {
- try
- {
- return (editor == null ? null : editor.getAction(actionID));
- }
- catch (Exception e)
- {
- return null;
- }
- }
-
- private IMenuManager editMenu;
-
- public void addToMenu(IMenuManager menuManager)
- {
- editMenu = menuManager.findMenuUsingPath(IWorkbenchActionConstants.M_EDIT);
-
- MenuManager treeMenu = new MenuManager(XSDEditorPlugin.getXSDString("_UI_MENU_XSD_EDITOR"));
- menuManager.insertAfter(IWorkbenchActionConstants.MB_ADDITIONS, treeMenu);
-
- treeMenu.add(new Separator("group1"));
-// Add retarget actions
-
- treeMenu.add(retargetReloadDependenciesAction);
-
- treeMenu.add(new Separator("group2"));
- }
-
-
-public void addToToolBar(IToolBarManager toolBarManager)
- {
- toolBarManager.add(new Separator("XMLSchema.2"));
-// Add retarget actions
- toolBarManager.add(retargetReloadDependenciesAction);
-
- toolBarManager.add(new Separator("XMLSchema.1"));
-
- toolBarManager.add(new Separator());
- }
-
- public void contributeToToolBar(IToolBarManager toolBarManager)
- {
- addToToolBar(toolBarManager);
- }
-
- public void contributeToMenu(IMenuManager menuManager)
- {
- addToMenu(menuManager);
- }
-
- /**
- * @see org.eclipse.ui.IEditorActionBarContributor#setActiveEditor(IEditorPart)
- */
- public void setActiveEditor(IEditorPart targetEditor)
- {
- super.setActiveEditor(targetEditor);
-
- if (targetEditor instanceof XSDEditor)
- {
- xsdEditor = (XSDEditor) targetEditor;
- reloadDependenciesAction.setEditor((XSDEditor)targetEditor);
-
- textEditor = ((XSDEditor)targetEditor).getXSDTextEditor();
- if (textEditor != null)
- {
- updateActions();
- getActionBars().updateActionBars();
- }
- }
- }
-
- public void init(IActionBars bars, IWorkbenchPage page)
- {
- Iterator e = fPartListeners.iterator();
- while (e.hasNext())
- {
- page.addPartListener((RetargetAction) e.next());
- }
-
- // register actions that have a dynamic editor.
-
- bars.setGlobalActionHandler(ISchemaEditorActionConstants.RETARGET_RELOAD_DEPENDENCIES_ACTION_ID, reloadDependenciesAction);
-
- super.init(bars, page);
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDContentOutlinePage.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDContentOutlinePage.java
deleted file mode 100644
index fb417488aa..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDContentOutlinePage.java
+++ /dev/null
@@ -1,378 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.views.contentoutline.ContentOutlinePage;
-import org.eclipse.wst.xsd.ui.internal.actions.OpenSchemaAction;
-import org.eclipse.wst.xsd.ui.internal.provider.CategoryAdapter;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.XSDSchemaDirective;
-import org.w3c.dom.Element;
-
-public class XSDContentOutlinePage extends ContentOutlinePage
-{
- protected XSDEditor xsdEditor;
- protected int level = 0;
- protected Object model;
- protected ITreeContentProvider contentProvider;
- protected ILabelProvider labelProvider;
- protected XSDSelectionManager selectionManager;
- protected SelectionManagerSelectionChangeListener selectionManagerSelectionChangeListener = new SelectionManagerSelectionChangeListener();
- protected TreeSelectionChangeListener treeSelectionChangeListener = new TreeSelectionChangeListener();
- XSDTextEditor xsdTextEditor;
- XSDMenuListener menuListener;
-
- /**
- *
- */
- public XSDContentOutlinePage(XSDTextEditor xsdTextEditor)
- {
- super();
- this.xsdTextEditor = xsdTextEditor;
- }
-
- public void setModel(Object newModel)
- {
- model = newModel;
- }
-
- public void setContentProvider(ITreeContentProvider contentProvider)
- {
- this.contentProvider = contentProvider;
- }
-
- public void setLabelProvider(ILabelProvider labelProvider)
- {
- this.labelProvider = labelProvider;
- }
-
- // expose
- public TreeViewer getTreeViewer()
- {
- return super.getTreeViewer();
- }
-
- public void createControl(Composite parent)
- {
- super.createControl(parent);
- getTreeViewer().setContentProvider(contentProvider);
- getTreeViewer().setLabelProvider(labelProvider);
- getTreeViewer().setInput(model);
- getTreeViewer().addSelectionChangedListener(this);
- MenuManager menuManager = new MenuManager("#popup");//$NON-NLS-1$
- menuManager.setRemoveAllWhenShown(true);
- Menu menu = menuManager.createContextMenu(getTreeViewer().getControl());
- getTreeViewer().getControl().setMenu(menu);
- menuListener = new XSDMenuListener(xsdTextEditor.getXSDEditor().getSelectionManager());
-// menuListener.setSelectionProvider(getTreeViewer());
- menuManager.addMenuListener(menuListener);
- setSelectionManager(xsdTextEditor.getXSDEditor().getSelectionManager());
- // cs... why are we doing this from the outline view?
- //
- //xsdTextEditor.getXSDEditor().getSelectionManager().setSelection(new
- // StructuredSelection(xsdTextEditor.getXSDSchema()));
- XSDKeyListener keyListener = new XSDKeyListener(getTreeViewer(), menuListener);
- getTreeViewer().getControl().addKeyListener(keyListener);
- // drill down from outline view
- getTreeViewer().getControl().addMouseListener(new MouseAdapter()
- {
- public void mouseDoubleClick(MouseEvent e)
- {
- ISelection iSelection = getTreeViewer().getSelection();
- if (iSelection instanceof StructuredSelection)
- {
- StructuredSelection selection = (StructuredSelection)iSelection;
- Object obj = selection.getFirstElement();
- if (obj instanceof XSDConcreteComponent)
- {
- XSDConcreteComponent comp = (XSDConcreteComponent)obj;
- if (comp.getContainer() instanceof XSDSchema)
- {
- xsdTextEditor.getXSDEditor().getGraphViewer().setInput(obj);
- }
- }
- }
-
- }
- });
- }
- class XSDKeyListener extends KeyAdapter
- {
- TreeViewer viewer;
- XSDMenuListener menuListener;
-
- public XSDKeyListener(TreeViewer viewer, XSDMenuListener menuListener)
- {
- super();
- this.viewer = viewer;
- this.menuListener = menuListener;
- }
-
- /**
- * @see org.eclipse.swt.events.KeyAdapter#keyReleased(KeyEvent)
- */
- public void keyReleased(KeyEvent e)
- {
- if (e.character == SWT.DEL)
- {
- menuListener.getDeleteAction().run();
- }
- else if (e.keyCode == SWT.F3) // open editor on any
- // include/import/redefine
- {
- if (e.widget instanceof Tree)
- {
- Tree tree = (Tree) e.widget;
- TreeItem[] selection = tree.getSelection();
- if (selection.length > 0)
- {
- if (selection[0].getData() instanceof XSDSchemaDirective)
- {
- XSDSchemaDirective comp = (XSDSchemaDirective) selection[0].getData();
- OpenSchemaAction openSchema = new OpenSchemaAction(XSDEditorPlugin.getXSDString("_UI_ACTION_OPEN_SCHEMA"), comp);
- openSchema.run();
- }
- }
- }
- }
- }
- }
-
- public void setExpandToLevel(int i)
- {
- level = i;
- }
-
- public void setInput(Object value)
- {
- getTreeViewer().setInput(value);
- getTreeViewer().expandToLevel(level);
- }
-
- // public ISelection getSelection()
- // {
- // if (getTreeViewer() == null)
- // return StructuredSelection.EMPTY;
- // return getTreeViewer().getSelection();
- // }
- public void setSelectionManager(XSDSelectionManager newSelectionManager)
- {
- TreeViewer treeViewer = getTreeViewer();
- // disconnect from old one
- if (selectionManager != null)
- {
- selectionManager.removeSelectionChangedListener(selectionManagerSelectionChangeListener);
- treeViewer.removeSelectionChangedListener(treeSelectionChangeListener);
- }
- selectionManager = newSelectionManager;
- // connect to new one
- if (selectionManager != null)
- {
- selectionManager.addSelectionChangedListener(selectionManagerSelectionChangeListener);
- treeViewer.addSelectionChangedListener(treeSelectionChangeListener);
- }
- }
- class SelectionManagerSelectionChangeListener implements ISelectionChangedListener
- {
- public void selectionChanged(SelectionChangedEvent event)
- {
- if (event.getSelectionProvider() != getTreeViewer())
- {
- getTreeViewer().setSelection(event.getSelection(), true);
- }
- }
- }
- class TreeSelectionChangeListener implements ISelectionChangedListener
- {
- public void selectionChanged(SelectionChangedEvent event)
- {
- if (selectionManager != null)
- {
- ISelection selection = event.getSelection();
- if (selection instanceof IStructuredSelection)
- {
- IStructuredSelection structuredSelection = (IStructuredSelection) selection;
- Object o = structuredSelection.getFirstElement();
- // TODO ...
- // we need to implement a selectionManagerMapping extension point
- // so that extensions can specify how they'd like to map view objects
- // to selection objects
- //
- if (o instanceof Element)
- {
- try
- {
- Object modelObject = xsdTextEditor.getXSDSchema().getCorrespondingComponent((Element) o);
- if (modelObject != null)
- {
- o = modelObject;
- }
- }
- catch (Exception e)
- {
- }
- }
- else if (o instanceof CategoryAdapter)
- {
- // todo... we need to ensure we eliminate the propagation
- // of 'view' specific objects into the SelectionManager.
- // We need to do some work to ensure all views utilize the 'Category' model object
- // so we can get rid of this CategoryAdapter class.
-// CategoryAdapter adapter = (CategoryAdapter) o;
-// o = adapter.getXSDSchema();
- }
- if (o != null)
- {
- selectionManager.setSelection(new StructuredSelection(o), getTreeViewer());
-// selectionManager.selectionChanged(new SelectionChangedEvent(getTreeViewer(),new StructuredSelection(o)));
- }
- else
- {
- // selectionManager.setSelection(new StructuredSelection(),
- // getTreeViewer());
- }
- }
- }
- }
- }
- FilterAction referenceAction, inheritedAction;
-
- public void setActionBars(IActionBars actionBars)
- {
- super.setActionBars(actionBars);
- // Uncomment to add sort action
- // SortAction sortAction = new SortAction();
- //
- // actionBars.getToolBarManager().add(sortAction);
- // sortAction.setChecked(false);
- referenceAction = new FilterAction(new ReferenceFilter("Reference Content"), XSDEditorPlugin.getXSDString("_UI_OUTLINE_SHOW_REFERENCES"), ImageDescriptor.createFromFile(XSDEditorPlugin
- .getPlugin().getClass(), "icons/XSDElementRef.gif"));
- boolean initialRef = xsdTextEditor.getXSDModelAdapterFactory().getShowReferences();
- referenceAction.setChecked(initialRef);
- inheritedAction = new FilterAction(new ReferenceFilter("Inherited Content"), XSDEditorPlugin.getXSDString("_UI_OUTLINE_SHOW_INHERITED"), ImageDescriptor.createFromFile(XSDEditorPlugin.getPlugin()
- .getClass(), "icons/XSDComplexContent.gif"));
- boolean initialInherited = xsdTextEditor.getXSDModelAdapterFactory().getShowReferences();
- IMenuManager menu = actionBars.getMenuManager();
- menu.add(referenceAction);
- menu.add(inheritedAction);
- }
-
- private void updateActions(Action current)
- {
- if (referenceAction.isChecked())
- {
- xsdTextEditor.getXSDModelAdapterFactory().setShowReferences(true);
- }
- else
- {
- xsdTextEditor.getXSDModelAdapterFactory().setShowReferences(false);
- }
- if (inheritedAction.isChecked())
- {
- xsdTextEditor.getXSDModelAdapterFactory().setShowInherited(true);
- }
- else
- {
- xsdTextEditor.getXSDModelAdapterFactory().setShowInherited(false);
- }
- }
- private Sorter sorter = new Sorter();
- public class Sorter extends org.eclipse.jface.viewers.ViewerSorter
- {
- }
- public class SortAction extends Action
- {
- public SortAction()
- {
- super("Sort", ImageDescriptor.createFromFile(XSDEditorPlugin.getPlugin().getClass(), "icons/sort.gif"));
- }
-
- public void run()
- {
- getTreeViewer().getControl().setVisible(false);
- Object[] expandedElements = getTreeViewer().getExpandedElements();
- getTreeViewer().setSorter(isChecked() ? sorter : null);
- Object input = getTreeViewer().getInput();
- getTreeViewer().setInput(input);
- getTreeViewer().setExpandedElements(expandedElements);
- getTreeViewer().getControl().setVisible(true);
- }
-
- public void setChecked(boolean checked)
- {
- super.setChecked(checked);
- setToolTipText(checked ? XSDEditorPlugin.getXSDString("_UI_OUTLINE_DO_NOT_SORT") : XSDEditorPlugin.getXSDString("_UI_OUTLINE_SORT"));
- }
- }
- public class FilterAction extends Action
- {
- ViewerFilter filter;
-
- public FilterAction(ViewerFilter filter, String label, ImageDescriptor image)
- {
- super(label, image);
- this.filter = filter;
- setChecked(false);
- }
-
- public void run()
- {
- updateActions(this);
- if (isChecked())
- {
- getTreeViewer().resetFilters();
- getTreeViewer().addFilter(filter);
- }
- else
- {
- getTreeViewer().removeFilter(filter);
- }
- }
- }
- class ReferenceFilter extends ViewerFilter // Dummy filter
- {
- public ReferenceFilter(String elementTag)
- {
- this.elementTag = elementTag;
- }
- protected String elementTag;
-
- public boolean select(Viewer viewer, Object parentElement, Object element)
- {
- return true;
- }
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDEditor.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDEditor.java
deleted file mode 100644
index 2235ff5fde..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDEditor.java
+++ /dev/null
@@ -1,1148 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal;
-
-import java.util.ArrayList;
-import java.util.EventObject;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.emf.common.command.BasicCommandStack;
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.common.command.CommandStackListener;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-//import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IPartListener;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.editors.text.JavaFileEditorInput;
-import org.eclipse.ui.views.properties.PropertySheet;
-import org.eclipse.wst.common.ui.properties.ITabbedPropertySheetPageContributor;
-import org.eclipse.wst.sse.core.INodeAdapter;
-import org.eclipse.wst.sse.core.INodeNotifier;
-import org.eclipse.wst.sse.core.IStructuredModel;
-import org.eclipse.wst.sse.core.exceptions.SourceEditingRuntimeException;
-import org.eclipse.wst.sse.core.internal.SSECorePlugin;
-import org.eclipse.wst.sse.core.undo.IStructuredTextUndoManager;
-import org.eclipse.wst.sse.ui.StructuredTextEditor;
-import org.eclipse.wst.xml.core.document.XMLModel;
-import org.eclipse.wst.xml.core.internal.document.XMLModelImpl;
-import org.eclipse.wst.xsd.ui.internal.graph.XSDGraphViewer;
-import org.eclipse.wst.xsd.ui.internal.util.OpenOnSelectionHelper;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDPackage;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.impl.XSDSchemaImpl;
-import org.eclipse.xsd.util.XSDConstants;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.ProcessingInstruction;
-
-// public class XSDEditor extends StructuredTextMultiPageEditorPart
-public class XSDEditor extends XSDMultiPageEditorPart implements ITabbedPropertySheetPageContributor
-{
- protected XSDTextEditor textEditor;
- IFile resourceFile;
- XSDSelectionManager xsdSelectionManager;
-
- private IStructuredModel result;
- private XMLModelImpl model;
-
- public XSDEditor()
- {
- super();
- xsdSelectionManager = new XSDSelectionManager();
- }
-
- InternalPartListener partListener = new InternalPartListener(this);
-
- // show outline view - defect 266116
- public void init(IEditorSite site, IEditorInput editorInput) throws PartInitException
- {
- super.init(site, editorInput);
-
- IWorkbenchWindow dw=PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- IWorkbenchPage page=dw.getActivePage();
- getSite().getPage().addPartListener(partListener);
- try
- {
- if (page != null)
- {
-// page.showView("org.eclipse.ui.views.ContentOutline");
- page.showView("org.eclipse.ui.views.PropertySheet");
- }
- } catch (PartInitException e)
- {
-// e.printStackTrace();
- }
- }
-
- // For team support
- // protected PropertyDirtyChangeListener propertyChangeListener;
-
- /**
- * Creates the pages of this multi-page editor.
- * <p>
- * Subclasses of <code>MultiPageEditor</code> must implement this method.
- * </p>
- */
- protected void createPages()
- {
- try
- {
- if (!loadFile())
- return;
-
- // source page MUST be created before design page, now
- createSourcePage();
-
- addSourcePage();
- buildXSDModel();
-
- // comment this line out to hide the graph page
- //
- createAndAddGraphPage();
-
- int pageIndexToShow = getDefaultPageTypeIndex();
- setActivePage(pageIndexToShow);
-
- addCommandStackListener();
-
- XSDEditorPlugin.getPlugin().getPreferenceStore().addPropertyChangeListener(preferenceStoreListener);
- }
- catch (PartInitException exception)
- {
- throw new SourceEditingRuntimeException(SSECorePlugin.getResourceString("An_error_has_occurred_when1_ERROR_")); //$NON-NLS-1$ = "An error has occurred when initializing the input for the the editor's source page."
- }
- }
-
- public String[] getPropertyCategories()
- {
- return new String[] { "general", "namespace", "other", "attributes", "documentation", "facets" }; //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.wst.common.ui.properties.ITabbedPropertySheetPageContributor#getContributorId()
- */
- public String getContributorId()
- {
- return "org.eclipse.wst.xsd.ui.internal.XSDEditor";
- //return getSite().getId();
- }
-
- protected CommandStackListener commandStackListener;
- protected void addCommandStackListener()
- {
- if (commandStackListener == null)
- {
- IStructuredTextUndoManager undoManager = getModel().getUndoManager();
- commandStackListener = new CommandStackListener()
- {
- /**
- * @see org.eclipse.emf.common.command.CommandStackListener#commandStackChanged(EventObject)
- */
- public void commandStackChanged(EventObject event)
- {
- Object obj = event.getSource();
- if (obj instanceof BasicCommandStack)
- {
- BasicCommandStack stack = (BasicCommandStack) obj;
- Command recentCommand = stack.getMostRecentCommand();
- Command redoCommand = stack.getRedoCommand();
- Command undoCommand = stack.getUndoCommand();
- if (recentCommand == redoCommand)
- {
- // there must have been an undo reset info tasks
- resetInformationTasks();
- }
- }
- }
- };
-
-//TODO WTP Port undoManager.getCommandStack().addCommandStackListener(commandStackListener);
-
- }
- }
-
- protected void pageChange(int arg)
- {
- super.pageChange(arg);
- }
-
- protected void removeCommandStackListener()
- {
- if (commandStackListener != null)
- {
- IStructuredTextUndoManager undoManager = getModel().getUndoManager();
-//TODO WTP Port undoManager.getCommandStack().removeCommandStackListener(commandStackListener);
- }
- }
-
- // This is from the IValidateEditEditor interface
-/* public void undoChange()
- {
- StructuredTextUndoManager undoManager = textEditor.getModel().getUndoManager();
- undoManager.undo();
- // Make the editor clean
- textEditor.getModel().setDirtyState(false);
- } */
-
- private class PreferenceStoreListener implements IPropertyChangeListener
- {
- /**
- * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(PropertyChangeEvent)
- */
- public void propertyChange(PropertyChangeEvent event)
- {
- }
- }
-
- protected IPropertyChangeListener preferenceStoreListener = new PreferenceStoreListener();
-
- protected int getDefaultPageTypeIndex()
- {
- int pageIndex = sourcePageIndex;
-
- if (XSDEditorPlugin.getPlugin().getDefaultPage().equals(XSDEditorPlugin.GRAPH_PAGE))
- {
- if (graphPageIndex != -1)
- pageIndex = graphPageIndex;
- }
-
- return pageIndex;
- }
-
- int currentPage = -1;
- public String getCurrentPageType()
- {
- // should update pref. for valid pages
- if (getActivePage() != -1)
- {
- currentPage = getActivePage();
- }
- if (currentPage == graphPageIndex)
- {
- return XSDEditorPlugin.GRAPH_PAGE;
- }
- else
- {
- return XSDEditorPlugin.SOURCE_PAGE;
- }
- }
-
- public Object getActivePart()
- {
- return getSite().getWorkbenchWindow().getActivePage().getActivePart();
- }
-
- public void dispose()
- {
-// propertyChangeListener.dispose();
- removeCommandStackListener();
-
- XSDEditorPlugin.getPlugin().setDefaultPage(getCurrentPageType());
- XSDEditorPlugin.getPlugin().getPreferenceStore().removePropertyChangeListener(preferenceStoreListener);
-
- getSite().getPage().removePartListener(partListener);
-
- super.dispose();
- }
-
- protected boolean loadFile()
- {
- Object input = getEditorInput();
-
- if (input instanceof IFileEditorInput)
- {
- resourceFile = ((IFileEditorInput) input).getFile();
- }
- else if (input instanceof JavaFileEditorInput)
- {
- IPath path = ((JavaFileEditorInput)input).getPath(input);
- String ext = path.getFileExtension();
- if (ext != null && ext.equals("xsd"))
- {
- return true;
- }
- return false;
- }
- else
- {
-// XSDEditorPlugin.getPlugin().getMsgLogger().write("###Error...XSDEditor::createPages() .. Can't find input..Exiting..");
- return false;
- }
- return true;
- }
-
- /**
- * 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)
- {
- openOnSelectionHelper.openOnGlobalReference(comp);
- }
-
- protected OpenOnSelectionHelper openOnSelectionHelper;
-
- public OpenOnSelectionHelper getOpenOnSelectionHelper()
- {
- return openOnSelectionHelper;
- }
-
- /**
- * @see org.eclipse.wst.xsd.ui.internal.XSDMultiPageEditorPart#createTextEditor()
- */
- protected StructuredTextEditor createTextEditor()
- {
- return new XSDTextEditor(this);
- }
-
- /*
- * @see StructuredTextMultiPageEditorPart#createSourcePage()
- */
- protected void createSourcePage() throws PartInitException
- {
- super.createSourcePage();
-
- textEditor = (XSDTextEditor) getTextEditor();
-
- openOnSelectionHelper = new OpenOnSelectionHelper(textEditor);
- }
-
- int sourcePageIndex = -1;
- /**
- * Adds the source page of the multi-page editor.
- */
- protected void addSourcePage() throws PartInitException {
-
- sourcePageIndex = addPage(textEditor, getEditorInput());
- setPageText(sourcePageIndex, XSDEditorPlugin.getXSDString("_UI_TAB_SOURCE"));
-
- // defect 223043 ... do textEditor.setModel() here instead of in createSourcePage()
- // the update's critical, to get viewer selection manager and highlighting to work
- IEditorInput editorInput = getEditorInput();
- if (editorInput instanceof IFileEditorInput)
- {
- textEditor.setModel((IFileEditorInput)getEditorInput());
- }
- else
- {
-// textEditor.setModel(editorInput);
- }
- textEditor.update();
- firePropertyChange(PROP_TITLE);
- }
-
- int graphPageIndex = -1;
- XSDGraphViewer graphViewer;
-
- /**
- * Creates the graph page and adds it to the multi-page editor.
- */
- protected void createAndAddGraphPage() throws PartInitException
- {
- graphViewer = new XSDGraphViewer(this);
- graphViewer.setSchema(xsdSchema);
- Control graphControl = graphViewer.createControl(getContainer());
- graphPageIndex = addPage(graphControl);
- setPageText(graphPageIndex, XSDEditorPlugin.getXSDString("_UI_TAB_GRAPH"));
-
- // graphViewer.setViewerSelectionManager(textEditor.getViewerSelectionManager());
- graphViewer.setSelectionManager(getSelectionManager());
-
- // this forces the editor to initially select the top level schema object
- //
- getSelectionManager().setSelection(new StructuredSelection(textEditor.getXSDSchema()));
- }
-
- /*
- * @see IAdaptable#getAdapter(Class)
- */
- public Object getAdapter(Class key)
- {
- Object result = null;
- if (key == ISelectionProvider.class)
- {
- result = xsdSelectionManager;
- }
- else
- {
- result = textEditor.getAdapter(key);
- }
- return result;
- }
-
- public XSDSelectionManager getSelectionManager()
- {
- return xsdSelectionManager;
- }
-
- /**
- * @see org.eclipse.wst.xsd.ui.internal.XSDMultiPageEditorPart#doSaveAs()
- */
- public void doSaveAs()
- {
- super.doSaveAs();
- }
-
- public void doSave(org.eclipse.core.runtime.IProgressMonitor monitor)
- {
- super.doSave(monitor);
- }
-
- protected XSDSchema xsdSchema;
- protected ResourceSet resourceSet;
-
- public void reparseSchema()
- {
- Document document = ((XMLModel)getModel()).getDocument();
- createSchema(document.getDocumentElement());
- }
-
- public XSDSchema createSchema(Node node)
- {
- try
- {
- EPackage.Registry reg = EPackage.Registry.INSTANCE;
- XSDPackage xsdPackage = (XSDPackage)reg.getEPackage(XSDPackage.eNS_URI);
- xsdSchema = xsdPackage.getXSDFactory().createXSDSchema();
-
- // Force the loading of the "meta" schema for schema instance instance.
- //
- String schemaForSchemaNamespace = node.getNamespaceURI();
- XSDSchemaImpl.getSchemaForSchema(schemaForSchemaNamespace);
-
- resourceSet = XSDSchemaImpl.createResourceSet();
- resourceSet.setURIConverter(new XSDURIConverter(resourceFile));
-
- String pathName = "";
- // If the resource is in the workspace....
- // otherwise the user is trying to open an external file
- if (resourceFile != null)
- {
- pathName = resourceFile.getFullPath().toString();
- Resource resource = resourceSet.getResource(URI.createPlatformResourceURI(pathName), true);
-// resource.getContents().add(xsdSchema);
- resourceSet.getResources().add(resource);
-
- Object obj = resource.getContents().get(0);
- if (obj instanceof XSDSchema)
- {
- xsdSchema = (XSDSchema)obj;
- }
-
-// URIConverter uriConverter = resourceSet.getURIConverter();
-// resourceSet.setURIConverter(new XSDURIConverter(resourceFile));
-
- xsdSchema.setElement((Element)node);
- resource.setModified(false);
- }
- else
- {
- xsdSchema.setElement((Element)node);
- }
- }
- catch (StackOverflowError e)
- {
-// XSDEditorPlugin.getPlugin().getMsgLogger().write("Stack overflow encountered. Possibly an invalid recursive circular schema");
- }
- catch (Exception ex)
- {
-// ex.printStackTrace();
- }
-
- return xsdSchema;
- }
-
- class XSDDocumentAdapter extends DocumentAdapter
- {
- INodeNotifier currentNotifier;
- int currentEventType;
-
- public XSDDocumentAdapter(Document document)
- {
- super(document);
- }
-
- boolean handlingNotifyChanged = false;
-
- public void notifyChanged(INodeNotifier notifier, int eventType, Object feature, Object oldValue, Object newValue, int index)
- {
- if (eventType == INodeNotifier.REMOVE) // don't handle remove events
- {
- return;
- }
-
- if (!handlingNotifyChanged)
- {
- handlingNotifyChanged = true;
- try
- {
- // delay handle events only in the source view
- if (getCurrentPageType() == XSDEditorPlugin.SOURCE_PAGE &&
- !(getActivePart() instanceof PropertySheet) &&
- !(getActivePart() instanceof org.eclipse.ui.views.contentoutline.ContentOutline)) {
- startDelayedEvent(notifier, eventType, feature, oldValue, newValue, index);
- //handleNotifyChange(notifier, eventType, feature, oldValue, newValue, index);
- }
- else // all other views, just handle the events right away
- {
- handleNotifyChange(notifier, eventType, feature, oldValue, newValue, index);
- }
- }
- catch (Exception e)
- {
-// XSDEditorPlugin.getPlugin().getMsgLogger().write(e);
- }
- handlingNotifyChanged = false;
- }
- }
-
- public void handleNotifyChange(INodeNotifier notifier, int eventType, Object feature, Object oldValue, Object newValue, int index)
- {
-// System.out.println(eventType + " : HandleNotifyChange " + notifier.hashCode() + " notifier " + notifier);
- switch (eventType)
- {
- case INodeNotifier.ADD:
- {
- if (newValue instanceof Element)
- {
- adapt((Element)newValue);
-// Add updateParentForDerivation(node, listener);
- }
- break;
- }
- case INodeNotifier.CHANGE:
- {
- Node node = (Node)notifier;
- XSDConcreteComponent listener = xsdSchema.getCorrespondingComponent(node);
- listener.elementAttributesChanged((Element)node);
- listener.elementChanged((Element)node);
- break;
- }
- case INodeNotifier.STRUCTURE_CHANGED:
- case INodeNotifier.CONTENT_CHANGED:
- {
- Node node = (Node)notifier;
- XSDConcreteComponent listener = xsdSchema.getCorrespondingComponent(node);
- if (node.getNodeType() == Node.ELEMENT_NODE)
- {
- listener.elementContentsChanged((Element)node);
- break;
- }
- else if (node.getNodeType() == Node.DOCUMENT_NODE)
- {
- Element docElement = ((Document)node).getDocumentElement();
- // Need to add check if doc element is being edited in the source
- if (docElement != null)
- {
- String prefix = docElement.getPrefix();
- String xmlnsString = prefix == null? "xmlns" : "xmlns:" + prefix;
- Attr attr = docElement.getAttributeNode(xmlnsString);
- boolean doParse = false;
- if (attr != null)
- {
- if (attr.getValue().equals("http://www.w3.org/2001/XMLSchema") && docElement.getLocalName().equals("schema"))
- {
- // We have a viable schema so parse it
- doParse = true;
- }
- }
-
- if (doParse)
- {
- adapt(docElement);
- xsdSchema.setElement(docElement);
- }
- }
- }
- break;
- }
- }
- }
-
- protected DelayedEvent delayedTask;
- protected void startDelayedEvent(INodeNotifier notifier, int eventType, Object feature, Object oldValue, Object newValue, int index)
- {
-// System.out.println("start delayed event");
- // check if there is already a delayed task for the same notifier and eventType
-// if (delayedTask != null)
-// {
-// Notifier aNotifier = delayedTask.getNotifier();
-// int anEventType = delayedTask.getEventType();
-// if (notifier == aNotifier && anEventType == eventType)
-// {
-// // same event, just different data, delay new event
-// delayedTask.setCancel(true);
-// }
-// }
-
- delayedTask = new DelayedEvent();
-
- delayedTask.setNotifier(notifier);
- delayedTask.setEventType(eventType);
- delayedTask.setFeature(feature);
- delayedTask.setOldValue(oldValue);
- delayedTask.setNewValue(newValue);
- delayedTask.setIndex(index);
-
- Display.getDefault().timerExec(400,delayedTask);
- }
-
- class DelayedEvent implements Runnable
- {
- INodeNotifier notifier;
- int eventType;
- Object feature;
- Object oldValue;
- Object newValue;
- int index;
- boolean cancelEvent = false;
-
- /*
- * @see Runnable#run()
- */
- public void run()
- {
- if (!cancelEvent)
- {
- handleNotifyChange(notifier, eventType, feature, oldValue, newValue, index);
- if (delayedTask == this)
- {
- delayedTask = null;
- }
- }
- }
-
- public void setCancel(boolean flag)
- {
- cancelEvent = flag;
- }
-
- public void setNotifier(INodeNotifier notifier)
- {
- this.notifier = notifier;
- }
-
- public void setEventType(int eventType)
- {
- this.eventType = eventType;
- }
-
- public void setFeature(Object feature)
- {
- this.feature = feature;
- }
-
- public void setOldValue(Object oldValue)
- {
- this.oldValue = oldValue;
- }
-
- public void setNewValue(Object newValue)
- {
- this.newValue = newValue;
- }
-
- public void setIndex(int index)
- {
- this.index = index;
- }
-
- public INodeNotifier getNotifier()
- {
- return notifier;
- }
-
- public int getEventType()
- {
- return eventType;
- }
-
- public Object getNewValue()
- {
- return newValue;
- }
-
- public Object getOldValue()
- {
- return oldValue;
- }
-
- }
- }
-
- abstract class DocumentAdapter implements INodeAdapter
- {
- public DocumentAdapter(Document document)
- {
- ((INodeNotifier)document).addAdapter(this);
- adapt(document.getDocumentElement());
- }
-
- public void adapt(Element element)
- {
- if (((INodeNotifier)element).getExistingAdapter(this) == null)
- {
-
- ((INodeNotifier)element).addAdapter(this);
-
- for (Node child = element.getFirstChild(); child != null; child = child.getNextSibling())
- {
- if (child.getNodeType() == Node.ELEMENT_NODE)
- {
- adapt((Element)child);
- }
- }
- }
- }
-
- public boolean isAdapterForType(Object type)
- {
- return type == this;
- }
-
- abstract public void notifyChanged
- (INodeNotifier notifier, int eventType, Object feature, Object oldValue, Object newValue, int index);
- }
-
-
- /**
- * Method createDefaultSchemaNode. Should only be called to insert a schema node into an empty document
- */
- public void createDefaultSchemaNode()
- {
- Document document = ((XMLModel)getModel()).getDocument();
- if (document.getChildNodes().getLength() == 0)
- {
- // if it is a completely empty file, then add the encoding and version processing instruction
-//TODO String encoding = EncodingHelper.getDefaultEncodingTag();
- String encoding = "UTF-8";
- ProcessingInstruction instr = document.createProcessingInstruction("xml", "version=\"1.0\" encoding=\"" + encoding + "\"");
- document.appendChild(instr);
- }
-
- // Create a default schema tag now
-
- // String defaultPrefixForTargetNamespace = getFileResource().getProjectRelativePath().removeFileExtension().lastSegment();
- String defaultPrefixForTargetNamespace = "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 NewXSDWizard
- if (XSDEditorPlugin.getPlugin().getXMLSchemaPrefix().trim().length() > 0)
- {
- prefixForSchemaNamespace = XSDEditorPlugin.getPlugin().getXMLSchemaPrefix() + ":";
- schemaNamespaceAttribute += ":" + XSDEditorPlugin.getPlugin().getXMLSchemaPrefix();
- }
- }
-
- document.appendChild(document.createTextNode("\n"));
- Element element = document.createElement(prefixForSchemaNamespace + XSDConstants.SCHEMA_ELEMENT_TAG);
-
- element.setAttribute(schemaNamespaceAttribute,"http://www.w3.org/2001/XMLSchema");
-
- String defaultTargetURI = XSDEditorPlugin.getPlugin().getXMLSchemaTargetNamespace();
- element.setAttribute(XSDConstants.TARGETNAMESPACE_ATTRIBUTE, defaultTargetURI);
- element.setAttribute("xmlns:" + defaultPrefixForTargetNamespace, defaultTargetURI);
-
- document.appendChild(element);
- }
-
- public void buildXSDModel()
- {
- try
- {
- Document document = ((XMLModel)getModel()).getDocument();
- if (document.getChildNodes().getLength() == 0)
- {
- // this is an empty document. Create a default schema tag now
- createDefaultSchemaNode();
- }
-
- createSchema(document.getDocumentElement());
-
- XSDDocumentAdapter documentAdapter =
- new XSDDocumentAdapter(((XMLModel)getModel()).getDocument());
- }
- catch (Exception e)
- {
-// XSDEditorPlugin.getPlugin().getMsgLogger().write("Failed to create Model");
-// XSDEditorPlugin.getPlugin().getMsgLogger().write(e);
-// e.printStackTrace();
- }
-
-
-
-// XSDResourceFactoryImpl.validate(xsdSchema, input.getFile().getContents(true));
- }
-
-// private void updateParentForDerivation(Node node, XSDConcreteComponent correspondingComponent)
-// {
-// if (XSDDOMHelper.inputEquals(node, XSDConstants.SIMPLECONTENT_ELEMENT_TAG, false)||
-// XSDDOMHelper.inputEquals(node,XSDConstants.COMPLEXCONTENT_ELEMENT_TAG,false))
-// {
-// XSDComplexTypeDefinition xsdComplexTypeDefinition =
-// correspondingComponent.getContainer() instanceof XSDComplexTypeDefinition ?
-// (XSDComplexTypeDefinition)correspondingComponent.getContainer() :
-// null;
-// if (xsdComplexTypeDefinition != null)
-// {
-// xsdComplexTypeDefinition.elementContentsChanged(xsdComplexTypeDefinition.getElement());
-// }
-// }
-// }
-
-// private void checkUnion(Node node, XSDConcreteComponent correspondingComponent, int i)
-// {
-// // bug 219967 - union changes to restriction
-// if (XSDDOMHelper.inputEquals(node, XSDConstants.UNION_ELEMENT_TAG, false))
-// {
-//// XSDConcreteComponent comp = correspondingComponent.getContainer();
-//// if (comp != null)
-//// {
-//// switch (i)
-//// {
-//// case 1:
-//// comp.elementAttributesChanged((Element)node);
-//// break;
-//// case 4:
-//// comp.elementContentsChanged((Element)node);
-//// break;
-//// }
-//// }
-// }
-// else
-// {
-// switch (i)
-// {
-// case 1:
-// case 4:
-// // do both types of updates since sometimes the attributes have changed indirectly
-// // because the content has changed
-// correspondingComponent.elementAttributesChanged((Element)node);
-// correspondingComponent.elementContentsChanged((Element)node);
-// break;
-// }
-// }
-// }
-
-// private void updateMap(XSDConcreteComponent listener, Element documentElement)
-// {
-// boolean handleChangeInSchema = false;
-// if (listener instanceof XSDSchema)
-// {
-// if (!handleChangeInSchema)
-// {
-// handleChangeInSchema = true;
-// XSDSchema xsdSchema = (XSDSchema)listener;
-// java.util.Map prefixToNameSpaceMap = xsdSchema.getQNamePrefixToNamespaceMap();
-// String targetNamespace = xsdSchema.getTargetNamespace();
-//// System.out.println("targetNamespace = " + targetNamespace);
-//
-// NamedNodeMap attributes = documentElement.getAttributes();
-// int length = attributes.getLength();
-//
-// ArrayList keyList = new ArrayList();
-// keyList.addAll(prefixToNameSpaceMap.keySet());
-//
-// String key;
-//
-//
-// // update the map when the prefix is changed
-// CHECK: for (int i = 0; i < length; i++)
-// {
-// Attr attr = (Attr)attributes.item(i);
-// String name = attr.getNodeName();
-//
-// if (isValidXMLNSAttribute(name))
-//// if (name.startsWith("xmlns"))
-// {
-// String value = attr.getNodeValue();
-// if (value == null)
-// {
-// break CHECK;
-// }
-// int index = name.indexOf(":");
-// key = index == -1 ? null : name.substring(index + 1);
-//// System.out.println(" Attribute key is " + key + " , value = " + value);
-//// System.out.println(" map.get(key) = " + prefixToNameSpaceMap.get(key));
-// if (!prefixToNameSpaceMap.containsKey(key))
-// {
-// for (Iterator iter = keyList.iterator(); iter.hasNext(); )
-// {
-// String aPrefix = (String)iter.next();
-//// System.out.println(" --> A Map Prefix is " + aPrefix);
-//// System.out.println(" --> model map.get(prefix) " + prefixToNameSpaceMap.get(aPrefix));
-// if (prefixToNameSpaceMap.get(aPrefix) != null)
-// {
-// if (prefixToNameSpaceMap.get(aPrefix).equals(value))
-// {
-// prefixToNameSpaceMap.remove(aPrefix);
-// }
-// }
-// }
-// }
-// else if (prefixToNameSpaceMap.containsKey(key))
-// {
-// if (prefixToNameSpaceMap.get(key) != null)
-// {
-// if (!prefixToNameSpaceMap.get(key).equals(value))
-// {
-// Set entrySet = prefixToNameSpaceMap.entrySet();
-// for (Iterator iter = entrySet.iterator(); iter.hasNext(); )
-// {
-// Map.Entry aMapEntry = (Map.Entry)iter.next();
-// if ( (key != null && (aMapEntry.getKey() != null && aMapEntry.getKey().equals(key)))
-// || (key == null && (aMapEntry.getKey() == null)))
-// {
-// aMapEntry.setValue(value);
-// }
-// }
-// }
-// }
-// else
-// {
-// Set entrySet = prefixToNameSpaceMap.entrySet();
-// for (Iterator iter = entrySet.iterator(); iter.hasNext(); )
-// {
-// Map.Entry aMapEntry = (Map.Entry)iter.next();
-// if ( (key != null && (aMapEntry.getKey() != null && aMapEntry.getKey().equals(key)))
-// || (key == null && (aMapEntry.getKey() == null)))
-// {
-// aMapEntry.setValue(value);
-// }
-// }
-// }
-// }
-// }
-// }
-//
-// boolean modelMapPrefixFound = false;
-// for (Iterator iter = keyList.iterator(); iter.hasNext(); )
-// {
-// String aPrefix = (String)iter.next();
-// modelMapPrefixFound = false;
-// attributes = documentElement.getAttributes();
-// length = attributes.getLength();
-//
-// for (int i = 0; i < length; i++)
-// {
-// Attr attr = (Attr)attributes.item(i);
-// if (attr != null)
-// {
-// String name = attr.getNodeName();
-//
-// // if (name.startsWith("xmlns"))
-// if (isValidXMLNSAttribute(name))
-// {
-// String value = attr.getNodeValue();
-// int index = name.indexOf(":");
-// key = index == -1 ? null : name.substring(index + 1);
-// if (aPrefix == null && key == null)
-// {
-// modelMapPrefixFound = true;
-// }
-// else if (aPrefix != null && (aPrefix.equals(key)))
-// {
-// modelMapPrefixFound = true;
-// if ((prefixToNameSpaceMap.get(key) != null && !prefixToNameSpaceMap.get(key).equals(value))
-// || (prefixToNameSpaceMap.get(key) == null && value != null))
-// {
-// if (value != null && value.length() > 0)
-// {
-// prefixToNameSpaceMap.put(aPrefix, value);
-// }
-// }
-// }
-// else if (key != null && (key.equals(aPrefix)))
-// {
-// modelMapPrefixFound = true;
-// }
-// }
-// }
-// }
-// if (!modelMapPrefixFound)
-// {
-// prefixToNameSpaceMap.remove(aPrefix);
-// }
-// }
-//
-// // to ensure map is recreated
-//// XSDSchemaHelper.updateElement(xsdSchema);
-//// reparseSchema();
-//
-// handleChangeInSchema = false;
-//
-//// System.out.println("XSDeditor Map is " + prefixToNameSpaceMap.values());
-//// System.out.println("XSDeditor Map keys are " + prefixToNameSpaceMap.keySet());
-//
-// }
-// }
-// }
-
- /**
- * Returns the xsdSchema.
- * @return XSDSchema
- */
- public XSDSchema getXSDSchema()
- {
- return xsdSchema;
- }
-
-
- /**
- * Returns the resourceFile.
- * @return IFile
- */
- public IFile getFileResource()
- {
- return resourceFile;
- }
-
- /**
- * Get the IDocument from the text viewer
- */
- public IDocument getEditorIDocument()
- {
- IDocument document = textEditor.getTextViewer().getDocument();
- return document;
- }
-
- /**
- * Create ref integrity tasks in task list
- */
- public void createTasksInTaskList(ArrayList messages)
- {
-// DisplayErrorInTaskList tasks = new DisplayErrorInTaskList(getEditorIDocument(), getFileResource(), messages);
-// tasks.run();
- }
-
- public void resetInformationTasks()
- {
-// DisplayErrorInTaskList.removeInfoMarkers(getFileResource());
- }
-
- public XSDGraphViewer getGraphViewer()
- {
- return graphViewer;
- }
-
-// /**
-// * @see org.eclipse.ui.part.MultiPageEditorPart#handlePropertyChange(int)
-// */
-// protected void handlePropertyChange(int propertyId)
-// {
-// super.handlePropertyChange(propertyId);
-//
-// if (propertyId == IEditorPart.PROP_INPUT)
-// {
-// setInput(textEditor.getEditorInput());
-// resourceFile = ((IFileEditorInput) getEditorInput()).getFile();
-// setTitle(resourceFile.getName());
-//// outline.setModel(getModel());
-//
-// // even though we've set title etc., several times already!
-// // only now is all prepared for it.
-// firePropertyChange(IWorkbenchPart.PROP_TITLE);
-// firePropertyChange(PROP_DIRTY);
-// }
-// else if (propertyId == IEditorPart.PROP_TITLE)
-// {
-// if (getEditorInput() != textEditor.getEditorInput())
-// {
-// setInput(textEditor.getEditorInput());
-// }
-// }
-// }
-
- public IEditorPart getActiveEditorPage()
- {
- return getActiveEditor();
- }
-
- public XSDTextEditor getXSDTextEditor()
- {
- return textEditor;
- }
-
- class InternalPartListener implements IPartListener
- {
- XSDEditor editor;
- public InternalPartListener(XSDEditor editor)
- {
- this.editor = editor;
- }
-
- public void partActivated(IWorkbenchPart part)
- {
- if (part == editor)
- {
- ISelection selection = getSelectionManager().getSelection();
- if (selection != null)
- {
- if (getCurrentPageType().equals(XSDEditorPlugin.GRAPH_PAGE))
- {
- getSelectionManager().selectionChanged(new SelectionChangedEvent(editor.getGraphViewer().getComponentViewer(), selection));
- }
- else if (getCurrentPageType().equals(XSDEditorPlugin.SOURCE_PAGE))
- {
- getSelectionManager().setSelection(selection);
- }
- }
- }
- }
-
- public void partBroughtToTop(IWorkbenchPart part)
- {
- }
-
- public void partClosed(IWorkbenchPart part)
- {
- }
-
-
- public void partDeactivated(IWorkbenchPart part)
- {
- }
-
- public void partOpened(IWorkbenchPart part)
- {
- }
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDEditorAdapter.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDEditorAdapter.java
deleted file mode 100644
index 7591376fb3..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDEditorAdapter.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal;
-
-import java.util.ArrayList;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jface.text.IDocument;
-
-public interface XSDEditorAdapter
-{
- public IFile getFileResource();
-
- public IDocument getEditorIDocument();
-
- public void createTasksInTaskList(ArrayList messages);
-
- public void resetInformationTasks();
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDEditorContextIds.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDEditorContextIds.java
deleted file mode 100644
index 8f95f5c6eb..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDEditorContextIds.java
+++ /dev/null
@@ -1,460 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal;
-
-/**
- * Context help id constants.
- */
-public interface XSDEditorContextIds
-{
- public static final String PLUGIN_NAME = "org.eclipse.wst.xsd.ui.internal";
-
- /* CONTEXT_IDs New XSD Wizard uses the WizardNewFileCreationPage from org.eclipse.ui.dialogs */
-
- /* CONTEXT_IDs for XSDEditor follow the xsdexxx context IDs */
-
- /* CONTEXT_ID xsde0010 for XSD Editor Design View */
- public static final String XSDE_SCHEMA_DESIGN_VIEW = PLUGIN_NAME + ".xsde0010";
- /* no CONTEXT_ID for File Name Text Edit (not editable) */
- /* CONTEXT_ID xsde0020 for Version Text Edit */
- public static final String XSDE_SCHEMA_VERSION = PLUGIN_NAME + ".xsde0020";
- /* CONTEXT_ID xsde0030 for Language Text Edit */
- public static final String XSDE_SCHEMA_LANGUAGE = PLUGIN_NAME + ".xsde0030";
- /* CONTEXT_ID xsde0040 for Namespace Group */
- public static final String XSDE_SCHEMA_NAMESPACE_GROUP = PLUGIN_NAME + ".xsde0040";
- /* CONTEXT_ID xsde0050 for Prefix Text Edit */
- public static final String XSDE_SCHEMA_PREFIX = PLUGIN_NAME + ".xsde0050";
- /* CONTEXT_ID xsde0060 for Target namespace Text Edit */
- public static final String XSDE_SCHEMA_TARGET_NAMESPACE = PLUGIN_NAME + ".xsde0060";
- /* CONTEXT_ID xsde0070 for Apply Push Button */
- public static final String XSDE_SCHEMA_APPLY = PLUGIN_NAME + ".xsde0070";
- /* CONTEXT_ID xsde0080 for Attribute form default Combo Box */
- public static final String XSDE_SCHEMA_ATTRIBUTE = PLUGIN_NAME + ".xsde0080";
- /* CONTEXT_ID xsde0090 for Element form default Combo Box */
- public static final String XSDE_SCHEMA_ELEMENT = PLUGIN_NAME + ".xsde0090";
- /* CONTEXT_ID xsde0100 for Block default Combo Box */
- public static final String XSDE_SCHEMA_BLOCK = PLUGIN_NAME + ".xsde0100";
- /* CONTEXT_ID xsde0110 for Final Default Combo Box */
- public static final String XSDE_SCHEMA_FINAL = PLUGIN_NAME + ".xsde0110";
-
-
- /* CONTEXT_ID xsde0200 for Annotations Comment Group - only used generically */
- /* CONTEXT_ID - used in Documentation Design View */
- /* CONTEXT_ID - used in App Info Design View */
- public static final String XSDE_ANNOTATION_COMMENT_GROUP = PLUGIN_NAME + ".xsde0200";
- /* CONTEXT_ID xsde0210 for Annotations Comment Group - only used generically */
- /* CONTEXT_ID - used in Documentation Design View */
- /* CONTEXT_ID - used in App Info Design View */
- public static final String XSDE_ANNOTATION_COMMENT = PLUGIN_NAME + ".xsde0210";
-
- /* CONTEXT_ID xsde0300 for Documentation Design View */
- public static final String XSDE_DOCUMENTATION_DESIGN_VIEW = PLUGIN_NAME + ".xsde0300";
- /* CONTEXT_ID xsde0310 for Source Text Edit */
- public static final String XSDE_DOCUMENTATION_SOURCE = PLUGIN_NAME + ".xsde0310";
- /* CONTEXT_ID xsde0320 for Language Text Edit */
- public static final String XSDE_DOCUMENTATION_LANGUAGE = PLUGIN_NAME + ".xsde0320";
- /* CONTEXT_ID Comment Group is from Annotations Window xsde0200 */
- /* CONTEXT_ID Comment Multi-line Edit is from Annotations Window xsd0210 */
-
- /* CONTEXT_ID xsde0400 for App Info Design View */
- public static final String XSDE_APP_INFO_DESIGN_VIEW = PLUGIN_NAME + ".xsde0400";
- /* CONTEXT_ID xsde0410 for App Info Source Text Edit */
- public static final String XSDE_APP_INFO_SOURCE = PLUGIN_NAME + ".xsde0410";
- /* CONTEXT_ID Comment Group is from Annotations Window xsde0200 */
- /* CONTEXT_ID Comment Multi-line Edit is from Annotations Window xsd0210 */
-
- /* CONTEXT_ID xsde0500 for Complex Type Design View */
- public static final String XSDE_COMPLEX_DESIGN_VIEW = PLUGIN_NAME + ".xsde0500";
- /* CONTEXT_ID xsde0510 for Name Text Edit */
- public static final String XSDE_COMPLEX_NAME = PLUGIN_NAME + ".xsde0510";
- /* CONTEXT_ID xsde0520 for Abstract Combo Box */
- public static final String XSDE_COMPLEX_ABSTRACT = PLUGIN_NAME + ".xsde0520";
- /* CONTEXT_ID xsde0530 for Mixed Combo Box */
- public static final String XSDE_COMPLEX_MIXED = PLUGIN_NAME + ".xsde0530";
- /* CONTEXT_ID xsde0540 for Block Combo Box */
- public static final String XSDE_COMPLEX_BLOCK = PLUGIN_NAME + ".xsde0540";
- /* CONTEXT_ID xsde0550 for Final Combo Box */
- public static final String XSDE_COMPLEX_FINAL = PLUGIN_NAME + ".xsde0550";
-
- /* CONTEXT_ID xsde0600 for Simple Type Design View */
- public static final String XSDE_SIMPLE_DESIGN_VIEW = PLUGIN_NAME + ".xsde0600";
- /* CONTEXT_ID xsde0610 for Name Text Edit */
- public static final String XSDE_SIMPLE_NAME = PLUGIN_NAME + ".xsde0610";
-
- /* CONTEXT_ID for Global Element and Element Design Views are the same */
- /* CONTEXT_ID xsde0700 for Element Design View */
- public static final String XSDE_ELEMENT_DESIGN_VIEW = PLUGIN_NAME + ".xsde0700";
- /* CONTEXT_ID xsde0710 for Element Name Text Edit */
- public static final String XSDE_ELEMENT_NAME = PLUGIN_NAME + ".xsde0710";
- /* CONTEXT_ID Type Information Group is from Type Helper xsde0900 */
- /* CONTEXT_ID Built-in simple type Radio Button is from Type Helper xsde0920 */
- /* CONTEXT_ID User-defined simple type Radio Button is from Type Helper xsde0930 */
- /* CONTEXT_ID User-defined complex type Radio Button is from Type Helper xsde0940 */
- /* CONTEXT_ID Type information Combo Box is from Type Helper xsde0950 */
- /* CONTEXT_ID xsde0720 for Abstract Check Box */
- public static final String XSDE_ELEMENT_ABSTRACT = PLUGIN_NAME + ".xsde0720";
- /* CONTEXT_ID xsde0730 for Nillable Check Box */
- public static final String XSDE_ELEMENT_NILLABLE = PLUGIN_NAME + ".xsde0730";
- /* CONTEXT_ID xsde0740 for Value Group */
- public static final String XSDE_ELEMENT_VALUE = PLUGIN_NAME + ".xsde0740";
- /* CONTEXT_ID xsde0750 for Fixed Radio Button */
- public static final String XSDE_ELEMENT_FIXED = PLUGIN_NAME + ".xsde0750";
- /* CONTEXT_ID xsde0760 for Default Radio Button */
- public static final String XSDE_ELEMENT_DEFAULT = PLUGIN_NAME + ".xsde0760";
- /* CONTEXT_ID xsde0770 for Value Group */
- public static final String XSDE_ELEMENT_VALUE_GROUP = PLUGIN_NAME + ".xsde0770";
- /* CONTEXT_ID xsde0780 for Minimum Text Edit */
- public static final String XSDE_ELEMENT_MINIMUM = PLUGIN_NAME + ".xsde0780";
- /* CONTEXT_ID xsde0790 for Maximum Text Edit */
- public static final String XSDE_ELEMENT_MAXIMUM = PLUGIN_NAME + ".xsde0790";
- /* CONTEXT_ID xsde0800 for Block Combo Box */
- public static final String XSDE_ELEMENT_BLOCK = PLUGIN_NAME + ".xsde0800";
- /* CONTEXT_ID xsde0810 for Final Combo Box */
- public static final String XSDE_ELEMENT_FINAL = PLUGIN_NAME + ".xsde0810";
- /* CONTEXT_ID xsde0820 for Substitution Group Combo Box */
- public static final String XSDE_ELEMENT_SUBSTITUTION = PLUGIN_NAME + ".xsde0820";
- /* CONTEXT_ID xsde0830 for Form Qualification Combo Box */
- public static final String XSDE_ELEMENT_FORM = PLUGIN_NAME + ".xsde0830";
-
- /* CONTEXT_ID xsde0900 for Type Helper Group - only used generically */
- /* CONTEXT_ID - used in Global Element Design View */
- /* CONTEXT_ID - used in Global Attribute Design View */
- /* CONTEXT_ID - used in Simple Content Design View */
- /* CONTEXT_ID - used in Restriction Design View */
- /* CONTEXT_ID - used in List Design View */
- /* CONTEXT_ID - used in Union Design View */
- public static final String XSDE_TYPE_HELPER_GROUP = PLUGIN_NAME + ".xsde0900";
- /* CONTEXT_ID xsde0910 for None Radio Button - only used generically */
- /* CONTEXT_ID - used in Simple Content Design View */
- /* CONTEXT_ID - used in Restriction Design View */
- /* CONTEXT_ID - used in List Design View */
- /* CONTEXT_ID - used in Union Design View */
- public static final String XSDE_TYPE_HELPER_NONE = PLUGIN_NAME + ".xsde0910";
- /* CONTEXT_ID xsde0920 for Built-in simple type Radio Button - only used generically */
- /* CONTEXT_ID - used in Global Element Design View */
- /* CONTEXT_ID - used in Global Attribute Design View */
- /* CONTEXT_ID - used in Simple Content Design View */
- /* CONTEXT_ID - used in Restriction Design View */
- /* CONTEXT_ID - used in List Design View */
- /* CONTEXT_ID - used in Union Design View */
- public static final String XSDE_TYPE_HELPER_BUILT_IN = PLUGIN_NAME + ".xsde0920";
- /* CONTEXT_ID xsde0930 for User-defined simple type Radio Button - only used generically */
- /* CONTEXT_ID - used in Global Element Design View */
- /* CONTEXT_ID - used in Global Attribute Design View */
- /* CONTEXT_ID - used in Simple Content Design View */
- /* CONTEXT_ID - used in Restriction Design View */
- /* CONTEXT_ID - used in List Design View */
- /* CONTEXT_ID - used in Union Design View */
- public static final String XSDE_TYPE_HELPER_USER_DEFINED_SIMPLE = PLUGIN_NAME + ".xsde0930";
- /* CONTEXT_ID xsde0940 for User-defined complex type Radio Button - only used generically */
- /* CONTEXT_ID - used in Global Element Design View */
- public static final String XSDE_TYPE_HELPER_USER_DEFINED_COMPLEX = PLUGIN_NAME + ".xsde0940";
- /* CONTEXT_ID xsde0950 for Type information Combo Box - only used generically */
- /* CONTEXT_ID - used in Global Element Design View */
- /* CONTEXT_ID - used in Global Attribute Design View */
- /* CONTEXT_ID - used in Simple Content Design View */
- /* CONTEXT_ID - used in Restriction Design View */
- /* CONTEXT_ID - used in List Design View */
- public static final String XSDE_TYPE_HELPER_TYPE = PLUGIN_NAME + ".xsde0950";
-
- /* CONTEXT_ID xsde1000 for Attribute Design View */
- public static final String XSDE_ATTRIBUTE_DESIGN_VIEW = PLUGIN_NAME + ".xsde1000";
- /* CONTEXT_ID xsde1010 for Attribute Name Text Edit */
- public static final String XSDE_ATTRIBUTE_NAME = PLUGIN_NAME + ".xsde1010";
- /* CONTEXT_ID Type Information Group is from Type Helper xsde0900 */
- /* CONTEXT_ID Built-in simple type Radio Button is from Type Helper xsde0920 */
- /* CONTEXT_ID User-defined simple type Radio Button is from Type Helper xsde0930 */
- /* CONTEXT_ID Type information Combo Box is from Type Helper xsde0950 */
- /* CONTEXT_ID xsde1020 for Value Group */
- public static final String XSDE_ATTRIBUTE_VALUE_GROUP = PLUGIN_NAME + ".xsde1020";
- /* CONTEXT_ID xsde1030 for Fixed Radio Button */
- public static final String XSDE_ATTRIBUTE_FIXED = PLUGIN_NAME + ".xsde1030";
- /* CONTEXT_ID xsde1040 for Default Radio Button */
- public static final String XSDE_ATTRIBUTE_DEFAULT = PLUGIN_NAME + ".xsde1040";
- /* CONTEXT_ID xsde1050 for Value Text Edit */
- public static final String XSDE_ATTRIBUTE_VALUE = PLUGIN_NAME + ".xsde1050";
- /* CONTEXT_ID xsde1060 for Usage Combo Box */
- public static final String XSDE_ATTRIBUTE_USAGE = PLUGIN_NAME + ".xsde1060";
- /* CONTEXT_ID xsde1070 for Form qualificaiton Combo Box */
- public static final String XSDE_ATTRIBUTE_FORM = PLUGIN_NAME + ".xsde1070";
-
- /* CONTEXT_ID xsde1100 for Element Ref Window Design View */
- public static final String XSDE_ELEMENT_REF_DESIGN_VIEW = PLUGIN_NAME + ".xsde1100";
- /* CONTEXT_ID xsde1110 for Reference Name Combo Box */
- public static final String XSDE_ELEMENT_REF_REFERENCE = PLUGIN_NAME + ".xsde1110";
- /* CONTEXT_ID xsde1120 for Minimum Text Edit */
- public static final String XSDE_ELEMENT_REF_MINIMUM = PLUGIN_NAME + ".xsde1120";
- /* CONTEXT_ID xsde1130 for Maximum Text Edit */
- public static final String XSDE_ELEMENT_REF_MAXIMUM = PLUGIN_NAME + ".xsde1130";
-
- /* CONTEXT_ID xsde1200 for Simple Content Design View - used generically */
- /* CONTEXT_ID - used in Simple Content Design View */
- /* CONTEXT_ID - used in Complex Content Design View */
- public static final String XSDE_SIMPLE_CONTENT_DESIGN_VIEW = PLUGIN_NAME + ".xsde1200";
- /* CONTEXT_ID Base Type Group is from Type Helper xsde0900 */
- /* CONTEXT_ID None Radio Button is from Type Helper xsde0910 */
- /* CONTEXT_ID Built-in simple type Radio Button is from Type Helper xsde0920 */
- /* CONTEXT_ID User-defined simple type Radio Button is from Type Helper xsde0930 */
- /* CONTEXT_ID Type information Combo Box is from Type Helper xsde0950 */
- /* CONTEXT_ID xsde1210 for Derived by Combo Box - used generically */
- /* CONTEXT_ID - used in Simple Content Design View */
- /* CONTEXT_ID - used in Complex Content Design View */
- public static final String XSDE_SIMPLE_CONTENT_DERIVED = PLUGIN_NAME + ".xsde1210";
-
- /* CONTEXT_ID xsde1300 for Restriction Design View */
- public static final String XSDE_RESTRICTION_DESIGN_VIEW = PLUGIN_NAME + ".xsde1300";
- /* CONTEXT_ID Base Type Group is from Type Helper xsde0900 */
- /* CONTEXT_ID None Radio Button is from Type Helper xsde0910 */
- /* CONTEXT_ID Built-in simple type Radio Button is from Type Helper xsde0920 */
- /* CONTEXT_ID User-defined simple type Radio Button is from Type Helper xsde0930 */
- /* CONTEXT_ID Type information Combo Box is from Type Helper xsde0950 */
- /* CONTEXT_ID xsde1310 for Facets Group */
- public static final String XSDE_RESTRICTION_FACETS_GROUP = PLUGIN_NAME + ".xsde1310";
- /* CONTEXT_ID xsde1320 for Facets Table */
- public static final String XSDE_RESTRICTION_FACETS = PLUGIN_NAME + ".xsde1320";
-
- /* CONTEXT_ID xsde1400 for List Design View */
- public static final String XSDE_LIST_DESIGN_VIEW = PLUGIN_NAME + ".xsde1400";
- /* CONTEXT_ID Base Type Group is from Type Helper xsde0900 */
- /* CONTEXT_ID None Radio Button is from Type Helper xsde0910 */
- /* CONTEXT_ID Built-in simple type Radio Button is from Type Helper xsde0920 */
- /* CONTEXT_ID User-defined simple type Radio Button is from Type Helper xsde0930 */
- /* CONTEXT_ID Type information Combo Box is from Type Helper xsde0950 */
-
- /* CONTEXT_ID xsde1500 for Attribute Group Design View */
- public static final String XSDE_ATTRIBUTE_GROUP_DESIGN_VIEW = PLUGIN_NAME + ".xsde1500";
- /* CONTEXT_ID xsde1510 for Name Text Edit */
- public static final String XSDE_ATTRIBUTE_GROUP_NAME = PLUGIN_NAME + ".xsde1510";
-
- /* CONTEXT_ID for Global Attribute and Attribute Design Views are the same */
- /* CONTEXT_ID xsde1600 for Attribute Group Reference Design View */
- public static final String XSDE_ATTRIBUTE_GROUP_REF_DESIGN_VIEW = PLUGIN_NAME + ".xsde1600";
- /* CONTEXT_ID xsde1610 for Reference Name Combo Box */
- public static final String XSDE_ATTRIBUTE_GROUP_REF_NAME = PLUGIN_NAME + ".xsde1610";
-
- /* CONTEXT_ID xsde1700 for Attribute Reference Design View */
- public static final String XSDE_ATTRIBUTE_REF_DESIGN_VIEW = PLUGIN_NAME + ".xsde1700";
- /* CONTEXT_ID xsde1710 for Reference Name Combo Box */
- public static final String XSDE_ATTRIBUTE_REF_NAME = PLUGIN_NAME + ".xsde1710";
-
- /* CONTEXT_ID xsde1800 for Pattern Design View */
- public static final String XSDE_PATTERN_DESIGN_VIEW = PLUGIN_NAME + ".xsde1800";
- /* CONTEXT_ID xsde1810 for Value Text Edit */
- public static final String XSDE_PATTERN_VALUE = PLUGIN_NAME + ".xsde1810";
- /* CONTEXT_ID xsde1820 for Create Regular Expression Push Button */
- public static final String XSDE_PATTERN_REGULAR = PLUGIN_NAME + ".xsde1820";
-
- /* CONTEXT_ID xsde1900 for Enum Design View */
- public static final String XSDE_ENUM_DESIGN_VIEW = PLUGIN_NAME + ".xsde1900";
- /* CONTEXT_ID xsde1910 for Value Text Edit */
- public static final String XSDE_ENUM_VALUE = PLUGIN_NAME + ".xsde1910";
-
- /* CONTEXT_ID xsde2000 for Include Design Page */
- public static final String XSDE_INCLUDE_DESIGN_VIEW = PLUGIN_NAME + ".xsde2000";
- /* no CONTEXT_ID for Schema Location Text Edit (not editable) */
- /* CONTEXT_ID Select Push Button is from Include Helper xsde2100 */
-
- /* CONTEXT_ID xsde2100 for Include Helper Select Push Button - used generically */
- /* CONTEXT_ID - used in Include Design View */
- /* CONTEXT_ID - used in Import Design View */
- public static final String XSDE_INCLUDE_HELPER_SELECT = PLUGIN_NAME + ".xsde2100";
-
- /* CONTEXT_ID xsde2200 for Import Design Page */
- public static final String XSDE_IMPORT_DESIGN_VIEW = PLUGIN_NAME + ".xsde2200";
- /* no CONTEXT_ID for Schema Location Text Edit (not editable) */
- /* CONTEXT_ID Select Push Button is from Include Helper xsde2100 */
- /* CONTEXT_ID xsde2210 for Prefix Text Edit */
- public static final String XSDE_IMPORT_PREFIX = PLUGIN_NAME + ".xsde2210";
- /* no CONTEXT_ID for Namespace Text Edit (not editable) */
-
- /* CONTEXT_ID xsde2300 for Redefine Design View */
- public static final String XSDE_REDEFINE_DESIGN_VIEW = PLUGIN_NAME + ".xsde2300";
- /* no CONTEXT_ID for Schema Location Text Edit (not editable) */
- /* CONTEXT_ID Select Push Button is from Include Helper xsde2100 */
-
- /* CONTEXT_ID xsde2400 for Group Design View */
- public static final String XSDE_GROUP_DESIGN_VIEW = PLUGIN_NAME + ".xsde2400";
- /* CONTEXT_ID xsde2410 for Name Text Edit */
- public static final String XSDE_GROUP_NAME = PLUGIN_NAME + ".xsde2410";
-
- /* CONTEXT_ID xsde2500 for Group Scope Design View */
- public static final String XSDE_GROUP_SCOPE_DESIGN_VIEW = PLUGIN_NAME + ".xsde2500";
- /* CONTEXT_ID xsde2510 for Content model Group */
- public static final String XSDE_GROUP_SCOPE_CONTENT_GROUP = PLUGIN_NAME + ".xsde2510";
- /* CONTEXT_ID xsde2520 for Sequence Radio Button */
- public static final String XSDE_GROUP_SCOPE_SEQUENCE = PLUGIN_NAME + ".xsde2520";
- /* CONTEXT_ID xsde2530 for Choice Radio Button */
- public static final String XSDE_GROUP_SCOPE_CHOICE = PLUGIN_NAME + ".xsde2530";
- /* CONTEXT_ID xsde2540 for All Radio Button */
- public static final String XSDE_GROUP_SCOPE_ALL = PLUGIN_NAME + ".xsde2540";
- /* CONTEXT_ID xsde2550 for Minimum Text Edit */
- public static final String XSDE_GROUP_SCOPE_MINIMUM = PLUGIN_NAME + ".xsde2550";
- /* CONTEXT_ID xsde2560 for Maximum Text Edit*/
- public static final String XSDE_GROUP_SCOPE_MAXIMUM = PLUGIN_NAME + ".xsde2560";
-
- /* CONTEXT_ID xsde2600 for Group Ref Design View */
- public static final String XSDE_GROUP_REF_DESIGN_VIEW = PLUGIN_NAME + ".xsde2600";
- /* CONTEXT_ID xsde2610 for Reference name Combo Box */
- public static final String XSDE_GROUP_REF_REFERENCE = PLUGIN_NAME + ".xsde2610";
- /* CONTEXT_ID xsde2620 for Minimum Text Edit */
- public static final String XSDE_GROUP_REF_MINIMUM = PLUGIN_NAME + ".xsde2620";
- /* CONTEXT_ID xsde2630 for Maximum Text Edit */
- public static final String XSDE_GROUP_REF_MAXIMUM = PLUGIN_NAME + ".xsde2630";
-
- /* CONTEXT_ID xsde2700 for Unique Design View */
- public static final String XSDE_UNIQUE_DESIGN_VIEW = PLUGIN_NAME + ".xsde2700";
- /* CONTEXT_ID Name Text Edit is from Unique Base xsde2800 */
- /* CONTEXT_ID Selector Group is from Unique Base xsde2810 */
- /* CONTEXT_ID Selector Mulit-line Edit is from Unique Base xsde2820 */
- /* CONTEXT_ID Fields Group is from Unique Base xsde2830 */
- /* CONTEXT_ID Source Text Edit is from Unique Base xsde2840 */
- /* CONTEXT_ID Add Push Button is from Unique Base xsde2850 */
- /* CONTEXT_ID Remove Push Button is from Unique Base xsde2860 */
- /* CONTEXT_ID Target List Box is from Unique Base xsde2870 */
-
- /* CONTEXT_ID xsde2800 for Unique Base Name Text Edit - used generically */
- /* CONTEXT_ID - used in Unique Design View */
- /* CONTEXT_ID - used in Key Design View */
- /* CONTEXT_ID - used in Key Ref Design View */
- public static final String XSDE_UNIQUE_BASE_NAME = PLUGIN_NAME + ".xsde2800";
- /* CONTEXT_ID xsde2810 for Selector Group - used generically */
- /* CONTEXT_ID - used in Unique Design View */
- /* CONTEXT_ID - used in Key Design View */
- /* CONTEXT_ID - used in Key Ref Design View */
- public static final String XSDE_UNIQUE_BASE_SELECTOR_GROUP = PLUGIN_NAME + ".xsde2810";
- /* CONTEXT_ID xsde2820 for Selector Multi-line Edit - used generically */
- /* CONTEXT_ID - used in Unique Design View */
- /* CONTEXT_ID - used in Key Design View */
- /* CONTEXT_ID - used in Key Ref Design View */
- public static final String XSDE_UNIQUE_BASE_SELECTOR = PLUGIN_NAME + ".xsde2820";
- /* CONTEXT_ID xsde2830 for Fields Group - used generically */
- /* CONTEXT_ID - used in Unique Design View */
- /* CONTEXT_ID - used in Key Design View */
- /* CONTEXT_ID - used in Key Ref Design View */
- public static final String XSDE_UNIQUE_BASE_FIELDS_GROUP = PLUGIN_NAME + ".xsde2830";
- /* CONTEXT_ID xsde2840 for Source Text Edit - used generically */
- /* CONTEXT_ID - used in Unique Design View */
- /* CONTEXT_ID - used in Key Design View */
- /* CONTEXT_ID - used in Key Ref Design View */
- public static final String XSDE_UNIQUE_BASE_SOURCE = PLUGIN_NAME + ".xsde2840";
- /* CONTEXT_ID xsde2850 for Add Push Button - used generically */
- /* CONTEXT_ID - used in Unique Design View */
- /* CONTEXT_ID - used in Key Design View */
- /* CONTEXT_ID - used in Key Ref Design View */
- public static final String XSDE_UNIQUE_BASE_ADD = PLUGIN_NAME + ".xsde2850";
- /* CONTEXT_ID xsde2860 for Remove Push Button - used generically */
- /* CONTEXT_ID - used in Unique Design View */
- /* CONTEXT_ID - used in Key Design View */
- /* CONTEXT_ID - used in Key Ref Design View */
- public static final String XSDE_UNIQUE_BASE_REMOVE = PLUGIN_NAME + ".xsde2860";
- /* CONTEXT_ID xsde2870 for Target List Box - used generically */
- /* CONTEXT_ID - used in Unique Design View */
- /* CONTEXT_ID - used in Key Design View */
- /* CONTEXT_ID - used in Key Ref Design View */
- public static final String XSDE_UNIQUE_BASE_TARGET = PLUGIN_NAME + ".xsde2870";
-
- /* CONTEXT_ID xsde2900 for Key Design View */
- public static final String XSDE_KEY_DESIGN_VIEW = PLUGIN_NAME + ".xsde2900";
- /* CONTEXT_ID Name Text Edit is from Unique Base xsde2800 */
- /* CONTEXT_ID Selector Group is from Unique Base xsde2810 */
- /* CONTEXT_ID Selector Mulit-line Edit is from Unique Base xsde2820 */
- /* CONTEXT_ID Fields Group is from Unique Base xsde2830 */
- /* CONTEXT_ID Source Text Edit is from Unique Base xsde2840 */
- /* CONTEXT_ID Add Push Button is from Unique Base xsde2850 */
- /* CONTEXT_ID Remove Push Button is from Unique Base xsde2860 */
- /* CONTEXT_ID Target List Box is from Unique Base xsde2870 */
- /* CONTEXT_ID xsde2900 for Key Design View */
-
- /* CONTEXT_ID xsde2950 for Key Ref Design View */
- public static final String XSDE_KEY_REF_DESIGN_VIEW = PLUGIN_NAME + ".xsde2950";
- /* CONTEXT_ID Name Text Edit is from Unique Base xsde2800 */
- /* CONTEXT_ID xsde2960 for Reference Key Combo Box */
- public static final String XSDE_KEY_REF_REFERENCE = PLUGIN_NAME + ".xsde2960";
- /* CONTEXT_ID Selector Group is from Unique Base xsde2810 */
- /* CONTEXT_ID Selector Mulit-line Edit is from Unique Base xsde2820 */
- /* CONTEXT_ID Fields Group is from Unique Base xsde2830 */
- /* CONTEXT_ID Source Text Edit is from Unique Base xsde2840 */
- /* CONTEXT_ID Add Push Button is from Unique Base xsde2850 */
- /* CONTEXT_ID Remove Push Button is from Unique Base xsde2860 */
- /* CONTEXT_ID Target List Box is from Unique Base xsde2870 */
-
- /* CONTEXT_ID xsde3000 for Any Element Design View */
- public static final String XSDE_ANY_ELEMENT_VIEW = PLUGIN_NAME + ".xsde3000";
- /* CONTEXT_ID xsde3010 for Namespace Text Edit */
- public static final String XSDE_ANY_ELEMENT_NAMESPACE = PLUGIN_NAME + ".xsde3010";
- /* CONTEXT_ID xsde3020 for Process Contents Combo Box */
- public static final String XSDE_ANY_ELEMENT_PROCESS = PLUGIN_NAME + ".xsde3020";
- /* CONTEXT_ID xsde3030 for Minimum Text Edit */
- public static final String XSDE_ANY_ELEMENT_MINIMUM = PLUGIN_NAME + ".xsde3030";
- /* CONTEXT_ID xsde3040 for Maximum Text Edit */
- public static final String XSDE_ANY_ELEMENT_MAXIMUM = PLUGIN_NAME + ".xsde3040";
-
- /* CONTEXT_ID xsde3100 for Any Attribute Design View */
- public static final String XSDE_ANY_ATTRIBUTE_VIEW = PLUGIN_NAME + ".xsde3100";
- /* CONTEXT_ID xsde3110 for Namespace Text Edit */
- public static final String XSDE_ANY_ATTRIBUTE_NAMESPACE = PLUGIN_NAME + ".xsde3110";
- /* CONTEXT_ID xsde3120 for Process Contents Combo Box */
- public static final String XSDE_ANY_ATTRIBUTE_PROCESS = PLUGIN_NAME + ".xsde3120";
-
- /* no CONTEXT_ID for Union Design View - uses a generic interface */
- /* CONTEXT_ID Type Information Group is from Type Helper xsde0900 */
- /* CONTEXT_ID Built-in simple type Radio Button is from Type Helper xsde0920 */
- /* CONTEXT_ID User-defined simple type Radio Button is from Type Helper xsde0930 */
- /* CONTEXT_ID Type information Combo Box is from Type Helper xsde0950 */
-
- /* CONTEXT_ID xsde3200 for Notation Design View */
- public static final String XSDE_NOTATION_VIEW = PLUGIN_NAME + ".xsde3200";
-
- /* CONTEXT_ID xsde4000 for Source View */
- public static final String XSDE_SOURCE_VIEW = PLUGIN_NAME + ".xsde4000";
-
- /* CONTEXT_IDs for Regular Expression Wizard follow the xsdrxxx context IDs */
-
- /* CONTEXT_ID xsdr0010 for Compose Regular Expression Page */
- public static final String XSDR_COMPOSITION_PAGE = PLUGIN_NAME + ".xsdr0010";
- /* CONTEXT_ID xsdr0015 for Token Contents Combo Box */
- public static final String XSDR_COMPOSITION_TOKEN = PLUGIN_NAME + ".xsdr0015";
- /* CONTEXT_ID xsdr0020 for Occurrece Group */
- public static final String XSDR_COMPOSITION_OCCURRENCE_GROUP = PLUGIN_NAME + ".xsdr0020";
- /* CONTEXT_ID xsdr0030 for Just once Radio Button */
- public static final String XSDR_COMPOSITION_JUST_ONCE = PLUGIN_NAME + ".xsdr0030";
- /* CONTEXT_ID xsdr0040 for Zero or more Radio Button */
- public static final String XSDR_COMPOSITION_ZERO_OR_MORE = PLUGIN_NAME + ".xsdr0040";
- /* CONTEXT_ID xsdr0050 for One or more Radio Button */
- public static final String XSDR_COMPOSITION_ONE_OR_MORE = PLUGIN_NAME + ".xsdr0050";
- /* CONTEXT_ID xsdr0060 for Optional Radio Button */
- public static final String XSDR_COMPOSITION_OPTIONAL = PLUGIN_NAME + ".xsdr0060";
- /* CONTEXT_ID xsdr0070 for Repeat Radio Button */
- public static final String XSDR_COMPOSITION_REPEAT = PLUGIN_NAME + ".xsdr0070";
- /* CONTEXT_ID xsdr0080 for Range Radio Button */
- public static final String XSDR_COMPOSITION_RANGE = PLUGIN_NAME + ".xsdr0080";
- /* CONTEXT_ID xsdr0090 for Repeat Text Edit */
- public static final String XSDR_COMPOSITION_REPEAT_TEXT = PLUGIN_NAME + ".xsdr0090";
- /* CONTEXT_ID xsdr0100 for Range Minimum Text Edit */
- public static final String XSDR_COMPOSITION_RANGE_MIN = PLUGIN_NAME + ".xsdr0100";
- /* CONTEXT_ID xsdr0110 for Range Maximum Text Edit */
- public static final String XSDR_COMPOSITION_RANGE_MAX = PLUGIN_NAME + ".xsdr0110";
- /* CONTEXT_ID xsdr0120 for Add Push Button */
- public static final String XSDR_COMPOSITION_ADD = PLUGIN_NAME + ".xsdr0120";
- /* CONTEXT_ID xsdr0130 for Current Regular Expression Text Edit */
- public static final String XSDR_COMPOSITION_CURRENT = PLUGIN_NAME + ".xsdr0130";
-
- /* CONTEXT_ID xsdr0200 for Test Regular Expression Page */
- public static final String XSDR_TEST_PAGE = PLUGIN_NAME + ".xsdr0200";
- /* no CONTEXT_ID for Regular Expression Text Edit (not editable) */
- /* CONTEXT_ID xsdr0210 for Sample Text Text Edit */
- public static final String XSDR_TEST_SAMPLE = PLUGIN_NAME + ".xsdr0210";
-
- /* CONTEXT_IDs for Preferences Page follows the xsdpxxx context IDs */
-
- /* CONTEXT_ID xsdp0010 for XML Schema Preferences Page */
- public static final String XSDP_PREFERENCE_PAGE = PLUGIN_NAME + ".xsdp0010";
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDEditorPlugin.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDEditorPlugin.java
deleted file mode 100644
index 527b582144..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDEditorPlugin.java
+++ /dev/null
@@ -1,353 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.text.MessageFormat;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IPluginDescriptor;
-import org.eclipse.core.runtime.Path;
-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.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.eclipse.wst.sse.core.IModelManager;
-import org.eclipse.wst.sse.core.IModelManagerPlugin;
-
-
-public class XSDEditorPlugin extends AbstractUIPlugin
-{
- public final static String PLUGIN_ID = "org.eclipse.wst.xsd.ui";
- public final static String XSD_EDITOR_ID = "org.eclipse.wst.xsd.ui.XSDEditor";
-
- public final static String DEFAULT_TARGET_NAMESPACE = "http://www.example.org";
-
- protected static XSDEditorPlugin plugin;
- // protected XMLSchemaPackage xmlschemaPackage;
-// KCPort private static MsgLogger myMsgLogger;
-
- public XSDEditorPlugin(IPluginDescriptor descriptor)
- {
- super(descriptor);
- plugin = this;
-// KCPort myMsgLogger = getMsgLogger();
- //myMsgLogger.write(Level.CONFIG, new BuildInfo());
- //myMsgLogger.write(Level.CONFIG, BuildInfo.getWSABuildLevel());
- }
-
- /**
- * Copy the w3c XMLSchema.dtd and datatypes.dtd into the plugin metadata directory
- * for validation purposes
- */
- public void startup()
- {
- modelManager = getModelManager();
- }
-
- private static IModelManager modelManager;
-
- public static IModelManager getModelManager() {
- IModelManagerPlugin plugin = (IModelManagerPlugin) Platform.getPlugin(IModelManagerPlugin.ID);
- return plugin.getModelManager();
- }
-
-
- /**
- * Get the Install URL
- */
- public static URL getInstallURL()
- {
- return getPlugin().getDescriptor().getInstallURL();
- }
-
- /**
- * Return the plugin physical directory location
- */
- public static IPath getPluginLocation()
- {
- try
- {
- IPath installPath = new Path(getInstallURL().toExternalForm()).removeTrailingSeparator();
- String installStr = Platform.asLocalURL(new URL(installPath.toString())).getFile();
- return new Path(installStr);
- }
- catch (IOException e)
- {
-
- }
- return null;
- }
-
- /**
- * Get the metadata directory for this plugin
- */
- public static String getMetaDataDirectory()
- {
- return getPlugin().getStateLocation().toOSString();
- }
-
- /**
- * Get the one xmlschema package.
- */
-// public XMLSchemaPackage getXMLSchemaPackage()
-// {
-// return xmlschemaPackage;
-// }
-
-// /**
-// * Get the one xmlschema factory.
-// */
-// public XMLSchemaFactory getXMLSchemaFactory()
-// {
-// return (XMLSchemaFactory)xmlschemaPackage.getEFactoryInstance();
-// }
-
- /**
- * Get the singleton instance.
- */
- public static XSDEditorPlugin getPlugin()
- {
- return plugin;
- }
-
- public static Image getXSDImage(String iconName)
- {
- return getPlugin().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 static String getXSDString(String key)
- {
- return Platform.getResourceBundle(plugin.getBundle()).getString(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 IWorkspace getWorkspace()
-// {
-// return ResourcesPlugin.getWorkspace();
-// }
-
- public static Shell getShell()
- {
- return getPlugin().getWorkbench().getActiveWorkbenchWindow().getShell();
- }
-
- /**
- * Get the xml schema default namespace prefix
- */
- public String getXMLSchemaPrefix()
- {
- return getPreferenceStore().getString(CONST_XSD_DEFAULT_PREFIX_TEXT);
- }
-
- /**
- * Get the xml schema default target namespace
- */
- public String getXMLSchemaTargetNamespace()
- {
- String targetNamespace = getPreferenceStore().getString(CONST_DEFAULT_TARGET_NAMESPACE);
- if(!targetNamespace.endsWith("/")){
- targetNamespace = targetNamespace + "/";
- }
- return targetNamespace;
- }
-
- /**
- * Get the xml schema language qualification
- */
- public boolean isQualifyXMLSchemaLanguage()
- {
- return getPreferenceStore().getBoolean(CONST_XSD_LANGUAGE_QUALIFY);
- }
-
- /**
- * Method isCombinedDesignAndSourceView.
- * @return boolean if the editor should have a single page that is
- * a combined design and source page
- */
- public boolean isCombinedDesignAndSourceView()
- {
- return COMBINED_LAYOUT.equals(getPreferenceStore().getString(EDITOR_LAYOUT));
- }
-
- public int getDesignLayout()
- {
- if (TOP_LAYOUT.equals(getPreferenceStore().getString(DESIGN_LAYOUT)))
- {
- return SWT.VERTICAL;
- }
- else if (BOTTOM_LAYOUT.equals(getPreferenceStore().getString(DESIGN_LAYOUT)))
- {
- return SWT.VERTICAL;
- }
- else if (LEFT_LAYOUT.equals(getPreferenceStore().getString(DESIGN_LAYOUT)))
- {
- return SWT.HORIZONTAL;
- }
- else if (RIGHT_LAYOUT.equals(getPreferenceStore().getString(DESIGN_LAYOUT)))
- {
- return SWT.HORIZONTAL;
- }
- return SWT.HORIZONTAL;
- }
-
- public String getDesignLayoutPosition()
- {
- if (TOP_LAYOUT.equals(getPreferenceStore().getString(DESIGN_LAYOUT)))
- {
- return TOP_LAYOUT;
- }
- else if (BOTTOM_LAYOUT.equals(getPreferenceStore().getString(DESIGN_LAYOUT)))
- {
- return BOTTOM_LAYOUT;
- }
- else if (LEFT_LAYOUT.equals(getPreferenceStore().getString(DESIGN_LAYOUT)))
- {
- return LEFT_LAYOUT;
- }
- else if (RIGHT_LAYOUT.equals(getPreferenceStore().getString(DESIGN_LAYOUT)))
- {
- return RIGHT_LAYOUT;
- }
- return RIGHT_LAYOUT;
- }
-
- /*---------------------------------------------------------------------------*/
- /* the following methods are impls for the IPluginHelper interface */
- /*---------------------------------------------------------------------------*/
-// public void setMsgLoggerConfig(Hashtable msgLoggerConfig)
-// {
-// getMsgLogger().setMsgLoggerConfig(msgLoggerConfig);
-// }
-//
-// public Hashtable getMsgLoggerConfig(Plugin plugin)
-// {
-// return (new PluginHelperImpl().getMsgLoggerConfig(plugin));
-// }
-//
-// public Hashtable getMsgLoggerConfig()
-// {
-// return (getMsgLoggerConfig(this));
-// }
-//
-// /**
-// * XSDEditor and XSDModel use the same logger. See plugin.xml
-// */
-// public MsgLogger getMsgLogger()
-// {
-// if (myMsgLogger == null)
-// {
-// myMsgLogger = (MsgLogger) MsgLogger.getFactory().getLogger(new PluginHelperImpl().getMsgLoggerName(this), this);
-// }
-// return (myMsgLogger);
-// }
-
- public static final String CONST_XSD_DEFAULT_PREFIX_TEXT = "org.eclipse.wst.xmlschema.xsdDefaultPrefixText";
- public static final String CONST_XSD_LANGUAGE_QUALIFY = "org.eclipse.wst.xmlschema.xsdQualify";
- public static final String CONST_DEFAULT_TARGET_NAMESPACE = "org.eclipse.wst.xmlschema.defaultTargetnamespaceText";
-
- // Preference to store which page should come up as the default page in the editor. This setting is based
- // on the page that was left showing the last time the editor was closed.
- 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";
- public static String GRAPH_PAGE = "org.eclipse.wst.xsd.ui.internal.graphPage";
-
- public static String EDITOR_LAYOUT = "org.eclipse.wst.xsd.ui.internal.editorlayout";
- public static String COMBINED_LAYOUT = "org.eclipse.wst.xsd.ui.internal.combined";
- public static String SEPARATE_LAYOUT = "org.eclipse.wst.xsd.ui.internal.separate";
-
- public static String DESIGN_LAYOUT = "org.eclipse.wst.xsd.ui.internal.designlayout";
- public static String TOP_LAYOUT = "org.eclipse.wst.xsd.ui.internal.top";
- public static String BOTTOM_LAYOUT = "org.eclipse.wst.xsd.ui.internal.bottom";
- public static String LEFT_LAYOUT = "org.eclipse.wst.xsd.ui.internal.left";
- public static String RIGHT_LAYOUT = "org.eclipse.wst.xsd.ui.internal.right";
-
- /**
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#initializeDefaultPreferences(IPreferenceStore)
- */
- protected void initializeDefaultPreferences(IPreferenceStore store)
- {
- super.initializeDefaultPreferences(store);
-
- store.setDefault(CONST_XSD_DEFAULT_PREFIX_TEXT, "xsd");
- store.setDefault(CONST_XSD_LANGUAGE_QUALIFY, false);
-
- store.setDefault(DEFAULT_PAGE, DESIGN_PAGE);
- store.setDefault(EDITOR_LAYOUT, COMBINED_LAYOUT);
- store.setDefault(DESIGN_LAYOUT, RIGHT_LAYOUT);
-
- store.setDefault(XSDEditorPlugin.CONST_DEFAULT_TARGET_NAMESPACE, DEFAULT_TARGET_NAMESPACE);
- }
-
- public void setDefaultPage(String page)
- {
- getPreferenceStore().setValue(DEFAULT_PAGE, 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);
- }
-
- protected URL baseURL;
- public URL getBaseURL()
- {
- return getDescriptor().getInstallURL();
- }
-
- public Image getIconImage(String object)
- {
- try
- {
- return ExtendedImageRegistry.getInstance().getImage(new URL(getBaseURL() + "icons/" + object + ".gif"));
- }
- catch (MalformedURLException exception)
- {
- System.out.println("Failed to load image for '" + object + "'");
- }
- return null;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDMenuListener.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDMenuListener.java
deleted file mode 100644
index 4246bd7e64..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDMenuListener.java
+++ /dev/null
@@ -1,2052 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gef.ui.parts.AbstractEditPartViewer;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.wst.xsd.ui.internal.actions.AddEnumsAction;
-import org.eclipse.wst.xsd.ui.internal.actions.AddModelGroupAction;
-import org.eclipse.wst.xsd.ui.internal.actions.BackAction;
-import org.eclipse.wst.xsd.ui.internal.actions.CreateAnnotationAction;
-import org.eclipse.wst.xsd.ui.internal.actions.CreateElementAction;
-import org.eclipse.wst.xsd.ui.internal.actions.CreateGroupAction;
-import org.eclipse.wst.xsd.ui.internal.actions.CreateIdentityConstraintsAction;
-import org.eclipse.wst.xsd.ui.internal.actions.CreateLocalComplexTypeAction;
-import org.eclipse.wst.xsd.ui.internal.actions.CreateLocalSimpleTypeAction;
-import org.eclipse.wst.xsd.ui.internal.actions.CreateSimpleContentAction;
-import org.eclipse.wst.xsd.ui.internal.actions.CreateSimpleTypeAction;
-import org.eclipse.wst.xsd.ui.internal.actions.DOMAttribute;
-import org.eclipse.wst.xsd.ui.internal.actions.DeleteAction;
-import org.eclipse.wst.xsd.ui.internal.actions.GraphRenameAction;
-import org.eclipse.wst.xsd.ui.internal.actions.MakeAnonymousGlobal;
-import org.eclipse.wst.xsd.ui.internal.actions.OpenSchemaAction;
-import org.eclipse.wst.xsd.ui.internal.actions.SetBaseTypeAction;
-import org.eclipse.wst.xsd.ui.internal.actions.XSDEditNamespacesAction;
-import org.eclipse.wst.xsd.ui.internal.graph.editparts.ComplexTypeDefinitionEditPart;
-import org.eclipse.wst.xsd.ui.internal.graph.editparts.ElementDeclarationEditPart;
-import org.eclipse.wst.xsd.ui.internal.graph.editparts.ModelGroupDefinitionEditPart;
-import org.eclipse.wst.xsd.ui.internal.graph.editparts.TopLevelComponentEditPart;
-import org.eclipse.wst.xsd.ui.internal.graph.model.Category;
-import org.eclipse.wst.xsd.ui.internal.provider.CategoryAdapter;
-import org.eclipse.wst.xsd.ui.internal.util.TypesHelper;
-import org.eclipse.wst.xsd.ui.internal.util.XSDDOMHelper;
-import org.eclipse.xsd.XSDComplexTypeDefinition;
-import org.eclipse.xsd.XSDCompositor;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDElementDeclaration;
-import org.eclipse.xsd.XSDModelGroupDefinition;
-import org.eclipse.xsd.XSDNamedComponent;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.XSDSchemaDirective;
-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;
-
-public class XSDMenuListener implements IMenuListener
-{
- protected ISelectionProvider selectionProvider;
- //protected XSDTextEditor textEditor;
- protected DeleteAction deleteAction;
-// protected IAction undoAction, redoAction;
- protected CreateElementAction addComplexTypeAction;
- protected XSDSchema xsdSchema;
- protected boolean isReadOnly;
- protected Object sourceContext;
-
- /**
- * Constructor for XSDMenuListener.
- */
- public XSDMenuListener(ISelectionProvider selectionProvider)
- {
- super();
- this.selectionProvider = selectionProvider;
-
- deleteAction = new DeleteAction(XSDEditorPlugin.getXSDString("_UI_ACTION_DELETE"), null, getXSDSchema());
- deleteAction.setSelectionProvider(selectionProvider);
- selectionProvider.addSelectionChangedListener(deleteAction);
- }
-
- public void setSourceContext(Object sourceContext)
- {
- this.sourceContext = sourceContext;
- }
-
- public void setSelectionProvider(ISelectionProvider selectionProvider)
- {
- this.selectionProvider = selectionProvider;
- }
-
- protected XSDSchema getXSDSchema()
- {
- return xsdSchema;
- }
-
- protected Object getSelectedElement()
- {
- ISelection selection = selectionProvider.getSelection();
- if (selection.isEmpty())
- {
- return null;
- }
- return ((IStructuredSelection) selection).getFirstElement();
- }
-
- protected void updateXSDSchema()
- {
- Object object = getSelectedElement();
- if (object instanceof XSDConcreteComponent)
- {
- xsdSchema = ((XSDConcreteComponent)object).getSchema();
- boolean flag = true;
- isReadOnly = false;
- if (xsdSchema == null)
- {
- return;
- }
- while (flag)
- {
- List list = xsdSchema.getReferencingDirectives();
- if (list.size() > 0)
- {
- isReadOnly = true;
- XSDSchemaDirective xsdSchemaDirective = (XSDSchemaDirective)list.get(0);
- if (xsdSchemaDirective.getSchema() != null)
- {
- xsdSchema = xsdSchemaDirective.getSchema();
- }
- else
- {
- flag = false;
- }
- }
- else
- {
- flag = false;
- }
- }
- }
- else if (object instanceof Category)
- {
- Category cg = (Category)object;
- xsdSchema = cg.getXSDSchema();
- }
- else if (object instanceof CategoryAdapter)
- {
- CategoryAdapter category = (CategoryAdapter)object;
- xsdSchema = category.getXSDSchema();
- }
- }
-
- /*
- * @see IMenuListener#menuAboutToShow(IMenuManager)
- */
- public void menuAboutToShow(IMenuManager manager)
- {
- isReadOnly = false;
- updateXSDSchema();
- if (xsdSchema == null)
- {
- return;
- }
-
- deleteAction.setXSDSchema(xsdSchema);
- deleteAction.setEnabled(!isReadOnly);
-
- BackAction backAction = new BackAction(XSDEditorPlugin.getXSDString("_UI_ACTION_BACK_TO_SCHEMA_VIEW")); //$NON-NLS-1$
- backAction.setXSDSchema(getXSDSchema());
- backAction.setSelectionProvider(selectionProvider);
-
- Object selectedElementObj = getSelectedElement();
-
- if (selectedElementObj instanceof XSDSchema || selectedElementObj instanceof Category || selectedElementObj instanceof CategoryAdapter)
- {
- backAction.setEnabled(false);
- }
- manager.add(backAction);
- manager.add(new Separator());
-// if (undoAction == null && textEditor != null)
-// {
-// undoAction = textEditor.getAction(org.eclipse.ui.texteditor.ITextEditorActionConstants.UNDO);
-// redoAction = textEditor.getAction(org.eclipse.ui.texteditor.ITextEditorActionConstants.REDO);
-// }
- // Element selectedElement = getSelectedElement();
-
- Element selectedElement = null;
-
- if (selectedElementObj instanceof Element)
- {
- selectedElement = (Element) selectedElementObj;
- }
- else if (selectedElementObj instanceof XSDConcreteComponent)
- {
- selectedElement = ((XSDConcreteComponent) selectedElementObj).getElement();
- }
- else if (selectedElementObj instanceof Category || selectedElementObj instanceof CategoryAdapter)
- {
- int groupType = -1;
- if (selectedElementObj instanceof Category)
- {
- Category category = (Category) selectedElementObj;
- groupType = category.getGroupType();
- }
- // todo... We need to ensure we eliminate the need for
- // this case. The XSDMenuListener class should not have
- // view dependant code. We need to do some work to ensure all
- // views utilize the 'Category' model object
- else if (selectedElementObj instanceof CategoryAdapter)
- {
- CategoryAdapter categoryAdapter = (CategoryAdapter) selectedElementObj;
- groupType = categoryAdapter.getGroupType();
- }
- ArrayList attributes = null;
- Element parent = getXSDSchema().getElement();
-
- if (parent == null)
- {
- return;
- }
-
- Node relativeNode = null;
- switch (groupType)
- {
- case Category.TYPES : {
- attributes = new ArrayList();
- attributes.add(new DOMAttribute(XSDConstants.NAME_ATTRIBUTE, getNewGlobalTypeName("ComplexType")));
- Action action = addCreateElementAction(manager, XSDConstants.COMPLEXTYPE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_COMPLEX_TYPE"), attributes, parent, relativeNode);
- ((CreateElementAction) action).setIsGlobal(true);
- attributes = new ArrayList();
- attributes.add(new DOMAttribute(XSDConstants.NAME_ATTRIBUTE, getNewGlobalTypeName("SimpleType")));
- Action action2 = addCreateSimpleTypeAction(manager, XSDConstants.SIMPLETYPE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_SIMPLE_TYPE"), attributes, parent, relativeNode);
- ((CreateElementAction) action2).setIsGlobal(true);
- break;
- }
- case Category.ELEMENTS : {
- attributes = new ArrayList();
- attributes.add(new DOMAttribute(XSDConstants.NAME_ATTRIBUTE, getNewGlobalName(XSDConstants.ELEMENT_ELEMENT_TAG, "GlobalElement")));
- attributes.add(new DOMAttribute(XSDConstants.TYPE_ATTRIBUTE, getBuiltInStringQName()));
- Action action = addCreateElementAction(manager, XSDConstants.ELEMENT_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ELEMENT"), attributes, parent, relativeNode);
- ((CreateElementAction) action).setIsGlobal(true);
- break;
- }
- case Category.GROUPS : {
- attributes = new ArrayList();
- attributes.add(new DOMAttribute(XSDConstants.NAME_ATTRIBUTE, getNewGlobalName(XSDConstants.GROUP_ELEMENT_TAG, "Group")));
- CreateGroupAction groupAction = addCreateGroupAction(manager, XSDConstants.GROUP_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_GROUP"), attributes, parent, relativeNode);
- groupAction.setIsGlobal(true);
- break;
- }
- case Category.ATTRIBUTES : {
- attributes = new ArrayList();
- attributes.add(new DOMAttribute(XSDConstants.NAME_ATTRIBUTE, getNewGlobalName(XSDConstants.ATTRIBUTE_ELEMENT_TAG, "GlobalAttribute")));
- attributes.add(new DOMAttribute(XSDConstants.TYPE_ATTRIBUTE, getBuiltInStringQName()));
- Action action = addCreateElementAction(manager, XSDConstants.ATTRIBUTE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_GLOBAL_ATTRIBUTE"), attributes, parent, relativeNode);
- ((CreateElementAction) action).setIsGlobal(true);
- break;
- }
- case Category.ATTRIBUTE_GROUPS : {
- attributes = new ArrayList();
- attributes.add(new DOMAttribute(XSDConstants.NAME_ATTRIBUTE, getNewGlobalName(XSDConstants.ATTRIBUTEGROUP_ELEMENT_TAG, "AttributeGroup")));
- Action action = addCreateElementAction(manager, XSDConstants.ATTRIBUTEGROUP_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ATTRIBUTE_GROUP"), attributes, parent, relativeNode);
- ((CreateElementAction) action).setIsGlobal(true);
- break;
- }
- case Category.NOTATIONS : {
- attributes = new ArrayList();
- attributes.add(new DOMAttribute(XSDConstants.NAME_ATTRIBUTE, getNewGlobalName(XSDConstants.NOTATION_ELEMENT_TAG, "Notation")));
- attributes.add(new DOMAttribute(XSDConstants.PUBLIC_ATTRIBUTE, ""));
- Action action = addCreateElementAction(manager, XSDConstants.NOTATION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_NOTATION"), attributes, parent, relativeNode);
- ((CreateElementAction) action).setIsGlobal(true);
- break;
- }
- case Category.DIRECTIVES : {
- boolean b = true;
- NodeList children = parent.getChildNodes();
- int length = children.getLength();
- Node effectiveRelativeNode = parent.getFirstChild();
- for (int i = 0; i < length && b; i++)
- {
- Node child = children.item(i);
- if (child != null && child instanceof Element)
- {
- if (XSDDOMHelper.inputEquals((Element) child, XSDConstants.INCLUDE_ELEMENT_TAG, false) || XSDDOMHelper.inputEquals((Element) child, XSDConstants.IMPORT_ELEMENT_TAG, false)
- || XSDDOMHelper.inputEquals((Element) child, XSDConstants.REDEFINE_ELEMENT_TAG, false) || XSDDOMHelper.inputEquals((Element) child, XSDConstants.ANNOTATION_ELEMENT_TAG, false))
- {
- effectiveRelativeNode = child;
- }
- else
- {
- b = false;
- }
- }
- }
- relativeNode = effectiveRelativeNode != null ? XSDDOMHelper.getNextElementNode(effectiveRelativeNode) : null;
- attributes = new ArrayList();
- attributes.add(new DOMAttribute(XSDConstants.SCHEMALOCATION_ATTRIBUTE, ""));
- Action action = addCreateElementAction(manager, XSDConstants.INCLUDE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_INCLUDE"), attributes, parent, relativeNode);
- ((CreateElementAction) action).setIsGlobal(true);
- action = addCreateElementAction(manager, XSDConstants.IMPORT_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_IMPORT"), null, parent, relativeNode);
- ((CreateElementAction) action).setIsGlobal(true);
- action = addCreateElementAction(manager, XSDConstants.REDEFINE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_REDEFINE"), attributes, parent, relativeNode);
- ((CreateElementAction) action).setIsGlobal(true);
- break;
- }
- case Category.ANNOTATIONS : {
- Action action = addCreateElementAction(manager, XSDConstants.ANNOTATION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ANNOTATION"), null, parent, relativeNode);
- ((CreateElementAction) action).setIsGlobal(true);
- break;
- }
- }
-// manager.add(new Separator());
-// if (undoAction != null)
-// {
-// manager.add(undoAction);
-// manager.add(redoAction);
-// }
- return;
- }
- if (selectedElement != null)
- {
- // Add context menu items for selected element
- addContextItems(manager, selectedElement, null);
- manager.add(new Separator());
- //else
-// if (textEditor != null)
-// {
-// Document document = getXSDSchema().getDocument();
-// if (document != null)
-// {
-// Element docElement = getXSDSchema().getDocument().getDocumentElement();
-// if (!XSDDOMHelper.inputEquals(docElement, XSDConstants.SCHEMA_ELEMENT_TAG, false))
-// // if (list.getLength() == 0)
-// {
-// // no schema tag. Enable the Add Schema action
-// AddSchemaNodeAction action = new AddSchemaNodeAction(XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_SCHEMA_NODE"));
-// action.setEditor((XSDEditor) textEditor.getEditorPart());
-// manager.add(action);
-// }
-// }
-// }
- }
-// manager.add(new Separator());
-// if (undoAction != null)
-// {
-// manager.add(undoAction);
-// manager.add(redoAction);
-// }
-
- manager.add(new Separator());
- if (deleteAction != null)
- {
- manager.add(deleteAction);
- }
- }
-
- protected String getBuiltInStringQName()
- {
- String stringName = "string";
- if (getXSDSchema() != null)
- {
- String schemaForSchemaPrefix = getXSDSchema().getSchemaForSchemaQNamePrefix();
- if (schemaForSchemaPrefix != null && schemaForSchemaPrefix.length() > 0)
- {
- String prefix = getXSDSchema().getSchemaForSchemaQNamePrefix();
- if (prefix != null && prefix.length() > 0)
- {
- stringName = prefix + ":" + stringName;
- }
- }
- }
- return stringName;
- }
-
- /**
- * Method addContextItems.
- *
- * @param manager
- * @param parent -
- * menu items should be context sensitive to this node
- * @param relativeNode -
- * anything inserted, should be inserted before this node (which is a
- * child of the parent node. A value of null means add to the end
- */
- protected void addContextItems(IMenuManager manager, Element parent, Node relativeNode)
- {
- ArrayList attributes = null;
- if (XSDDOMHelper.inputEquals(parent, XSDConstants.SCHEMA_ELEMENT_TAG, false))
- { //
- addSchemaElementItems(manager, parent, relativeNode);
- manager.add(new Separator());
- boolean b = true;
- NodeList children = parent.getChildNodes();
- Node effectiveRelativeNode = parent.getFirstChild();
- for (int i = 0; i < children.getLength() && b; i++)
- {
- Node child = children.item(i);
- if (child != null && child instanceof Element)
- {
- if (XSDDOMHelper.inputEquals((Element) child, XSDConstants.INCLUDE_ELEMENT_TAG, false) || XSDDOMHelper.inputEquals((Element) child, XSDConstants.IMPORT_ELEMENT_TAG, false)
- || XSDDOMHelper.inputEquals((Element) child, XSDConstants.REDEFINE_ELEMENT_TAG, false) || XSDDOMHelper.inputEquals((Element) child, XSDConstants.ANNOTATION_ELEMENT_TAG, false))
- {
- effectiveRelativeNode = child;
- }
- else
- {
- b = false;
- }
- }
- }
- relativeNode = effectiveRelativeNode != null ? effectiveRelativeNode.getNextSibling() : null;
- attributes = new ArrayList();
- attributes.add(new DOMAttribute(XSDConstants.SCHEMALOCATION_ATTRIBUTE, ""));
- addCreateElementAction(manager, XSDConstants.INCLUDE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_INCLUDE"), attributes, parent, relativeNode);
- addCreateElementAction(manager, XSDConstants.IMPORT_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_IMPORT"), null, parent, relativeNode);
- addCreateElementAction(manager, XSDConstants.REDEFINE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_REDEFINE"), attributes, parent, relativeNode);
- attributes = null;
- addCreateAnnotationAction(manager, XSDConstants.ANNOTATION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ANNOTATION"), null, parent, relativeNode);
- }
- else if (XSDDOMHelper.inputEquals(parent, XSDConstants.ANNOTATION_ELEMENT_TAG, false))
- { //
- addCreateElementAction(manager, XSDConstants.DOCUMENTATION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_DOC"), attributes, parent, null);
- addCreateElementAction(manager, XSDConstants.APPINFO_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_APP_INFO"), attributes, parent, null);
- }
- else if (XSDDOMHelper.inputEquals(parent, XSDConstants.ELEMENT_ELEMENT_TAG, false))
- { //
- Element parentNode = (Element) parent.getParentNode();
- boolean isGlobalElement = false;
- if (XSDDOMHelper.inputEquals(parentNode, XSDConstants.SCHEMA_ELEMENT_TAG, false))
- {
- isGlobalElement = true;
- }
- boolean annotationExists = addCreateAnnotationActionIfNotExist(manager, XSDConstants.ANNOTATION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ANNOTATION"), attributes, parent,
- parent.getFirstChild());
- boolean simpleTypeExists = elementExists(XSDConstants.SIMPLETYPE_ELEMENT_TAG, parent);
- boolean complexTypeExists = elementExists(XSDConstants.COMPLEXTYPE_ELEMENT_TAG, parent);
- manager.add(new Separator());
- if (annotationExists)
- {
- Node annotationNode = getFirstChildNodeIfExists(parent, XSDConstants.ANNOTATION_ELEMENT_TAG, false);
- if (!(simpleTypeExists || complexTypeExists) && annotationNode != null)
- {
- //addCreateLocalSimpleTypeActionIfNotExist(manager,
- // XSDConstants.SIMPLETYPE_ELEMENT_TAG,
- // XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_LOCAL_SIMPLE_TYPE"),
- // attributes, parent, annotationNode.getNextSibling());
- //addCreateLocalComplexTypeActionIfNotExist(manager,
- // XSDConstants.COMPLEXTYPE_ELEMENT_TAG, "Add Local Complex Type",
- // attributes, parent, annotationNode.getNextSibling());
- manager.add(new Separator());
- }
- }
- else
- {
- // Should still be able to add the content models if the anonymous type
- // exists,
- // ie. with attributes
- // if (!(simpleTypeExists || complexTypeExists))
- // {
- //addCreateLocalSimpleTypeActionIfNotExist(manager,
- // XSDConstants.SIMPLETYPE_ELEMENT_TAG,
- // XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_LOCAL_SIMPLE_TYPE"),
- // attributes, parent, parent.getFirstChild());
- //addCreateLocalComplexTypeActionIfNotExist(manager,
- // XSDConstants.COMPLEXTYPE_ELEMENT_TAG, "Add Local Complex Type",
- // attributes, parent, parent.getFirstChild());
- XSDConcreteComponent concreteComponent = getXSDSchema().getCorrespondingComponent(parent);
- if (concreteComponent != null)
- {
- AddModelGroupAction addModelGroupAction = new AddModelGroupAction(concreteComponent, XSDCompositor.SEQUENCE_LITERAL);
- addModelGroupAction.setEnabled(!isReadOnly);
- manager.add(addModelGroupAction);
-
- addModelGroupAction = new AddModelGroupAction(concreteComponent, XSDCompositor.CHOICE_LITERAL);
- addModelGroupAction.setEnabled(!isReadOnly);
- manager.add(addModelGroupAction);
-
- addModelGroupAction = new AddModelGroupAction(concreteComponent, XSDCompositor.ALL_LITERAL);
- addModelGroupAction.setEnabled(!isReadOnly);
- manager.add(addModelGroupAction);
-
- manager.add(new Separator());
- }
- // }
- }
-// attributes = new ArrayList();
-// attributes.add(new DOMAttribute(XSDConstants.NAME_ATTRIBUTE, "New_Unique"));
-// addCreateIdentityConstraintsAction(manager, XSDConstants.UNIQUE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_UNIQUE"), attributes, parent, null);
-// attributes = new ArrayList();
-// attributes.add(new DOMAttribute(XSDConstants.NAME_ATTRIBUTE, "New_Key"));
-// addCreateIdentityConstraintsAction(manager, XSDConstants.KEY_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_KEY"), attributes, parent, null);
-// attributes = new ArrayList();
-// attributes.add(new DOMAttribute(XSDConstants.NAME_ATTRIBUTE, "New_KeyRef"));
-// addCreateIdentityConstraintsAction(manager, XSDConstants.KEYREF_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_KEY_REF"), attributes, parent, null);
- XSDDOMHelper domHelper = new XSDDOMHelper();
- Element anonymousType = (Element) domHelper.getChildNode(parent, XSDConstants.COMPLEXTYPE_ELEMENT_TAG);
- if (anonymousType != null)
- {
- manager.add(new Separator());
- attributes = new ArrayList();
- attributes.add(new DOMAttribute(XSDConstants.NAME_ATTRIBUTE, getNewGlobalTypeName("ComplexType")));
- addMoveAnonymousGlobal(manager, XSDConstants.COMPLEXTYPE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_MAKE_ANONYMOUS_TYPE_GLOBAL"), attributes, anonymousType, null);
- attributes = null;
- }
- anonymousType = (Element) domHelper.getChildNode(parent, XSDConstants.SIMPLETYPE_ELEMENT_TAG);
- if (anonymousType != null)
- {
- manager.add(new Separator());
- attributes = new ArrayList();
- attributes.add(new DOMAttribute(XSDConstants.NAME_ATTRIBUTE, getNewGlobalTypeName("SimpleType")));
- addMoveAnonymousGlobal(manager, XSDConstants.SIMPLETYPE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_MAKE_ANONYMOUS_TYPE_GLOBAL"), attributes, anonymousType, null);
- attributes = null;
- }
- }
- else if (XSDDOMHelper.inputEquals(parent, XSDConstants.SEQUENCE_ELEMENT_TAG, false) || XSDDOMHelper.inputEquals(parent, XSDConstants.CHOICE_ELEMENT_TAG, false))
- { //
- addCreateAnnotationActionIfNotExist(manager, XSDConstants.ANNOTATION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ANNOTATION"), attributes, parent, parent.getFirstChild());
- manager.add(new Separator());
- addCreateElementAction(manager, XSDConstants.CHOICE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_CHOICE"), attributes, parent, null);
- addCreateElementAction(manager, XSDConstants.SEQUENCE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_SEQUENCE"), attributes, parent, null);
- addCreateElementRefAction(manager, XSDConstants.GROUP_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ADD_GROUP_REF"), parent, null);
- manager.add(new Separator());
- attributes = new ArrayList();
- attributes.add(new DOMAttribute(XSDConstants.NAME_ATTRIBUTE, getNewName(parent, XSDConstants.ELEMENT_ELEMENT_TAG, "Element", false)));
- attributes.add(new DOMAttribute(XSDConstants.TYPE_ATTRIBUTE, getBuiltInStringQName()));
- addCreateElementAction(manager, XSDConstants.ELEMENT_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ELEMENT"), attributes, parent, null);
- addCreateElementRefAction(manager, XSDConstants.ELEMENT_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ELEMENT_REF"), parent, null);
- manager.add(new Separator());
- attributes = null;
- addCreateElementAction(manager, XSDConstants.ANY_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ANY_ELEMENT"), attributes, parent, null);
- }
- else if (XSDDOMHelper.inputEquals(parent, XSDConstants.ALL_ELEMENT_TAG, false))
- { //
- addCreateAnnotationActionIfNotExist(manager, XSDConstants.ANNOTATION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ANNOTATION"), attributes, parent, parent.getFirstChild());
- manager.add(new Separator());
- attributes = new ArrayList();
- attributes.add(new DOMAttribute(XSDConstants.NAME_ATTRIBUTE, getNewName(parent, XSDConstants.ELEMENT_ELEMENT_TAG, "Element", false)));
- attributes.add(new DOMAttribute(XSDConstants.TYPE_ATTRIBUTE, getBuiltInStringQName()));
- addCreateElementAction(manager, XSDConstants.ELEMENT_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ELEMENT"), attributes, parent, null);
- addCreateElementRefAction(manager, XSDConstants.ELEMENT_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ELEMENT_REF"), parent, null);
- }
- else if (XSDDOMHelper.inputEquals(parent, XSDConstants.ATTRIBUTEGROUP_ELEMENT_TAG, false))
- { //
- boolean annotationExists = addCreateAnnotationActionIfNotExist(manager, XSDConstants.ANNOTATION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ANNOTATION"), attributes, parent,
- parent.getFirstChild());
- boolean anyAttributeExists = elementExists(XSDConstants.ANYATTRIBUTE_ELEMENT_TAG, parent);
- Node anyAttributeNode = null;
- manager.add(new Separator());
- if (anyAttributeExists)
- {
- anyAttributeNode = getFirstChildNodeIfExists(parent, XSDConstants.ANYATTRIBUTE_ELEMENT_TAG, false);
- attributes = new ArrayList();
- attributes.add(new DOMAttribute(XSDConstants.NAME_ATTRIBUTE, getNewName(parent, XSDConstants.ATTRIBUTE_ELEMENT_TAG, "Attribute", false)));
- attributes.add(new DOMAttribute(XSDConstants.TYPE_ATTRIBUTE, getBuiltInStringQName()));
- addCreateElementAction(manager, XSDConstants.ATTRIBUTE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ATTRIBUTE"), attributes, parent, anyAttributeNode);
- attributes = null;
- addCreateElementRefAction(manager, XSDConstants.ATTRIBUTE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ATTRIBUTE_REFERENCE"), parent, anyAttributeNode);
- addCreateElementRefAction(manager, XSDConstants.ATTRIBUTEGROUP_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ATTRIBUTE_GROUP_REF"), parent, anyAttributeNode);
- }
- else
- {
- attributes = new ArrayList();
- attributes.add(new DOMAttribute(XSDConstants.NAME_ATTRIBUTE, getNewName(parent, XSDConstants.ATTRIBUTE_ELEMENT_TAG, "Attribute", false)));
- attributes.add(new DOMAttribute(XSDConstants.TYPE_ATTRIBUTE, getBuiltInStringQName()));
- addCreateElementAction(manager, XSDConstants.ATTRIBUTE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ATTRIBUTE"), attributes, parent, parent.getLastChild());
- attributes = null;
- addCreateElementRefAction(manager, XSDConstants.ATTRIBUTE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ATTRIBUTE_REFERENCE"), parent, parent.getLastChild());
- addCreateElementRefAction(manager, XSDConstants.ATTRIBUTEGROUP_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ATTRIBUTE_GROUP_REF"), parent, parent.getLastChild());
- }
- attributes = null;
- addCreateElementActionIfNotExist(manager, XSDConstants.ANYATTRIBUTE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ANY_ATTRIBUTE"), attributes, parent, null);
- }
- else if (XSDDOMHelper.inputEquals(parent, XSDConstants.NOTATION_ELEMENT_TAG, false))
- { //
- addCreateAnnotationActionIfNotExist(manager, XSDConstants.ANNOTATION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ANNOTATION"), attributes, parent, null);
- }
- else if (XSDDOMHelper.inputEquals(parent, XSDConstants.SIMPLETYPE_ELEMENT_TAG, false))
- { //
- addCreateAnnotationActionIfNotExist(manager, XSDConstants.ANNOTATION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ANNOTATION"), attributes, parent, parent.getFirstChild());
- boolean restrictionExists = elementExists(XSDConstants.RESTRICTION_ELEMENT_TAG, parent);
- boolean unionExists = elementExists(XSDConstants.UNION_ELEMENT_TAG, parent);
- boolean listExists = elementExists(XSDConstants.LIST_ELEMENT_TAG, parent);
- if (!(restrictionExists || unionExists || listExists))
- {
- attributes = new ArrayList();
- attributes.add(new DOMAttribute(XSDConstants.BASE_ATTRIBUTE, getBuiltInStringQName()));
- addCreateElementActionIfNotExist(manager, XSDConstants.RESTRICTION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_RESTRICTION"), attributes, parent, null);
- attributes = null;
- attributes = new ArrayList();
- attributes.add(new DOMAttribute(XSDConstants.MEMBERTYPES_ATTRIBUTE, getBuiltInStringQName()));
- addCreateElementActionIfNotExist(manager, XSDConstants.UNION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_UNION"), attributes, parent, null);
- attributes = null;
- attributes = new ArrayList();
- attributes.add(new DOMAttribute(XSDConstants.ITEMTYPE_ATTRIBUTE, getBuiltInStringQName()));
- addCreateElementActionIfNotExist(manager, XSDConstants.LIST_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_LIST"), attributes, parent, null);
- attributes = null;
- }
- if (XSDDOMHelper.inputEquals(parent.getParentNode(), XSDConstants.ELEMENT_ELEMENT_TAG, false))
- {
- manager.add(new Separator());
- attributes = new ArrayList();
- attributes.add(new DOMAttribute(XSDConstants.NAME_ATTRIBUTE, getNewGlobalTypeName("SimpleType")));
- addMoveAnonymousGlobal(manager, XSDConstants.SIMPLETYPE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_MAKE_ANONYMOUS_TYPE_GLOBAL"), attributes, parent, null);
- attributes = null;
- }
- }
- else if (XSDDOMHelper.inputEquals(parent, XSDConstants.GROUP_ELEMENT_TAG, false))
- { //
- addCreateAnnotationActionIfNotExist(manager, XSDConstants.ANNOTATION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ANNOTATION"), attributes, parent, parent.getFirstChild());
- addCreateElementActionIfNotExist(manager, XSDConstants.SEQUENCE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_CONTENT_MODEL"), attributes, parent, null);
- }
- else if (XSDDOMHelper.inputEquals(parent, XSDConstants.COMPLEXTYPE_ELEMENT_TAG, false))
- { //
- boolean annotationExists = false;
- boolean contentExists = false;
- boolean complexOrSimpleContentExists = false;
- boolean anyAttributeExists = false;
- Node annotationNode = null;
- Node contentNode = null;
- Node anyAttributeNode = null;
- NodeList children = parent.getChildNodes();
- for (int i = 0; i < children.getLength(); i++)
- {
- Node child = children.item(i);
- if (child != null && child instanceof Element)
- {
- if (XSDDOMHelper.inputEquals((Element) child, XSDConstants.ANNOTATION_ELEMENT_TAG, false))
- {
- annotationNode = child;
- annotationExists = true;
- }
- else if (XSDDOMHelper.inputEquals((Element) child, XSDConstants.SEQUENCE_ELEMENT_TAG, false) || XSDDOMHelper.inputEquals((Element) child, XSDConstants.ALL_ELEMENT_TAG, false)
- || XSDDOMHelper.inputEquals((Element) child, XSDConstants.CHOICE_ELEMENT_TAG, false) || XSDDOMHelper.inputEquals((Element) child, XSDConstants.GROUP_ELEMENT_TAG, true)
- || XSDDOMHelper.inputEquals((Element) child, XSDConstants.SIMPLECONTENT_ELEMENT_TAG, false) || XSDDOMHelper.inputEquals((Element) child, XSDConstants.COMPLEXCONTENT_ELEMENT_TAG, false))
- {
- contentExists = true;
- contentNode = child;
- if (XSDDOMHelper.inputEquals((Element) child, XSDConstants.SIMPLECONTENT_ELEMENT_TAG, false) || XSDDOMHelper.inputEquals((Element) child, XSDConstants.COMPLEXCONTENT_ELEMENT_TAG, false))
- {
- complexOrSimpleContentExists = true;
- }
- }
- else if (XSDDOMHelper.inputEquals((Element) child, XSDConstants.ANYATTRIBUTE_ELEMENT_TAG, false))
- {
- anyAttributeExists = true;
- anyAttributeNode = child;
- }
- }
- }
- addCreateAnnotationActionIfNotExist(manager, XSDConstants.ANNOTATION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ANNOTATION"), attributes, parent, parent.getFirstChild());
- manager.add(new Separator());
- addSetBaseTypeAction(manager, parent);
- XSDConcreteComponent concreteComponent = getXSDSchema().getCorrespondingComponent(parent);
- if (annotationExists)
- {
- if (!contentExists)
- {
- // Add content model
- // addCreateElementAction(manager, XSDConstants.SEQUENCE_ELEMENT_TAG,
- // XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_CONTENT_MODEL"),
- // attributes, parent, annotationNode.getNextSibling());
- if (concreteComponent != null)
- {
- AddModelGroupAction addModelGroupAction = new AddModelGroupAction(concreteComponent, XSDCompositor.SEQUENCE_LITERAL);
- addModelGroupAction.setEnabled(!isReadOnly);
- manager.add(addModelGroupAction);
-
- addModelGroupAction = new AddModelGroupAction(concreteComponent, XSDCompositor.CHOICE_LITERAL);
- addModelGroupAction.setEnabled(!isReadOnly);
- manager.add(addModelGroupAction);
-
- addModelGroupAction = new AddModelGroupAction(concreteComponent, XSDCompositor.ALL_LITERAL);
- addModelGroupAction.setEnabled(!isReadOnly);
- manager.add(addModelGroupAction);
-
- }
- // Temporarily remove this until we provide a graphical rep of these
- // components
- // addCreateSimpleContentAction(manager,
- // XSDConstants.SIMPLECONTENT_ELEMENT_TAG,
- // XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_SIMPLE_CONTENT"),
- // attributes,
- // parent, annotationNode.getNextSibling());
- // addCreateSimpleContentAction(manager,
- // XSDConstants.COMPLEXCONTENT_ELEMENT_TAG,
- // XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_COMPLEX_CONTENT"),
- // attributes,
- // parent, annotationNode.getNextSibling());
- addCreateElementRefAction(manager, XSDConstants.GROUP_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ADD_GROUP_REF"), parent, annotationNode.getNextSibling());
- attributes = null;
- }
- }
- else
- {
- if (!contentExists)
- {
- // Add content model
- // addCreateElementAction(manager, XSDConstants.SEQUENCE_ELEMENT_TAG,
- // XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_CONTENT_MODEL"),
- // attributes, parent, parent.getFirstChild());
- if (concreteComponent != null)
- {
- AddModelGroupAction addModelGroupAction = new AddModelGroupAction(concreteComponent, XSDCompositor.SEQUENCE_LITERAL);
- addModelGroupAction.setEnabled(!isReadOnly);
- manager.add(addModelGroupAction);
-
- addModelGroupAction = new AddModelGroupAction(concreteComponent, XSDCompositor.CHOICE_LITERAL);
- addModelGroupAction.setEnabled(!isReadOnly);
- manager.add(addModelGroupAction);
-
- addModelGroupAction = new AddModelGroupAction(concreteComponent, XSDCompositor.ALL_LITERAL);
- addModelGroupAction.setEnabled(!isReadOnly);
- manager.add(addModelGroupAction);
-
- }
- // Temporarily remove this until we provide a graphical rep of these
- // components
- // addCreateSimpleContentAction(manager,
- // XSDConstants.SIMPLECONTENT_ELEMENT_TAG,
- // XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_SIMPLE_CONTENT"),
- // attributes,
- // parent, parent.getFirstChild());
- // addCreateSimpleContentAction(manager,
- // XSDConstants.COMPLEXCONTENT_ELEMENT_TAG,
- // XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_COMPLEX_CONTENT"),
- // attributes,
- // parent, parent.getFirstChild());
- addCreateElementRefAction(manager, XSDConstants.GROUP_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ADD_GROUP_REF"), parent, parent.getFirstChild());
- attributes = null;
- }
- }
- manager.add(new Separator());
- if (anyAttributeExists)
- {
- if (!complexOrSimpleContentExists)
- {
-// attributes = new ArrayList();
-// attributes.add(new DOMAttribute(XSDConstants.NAME_ATTRIBUTE, getNewName(parent, XSDConstants.ATTRIBUTE_ELEMENT_TAG, "Attribute", false)));
-// attributes.add(new DOMAttribute(XSDConstants.TYPE_ATTRIBUTE, getBuiltInStringQName()));
-// addCreateElementAction(manager, XSDConstants.ATTRIBUTE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ATTRIBUTE"), attributes, parent, anyAttributeNode);
-// attributes = null;
-// // ARE ATTRIBUTE GROUPS ALLOWED ?
-// // addCreateElementAction(manager,
-// // XSDConstants.ATTRIBUTEGROUP_ELEMENT_TAG,
-// // "_UI_ACTION_ADD_ATTRIBUTE_GROUP", attributes, parent,
-// // anyAttributeNode);
-// addCreateElementRefAction(manager, XSDConstants.ATTRIBUTE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ATTRIBUTE_REFERENCE"), parent, anyAttributeNode);
-// addCreateElementRefAction(manager, XSDConstants.ATTRIBUTEGROUP_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ATTRIBUTE_GROUP_REF"), parent, anyAttributeNode);
- }
- }
- else
- {
- if (!complexOrSimpleContentExists)
- {
-// attributes = new ArrayList();
-// attributes.add(new DOMAttribute(XSDConstants.NAME_ATTRIBUTE, getNewName(parent, XSDConstants.ATTRIBUTE_ELEMENT_TAG, "Attribute", false)));
-// attributes.add(new DOMAttribute(XSDConstants.TYPE_ATTRIBUTE, getBuiltInStringQName()));
-// addCreateElementAction(manager, XSDConstants.ATTRIBUTE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ATTRIBUTE"), attributes, parent, parent.getLastChild());
-// attributes = null;
-// // ARE ATTRIBUTE GROUPS ALLOWED ?
-// // addCreateElementAction(manager,
-// // XSDConstants.ATTRIBUTEGROUP_ELEMENT_TAG,
-// // "_UI_ACTION_ADD_ATTRIBUTE_GROUP", attributes, parent,
-// // parent.getLastChild());
-// addCreateElementRefAction(manager, XSDConstants.ATTRIBUTE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ATTRIBUTE_REFERENCE"), parent, parent.getLastChild());
-// addCreateElementRefAction(manager, XSDConstants.ATTRIBUTEGROUP_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ATTRIBUTE_GROUP_REF"), parent, parent.getLastChild());
-// attributes = null;
-// addCreateElementActionIfNotExist(manager, XSDConstants.ANYATTRIBUTE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ANY_ATTRIBUTE"), attributes, parent, parent.getLastChild());
- }
- }
- if (XSDDOMHelper.inputEquals(parent.getParentNode(), XSDConstants.ELEMENT_ELEMENT_TAG, false))
- {
- manager.add(new Separator());
- attributes = new ArrayList();
- attributes.add(new DOMAttribute(XSDConstants.NAME_ATTRIBUTE, getNewGlobalTypeName("ComplexType")));
- addMoveAnonymousGlobal(manager, XSDConstants.COMPLEXTYPE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_MAKE_ANONYMOUS_TYPE_GLOBAL"), attributes, parent, null);
- attributes = null;
- }
- }
- else if (XSDDOMHelper.inputEquals(parent, XSDConstants.COMPLEXCONTENT_ELEMENT_TAG, false))
- { //
- XSDDOMHelper xsdDOMHelper = new XSDDOMHelper();
- Element derivedByNode = xsdDOMHelper.getDerivedByElement(parent);
- String derivedByName = xsdDOMHelper.getDerivedByName(parent);
- boolean annotationExists = addCreateAnnotationActionIfNotExist(manager, XSDConstants.ANNOTATION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ANNOTATION"), attributes, parent,
- parent.getFirstChild());
- manager.add(new Separator());
- if (derivedByNode == null)
- {
- TypesHelper typesHelper = new TypesHelper(getXSDSchema());
- String firstType = "";
- List listOfCT = typesHelper.getUserComplexTypeNamesList();
- if (listOfCT.size() > 0)
- {
- firstType = (String) (listOfCT).get(0);
- }
- attributes = new ArrayList();
- attributes.add(new DOMAttribute(XSDConstants.BASE_ATTRIBUTE, firstType));
- addCreateElementActionIfNotExist(manager, XSDConstants.RESTRICTION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_RESTRICTION"), attributes, parent, null);
- addCreateElementActionIfNotExist(manager, XSDConstants.EXTENSION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_EXTENSION"), attributes, parent, null);
- }
- }
- else if (XSDDOMHelper.inputEquals(parent, XSDConstants.SIMPLECONTENT_ELEMENT_TAG, false))
- { //
- XSDDOMHelper xsdDOMHelper = new XSDDOMHelper();
- Element derivedByNode = xsdDOMHelper.getDerivedByElement(parent);
- String derivedByName = xsdDOMHelper.getDerivedByName(parent);
- boolean annotationExists = addCreateAnnotationActionIfNotExist(manager, XSDConstants.ANNOTATION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ANNOTATION"), attributes, parent,
- parent.getFirstChild());
- manager.add(new Separator());
- if (derivedByNode == null)
- {
- TypesHelper typesHelper = new TypesHelper(getXSDSchema());
- String firstType = "";
- List listOfCT = typesHelper.getUserComplexTypeNamesList();
- if (listOfCT.size() > 0)
- {
- firstType = (String) (listOfCT).get(0);
- }
- attributes = new ArrayList();
- attributes.add(new DOMAttribute(XSDConstants.BASE_ATTRIBUTE, firstType));
- addCreateElementActionIfNotExist(manager, XSDConstants.RESTRICTION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_RESTRICTION"), attributes, parent, null);
- addCreateElementActionIfNotExist(manager, XSDConstants.EXTENSION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_EXTENSION"), attributes, parent, null);
- }
- /*
- * for combined SimpleContent and derivedBy nodes (but without
- * restrictions) XSDDOMHelper xsdDOMHelper = new XSDDOMHelper(); Element
- * derivedByNode = xsdDOMHelper.getDerivedByElement(parent); String
- * derivedByName = xsdDOMHelper.getDerivedByName(parent);
- *
- * if (derivedByNode != null) { if (derivedByName.equals("restriction")) {
- * addCreateElementActionIfNotExist(manager,
- * XSDConstants.SIMPLETYPE_ELEMENT_TAG, "_UI_ACTION_ADD_SIMPLE_TYPE",
- * attributes, derivedByNode, relativeNode); }
- * addCreateElementActionIfNotExist(manager,
- * XSDConstants.ANNOTATION_ELEMENT_TAG, "_UI_ACTION_ADD_ANNOTATION",
- * attributes, derivedByNode, relativeNode);
- * addCreateElementAction(manager, XSDConstants.ATTRIBUTE_ELEMENT_TAG,
- * "_UI_ACTION_ADD_ATTRIBUTE", attributes, derivedByNode, relativeNode);
- * attributes = new ArrayList(); attributes.add(new
- * DOMAttribute(XSDConstants.REF_ATTRIBUTE, ""));
- * addCreateElementAction(manager,
- * XSDConstants.ATTRIBUTEGROUP_ELEMENT_TAG,
- * "_UI_ACTION_ADD_ATTRIBUTE_GROUP_REF", attributes, derivedByNode,
- * relativeNode); attributes = new ArrayList();
- * addCreateElementActionIfNotExist(manager,
- * XSDConstants.ANYATTRIBUTE_ELEMENT_TAG, "_UI_ACTION_ADD_ANY_ATTRIBUTE",
- * attributes, derivedByNode, relativeNode); } else { TypesHelper
- * typesHelper = new TypesHelper(getXSDSchema()); String firstType =
- * (String)(typesHelper.getBuiltInTypeNamesList()).get(0); attributes =
- * new ArrayList(); attributes.add(new
- * DOMAttribute(XSDConstants.BASE_ATTRIBUTE, firstType));
- *
- * addCreateElementActionIfNotExist(manager,
- * XSDConstants.ANNOTATION_ELEMENT_TAG, "_UI_ACTION_ADD_ANNOTATION",
- * attributes, parent, relativeNode);
- * addCreateElementActionIfNotExist(manager,
- * XSDConstants.RESTRICTION_ELEMENT_TAG, "_UI_ACTION_ADD_RESTRICTION",
- * attributes, parent, relativeNode);
- * addCreateElementActionIfNotExist(manager,
- * XSDConstants.EXTENSION_ELEMENT_TAG, "_UI_ACTION_ADD_EXTENSION",
- * attributes, parent, relativeNode); }
- */
- // addCreateElementActionIfNotExist(manager,
- // XSDConstants.SEQUENCE_ELEMENT_TAG,
- // "_UI_ACTION_ADD_CONTENT_MODEL", attributes, parent, relativeNode);
- // attributes = new ArrayList();
- // attributes.add(new DOMAttribute(XSDConstants.REF_ATTRIBUTE, ""));
- // addCreateElementActionIfNotExist(manager,
- // XSDConstants.GROUP_ELEMENT_TAG,
- // "_UI_ADD_GROUP_REF", attributes, parent, relativeNode);
- // addCreateElementAction(manager, XSDConstants.ATTRIBUTE_ELEMENT_TAG,
- // "_UI_ACTION_ADD_ATTRIBUTE", attributes, parent, relativeNode);
- // attributes = new ArrayList();
- // attributes.add(new DOMAttribute(XSDConstants.REF_ATTRIBUTE, ""));
- // addCreateElementAction(manager,
- // XSDConstants.ATTRIBUTEGROUP_ELEMENT_TAG,
- // "_UI_ACTION_ADD_ATTRIBUTE_GROUP_REF", attributes, parent,
- // relativeNode);
- // addCreateElementActionIfNotExist(manager,
- // XSDConstants.ANYATTRIBUTE_ELEMENT_TAG, "_UI_ACTION_ADD_ANY_ATTRIBUTE",
- // attributes, parent, relativeNode);
- }
- else if (XSDDOMHelper.inputEquals(parent, XSDConstants.RESTRICTION_ELEMENT_TAG, false))
- {
- Element parentNode = (Element) parent.getParentNode();
- // <simpleContent>
- // <restriction>
- // ...
- if (XSDDOMHelper.inputEquals(parentNode, XSDConstants.SIMPLECONTENT_ELEMENT_TAG, false))
- {
- boolean annotationExists = false;
- boolean anyAttributeExists = false;
- Node anyAttributeNode = null;
- anyAttributeExists = elementExists(XSDConstants.ANYATTRIBUTE_ELEMENT_TAG, parent);
- annotationExists = addCreateAnnotationActionIfNotExist(manager, XSDConstants.ANNOTATION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ANNOTATION"), attributes, parent, parent
- .getFirstChild());
- if (annotationExists)
- {
- Node annotationNode = getFirstChildNodeIfExists(parent, XSDConstants.ANNOTATION_ELEMENT_TAG, false);
- //addCreateLocalSimpleTypeActionIfNotExist(manager,
- // XSDConstants.SIMPLETYPE_ELEMENT_TAG,
- // XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_LOCAL_SIMPLE_TYPE"),
- // attributes, parent, annotationNode.getNextSibling());
- }
- else
- {
- //addCreateLocalSimpleTypeActionIfNotExist(manager,
- // XSDConstants.SIMPLETYPE_ELEMENT_TAG,
- // XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_LOCAL_SIMPLE_TYPE"),
- // attributes, parent, parent.getFirstChild());
- }
- /*
- * addCreateElementAction(manager, XSDConstants.ATTRIBUTE_ELEMENT_TAG,
- * "_UI_ACTION_ADD_ATTRIBUTE", attributes, parent, relativeNode);
- * attributes = new ArrayList(); attributes.add(new
- * DOMAttribute(XSDConstants.REF_ATTRIBUTE, ""));
- * addCreateElementAction(manager,
- * XSDConstants.ATTRIBUTEGROUP_ELEMENT_TAG,
- * "_UI_ACTION_ADD_ATTRIBUTE_GROUP_REF", attributes, parent,
- * relativeNode); attributes = new ArrayList();
- * addCreateElementActionIfNotExist(manager,
- * XSDConstants.ANYATTRIBUTE_ELEMENT_TAG,
- * "_UI_ACTION_ADD_ANY_ATTRIBUTE", attributes, parent, relativeNode);
- */
- manager.add(new Separator());
- if (anyAttributeExists)
- {
- anyAttributeNode = getFirstChildNodeIfExists(parent, XSDConstants.ANYATTRIBUTE_ELEMENT_TAG, false);
- attributes = new ArrayList();
- attributes.add(new DOMAttribute(XSDConstants.NAME_ATTRIBUTE, getNewName(parent, XSDConstants.ATTRIBUTE_ELEMENT_TAG, "Attribute", false)));
- attributes.add(new DOMAttribute(XSDConstants.TYPE_ATTRIBUTE, getBuiltInStringQName()));
- addCreateElementAction(manager, XSDConstants.ATTRIBUTE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ATTRIBUTE"), attributes, parent, anyAttributeNode);
- attributes = null;
- addCreateElementRefAction(manager, XSDConstants.ATTRIBUTE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ATTRIBUTE_REFERENCE"), parent, anyAttributeNode);
- addCreateElementRefAction(manager, XSDConstants.ATTRIBUTEGROUP_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ATTRIBUTE_GROUP_REF"), parent, anyAttributeNode);
- }
- else
- {
- attributes = new ArrayList();
- attributes.add(new DOMAttribute(XSDConstants.NAME_ATTRIBUTE, getNewName(parent, XSDConstants.ATTRIBUTE_ELEMENT_TAG, "Attribute", false)));
- attributes.add(new DOMAttribute(XSDConstants.TYPE_ATTRIBUTE, getBuiltInStringQName()));
- addCreateElementAction(manager, XSDConstants.ATTRIBUTE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ATTRIBUTE"), attributes, parent, parent.getLastChild());
- attributes = null;
- addCreateElementRefAction(manager, XSDConstants.ATTRIBUTE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ATTRIBUTE_REFERENCE"), parent, parent.getLastChild());
- addCreateElementRefAction(manager, XSDConstants.ATTRIBUTEGROUP_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ATTRIBUTE_GROUP_REF"), parent, parent.getLastChild());
- }
- attributes = null;
- addCreateElementActionIfNotExist(manager, XSDConstants.ANYATTRIBUTE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ANY_ATTRIBUTE"), attributes, parent, parent.getLastChild());
- }
- // <simpleType>
- // <restriction>
- // ...
- else if (XSDDOMHelper.inputEquals(parentNode, XSDConstants.SIMPLETYPE_ELEMENT_TAG, false))
- {
- boolean annotationExists = false;
- attributes = null;
- annotationExists = addCreateAnnotationActionIfNotExist(manager, XSDConstants.ANNOTATION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ANNOTATION"), attributes, parent, parent
- .getFirstChild());
- if (annotationExists)
- {
- Node annotationNode = getFirstChildNodeIfExists(parent, XSDConstants.ANNOTATION_ELEMENT_TAG, false);
- addCreateLocalSimpleTypeActionIfNotExist(manager, XSDConstants.SIMPLETYPE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_LOCAL_SIMPLE_TYPE"), attributes, parent, annotationNode
- .getNextSibling());
- }
- else
- {
- addCreateLocalSimpleTypeActionIfNotExist(manager, XSDConstants.SIMPLETYPE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_LOCAL_SIMPLE_TYPE"), attributes, parent, parent
- .getFirstChild());
- }
- manager.add(new Separator());
- addCreateElementAction(manager, XSDConstants.PATTERN_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_PATTERN"), attributes, parent, null);
- addCreateElementAction(manager, XSDConstants.ENUMERATION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ENUM"), attributes, parent, null);
- addEnumsAction(manager, XSDConstants.ENUMERATION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ENUMS"), attributes, parent, null);
- }
- // <complexContent>
- // <restriction>
- // ...
- else if (XSDDOMHelper.inputEquals(parentNode, XSDConstants.COMPLEXCONTENT_ELEMENT_TAG, false))
- {
- boolean annotationExists = false;
- boolean anyAttributeExists = false;
- Node anyAttributeNode = null;
- boolean sequenceExists = elementExists(XSDConstants.SEQUENCE_ELEMENT_TAG, parent);
- boolean choiceExists = elementExists(XSDConstants.CHOICE_ELEMENT_TAG, parent);
- boolean allExists = elementExists(XSDConstants.ALL_ELEMENT_TAG, parent);
- boolean groupExists = elementExists(XSDConstants.GROUP_ELEMENT_TAG, parent);
- anyAttributeExists = elementExists(XSDConstants.ANYATTRIBUTE_ELEMENT_TAG, parent);
- annotationExists = addCreateAnnotationActionIfNotExist(manager, XSDConstants.ANNOTATION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ANNOTATION"), attributes, parent, parent
- .getFirstChild());
- manager.add(new Separator());
- if (annotationExists)
- {
- if (!(sequenceExists || choiceExists || allExists || groupExists))
- {
- Node annotationNode = getFirstChildNodeIfExists(parent, XSDConstants.ANNOTATION_ELEMENT_TAG, false);
- addCreateElementActionIfNotExist(manager, XSDConstants.SEQUENCE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_CONTENT_MODEL"), attributes, parent, annotationNode
- .getNextSibling());
- // addCreateGroupAction(manager, XSDConstants.GROUP_ELEMENT_TAG,
- // "_UI_ACTION_ADD_GROUP", attributes, parent,
- // annotationNode.getNextSibling());
- addCreateElementRefAction(manager, XSDConstants.GROUP_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ADD_GROUP_REF"), parent, annotationNode.getNextSibling());
- }
- }
- else
- {
- if (!(sequenceExists || choiceExists || allExists || groupExists))
- {
- addCreateElementActionIfNotExist(manager, XSDConstants.SEQUENCE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_CONTENT_MODEL"), attributes, parent, parent.getFirstChild());
- // addCreateGroupAction(manager, XSDConstants.GROUP_ELEMENT_TAG,
- // "_UI_ACTION_ADD_GROUP", attributes, parent,
- // parent.getFirstChild());
- addCreateElementRefAction(manager, XSDConstants.GROUP_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ADD_GROUP_REF"), parent, parent.getFirstChild());
- }
- }
- manager.add(new Separator());
- if (anyAttributeExists)
- {
- anyAttributeNode = getFirstChildNodeIfExists(parent, XSDConstants.ANYATTRIBUTE_ELEMENT_TAG, false);
- attributes = new ArrayList();
- attributes.add(new DOMAttribute(XSDConstants.NAME_ATTRIBUTE, getNewName(parent, XSDConstants.ATTRIBUTE_ELEMENT_TAG, "Attribute", false)));
- attributes.add(new DOMAttribute(XSDConstants.TYPE_ATTRIBUTE, getBuiltInStringQName()));
- addCreateElementAction(manager, XSDConstants.ATTRIBUTE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ATTRIBUTE"), attributes, parent, anyAttributeNode);
- attributes = null;
- addCreateElementRefAction(manager, XSDConstants.ATTRIBUTE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ATTRIBUTE_REFERENCE"), parent, anyAttributeNode);
- addCreateElementRefAction(manager, XSDConstants.ATTRIBUTEGROUP_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ATTRIBUTE_GROUP_REF"), parent, anyAttributeNode);
- }
- else
- {
- attributes = new ArrayList();
- attributes.add(new DOMAttribute(XSDConstants.NAME_ATTRIBUTE, getNewName(parent, XSDConstants.ATTRIBUTE_ELEMENT_TAG, "Attribute", false)));
- attributes.add(new DOMAttribute(XSDConstants.TYPE_ATTRIBUTE, getBuiltInStringQName()));
- addCreateElementAction(manager, XSDConstants.ATTRIBUTE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ATTRIBUTE"), attributes, parent, parent.getLastChild());
- attributes = null;
- addCreateElementRefAction(manager, XSDConstants.ATTRIBUTE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ATTRIBUTE_REFERENCE"), parent, parent.getLastChild());
- addCreateElementRefAction(manager, XSDConstants.ATTRIBUTEGROUP_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ATTRIBUTE_GROUP_REF"), parent, parent.getLastChild());
- }
- attributes = null;
- addCreateElementActionIfNotExist(manager, XSDConstants.ANYATTRIBUTE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ANY_ATTRIBUTE"), attributes, parent, parent.getLastChild());
- }
- }
- else if (XSDDOMHelper.inputEquals(parent, XSDConstants.EXTENSION_ELEMENT_TAG, false))
- { //
- Element parentNode = (Element) parent.getParentNode();
- // <simpleContent>
- // <extension>
- // ...
- if (XSDDOMHelper.inputEquals(parentNode, XSDConstants.SIMPLECONTENT_ELEMENT_TAG, false))
- {
- boolean annotationExists = false;
- boolean anyAttributeExists = false;
- Node anyAttributeNode = null;
- anyAttributeExists = elementExists(XSDConstants.ANYATTRIBUTE_ELEMENT_TAG, parent);
- annotationExists = addCreateAnnotationActionIfNotExist(manager, XSDConstants.ANNOTATION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ANNOTATION"), attributes, parent, parent
- .getFirstChild());
- manager.add(new Separator());
- if (anyAttributeExists)
- {
- anyAttributeNode = getFirstChildNodeIfExists(parent, XSDConstants.ANYATTRIBUTE_ELEMENT_TAG, false);
- attributes = new ArrayList();
- attributes.add(new DOMAttribute(XSDConstants.NAME_ATTRIBUTE, getNewName(parent, XSDConstants.ATTRIBUTE_ELEMENT_TAG, "Attribute", false)));
- attributes.add(new DOMAttribute(XSDConstants.TYPE_ATTRIBUTE, getBuiltInStringQName()));
- addCreateElementAction(manager, XSDConstants.ATTRIBUTE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ATTRIBUTE"), attributes, parent, anyAttributeNode);
- attributes = null;
- addCreateElementRefAction(manager, XSDConstants.ATTRIBUTE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ATTRIBUTE_REFERENCE"), parent, anyAttributeNode);
- addCreateElementRefAction(manager, XSDConstants.ATTRIBUTEGROUP_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ATTRIBUTE_GROUP_REF"), parent, anyAttributeNode);
- }
- else
- {
- attributes = new ArrayList();
- attributes.add(new DOMAttribute(XSDConstants.NAME_ATTRIBUTE, getNewName(parent, XSDConstants.ATTRIBUTE_ELEMENT_TAG, "Attribute", false)));
- attributes.add(new DOMAttribute(XSDConstants.TYPE_ATTRIBUTE, getBuiltInStringQName()));
- addCreateElementAction(manager, XSDConstants.ATTRIBUTE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ATTRIBUTE"), attributes, parent, parent.getLastChild());
- attributes = null;
- addCreateElementRefAction(manager, XSDConstants.ATTRIBUTE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ATTRIBUTE_REFERENCE"), parent, parent.getLastChild());
- addCreateElementRefAction(manager, XSDConstants.ATTRIBUTEGROUP_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ATTRIBUTE_GROUP_REF"), parent, parent.getLastChild());
- }
- attributes = null;
- addCreateElementActionIfNotExist(manager, XSDConstants.ANYATTRIBUTE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ANY_ATTRIBUTE"), attributes, parent, parent.getLastChild());
- }
- // <complexContent>
- // <extension>
- // ...
- else if (XSDDOMHelper.inputEquals(parentNode, XSDConstants.COMPLEXCONTENT_ELEMENT_TAG, false))
- {
- boolean annotationExists = false;
- boolean anyAttributeExists = false;
- Node anyAttributeNode = null;
- boolean sequenceExists = elementExists(XSDConstants.SEQUENCE_ELEMENT_TAG, parent);
- boolean choiceExists = elementExists(XSDConstants.CHOICE_ELEMENT_TAG, parent);
- boolean allExists = elementExists(XSDConstants.ALL_ELEMENT_TAG, parent);
- boolean groupExists = elementExists(XSDConstants.GROUP_ELEMENT_TAG, parent);
- anyAttributeExists = elementExists(XSDConstants.ANYATTRIBUTE_ELEMENT_TAG, parent);
- annotationExists = addCreateAnnotationActionIfNotExist(manager, XSDConstants.ANNOTATION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ANNOTATION"), attributes, parent, parent
- .getFirstChild());
- manager.add(new Separator());
- if (annotationExists)
- {
- if (!(sequenceExists || choiceExists || allExists || groupExists))
- {
- Node annotationNode = getFirstChildNodeIfExists(parent, XSDConstants.ANNOTATION_ELEMENT_TAG, false);
- addCreateElementActionIfNotExist(manager, XSDConstants.SEQUENCE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_CONTENT_MODEL"), attributes, parent, annotationNode
- .getNextSibling());
- // addCreateGroupAction(manager, XSDConstants.GROUP_ELEMENT_TAG,
- // XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_GROUP"), attributes,
- // parent,
- // annotationNode.getNextSibling());
- addCreateElementRefAction(manager, XSDConstants.GROUP_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ADD_GROUP_REF"), parent, annotationNode.getNextSibling());
- }
- }
- else
- {
- if (!(sequenceExists || choiceExists || allExists || groupExists))
- {
- addCreateElementActionIfNotExist(manager, XSDConstants.SEQUENCE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_CONTENT_MODEL"), attributes, parent, parent.getFirstChild());
- // addCreateGroupAction(manager, XSDConstants.GROUP_ELEMENT_TAG,
- // XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_GROUP"), attributes,
- // parent,
- // parent.getFirstChild());
- addCreateElementRefAction(manager, XSDConstants.GROUP_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ADD_GROUP_REF"), parent, parent.getFirstChild());
- }
- }
- manager.add(new Separator());
- if (anyAttributeExists)
- {
- anyAttributeNode = getFirstChildNodeIfExists(parent, XSDConstants.ANYATTRIBUTE_ELEMENT_TAG, false);
- attributes = new ArrayList();
- attributes.add(new DOMAttribute(XSDConstants.NAME_ATTRIBUTE, getNewName(parent, XSDConstants.ATTRIBUTE_ELEMENT_TAG, "Attribute", false)));
- attributes.add(new DOMAttribute(XSDConstants.TYPE_ATTRIBUTE, getBuiltInStringQName()));
- addCreateElementAction(manager, XSDConstants.ATTRIBUTE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ATTRIBUTE"), attributes, parent, anyAttributeNode);
- attributes = null;
- addCreateElementRefAction(manager, XSDConstants.ATTRIBUTE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ATTRIBUTE_REFERENCE"), parent, anyAttributeNode);
- addCreateElementRefAction(manager, XSDConstants.ATTRIBUTEGROUP_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ATTRIBUTE_GROUP_REF"), parent, anyAttributeNode);
- }
- else
- {
- attributes = new ArrayList();
- attributes.add(new DOMAttribute(XSDConstants.NAME_ATTRIBUTE, getNewName(parent, XSDConstants.ATTRIBUTE_ELEMENT_TAG, "Attribute", false)));
- attributes.add(new DOMAttribute(XSDConstants.TYPE_ATTRIBUTE, getBuiltInStringQName()));
- addCreateElementAction(manager, XSDConstants.ATTRIBUTE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ATTRIBUTE"), attributes, parent, parent.getLastChild());
- attributes = null;
- addCreateElementRefAction(manager, XSDConstants.ATTRIBUTE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ATTRIBUTE_REFERENCE"), parent, parent.getLastChild());
- addCreateElementRefAction(manager, XSDConstants.ATTRIBUTEGROUP_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ATTRIBUTE_GROUP_REF"), parent, parent.getLastChild());
- }
- attributes = null;
- addCreateElementActionIfNotExist(manager, XSDConstants.ANYATTRIBUTE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ANY_ATTRIBUTE"), attributes, parent, parent.getLastChild());
- }
- }
- else if (XSDDOMHelper.inputEquals(parent, XSDConstants.REDEFINE_ELEMENT_TAG, false))
- { //
- addCreateElementAction(manager, XSDConstants.ANNOTATION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ANNOTATION"), attributes, parent, null);
- addCreateElementAction(manager, XSDConstants.SIMPLETYPE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_SIMPLE_TYPE"), attributes, parent, null);
- addCreateElementAction(manager, XSDConstants.COMPLEXTYPE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_COMPLEX_TYPE"), attributes, parent, null);
- addCreateGroupAction(manager, XSDConstants.GROUP_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_GROUP"), attributes, parent, null);
- addCreateElementAction(manager, XSDConstants.ATTRIBUTEGROUP_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ATTRIBUTE_GROUP"), attributes, parent, null);
- manager.add(new Separator());
- addOpenSchemaAction(manager, XSDEditorPlugin.getXSDString("_UI_ACTION_OPEN_SCHEMA"), parent);
- }
- else if (XSDDOMHelper.inputEquals(parent, XSDConstants.LIST_ELEMENT_TAG, false))
- { //
- boolean annotationExists = addCreateAnnotationActionIfNotExist(manager, XSDConstants.ANNOTATION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ANNOTATION"), attributes, parent,
- parent.getFirstChild());
- manager.add(new Separator());
- addCreateLocalSimpleTypeActionIfNotExist(manager, XSDConstants.SIMPLETYPE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_LOCAL_SIMPLE_TYPE"), attributes, parent, null);
- }
- else if (XSDDOMHelper.inputEquals(parent, XSDConstants.UNION_ELEMENT_TAG, false))
- { //
- boolean annotationExists = addCreateAnnotationActionIfNotExist(manager, XSDConstants.ANNOTATION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ANNOTATION"), attributes, parent,
- parent.getFirstChild());
- manager.add(new Separator());
- addCreateLocalSimpleTypeAction(manager, XSDConstants.SIMPLETYPE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_LOCAL_SIMPLE_TYPE"), attributes, parent, null);
- }
- else if (XSDDOMHelper.inputEquals(parent, XSDConstants.UNIQUE_ELEMENT_TAG, false))
- { //
- boolean annotationExists = addCreateAnnotationActionIfNotExist(manager, XSDConstants.ANNOTATION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ANNOTATION"), attributes, parent,
- parent.getFirstChild());
- manager.add(new Separator());
- attributes = new ArrayList();
- attributes.add(new DOMAttribute(XSDConstants.XPATH_ATTRIBUTE, ""));
- if (annotationExists)
- {
- Node annotationNode = getFirstChildNodeIfExists(parent, XSDConstants.ANNOTATION_ELEMENT_TAG, false);
- addCreateElementActionIfNotExist(manager, XSDConstants.SELECTOR_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_SELECTOR"), attributes, parent, annotationNode.getNextSibling());
- }
- else
- {
- addCreateElementActionIfNotExist(manager, XSDConstants.SELECTOR_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_SELECTOR"), attributes, parent, parent.getFirstChild());
- }
- attributes = new ArrayList();
- attributes.add(new DOMAttribute(XSDConstants.XPATH_ATTRIBUTE, ""));
- addCreateElementAction(manager, XSDConstants.FIELD_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_FIELD"), attributes, parent, null);
- }
- else if (XSDDOMHelper.inputEquals(parent, XSDConstants.KEYREF_ELEMENT_TAG, false))
- { //
- boolean annotationExists = addCreateAnnotationActionIfNotExist(manager, XSDConstants.ANNOTATION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ANNOTATION"), attributes, parent,
- parent.getFirstChild());
- manager.add(new Separator());
- attributes = new ArrayList();
- attributes.add(new DOMAttribute(XSDConstants.XPATH_ATTRIBUTE, ""));
- if (annotationExists)
- {
- Node annotationNode = getFirstChildNodeIfExists(parent, XSDConstants.ANNOTATION_ELEMENT_TAG, false);
- addCreateElementActionIfNotExist(manager, XSDConstants.SELECTOR_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_SELECTOR"), attributes, parent, annotationNode.getNextSibling());
- }
- else
- {
- addCreateElementActionIfNotExist(manager, XSDConstants.SELECTOR_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_SELECTOR"), attributes, parent, parent.getFirstChild());
- }
- attributes = new ArrayList();
- attributes.add(new DOMAttribute(XSDConstants.XPATH_ATTRIBUTE, ""));
- addCreateElementAction(manager, XSDConstants.FIELD_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_FIELD"), attributes, parent, null);
- }
- else if (XSDDOMHelper.inputEquals(parent, XSDConstants.KEY_ELEMENT_TAG, false))
- { //
- boolean annotationExists = addCreateAnnotationActionIfNotExist(manager, XSDConstants.ANNOTATION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ANNOTATION"), attributes, parent,
- parent.getFirstChild());
- manager.add(new Separator());
- attributes = new ArrayList();
- attributes.add(new DOMAttribute(XSDConstants.XPATH_ATTRIBUTE, ""));
- if (annotationExists)
- {
- Node annotationNode = getFirstChildNodeIfExists(parent, XSDConstants.ANNOTATION_ELEMENT_TAG, false);
- addCreateElementActionIfNotExist(manager, XSDConstants.SELECTOR_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_SELECTOR"), attributes, parent, annotationNode.getNextSibling());
- }
- else
- {
- addCreateElementActionIfNotExist(manager, XSDConstants.SELECTOR_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_SELECTOR"), attributes, parent, parent.getFirstChild());
- }
- attributes = new ArrayList();
- attributes.add(new DOMAttribute(XSDConstants.XPATH_ATTRIBUTE, ""));
- addCreateElementAction(manager, XSDConstants.FIELD_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_FIELD"), attributes, parent, null);
- }
- else if (XSDDOMHelper.inputEquals(parent, XSDConstants.IMPORT_ELEMENT_TAG, false))
- {
- addCreateElementActionIfNotExist(manager, XSDConstants.ANNOTATION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ANNOTATION"), attributes, parent, parent.getFirstChild());
- manager.add(new Separator());
- addOpenSchemaAction(manager, XSDEditorPlugin.getXSDString("_UI_ACTION_OPEN_SCHEMA"), parent);
- }
- else if (XSDDOMHelper.inputEquals(parent, XSDConstants.SELECTOR_ELEMENT_TAG, false))
- {
- addCreateElementActionIfNotExist(manager, XSDConstants.ANNOTATION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ANNOTATION"), attributes, parent, parent.getFirstChild());
- }
- else if (XSDDOMHelper.inputEquals(parent, XSDConstants.FIELD_ELEMENT_TAG, false))
- {
- addCreateElementActionIfNotExist(manager, XSDConstants.ANNOTATION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ANNOTATION"), attributes, parent, parent.getFirstChild());
- }
- else if (XSDDOMHelper.inputEquals(parent, XSDConstants.INCLUDE_ELEMENT_TAG, false))
- {
- addCreateElementActionIfNotExist(manager, XSDConstants.ANNOTATION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ANNOTATION"), attributes, parent, parent.getFirstChild());
- manager.add(new Separator());
- addOpenSchemaAction(manager, XSDEditorPlugin.getXSDString("_UI_ACTION_OPEN_SCHEMA"), parent);
- }
- else if (XSDDOMHelper.inputEquals(parent, XSDConstants.ANY_ELEMENT_TAG, false))
- {
- addCreateElementActionIfNotExist(manager, XSDConstants.ANNOTATION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ANNOTATION"), attributes, parent, parent.getFirstChild());
- }
- else if (XSDDOMHelper.inputEquals(parent, XSDConstants.ANYATTRIBUTE_ELEMENT_TAG, false))
- {
- addCreateElementActionIfNotExist(manager, XSDConstants.ANNOTATION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ANNOTATION"), attributes, parent, parent.getFirstChild());
- }
- else if (XSDDOMHelper.inputEquals(parent, XSDConstants.ATTRIBUTE_ELEMENT_TAG, false))
- {
- addCreateElementActionIfNotExist(manager, XSDConstants.ANNOTATION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ANNOTATION"), attributes, parent, parent.getFirstChild());
- addCreateLocalSimpleTypeActionIfNotExist(manager, XSDConstants.SIMPLETYPE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_LOCAL_SIMPLE_TYPE"), attributes, parent, null);
- }
- // Facets all have optional annotation nodes
- else if (XSDDOMHelper.inputEquals(parent, XSDConstants.MINEXCLUSIVE_ELEMENT_TAG, false))
- {
- addCreateAnnotationActionIfNotExist(manager, XSDConstants.ANNOTATION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ANNOTATION"), attributes, parent, parent.getFirstChild());
- }
- else if (XSDDOMHelper.inputEquals(parent, XSDConstants.MININCLUSIVE_ELEMENT_TAG, false))
- {
- addCreateAnnotationActionIfNotExist(manager, XSDConstants.ANNOTATION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ANNOTATION"), attributes, parent, parent.getFirstChild());
- }
- else if (XSDDOMHelper.inputEquals(parent, XSDConstants.MAXEXCLUSIVE_ELEMENT_TAG, false))
- {
- addCreateAnnotationActionIfNotExist(manager, XSDConstants.ANNOTATION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ANNOTATION"), attributes, parent, parent.getFirstChild());
- }
- else if (XSDDOMHelper.inputEquals(parent, XSDConstants.MAXINCLUSIVE_ELEMENT_TAG, false))
- {
- addCreateAnnotationActionIfNotExist(manager, XSDConstants.ANNOTATION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ANNOTATION"), attributes, parent, parent.getFirstChild());
- }
- else if (XSDDOMHelper.inputEquals(parent, XSDConstants.TOTALDIGITS_ELEMENT_TAG, false))
- {
- addCreateAnnotationActionIfNotExist(manager, XSDConstants.ANNOTATION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ANNOTATION"), attributes, parent, parent.getFirstChild());
- }
- else if (XSDDOMHelper.inputEquals(parent, XSDConstants.FRACTIONDIGITS_ELEMENT_TAG, false))
- {
- addCreateAnnotationActionIfNotExist(manager, XSDConstants.ANNOTATION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ANNOTATION"), attributes, parent, parent.getFirstChild());
- }
- else if (XSDDOMHelper.inputEquals(parent, XSDConstants.LENGTH_ELEMENT_TAG, false))
- {
- addCreateAnnotationActionIfNotExist(manager, XSDConstants.ANNOTATION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ANNOTATION"), attributes, parent, parent.getFirstChild());
- }
- else if (XSDDOMHelper.inputEquals(parent, XSDConstants.MINLENGTH_ELEMENT_TAG, false))
- {
- addCreateAnnotationActionIfNotExist(manager, XSDConstants.ANNOTATION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ANNOTATION"), attributes, parent, parent.getFirstChild());
- }
- else if (XSDDOMHelper.inputEquals(parent, XSDConstants.MAXLENGTH_ELEMENT_TAG, false))
- {
- addCreateAnnotationActionIfNotExist(manager, XSDConstants.ANNOTATION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ANNOTATION"), attributes, parent, parent.getFirstChild());
- }
- else if (XSDDOMHelper.inputEquals(parent, XSDConstants.ENUMERATION_ELEMENT_TAG, false))
- {
- addCreateAnnotationActionIfNotExist(manager, XSDConstants.ANNOTATION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ANNOTATION"), attributes, parent, parent.getFirstChild());
- }
- else if (XSDDOMHelper.inputEquals(parent, XSDConstants.WHITESPACE_ELEMENT_TAG, false))
- {
- addCreateAnnotationActionIfNotExist(manager, XSDConstants.ANNOTATION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ANNOTATION"), attributes, parent, parent.getFirstChild());
- }
- else if (XSDDOMHelper.inputEquals(parent, XSDConstants.PATTERN_ELEMENT_TAG, false))
- {
- addCreateAnnotationActionIfNotExist(manager, XSDConstants.ANNOTATION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ANNOTATION"), attributes, parent, parent.getFirstChild());
- }
- else if (XSDDOMHelper.inputEquals(parent, XSDConstants.ATTRIBUTEGROUP_ELEMENT_TAG, true))
- {
- addCreateAnnotationActionIfNotExist(manager, XSDConstants.ANNOTATION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ANNOTATION"), attributes, parent, parent.getFirstChild());
- }
- else if (XSDDOMHelper.inputEquals(parent, XSDConstants.ATTRIBUTE_ELEMENT_TAG, true))
- {
- addCreateAnnotationActionIfNotExist(manager, XSDConstants.ANNOTATION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ANNOTATION"), attributes, parent, parent.getFirstChild());
- }
- else if (XSDDOMHelper.inputEquals(parent, XSDConstants.ELEMENT_ELEMENT_TAG, true))
- {
- // TODO common this up with the non-ref case
-// addCreateAnnotationActionIfNotExist(manager, XSDConstants.ANNOTATION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ANNOTATION"), attributes, parent, parent.getFirstChild());
- XSDConcreteComponent xsdConcreteComponent = (XSDConcreteComponent)getXSDSchema().getCorrespondingComponent(parent);
- if (xsdConcreteComponent instanceof XSDElementDeclaration)
- {
- XSDElementDeclaration xsdElementDeclaration = (XSDElementDeclaration)xsdConcreteComponent;
- XSDElementDeclaration resolvedElementDeclaration = xsdElementDeclaration.getResolvedElementDeclaration();
- if (resolvedElementDeclaration.getRootContainer() == xsdSchema)
- {
- parent = resolvedElementDeclaration.getElement();
-
- Element parentNode = (Element) parent.getParentNode();
-
- boolean isGlobalElement = false;
- if (XSDDOMHelper.inputEquals(parentNode, XSDConstants.SCHEMA_ELEMENT_TAG, false))
- {
- isGlobalElement = true;
- }
- boolean annotationExists = addCreateAnnotationActionIfNotExist(manager, XSDConstants.ANNOTATION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ANNOTATION"), attributes, parent,
- parent.getFirstChild());
- boolean simpleTypeExists = elementExists(XSDConstants.SIMPLETYPE_ELEMENT_TAG, parent);
- boolean complexTypeExists = elementExists(XSDConstants.COMPLEXTYPE_ELEMENT_TAG, parent);
- manager.add(new Separator());
- if (annotationExists)
- {
- Node annotationNode = getFirstChildNodeIfExists(parent, XSDConstants.ANNOTATION_ELEMENT_TAG, false);
- if (!(simpleTypeExists || complexTypeExists) && annotationNode != null)
- {
- //addCreateLocalSimpleTypeActionIfNotExist(manager,
- // XSDConstants.SIMPLETYPE_ELEMENT_TAG,
- // XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_LOCAL_SIMPLE_TYPE"),
- // attributes, parent, annotationNode.getNextSibling());
- //addCreateLocalComplexTypeActionIfNotExist(manager,
- // XSDConstants.COMPLEXTYPE_ELEMENT_TAG, "Add Local Complex Type",
- // attributes, parent, annotationNode.getNextSibling());
- manager.add(new Separator());
- }
- }
- else
- {
- // Should still be able to add the content models if the anonymous type
- // exists,
- // ie. with attributes
- // if (!(simpleTypeExists || complexTypeExists))
- // {
- //addCreateLocalSimpleTypeActionIfNotExist(manager,
- // XSDConstants.SIMPLETYPE_ELEMENT_TAG,
- // XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_LOCAL_SIMPLE_TYPE"),
- // attributes, parent, parent.getFirstChild());
- //addCreateLocalComplexTypeActionIfNotExist(manager,
- // XSDConstants.COMPLEXTYPE_ELEMENT_TAG, "Add Local Complex Type",
- // attributes, parent, parent.getFirstChild());
- XSDConcreteComponent concreteComponent = getXSDSchema().getCorrespondingComponent(parent);
- if (concreteComponent != null)
- {
- AddModelGroupAction addModelGroupAction = new AddModelGroupAction(concreteComponent, XSDCompositor.SEQUENCE_LITERAL);
- addModelGroupAction.setEnabled(!isReadOnly);
- manager.add(addModelGroupAction);
-
- addModelGroupAction = new AddModelGroupAction(concreteComponent, XSDCompositor.CHOICE_LITERAL);
- addModelGroupAction.setEnabled(!isReadOnly);
- manager.add(addModelGroupAction);
-
- addModelGroupAction = new AddModelGroupAction(concreteComponent, XSDCompositor.ALL_LITERAL);
- addModelGroupAction.setEnabled(!isReadOnly);
- manager.add(addModelGroupAction);
-
- manager.add(new Separator());
- }
- // }
- }
- // attributes = new ArrayList();
- // attributes.add(new DOMAttribute(XSDConstants.NAME_ATTRIBUTE, "New_Unique"));
- // addCreateIdentityConstraintsAction(manager, XSDConstants.UNIQUE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_UNIQUE"), attributes, parent, null);
- // attributes = new ArrayList();
- // attributes.add(new DOMAttribute(XSDConstants.NAME_ATTRIBUTE, "New_Key"));
- // addCreateIdentityConstraintsAction(manager, XSDConstants.KEY_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_KEY"), attributes, parent, null);
- // attributes = new ArrayList();
- // attributes.add(new DOMAttribute(XSDConstants.NAME_ATTRIBUTE, "New_KeyRef"));
- // addCreateIdentityConstraintsAction(manager, XSDConstants.KEYREF_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_KEY_REF"), attributes, parent, null);
- XSDDOMHelper domHelper = new XSDDOMHelper();
- Element anonymousType = (Element) domHelper.getChildNode(parent, XSDConstants.COMPLEXTYPE_ELEMENT_TAG);
- if (anonymousType != null)
- {
- manager.add(new Separator());
- attributes = new ArrayList();
- attributes.add(new DOMAttribute(XSDConstants.NAME_ATTRIBUTE, getNewGlobalTypeName("ComplexType")));
- addMoveAnonymousGlobal(manager, XSDConstants.COMPLEXTYPE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_MAKE_ANONYMOUS_TYPE_GLOBAL"), attributes, anonymousType, null);
- attributes = null;
- }
- anonymousType = (Element) domHelper.getChildNode(parent, XSDConstants.SIMPLETYPE_ELEMENT_TAG);
- if (anonymousType != null)
- {
- manager.add(new Separator());
- attributes = new ArrayList();
- attributes.add(new DOMAttribute(XSDConstants.NAME_ATTRIBUTE, getNewGlobalTypeName("SimpleType")));
- addMoveAnonymousGlobal(manager, XSDConstants.SIMPLETYPE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_MAKE_ANONYMOUS_TYPE_GLOBAL"), attributes, anonymousType, null);
- attributes = null;
- }
- }
- }
- }
- /*
- * These have none else if (XSDDOMHelper.inputEquals(parent,
- * XSDConstants.DOCUMENTATION_ELEMENT_TAG, false)) { } else if
- * (XSDDOMHelper.inputEquals(parent, XSDConstants.APPINFO_ELEMENT_TAG,
- * false)) { }
- */
-
- XSDConcreteComponent concreteComponent = getXSDSchema().getCorrespondingComponent(parent);
- if (concreteComponent instanceof XSDNamedComponent)
- {
- if (selectionProvider instanceof XSDSelectionManager)
- {
- if (sourceContext instanceof AbstractEditPartViewer)
- {
- AbstractEditPartViewer viewer = (AbstractEditPartViewer)sourceContext;
-
- Object obj = viewer.getSelectedEditParts().get(0);
-
- if (obj instanceof GraphicalEditPart)
- {
- boolean canEdit = true;
- if (obj instanceof ElementDeclarationEditPart)
- {
- XSDElementDeclaration elem = ((ElementDeclarationEditPart)obj).getXSDElementDeclaration();
- if (elem.isElementDeclarationReference())
- {
- canEdit = false;
- }
- }
- else if (obj instanceof ModelGroupDefinitionEditPart)
- {
- XSDModelGroupDefinition group = ((ModelGroupDefinitionEditPart)obj).getXSDModelGroupDefinition();
- if (group.isModelGroupDefinitionReference())
- {
- canEdit = false;
- }
- }
- else if (obj instanceof ComplexTypeDefinitionEditPart)
- {
- XSDComplexTypeDefinition ct = ((ComplexTypeDefinitionEditPart)obj).getXSDComplexTypeDefinition();
- if (ct.getName() == null) // anonymous
- {
- canEdit = false;
- }
- }
- else if (obj instanceof TopLevelComponentEditPart)
- {
- canEdit = true;
- }
- else
- {
- canEdit = false;
- }
- if (canEdit)
- {
- GraphRenameAction graphRenameAction = new GraphRenameAction((XSDNamedComponent)concreteComponent, (GraphicalEditPart)obj);
- manager.add(graphRenameAction);
- }
- }
- }
- }
- }
- }
-
- protected void addContextInsertItems(IMenuManager manager, Element parent, Element currentElement, Node relativeNode)
- {
- ArrayList attributes = null;
- if (XSDDOMHelper.inputEquals(currentElement, XSDConstants.INCLUDE_ELEMENT_TAG, false) || XSDDOMHelper.inputEquals(currentElement, XSDConstants.IMPORT_ELEMENT_TAG, false)
- || XSDDOMHelper.inputEquals(currentElement, XSDConstants.REDEFINE_ELEMENT_TAG, false) || XSDDOMHelper.inputEquals(currentElement, XSDConstants.ANNOTATION_ELEMENT_TAG, false))
- {
- if (XSDDOMHelper.inputEquals(parent, XSDConstants.SCHEMA_ELEMENT_TAG, false))
- {
- attributes = new ArrayList();
- attributes.add(new DOMAttribute(XSDConstants.SCHEMALOCATION_ATTRIBUTE, ""));
- addCreateElementAction(manager, XSDConstants.INCLUDE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_INCLUDE"), attributes, parent, relativeNode);
- addCreateElementAction(manager, XSDConstants.IMPORT_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_IMPORT"), null, parent, relativeNode);
- addCreateElementAction(manager, XSDConstants.REDEFINE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_REDEFINE"), attributes, parent, relativeNode);
- attributes = null;
- addCreateElementAction(manager, XSDConstants.ANNOTATION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ANNOTATION"), null, parent, relativeNode);
- }
- }
- else if (XSDDOMHelper.inputEquals(currentElement, XSDConstants.SIMPLETYPE_ELEMENT_TAG, false))
- {
- if (XSDDOMHelper.inputEquals(parent, XSDConstants.SCHEMA_ELEMENT_TAG, false))
- {
- addSchemaElementItems(manager, parent, relativeNode);
- }
- // else if (XSDDOMHelper.inputEquals(parent,
- // XSDConstants.LIST_ELEMENT_TAG,
- // false))
- // {
- // addCreateElementAction(manager, XSDConstants.SIMPLETYPE_ELEMENT_TAG,
- // "_UI_ACTION_ADD_SIMPLE_TYPE", attributes, parent, relativeNode);
- // }
- else if (XSDDOMHelper.inputEquals(parent, XSDConstants.UNION_ELEMENT_TAG, false))
- {
- addCreateLocalSimpleTypeAction(manager, XSDConstants.SIMPLETYPE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_LOCAL_SIMPLE_TYPE"), attributes, parent, relativeNode);
- }
- }
- else if (XSDDOMHelper.inputEquals(currentElement, XSDConstants.COMPLEXTYPE_ELEMENT_TAG, false))
- {
- if (XSDDOMHelper.inputEquals(parent, XSDConstants.SCHEMA_ELEMENT_TAG, false))
- {
- addSchemaElementItems(manager, parent, relativeNode);
- }
- }
- else if (XSDDOMHelper.inputEquals(currentElement, XSDConstants.GROUP_ELEMENT_TAG, false))
- {
- if (XSDDOMHelper.inputEquals(parent, XSDConstants.SCHEMA_ELEMENT_TAG, false))
- {
- addSchemaElementItems(manager, parent, relativeNode);
- }
- }
- else if (XSDDOMHelper.inputEquals(currentElement, XSDConstants.ATTRIBUTEGROUP_ELEMENT_TAG, false))
- {
- if (XSDDOMHelper.inputEquals(parent, XSDConstants.SCHEMA_ELEMENT_TAG, false))
- {
- addSchemaElementItems(manager, parent, relativeNode);
- }
- }
- else if (XSDDOMHelper.inputEquals(currentElement, XSDConstants.ELEMENT_ELEMENT_TAG, false))
- {
- if (XSDDOMHelper.inputEquals(parent, XSDConstants.SCHEMA_ELEMENT_TAG, false))
- {
- addSchemaElementItems(manager, parent, relativeNode);
- }
- }
- else if (XSDDOMHelper.inputEquals(currentElement, XSDConstants.ATTRIBUTE_ELEMENT_TAG, false))
- {
- if (XSDDOMHelper.inputEquals(parent, XSDConstants.SCHEMA_ELEMENT_TAG, false))
- {
- addSchemaElementItems(manager, parent, relativeNode);
- }
- }
- else if (XSDDOMHelper.inputEquals(currentElement, XSDConstants.NOTATION_ELEMENT_TAG, false))
- {
- if (XSDDOMHelper.inputEquals(parent, XSDConstants.SCHEMA_ELEMENT_TAG, false))
- {
- addSchemaElementItems(manager, parent, relativeNode);
- }
- }
- else if (XSDDOMHelper.inputEquals(currentElement, XSDConstants.DOCUMENTATION_ELEMENT_TAG, false))
- {
- addCreateElementAction(manager, XSDConstants.DOCUMENTATION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_DOC"), attributes, parent, relativeNode);
- addCreateElementAction(manager, XSDConstants.APPINFO_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_APP_INFO"), attributes, parent, relativeNode);
- }
- else if (XSDDOMHelper.inputEquals(currentElement, XSDConstants.APPINFO_ELEMENT_TAG, false))
- {
- addCreateElementAction(manager, XSDConstants.DOCUMENTATION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_DOC"), attributes, parent, relativeNode);
- addCreateElementAction(manager, XSDConstants.APPINFO_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_APP_INFO"), attributes, parent, relativeNode);
- }
- }
-
- protected String getNewGlobalName(String elementTag, String description)
- {
- return getNewGlobalName(elementTag, description, false);
- }
-
- protected String getNewGlobalTypeName(String description)
- {
- return getNewGlobalName(null, description, true);
- }
-
- protected String getNewGlobalName(String elementTag, String description, boolean isSimpleOrComplexType)
- {
- return getNewName(getXSDSchema().getDocument(), elementTag, description, isSimpleOrComplexType);
- }
-
- // TODO.. .we need to rewrite this code to me model driven... not document driven
- //
- protected String getNewName(Node parentNode, String elementTag, String description, boolean isSimpleOrComplexType)
- {
- NodeList list = null;
- NodeList typeList2 = null;
- // if the global name is for a simple or complex type, we ignore the
- // elementTag and populate 2 lists
- // one to look for all simple types and the other to look for all complex
- // types
- if (isSimpleOrComplexType)
- {
- if (parentNode instanceof Document)
- {
- list = ((Document) parentNode).getElementsByTagNameNS(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, XSDConstants.COMPLEXTYPE_ELEMENT_TAG);
- typeList2 = ((Document) parentNode).getElementsByTagNameNS(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, XSDConstants.SIMPLETYPE_ELEMENT_TAG);
- }
- else if (parentNode instanceof Element)
- {
- list = ((Element) parentNode).getElementsByTagNameNS(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, XSDConstants.COMPLEXTYPE_ELEMENT_TAG);
- typeList2 = ((Element) parentNode).getElementsByTagNameNS(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, XSDConstants.SIMPLETYPE_ELEMENT_TAG);
- }
- }
- else
- {
- if (parentNode instanceof Document)
- {
- list = ((Document) parentNode).getElementsByTagNameNS(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, elementTag);
- }
- else if (parentNode instanceof Element)
- {
- list = ((Element) parentNode).getElementsByTagNameNS(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, elementTag);
- }
- }
- String name = "New" + description;
- if (list == null || list.getLength() == 0 && (typeList2 != null && typeList2.getLength() == 0))
- {
- return name;
- }
- for (int i = 1; i < 100; i++)
- {
- boolean newName = false;
- for (int j = 0; j < list.getLength(); j++)
- {
- String currName = ((Element) list.item(j)).getAttribute(XSDConstants.NAME_ATTRIBUTE);
- if (currName == null || currName.length() == 0)
- {
- continue;
- }
- if (currName.equals(name))
- {
- name = "New" + description + String.valueOf(i);
- newName = true;
- break;
- }
- }
- // if there is another type list and we haven't created a new name, then
- // check the type list
- if (typeList2 != null && !newName)
- {
- for (int j = 0; j < typeList2.getLength(); j++)
- {
- String currName = ((Element) typeList2.item(j)).getAttribute(XSDConstants.NAME_ATTRIBUTE);
- if (currName == null || currName.length() == 0)
- {
- continue;
- }
- if (currName.equals(name))
- {
- name = "New" + description + String.valueOf(i);
- break;
- }
- }
- }
- }
- return name;
- }
-
- protected String getFirstGlobalElementTagName(String elementTag)
- {
- //XMLModel model = getXMLModel();
- //if (model != null)
- {
- String targetNamespace = "";
- XSDSchema schema = getXSDSchema();
- TypesHelper helper = new TypesHelper(schema);
- String prefix = "";
- if (schema != null)
- {
- prefix = helper.getPrefix(schema.getTargetNamespace(), true);
- }
- // get the schema node
- NodeList slist = schema.getDocument().getElementsByTagNameNS(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, XSDConstants.SCHEMA_ELEMENT_TAG);
- Node schemaNode = null;
- if (slist != null && slist.getLength() > 0)
- {
- schemaNode = slist.item(0);
- }
- NodeList list = null;
- // get the schema's direct children - hence, globals
- if (schemaNode != null)
- {
- list = schemaNode.getChildNodes();
- }
- String name = null;
- 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(elementTag))
- {
- name = ((Element) list.item(i)).getAttribute(XSDConstants.NAME_ATTRIBUTE);
- if (name != null && name.length() > 0)
- {
- return prefix + name;
- }
- }
- }
- }
- }
- if (elementTag.equals(XSDConstants.ELEMENT_ELEMENT_TAG))
- {
- return helper.getGlobalElement(schema);
- }
- else if (elementTag.equals(XSDConstants.ATTRIBUTE_ELEMENT_TAG))
- {
- return helper.getGlobalAttribute(schema);
- }
- else if (elementTag.equals(XSDConstants.ATTRIBUTEGROUP_ELEMENT_TAG))
- {
- return helper.getGlobalAttributeGroup(schema);
- }
- else if (elementTag.equals(XSDConstants.GROUP_ELEMENT_TAG))
- {
- return helper.getModelGroup(schema);
- }
- }
- return null;
- }
-
- protected void addSchemaElementItems(IMenuManager manager, Element parent, Node relativeNode)
- {
- ArrayList attributes = null;
- // Add Edit Namespaces menu action
- //////////////// Externalize String below!!!!!
- XSDEditNamespacesAction nsAction = new XSDEditNamespacesAction(XSDEditorPlugin.getXSDString("_UI_ACTION_EDIT_NAMESPACES"), parent, relativeNode, getXSDSchema());
- manager.add(nsAction);
- manager.add(new Separator());
- DOMAttribute nameAttribute = new DOMAttribute(XSDConstants.NAME_ATTRIBUTE, getNewGlobalTypeName("ComplexType"));
- attributes = new ArrayList();
- attributes.add(nameAttribute);
- Action action = addCreateElementAction(manager, XSDConstants.COMPLEXTYPE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_COMPLEX_TYPE"), attributes, parent, relativeNode);
- ((CreateElementAction) action).setIsGlobal(true);
- attributes = new ArrayList();
- attributes.add(new DOMAttribute(XSDConstants.NAME_ATTRIBUTE, getNewGlobalTypeName("SimpleType")));
- action = addCreateElementAction(manager, XSDConstants.SIMPLETYPE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_SIMPLE_TYPE"), attributes, parent, relativeNode);
- ((CreateElementAction) action).setIsGlobal(true);
- attributes = new ArrayList();
- attributes.add(new DOMAttribute(XSDConstants.NAME_ATTRIBUTE, getNewGlobalName(XSDConstants.ELEMENT_ELEMENT_TAG, "GlobalElement")));
- attributes.add(new DOMAttribute(XSDConstants.TYPE_ATTRIBUTE, getBuiltInStringQName()));
- action = addCreateElementAction(manager, XSDConstants.ELEMENT_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_GLOBAL_ELEMENT"), attributes, parent, relativeNode);
- ((CreateElementAction) action).setIsGlobal(true);
- attributes = new ArrayList();
- attributes.add(new DOMAttribute(XSDConstants.NAME_ATTRIBUTE, getNewGlobalName(XSDConstants.ATTRIBUTE_ELEMENT_TAG, "GlobalAttribute")));
- attributes.add(new DOMAttribute(XSDConstants.TYPE_ATTRIBUTE, getBuiltInStringQName()));
- action = addCreateElementAction(manager, XSDConstants.ATTRIBUTE_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_GLOBAL_ATTRIBUTE"), attributes, parent, relativeNode);
- ((CreateElementAction) action).setIsGlobal(true);
- attributes = new ArrayList();
- attributes.add(new DOMAttribute(XSDConstants.NAME_ATTRIBUTE, getNewGlobalName(XSDConstants.ATTRIBUTEGROUP_ELEMENT_TAG, "AttributeGroup")));
- action = addCreateElementAction(manager, XSDConstants.ATTRIBUTEGROUP_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ATTRIBUTE_GROUP"), attributes, parent, relativeNode);
- ((CreateElementAction) action).setIsGlobal(true);
- attributes = new ArrayList();
- attributes.add(new DOMAttribute(XSDConstants.NAME_ATTRIBUTE, getNewGlobalName(XSDConstants.GROUP_ELEMENT_TAG, "Group")));
- CreateGroupAction groupAction = addCreateGroupAction(manager, XSDConstants.GROUP_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_GROUP"), attributes, parent, relativeNode);
- groupAction.setIsGlobal(true);
- attributes = new ArrayList();
- attributes.add(new DOMAttribute(XSDConstants.NAME_ATTRIBUTE, getNewGlobalName(XSDConstants.NOTATION_ELEMENT_TAG, "Notation")));
- attributes.add(new DOMAttribute(XSDConstants.PUBLIC_ATTRIBUTE, ""));
- action = addCreateElementAction(manager, XSDConstants.NOTATION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_NOTATION"), attributes, parent, relativeNode);
- ((CreateElementAction) action).setIsGlobal(true);
- action = addCreateElementAction(manager, XSDConstants.ANNOTATION_ELEMENT_TAG, XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ANNOTATION"), null, parent, relativeNode);
- ((CreateElementAction) action).setIsGlobal(true);
- }
-
- // returns whether element exists already
- protected boolean addCreateElementActionIfNotExist(IMenuManager manager, String elementTag, String label, List attributes, Element parent, Node relativeNode)
- {
- // if
- // (!(parent.getElementsByTagNameNS(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001,
- // elementTag).getLength() > 0))
- // XSDDOMHelper helper = new XSDDOMHelper();
- // if (helper.getChildNode(parent, elementTag) == null)
- if (getFirstChildNodeIfExists(parent, elementTag, false) == null)
- {
- addCreateElementAction(manager, elementTag, label, attributes, parent, relativeNode);
- return false;
- }
- return true;
- }
-
- protected Action addCreateElementAction(IMenuManager manager, String elementTag, String label, List attributes, Element parent, Node relativeNode)
- {
- CreateElementAction action = new CreateElementAction(label);
- action.setElementTag(elementTag);
- action.setAttributes(attributes);
- action.setParentNode(parent);
- action.setRelativeNode(relativeNode);
- action.setXSDSchema(getXSDSchema());
- action.setSelectionProvider(selectionProvider);
- action.setEnabled(!isReadOnly);
- action.setSourceContext(sourceContext);
- manager.add(action);
- return action;
- }
-
- protected void addCreateElementAction(IMenuManager manager, String elementTag, String label, List attributes, Element parent, Node relativeNode, boolean isEnabled)
- {
- Action action = addCreateElementAction(manager, elementTag, label, attributes, parent, relativeNode);
- action.setEnabled(isEnabled);
- }
-
- protected void addCreateElementRefAction(IMenuManager manager, String elementTag, String label, Element parent, Node relativeNode)
- {
- ArrayList attributes = new ArrayList();
- String ref = getFirstGlobalElementTagName(elementTag);
- attributes.add(new DOMAttribute(XSDConstants.REF_ATTRIBUTE, ref));
- Action action = addCreateElementAction(manager, elementTag, label, attributes, parent, relativeNode);
- action.setEnabled(ref != null && !isReadOnly);
- }
-
- protected void addCreateSimpleContentAction(IMenuManager manager, String elementTag, String label, List attributes, Element parent, Node relativeNode)
- {
- // if
- // (!(parent.getElementsByTagNameNS(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001,
- // elementTag).getLength() > 0))
- if (getFirstChildNodeIfExists(parent, elementTag, false) == null)
- {
- CreateSimpleContentAction action = new CreateSimpleContentAction(label, getXSDSchema());
- action.setElementTag(elementTag);
- action.setAttributes(attributes);
- action.setParentNode(parent);
- action.setRelativeNode(relativeNode);
- action.setEnabled(!isReadOnly);
- manager.add(action);
- }
- }
-
- protected CreateGroupAction addCreateGroupAction(IMenuManager manager, String elementTag, String label, List attributes, Element parent, Node relativeNode)
- {
- CreateGroupAction action = new CreateGroupAction(label, getXSDSchema());
- action.setElementTag(elementTag);
- action.setAttributes(attributes);
- action.setParentNode(parent);
- action.setRelativeNode(relativeNode);
- action.setXSDSchema(getXSDSchema());
- action.setSelectionProvider(selectionProvider);
- action.setEnabled(!isReadOnly);
- action.setSourceContext(sourceContext);
- manager.add(action);
- return action;
- }
-
- protected void addCreateIdentityConstraintsAction(IMenuManager manager, String elementTag, String label, List attributes, Element parent, Node relativeNode)
- {
- CreateIdentityConstraintsAction action = new CreateIdentityConstraintsAction(label, getXSDSchema());
- action.setElementTag(elementTag);
- action.setAttributes(attributes);
- action.setParentNode(parent);
- action.setRelativeNode(relativeNode);
- action.setXSDSchema(getXSDSchema());
- action.setSelectionProvider(selectionProvider);
- action.setEnabled(!isReadOnly);
- manager.add(action);
- }
-
- protected void addEnumsAction(IMenuManager manager, String elementTag, String label, List attributes, Element parent, Node relativeNode)
- {
- AddEnumsAction action = new AddEnumsAction(label);
- action.setElementTag(elementTag);
- action.setAttributes(attributes);
- action.setParentNode(parent);
- action.setRelativeNode(relativeNode);
- action.setDescription(XSDEditorPlugin.getXSDString("_UI_ENUMERATIONS_DIALOG_TITLE"));
- action.setEnabled(!isReadOnly);
- manager.add(action);
- }
-
- protected Action addCreateSimpleTypeAction(IMenuManager manager, String elementTag, String label, List attributes, Element parent, Node relativeNode)
- {
- CreateSimpleTypeAction action = new CreateSimpleTypeAction(label);
- action.setElementTag(elementTag);
- action.setAttributes(attributes);
- action.setParentNode(parent);
- action.setRelativeNode(relativeNode);
- action.setXSDSchema(getXSDSchema());
- action.setSelectionProvider(selectionProvider);
- action.setEnabled(!isReadOnly);
- action.setSourceContext(sourceContext);
- manager.add(action);
- return action;
- }
-
- protected boolean addCreateLocalSimpleTypeActionIfNotExist(IMenuManager manager, String elementTag, String label, List attributes, Element parent, Node relativeNode)
- {
- // if
- // (!(parent.getElementsByTagNameNS(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001,
- // elementTag).getLength() > 0))
- // XSDDOMHelper helper = new XSDDOMHelper();
- // if (helper.getChildNode(parent, elementTag) == null)
- if (getFirstChildNodeIfExists(parent, elementTag, false) == null)
- {
- addCreateLocalSimpleTypeAction(manager, elementTag, label, attributes, parent, relativeNode);
- return false;
- }
- return true;
- }
-
- protected void addSetBaseTypeAction(IMenuManager manager, Element element)
- {
- SetBaseTypeAction action = new SetBaseTypeAction(XSDEditorPlugin.getXSDString("_UI_ACTION_SET_BASE_TYPE"));// +
- // "...");
- action.setComplexTypeElement(element);
- action.setXSDSchema(getXSDSchema());
- action.setEnabled(!isReadOnly);
- manager.add(action);
- }
-
- protected void addCreateLocalSimpleTypeAction(IMenuManager manager, String elementTag, String label, List attributes, Element parent, Node relativeNode)
- {
- CreateLocalSimpleTypeAction action = new CreateLocalSimpleTypeAction(label);
- action.setElementTag(elementTag);
- action.setAttributes(attributes);
- action.setParentNode(parent);
- action.setRelativeNode(relativeNode);
- action.setXSDSchema(getXSDSchema());
- action.setSelectionProvider(selectionProvider);
- action.setEnabled(!isReadOnly);
- manager.add(action);
- }
-
- protected boolean addCreateLocalComplexTypeActionIfNotExist(IMenuManager manager, String elementTag, String label, List attributes, Element parent, Node relativeNode)
- {
- if (getFirstChildNodeIfExists(parent, elementTag, false) == null)
- {
- addCreateLocalComplexTypeAction(manager, elementTag, label, attributes, parent, relativeNode);
- return false;
- }
- return true;
- }
-
- protected void addCreateLocalComplexTypeAction(IMenuManager manager, String elementTag, String label, List attributes, Element parent, Node relativeNode)
- {
- CreateLocalComplexTypeAction action = new CreateLocalComplexTypeAction(label);
- action.setElementTag(elementTag);
- action.setAttributes(attributes);
- action.setParentNode(parent);
- action.setRelativeNode(relativeNode);
- action.setXSDSchema(getXSDSchema());
- action.setSelectionProvider(selectionProvider);
- action.setEnabled(!isReadOnly);
- manager.add(action);
- }
-
- protected boolean addCreateAnnotationActionIfNotExist(IMenuManager manager, String elementTag, String label, List attributes, Element parent, Node relativeNode)
- {
- // if
- // (!(parent.getElementsByTagNameNS(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001,
- // elementTag).getLength() > 0))
- // XSDDOMHelper helper = new XSDDOMHelper();
- // if (helper.getChildNode(parent, elementTag) == null)
- // CS... I comment the
- //
- //if (getFirstChildNodeIfExists(parent, elementTag, false) == null)
- //{
- // addCreateAnnotationAction(manager,elementTag,label,attributes,parent,relativeNode);
- // return false;
- //}
- //return true;
- return false;
- }
-
- protected void addOpenSchemaAction(IMenuManager manager, String label, Element parent)
- {
- OpenSchemaAction openAction = new OpenSchemaAction(label, getXSDSchema().getCorrespondingComponent(parent));
- manager.add(openAction);
- }
-
- protected void addMoveAnonymousGlobal(IMenuManager manager, String elementTag, String label, List attributes, Element parent, Node relativeNode)
- {
- MakeAnonymousGlobal action = new MakeAnonymousGlobal(label, parent, getXSDSchema());
- action.setElementTag(elementTag);
- action.setAttributes(attributes);
- action.setParentNode(getXSDSchema().getElement());
- action.setRelativeNode(relativeNode);
- action.setEnabled(!isReadOnly);
- manager.add(action);
- }
-
- protected void addCreateAnnotationAction(IMenuManager manager, String elementTag, String label, List attributes, Element parent, Node relativeNode)
- {
- CreateAnnotationAction action = new CreateAnnotationAction(label);
- action.setElementTag(elementTag);
- action.setAttributes(attributes);
- action.setParentNode(parent);
- action.setRelativeNode(relativeNode);
- action.setEnabled(!isReadOnly);
- manager.add(action);
- }
-
- protected Node getFirstChildNodeIfExists(Node parent, String elementTag, boolean isRef)
- {
- if (parent == null)
- return null;
- NodeList children = parent.getChildNodes();
- Node targetNode = null;
- for (int i = 0; i < children.getLength(); i++)
- {
- Node child = children.item(i);
- if (child != null && child instanceof Element)
- {
- if (XSDDOMHelper.inputEquals((Element) child, elementTag, isRef))
- {
- targetNode = child;
- break;
- }
- }
- }
- return targetNode;
- }
-
- protected boolean elementExists(String elementTag, Element parent)
- {
- if (!(parent.getElementsByTagNameNS(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, elementTag).getLength() > 0))
- {
- return false;
- }
- return true;
- }
-
- /**
- * Returns the deleteAction.
- *
- * @return DeleteAction
- */
- public DeleteAction getDeleteAction()
- {
- return deleteAction;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDMultiPageEditorPart.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDMultiPageEditorPart.java
deleted file mode 100644
index 0673533945..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDMultiPageEditorPart.java
+++ /dev/null
@@ -1,726 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.List;
-
-import org.eclipse.core.internal.resources.ResourceException;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextInputListener;
-import org.eclipse.swt.events.ShellAdapter;
-import org.eclipse.swt.events.ShellEvent;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorActionBarContributor;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IPartListener;
-import org.eclipse.ui.IPropertyListener;
-import org.eclipse.ui.IStorageEditorInput;
-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.ide.IGotoMarker;
-import org.eclipse.ui.part.MultiPageEditorPart;
-import org.eclipse.ui.part.MultiPageEditorSite;
-import org.eclipse.wst.sse.core.IStructuredModel;
-import org.eclipse.wst.sse.core.exceptions.SourceEditingRuntimeException;
-import org.eclipse.wst.sse.core.internal.SSECorePlugin;
-import org.eclipse.wst.sse.ui.StructuredTextEditor;
-import org.eclipse.wst.xml.core.XMLPreferenceNames;
-import org.eclipse.wst.xml.ui.StructuredTextEditorXML;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-
-public class XSDMultiPageEditorPart extends MultiPageEditorPart implements IPropertyListener
-{
-
- /**
- *
- */
- public XSDMultiPageEditorPart()
- {
- super();
- }
-
- /**
- * Internal part activation listener
- */
- class PartListener extends ShellAdapter implements IPartListener {
- private IWorkbenchPart fActivePart;
- private boolean fIsHandlingActivation = false;
-
- private void handleActivation() {
-
- if (fIsHandlingActivation)
- return;
-
- if (fActivePart == XSDMultiPageEditorPart.this) {
- fIsHandlingActivation = true;
- try {
- safelySanityCheckState();
- }
- finally {
- fIsHandlingActivation = false;
- }
- }
- }
-
- /**
- * @see IPartListener#partActivated(IWorkbenchPart)
- */
- public void partActivated(IWorkbenchPart part) {
- fActivePart = part;
- handleActivation();
- }
-
- /**
- * @see IPartListener#partBroughtToTop(IWorkbenchPart)
- */
- public void partBroughtToTop(IWorkbenchPart part) {
- }
-
- /**
- * @see IPartListener#partClosed(IWorkbenchPart)
- */
- public void partClosed(IWorkbenchPart part) {
- }
-
- /**
- * @see IPartListener#partDeactivated(IWorkbenchPart)
- */
- public void partDeactivated(IWorkbenchPart part) {
- fActivePart = null;
- }
-
- /**
- * @see IPartListener#partOpened(IWorkbenchPart)
- */
- public void partOpened(IWorkbenchPart part) {
- }
-
- /*
- * @see ShellListener#shellActivated(ShellEvent)
- */
- public void shellActivated(ShellEvent e) {
- handleActivation();
- }
- }
-
- class TextInputListener implements ITextInputListener {
- public void inputDocumentAboutToBeChanged(IDocument oldInput, IDocument newInput) {
- }
-
- public void inputDocumentChanged(IDocument oldInput, IDocument newInput) {
- }
- }
-
- /** The source page index. */
- private int fSourcePageIndex;
- /** The text editor. */
- private StructuredTextEditor fTextEditor;
-
- private PartListener partListener;
-
-
- /*
- * This method is just to make firePropertyChanged accessbible from some
- * (anonomous) inner classes.
- */
- protected void _firePropertyChange(int property) {
- super.firePropertyChange(property);
- }
-
- /**
- * Adds the source page of the multi-page editor.
- */
- protected void addSourcePage() throws PartInitException {
- try {
- fSourcePageIndex = addPage(fTextEditor, getEditorInput());
- setPageText(fSourcePageIndex, XSDEditorPlugin.getXSDString("_UI_TAB_SOURCE")); //$NON-NLS-1$
- // the update's critical, to get viewer selection manager and
- // highlighting to work
- fTextEditor.update();
-
- firePropertyChange(PROP_TITLE);
-
- // Changes to the Text Viewer's document instance should also force an
- // input refresh
- fTextEditor.getTextViewer().addTextInputListener(new TextInputListener());
- }
- catch (PartInitException exception) {
- // dispose editor
- dispose();
-
- throw new SourceEditingRuntimeException(SSECorePlugin.getResourceString("An_error_has_occurred_when1_ERROR_")); //$NON-NLS-1$
- }
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.MultiPageEditorPart#createPages()
- */
- protected void createPages()
- {
- try
- {
- // source page MUST be created before design page, now
- createSourcePage();
- addSourcePage();
- setActivePage();
-
- // future_TODO: add a catch block here for any exception the design
- // page throws and convert it into a more informative message.
- }
- catch (PartInitException e) {
- throw new RuntimeException(e);
- }
- }
-
- /**
- * @see org.eclipse.ui.part.MultiPageEditorPart#createSite(org.eclipse.ui.IEditorPart)
- */
- protected IEditorSite createSite(IEditorPart editor) {
- IEditorSite site = null;
- if (editor == fTextEditor) {
- site = new MultiPageEditorSite(this, editor) {
- /**
- * @see org.eclipse.ui.part.MultiPageEditorSite#getActionBarContributor()
- */
- public IEditorActionBarContributor getActionBarContributor() {
- IEditorActionBarContributor contributor = super.getActionBarContributor();
- IEditorActionBarContributor multiContributor = XSDMultiPageEditorPart.this.getEditorSite().getActionBarContributor();
-// if (multiContributor instanceof XMLMultiPageEditorActionBarContributor) {
-// contributor = ((XMLMultiPageEditorActionBarContributor) multiContributor).sourceViewerActionContributor;
-// }
- return contributor;
- }
- };
- }
- else {
- site = super.createSite(editor);
- }
- return site;
- }
-
- /**
- * Creates the source page of the multi-page editor.
- */
- protected void createSourcePage() throws PartInitException {
- fTextEditor = createTextEditor();
- fTextEditor.setEditorPart(this);
-
- // Set the SourceViewerConfiguration now so the text editor won't use
- // the default configuration first
- // and switch to the StructuredTextViewerConfiguration later.
- // DMW removed setSourceViewerConfiguration 3/26/2003 since added
- // createPartControl to our text editor.
- // fTextEditor.setSourceViewerConfiguration();
- fTextEditor.addPropertyListener(this);
- }
-
- /**
- * Method createTextEditor.
- *
- * @return StructuredTextEditor
- */
- protected StructuredTextEditor createTextEditor() {
- return new StructuredTextEditorXML();
- }
-
- public void dispose()
- {
- IWorkbenchWindow window = getSite().getWorkbenchWindow();
- window.getPartService().removePartListener(partListener);
- window.getShell().removeShellListener(partListener);
-
- getSite().getPage().removePartListener(partListener);
- if (fTextEditor != null) {
- fTextEditor.removePropertyListener(this);
- }
-
- // moved to last when added window ... seems like
- // we'd be in danger of losing some data, like site,
- // or something.
- super.dispose();
- }
-
- /*
- * (non-Javadoc) Saves the contents of this editor. <p> Subclasses must
- * override this method to implement the open-save-close lifecycle for an
- * editor. For greater details, see <code> IEditorPart </code></p>
- *
- * @see IEditorPart
- */
- public void doSave(IProgressMonitor monitor) {
- fTextEditor.doSave(monitor);
- // // this is a temporary way to force validation.
- // // when the validator is a workbench builder, the following lines
- // can be removed
- // if (fDesignViewer != null)
- // fDesignViewer.saveOccurred();
-
- }
-
- /*
- * (non-Javadoc) Saves the contents of this editor to another object. <p>
- * Subclasses must override this method to implement the open-save-close
- * lifecycle for an editor. For greater details, see <code> IEditorPart
- * </code></p>
- *
- * @see IEditorPart
- */
- public void doSaveAs() {
- fTextEditor.doSaveAs();
- // 253619
- // following used to be executed here, but is
- // now called "back" from text editor (since
- // mulitiple paths to the performSaveAs in StructuredTextEditor.
- //doSaveAsForStructuredTextMulitPagePart();
- }
-
- private void editorInputIsAcceptable(IEditorInput input) throws PartInitException {
- if (input instanceof IFileEditorInput) {
- // verify that it can be opened
- CoreException[] coreExceptionArray = new CoreException[1];
- if (fileDoesNotExist((IFileEditorInput) input, coreExceptionArray)) {
- // todo use message formatter for {0}
- Throwable coreException = coreExceptionArray[0];
- if (coreException instanceof ResourceException) {
- // I'm assuming this is always 'does not exist'
- // we'll refresh local go mimic behavior of default
- // editor, where the
- // troublesome file is refreshed (and will cause it to
- // 'disappear' from Navigator.
- try {
- ((IFileEditorInput) input).getFile().refreshLocal(IResource.DEPTH_ZERO, new NullProgressMonitor());
- }
- catch (CoreException ce) {
- // very unlikely
-// Logger.logException(ce);
- }
- throw new PartInitException(SSECorePlugin.getResourceString("23concat_EXC_", (new Object[]{input.getName()}))); //$NON-NLS-1$
- //$NON-NLS-1$ = "Resource {0} does not exist."
- }
- else {
- throw new PartInitException(SSECorePlugin.getResourceString("32concat_EXC_", (new Object[]{input.getName()}))); //$NON-NLS-1$
- //$NON-NLS-1$ = "Editor could not be open on {0}"
- }
- }
- }
- else if (input instanceof IStorageEditorInput) {
- InputStream contents = null;
- try {
- contents = ((IStorageEditorInput) input).getStorage().getContents();
- }
- catch (CoreException noStorageExc) {
- }
- if (contents == null) {
- throw new PartInitException(SSECorePlugin.getResourceString("32concat_EXC_", (new Object[]{input.getName()}))); //$NON-NLS-1$
- }
- else {
- try {
- contents.close();
- }
- catch (IOException e) {
- }
- }
- }
- }
-
- // void doSaveAsForStructuredTextMulitPagePart() {
- // setPageText(getActivePage(), fTextEditor.getTitle());
- // setInput(fTextEditor.getEditorInput());
- // if (fDesignViewer != null) {
- // //fDesignViewer.setEditorInput(fTextEditor.getEditorInput());
- // fDesignViewer.setModel(getModel());
- // fDesignViewer.saveAsOccurred();
- // }
- // // even though we've set title etc., several times already!
- // // only now is all prepared for it.
- // firePropertyChange(IWorkbenchPart.PROP_TITLE);
- // firePropertyChange(PROP_DIRTY);
- // }
- /*
- * (non-Javadoc) Initializes the editor part with a site and input. <p>
- * Subclasses of <code> EditorPart </code> must implement this method.
- * Within the implementation subclasses should verify that the input type
- * is acceptable and then save the site and input. Here is sample code:
- * </p><pre> if (!(input instanceof IFileEditorInput)) throw new
- * PartInitException("Invalid Input: Must be IFileEditorInput");
- * setSite(site); setInput(editorInput); </pre>
- */
- protected boolean fileDoesNotExist(IFileEditorInput input, Throwable[] coreException) {
- boolean result = false;
- InputStream inStream = null;
- if ((!(input.exists())) || (!(input.getFile().exists()))) {
- result = true;
- }
- else {
- try {
- inStream = input.getFile().getContents(true);
- }
- catch (CoreException e) {
- // very likely to be file not found
- result = true;
- coreException[0] = e;
- }
- finally {
- if (input != null) {
- try {
- if (inStream != null) {
- inStream.close();
- }
- }
- catch (IOException e) {
-
- }
- }
- }
- }
- return result;
- }
-
- public Object getAdapter(Class key) {
- Object result = null;
-
- // DMW: I'm bullet-proofing this because
- // its been reported (on 4.03 version) a null pointer sometimes
- // happens here on startup, when an editor has been left
- // open when workbench shutdown.
- if (fTextEditor != null) {
- result = fTextEditor.getAdapter(key);
- }
- return result;
- }
-
- /**
- * IExtendedMarkupEditor method
- */
- public Node getCaretNode() {
- if (getTextEditor() == null)
- return null;
-
- return getTextEditor().getCaretNode();
- }
-
- /**
- * IExtendedSimpleEditor method
- */
- public int getCaretPosition() {
- if (getTextEditor() == null)
- return -1;
-
- return getTextEditor().getCaretPosition();
- }
-
- /**
- * IExtendedSimpleEditor method
- */
- public IDocument getDocument() {
- if (getTextEditor() == null)
- return null;
-
- return getTextEditor().getDocument();
- }
-
- /**
- * IExtendedMarkupEditor method
- */
- public Document getDOMDocument() {
- if (getTextEditor() == null)
- return null;
-
- return getTextEditor().getDOMDocument();
- }
-
- /**
- * IExtendedSimpleEditor method
- */
- public IEditorPart getEditorPart() {
- return this;
- }
-
- protected IStructuredModel getModel() {
- IStructuredModel model = null;
- if (fTextEditor != null)
- model = fTextEditor.getModel();
- return model;
- }
-
- protected IPreferenceStore getPreferenceStore() {
- return XSDEditorPlugin.getPlugin().getPreferenceStore();
- }
-
- /**
- * IExtendedMarkupEditor method
- */
- public List getSelectedNodes() {
- if (getTextEditor() == null)
- return null;
- return getTextEditor().getSelectedNodes();
- }
-
- /**
- * IExtendedSimpleEditor method
- */
- public Point getSelectionRange() {
- if (getTextEditor() == null)
- return new Point(-1, -1);
-
- return getTextEditor().getSelectionRange();
- }
-
- public StructuredTextEditor getTextEditor() {
- return fTextEditor;
- }
-
- /*
- * (non-Javadoc) Method declared on IWorkbenchPart.
- */
- public String getTitle() {
- String title = null;
- if (getTextEditor() == null) {
- if (getEditorInput() != null) {
- title = getEditorInput().getName();
- }
- }
- else {
- title = getTextEditor().getTitle();
- }
- if (title == null) {
- title = getPartName();
- }
- return title;
- }
-
- /*
- * (non-Javadoc) Sets the cursor and selection state for this editor to
- * the passage defined by the given marker. <p> Subclasses may override.
- * For greater details, see <code> IEditorPart </code></p>
- *
- * @see IEditorPart
- */
- public void gotoMarker(IMarker marker) {
- // (pa) 20020217 this was null when opening an editor that was
- // already open
- if (fTextEditor != null) {
- IGotoMarker markerGotoer = (IGotoMarker) fTextEditor.getAdapter(IGotoMarker.class);
- markerGotoer.gotoMarker(marker);
- }
- }
-
- public void init(IEditorSite site, IEditorInput input) throws PartInitException {
- editorInputIsAcceptable(input);
- try {
- super.init(site, input);
- if (partListener == null) {
- partListener = new PartListener();
- }
- //getSite().getPage().addPartListener(partListner);
- // we want to listen for our own activation
- IWorkbenchWindow window = getSite().getWorkbenchWindow();
- window.getPartService().addPartListener(partListener);
- window.getShell().addShellListener(partListener);
- }
- catch (Exception e) {
- if (e instanceof SourceEditingRuntimeException) {
- Throwable t = ((SourceEditingRuntimeException) e).getOriginalException();
- if (t instanceof IOException) {
- System.out.println(t);
- // file not found
- }
- }
- }
- setPartName(input.getName());
- }
-
- /*
- * (non-Javadoc) Returns whether the "save as" operation is supported by
- * this editor. <p> Subclasses must override this method to implement the
- * open-save-close lifecycle for an editor. For greater details, see
- * <code> IEditorPart </code></p>
- *
- * @see IEditorPart
- */
- public boolean isSaveAsAllowed() {
- return fTextEditor != null && fTextEditor.isSaveAsAllowed();
- }
-
- /*
- * (non-Javadoc) Returns whether the contents of this editor should be
- * saved when the editor is closed. <p> This method returns <code> true
- * </code> if and only if the editor is dirty ( <code> isDirty </code> ).
- * </p>
- */
- public boolean isSaveOnCloseNeeded() {
- // overriding super class since it does a lowly isDirty!
- if (fTextEditor != null)
- return fTextEditor.isSaveOnCloseNeeded();
- return isDirty();
- }
-
- /**
- * Notifies this multi-page editor that the page with the given id has
- * been activated. This method is called when the user selects a different
- * tab.
- *
- * @param newPageIndex
- * the index of the activated page
- */
- protected void pageChange(int newPageIndex) {
- super.pageChange(newPageIndex);
-
- saveLastActivePageIndex(newPageIndex);
- }
-
- /**
- * Posts the update code "behind" the running operation.
- */
- protected void postOnDisplayQue(Runnable runnable) {
- IWorkbench workbench = PlatformUI.getWorkbench();
- IWorkbenchWindow[] windows = workbench.getWorkbenchWindows();
- if (windows != null && windows.length > 0) {
- Display display = windows[0].getShell().getDisplay();
- display.asyncExec(runnable);
- }
- else
- runnable.run();
- }
-
- /**
- * Indicates that a property has changed.
- *
- * @param source
- * the object whose property has changed
- * @param propId
- * the id of the property which has changed; property ids are
- * generally defined as constants on the source class
- */
- public void propertyChanged(Object source, int propId) {
- switch (propId) {
- // had to implement input changed "listener" so that
- // strucutedText could tell it containing editor that
- // the input has change, when a 'resource moved' event is
- // found.
- case IEditorPart.PROP_INPUT :
- case IEditorPart.PROP_DIRTY : {
- if (source == fTextEditor) {
- if (fTextEditor.getEditorInput() != getEditorInput()) {
- setInput(fTextEditor.getEditorInput());
- // title should always change when input changes.
- // create runnable for following post call
- Runnable runnable = new Runnable() {
- public void run() {
- _firePropertyChange(IWorkbenchPart.PROP_TITLE);
- }
- };
- // Update is just to post things on the display queue
- // (thread). We have to do this to get the dirty
- // property to get updated after other things on the
- // queue are executed.
- postOnDisplayQue(runnable);
- }
- }
- break;
- }
- case IWorkbenchPart.PROP_TITLE : {
- // update the input if the title is changed
- if (source == fTextEditor) {
- if (fTextEditor.getEditorInput() != getEditorInput()) {
- setInput(fTextEditor.getEditorInput());
- }
- }
- break;
- }
- default : {
- // propagate changes. Is this needed? Answer: Yes.
- if (source == fTextEditor) {
- firePropertyChange(propId);
- }
- break;
- }
- }
-
- }
-
- protected void safelySanityCheckState() {
- // If we're called before editor is created, simply ignore since we
- // delegate this function to our embedded TextEditor
- if (getTextEditor() == null)
- return;
-
- getTextEditor().safelySanityCheckState(getEditorInput());
-
- }
-
- protected void saveLastActivePageIndex(int newPageIndex) {
- // save the last active page index to preference manager
- getPreferenceStore().setValue(XMLPreferenceNames.LAST_ACTIVE_PAGE, newPageIndex);
- }
-
- /**
- * Sets the currently active page.
- */
- protected void setActivePage() {
- // retrieve the last active page index from preference manager
- int activePageIndex = getPreferenceStore().getInt(XMLPreferenceNames.LAST_ACTIVE_PAGE);
-
- // We check this range since someone could hand edit the XML
- // preference file to an invalid value ... which I know from
- // experience :( ... if they do, we'll reset to default and continue
- // rather than throw an assertion error in the setActivePage(int)
- // method.
- if (activePageIndex < 0 || activePageIndex >= getPageCount()) {
- activePageIndex = fSourcePageIndex;
- }
- setActivePage(activePageIndex);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.part.EditorPart#setInput(org.eclipse.ui.IEditorInput)
- */
- protected void setInput(IEditorInput input) {
- // If driven from the Source page, it's "model" may not be up to date
- // with the input just yet. We'll rely on later notification from the
- // TextViewer to set us straight
- super.setInput(input);
- setPartName(input.getName());
- }
-
- /**
- * IExtendedMarkupEditor method
- */
- public IStatus validateEdit(Shell context) {
- if (getTextEditor() == null)
- return new Status(IStatus.ERROR, XSDEditorPlugin.PLUGIN_ID, IStatus.INFO, "", null); //$NON-NLS-1$
-
- return getTextEditor().validateEdit(context);
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDSelectionManager.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDSelectionManager.java
deleted file mode 100644
index 22f0354d2b..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDSelectionManager.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-
-public class XSDSelectionManager implements ISelectionProvider, ISelectionChangedListener
-{
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ISelectionProvider#addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener)
- */
- public void addSelectionChangedListener(ISelectionChangedListener listener)
- {
- listenerList.add(listener);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ISelectionProvider#getSelection()
- */
- public ISelection getSelection()
- {
- return currentSelection;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ISelectionProvider#removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener)
- */
- public void removeSelectionChangedListener(ISelectionChangedListener listener)
- {
- listenerList.remove(listener);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ISelectionProvider#setSelection(org.eclipse.jface.viewers.ISelection)
- */
- public void setSelection(ISelection selection)
- {
- setSelection(selection, this);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
- */
- public void selectionChanged(SelectionChangedEvent event)
- {
- if (enableNotify)
- {
- setSelection(event.getSelection(), event.getSelectionProvider());
- }
- }
-
-
- protected List listenerList = new ArrayList();
- protected ISelection currentSelection;
- protected boolean enableNotify = true;
-
- public void setSelection(ISelection selection, ISelectionProvider source)
- {
-// System.out.println("SelectionManager.setSelection() " + selection + ", " + source);
- if (enableNotify)
- {
- currentSelection = selection;
- enableNotify = false;
- try
- {
- SelectionChangedEvent event = new SelectionChangedEvent(source, selection);
- List copyOfListenerList = new ArrayList(listenerList);
- for (Iterator i = copyOfListenerList.iterator(); i.hasNext(); )
- {
- ISelectionChangedListener listener = (ISelectionChangedListener)i.next();
- listener.selectionChanged(event);
- }
- }
- finally
- {
- enableNotify = true;
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDTextEditor.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDTextEditor.java
deleted file mode 100644
index 7b7931e34a..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDTextEditor.java
+++ /dev/null
@@ -1,405 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.ResourceBundle;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.jface.text.source.IVerticalRuler;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
-import org.eclipse.ui.views.properties.IPropertySheetPage;
-import org.eclipse.wst.common.contentmodel.modelquery.ModelQuery;
-import org.eclipse.wst.sse.core.internal.SSECorePlugin;
-import org.eclipse.wst.sse.ui.StructuredTextViewer;
-import org.eclipse.wst.sse.ui.edit.util.StructuredTextEditorActionConstants;
-import org.eclipse.wst.sse.ui.internal.openon.OpenOnAction;
-import org.eclipse.wst.sse.ui.view.events.INodeSelectionListener;
-import org.eclipse.wst.sse.ui.view.events.NodeSelectionChangedEvent;
-import org.eclipse.wst.xml.core.document.XMLModel;
-import org.eclipse.wst.xml.core.document.XMLNode;
-import org.eclipse.wst.xml.ui.StructuredTextEditorXML;
-import org.eclipse.wst.xsd.ui.internal.properties.section.XSDTabbedPropertySheetPage;
-import org.eclipse.wst.xsd.ui.internal.provider.CategoryAdapter;
-import org.eclipse.wst.xsd.ui.internal.provider.XSDAdapterFactoryLabelProvider;
-import org.eclipse.wst.xsd.ui.internal.provider.XSDContentProvider;
-import org.eclipse.wst.xsd.ui.internal.provider.XSDModelAdapterFactoryImpl;
-import org.eclipse.wst.xsd.ui.internal.util.SelectionAdapter;
-import org.eclipse.xsd.XSDComponent;
-import org.eclipse.xsd.XSDSchema;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-
-public class XSDTextEditor extends StructuredTextEditorXML implements INodeSelectionListener, ISelectionChangedListener
-{
- protected XSDSelectionManager xsdSelectionManager;
- protected XSDModelAdapterFactoryImpl xsdModelAdapterFactory;
- protected static XSDAdapterFactoryLabelProvider adapterFactoryLabelProvider;
- protected InternalSelectionProvider internalSelectionProvider = new InternalSelectionProvider();
-
- public XSDTextEditor(XSDEditor xsdEditor)
- {
- super();
- xsdSelectionManager = xsdEditor.getSelectionManager();
- xsdSelectionManager.addSelectionChangedListener(this);
-
- setHelpContextId(XSDEditorContextIds.XSDE_SOURCE_VIEW);
-
- xsdModelAdapterFactory = new XSDModelAdapterFactoryImpl();
- adapterFactoryLabelProvider = new XSDAdapterFactoryLabelProvider(xsdModelAdapterFactory);
- }
-
- public void dispose()
- {
- super.dispose();
- xsdSelectionManager.removeSelectionChangedListener(this);
- }
-
- public XSDModelAdapterFactoryImpl getXSDModelAdapterFactory()
- {
- return xsdModelAdapterFactory;
- }
-
- public static XSDAdapterFactoryLabelProvider getLabelProvider()
- {
- return adapterFactoryLabelProvider;
- }
-
- public Object getAdapter(Class required) {
-
- if (IPropertySheetPage.class.equals(required))
- {
- fPropertySheetPage = new XSDTabbedPropertySheetPage(getXSDEditor());
-
- ((XSDTabbedPropertySheetPage)fPropertySheetPage).setXSDModelAdapterFactory(xsdModelAdapterFactory);
- ((XSDTabbedPropertySheetPage)fPropertySheetPage).setSelectionManager(getXSDEditor().getSelectionManager());
- ((XSDTabbedPropertySheetPage)fPropertySheetPage).setXSDSchema(getXSDSchema());
-
- return fPropertySheetPage;
- }
- else if (IContentOutlinePage.class.equals(required))
- {
- if (fOutlinePage == null || fOutlinePage.getControl() == null || fOutlinePage.getControl().isDisposed())
- {
- XSDContentOutlinePage outlinePage = new XSDContentOutlinePage(this);
- XSDContentProvider xsdContentProvider = new XSDContentProvider(xsdModelAdapterFactory);
- xsdContentProvider.setXSDSchema(getXSDSchema());
- outlinePage.setContentProvider(xsdContentProvider);
- outlinePage.setLabelProvider(adapterFactoryLabelProvider);
- outlinePage.setModel(getXSDSchema().getDocument());
-
- // Update outline selection from source editor selection:
- getViewerSelectionManager().addNodeSelectionListener(this);
- internalSelectionProvider.addSelectionChangedListener(getViewerSelectionManager());
- internalSelectionProvider.setEventSource(outlinePage);
-
- fOutlinePage = outlinePage;
- }
- return fOutlinePage;
- }
-
- return super.getAdapter(required);
- }
-
- XSDModelQueryContributor xsdModelQueryContributor = new XSDModelQueryContributor();
-
- protected XSDContentOutlinePage outlinePage;
-
- /*
- * @see StructuredTextEditor#getContentOutlinePage()
- */
- public IContentOutlinePage getContentOutlinePage()
- {
- return fOutlinePage;
- }
-
- // used to map selections from the outline view to the source view
- // this class thinks of selections in terms of DOM element
- class InternalSelectionProvider extends SelectionAdapter
- {
- protected Object getObjectForOtherModel(Object object)
- {
- Node node = null;
-
- if (object instanceof Node)
- {
- node = (Node)object;
- }
- else if (object instanceof XSDComponent)
- {
- node = ((XSDComponent)object).getElement();
- }
- else if (object instanceof CategoryAdapter)
- {
- node = ((CategoryAdapter)object).getXSDSchema().getElement();
- }
-
- // the text editor can only accept sed nodes!
- //
- if (!(node instanceof XMLNode))
- {
- node = null;
- }
- return node;
- }
- }
-
- public void selectionChanged(SelectionChangedEvent event)
- {
- // here we convert the model selection to a node selection req'd for the source view
- //
- internalSelectionProvider.setSelection(event.getSelection());
- }
-
- public void nodeSelectionChanged(NodeSelectionChangedEvent event)
- {
- // here we convert an node seleciton to a model selection as req'd by the other views
- //
- if (!event.getSource().equals(internalSelectionProvider) && getXSDEditor().getActiveEditorPage() != null)
- {
- Element element = null;
- List list = event.getSelectedNodes();
- for (Iterator i = list.iterator(); i.hasNext();)
- {
- Node node = (Node)i.next();
- if (node != null)
- {
- if (node.getNodeType() == Node.ELEMENT_NODE)
- {
- element = (Element)node;
- break;
- }
- else if (node.getNodeType() == Node.ATTRIBUTE_NODE)
- {
- element = ((Attr)node).getOwnerElement();
- break;
- }
- }
- }
-
- Object o = element;
- if (element != null)
- {
- Object modelObject = getXSDSchema().getCorrespondingComponent(element);
- if (modelObject != null)
- {
- o = modelObject;
- }
- }
-
- if (o != null)
- {
- xsdSelectionManager.setSelection(new StructuredSelection(o), internalSelectionProvider);
- }
- else
- {
- xsdSelectionManager.setSelection(new StructuredSelection(), internalSelectionProvider);
- }
- }
- }
-
-
- /*
- * @see ITextEditor#doRevertToSaved()
- */
- public void doRevertToSaved()
- {
- super.doRevertToSaved();
- }
-
- /*
- * @see StructuredTextEditor#update()
- */
- public void update()
- {
- super.update();
- if (outlinePage != null)
- outlinePage.setModel(getModel());
- }
-
- protected Composite client;
-
- protected void addOpenOnSelectionListener()
- {
- getTextViewer().getTextWidget().addKeyListener(new KeyAdapter()
- {
- /**
- * @see org.eclipse.swt.events.KeyListener#keyReleased(org.eclipse.swt.events.KeyEvent)
- */
- public void keyReleased(KeyEvent arg0)
- {
- if (arg0.keyCode == SWT.F3)
- {
- getXSDEditor().getOpenOnSelectionHelper().openOnSelection();
- }
- }
-
- });
- }
-
- // private static Color dividerColor;
-
- protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler verticalRuler, int styles) {
-
- fAnnotationAccess= createAnnotationAccess();
- fOverviewRuler= createOverviewRuler(getSharedColors());
-
- StructuredTextViewer sourceViewer = createStructedTextViewer(parent, verticalRuler, styles);
- initSourceViewer(sourceViewer);
-
- // end of super createSourceViewer
-
- //StructuredAnnotationAccess annotationAccess = new StructuredAnnotationAccess();
- // DefaultMarkerAnnotationAccess annotationAccess = new DefaultMarkerAnnotationAccess();
-
- // ISharedTextColors sharedColors = getTextColorsCache();
-//// fOverviewRuler = new OverviewRuler(annotationAccess, OVERVIEW_RULER_WIDTH, sharedColors);
- // fOverviewRuler = new OverviewRuler(createAnnotationAccess(), 12, sharedColors);
-
-// fOverviewRuler.addHeaderAnnotationType(StructuredAnnotationType.ERROR);
-// fOverviewRuler.addHeaderAnnotationType(StructuredAnnotationType.WARNING);
-
- // fSourceViewerDecorationSupport = new SourceViewerDecorationSupport(sourceViewer, fOverviewRuler, annotationAccess, sharedColors);
- //configureSourceViewerDecorationSupport(fSourceViewerDecorationSupport);
-
-// The following method was removed
-// sourceViewer.setEditor(this);
-
- return sourceViewer;
- }
-
- /*
- * @see StructuredTextEditor#setModel(IFileEditorInput)
- */
- public void setModel(IFileEditorInput input)
- {
- super.setModel(input);
- if (getModel() instanceof XMLModel)
- {
- xsdModelQueryContributor.setModel((XMLModel)getModel());
- }
- file = input.getFile();
- }
-
- protected IFile file;
-
-
- /**
- * Gets the xsdSchema.
- * @return Returns a XSDSchema
- */
- public XSDSchema getXSDSchema()
- {
- return ((XSDEditor)getEditorPart()).getXSDSchema();
- }
-
- public XSDEditor getXSDEditor()
- {
- return (XSDEditor)getEditorPart();
- }
-
- /**
- * @see org.eclipse.ui.texteditor.AbstractTextEditor#safelySanityCheckState(IEditorInput)
- */
- public void safelySanityCheckState(IEditorInput input)
- {
- super.safelySanityCheckState(input);
- }
-
- protected class WrappedOpenFileAction extends OpenOnAction
- {
- /**
- * Constructor for WrappedAction.
- * @param bundle
- * @param prefix
- * @param editor
- */
- public WrappedOpenFileAction(
- ResourceBundle bundle,
- String prefix,
- ITextEditor editor)
- {
- super(bundle, prefix, editor);
- }
-
- /**
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run()
- {
- if (!getXSDEditor().getOpenOnSelectionHelper().openOnSelection())
- {
- super.run();
- }
- }
- }
-
- protected WrappedOpenFileAction wrappedAction;
- private static final String DOT = "."; //$NON-NLS-1$
-
- /**
- * @see org.eclipse.ui.texteditor.AbstractTextEditor#createActions()
- */
- protected void createActions()
- {
- super.createActions();
- addOpenOnSelectionListener();
- ResourceBundle resourceBundle = SSECorePlugin.getDefault().getResourceBundle(); //ResourceBundle.getBundle(RESOURCE_BUNDLE_NAME);
-
- wrappedAction = new WrappedOpenFileAction(resourceBundle, StructuredTextEditorActionConstants.ACTION_NAME_OPEN_FILE + DOT, this);
- setAction(StructuredTextEditorActionConstants.ACTION_NAME_OPEN_FILE, wrappedAction);
-
- }
-
-
- class XSDModelQueryContributor extends AbstractXSDModelQueryContributor
- {
- public AbstractXSDDataTypeValueExtension createXSDDataTypeValueExtension(ModelQuery modelQuery)
- {
- return new XSDDataTypeValueExtension(modelQuery);
- }
- }
-
-
- class XSDDataTypeValueExtension extends AbstractXSDDataTypeValueExtension
- {
- public XSDDataTypeValueExtension(ModelQuery modelQuery)
- {
- super(modelQuery);
- }
-
- public String getId()
- {
- return "XSDDataTypeValueExtension";
- }
-
- protected XSDSchema getEnclosingXSDSchema(Element element)
- {
- return getXSDSchema();
- }
- }
-
-}
-
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDURIConverter.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDURIConverter.java
deleted file mode 100644
index 58f639bbdb..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDURIConverter.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.resource.impl.URIConverterImpl;
-import org.eclipse.wst.xml.uriresolver.util.IdResolver;
-import org.eclipse.wst.xml.uriresolver.util.IdResolverImpl;
-
-public class XSDURIConverter extends URIConverterImpl
-{
- IFile resourceFile;
- public XSDURIConverter(IFile resourceFile)
- {
- super();
- this.resourceFile = resourceFile;
- }
-
- /**
- * @see org.eclipse.emf.ecore.resource.URIConverter#createInputStream(URI)
- */
- public InputStream createInputStream(URI uri) throws IOException
- {
- String scheme = uri.scheme();
- URI mappedURI = uri;
- if (scheme != null && !scheme.equals("file") && !scheme.equals("platform"))
- // if ("http".equals(scheme))
- {
- String theURI = uri.toString();
- IdResolver idResolver = new IdResolverImpl(theURI);
- String result = idResolver.resolveId("/", null, theURI);
- if (result != null)
- {
- mappedURI = createURI(result);
- }
- }
- return super.createURLInputStream(mappedURI);
- }
-
- public static URI createURI(String uriString)
- {
- if (hasProtocol(uriString))
- return URI.createURI(uriString);
- else
- return URI.createFileURI(uriString);
- }
-
- private static boolean hasProtocol(String uri)
- {
- boolean result = false;
- if (uri != null)
- {
- int index = uri.indexOf(":");
- if (index != -1 && index > 2) // assume protocol with be length 3 so that the'C' in 'C:/' is not interpreted as a protocol
- {
- result = true;
- }
- }
- return result;
- }
-
- private String getRelativePathToSchema(String a, String b)
- {
- String result;
- if (b.startsWith(a))
- {
- result = b.substring(a.length() + 1);
- return result;
- }
- else
- {
- return b;
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/AbstractAction.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/AbstractAction.java
deleted file mode 100644
index b421416adf..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/AbstractAction.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.actions;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.wst.xml.core.internal.document.DocumentImpl;
-import org.eclipse.xsd.XSDConcreteComponent;
-
-public class AbstractAction extends Action
-{
- XSDConcreteComponent xsdConcreteComponent;
-
- /**
- * @param text
- */
- public AbstractAction(String text, XSDConcreteComponent xsdConcreteComponent)
- {
- super(text);
- this.xsdConcreteComponent = xsdConcreteComponent;
- }
-
- /**
- * @param text
- * @param image
- */
- public AbstractAction(String text, ImageDescriptor image, XSDConcreteComponent xsdConcreteComponent)
- {
- super(text, image);
- this.xsdConcreteComponent = xsdConcreteComponent;
- }
-
- /**
- * @param text
- * @param style
- */
- public AbstractAction(String text, int style)
- {
- super(text, style);
- }
-
- public DocumentImpl getDocument()
- {
- return (DocumentImpl) xsdConcreteComponent.getElement().getOwnerDocument();
- }
-
- public void beginRecording(String description)
- {
- getDocument().getModel().beginRecording(this, description);
- }
-
- public void endRecording()
- {
- DocumentImpl doc = (DocumentImpl) getDocument();
-
- doc.getModel().endRecording(this);
- }
-
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/AddAttributeAction.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/AddAttributeAction.java
deleted file mode 100644
index f1a9f3ffe3..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/AddAttributeAction.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.actions;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.wst.xsd.ui.internal.commands.AddAttributeDeclarationCommand;
-import org.eclipse.xsd.XSDConcreteComponent;
-
-public class AddAttributeAction extends AbstractAction
-{
- protected AddAttributeDeclarationCommand command;
-
- public AddAttributeAction(String text, XSDConcreteComponent parent)
- {
- super(text, parent);
- command = new AddAttributeDeclarationCommand(parent);
- }
-
- public AddAttributeAction(String text, ImageDescriptor image, XSDConcreteComponent parent)
- {
- super(text, image, parent);
- command = new AddAttributeDeclarationCommand(parent);
- }
-
- public void run()
- {
- beginRecording(getText());
- command.run();
-
- endRecording();
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/AddEnumsAction.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/AddEnumsAction.java
deleted file mode 100644
index ecc2f4b9d4..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/AddEnumsAction.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.actions;
-
-import java.util.List;
-import java.util.StringTokenizer;
-
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.wst.xsd.ui.internal.widgets.EnumerationsDialog;
-import org.eclipse.xsd.util.XSDConstants;
-import org.w3c.dom.Element;
-
-
-/**
- * Pattern is scoped to Enum Type
- */
-public class AddEnumsAction extends CreateElementAction
-{
- public AddEnumsAction(String label)
- {
- super(label);
- }
-
- public Element createAndAddNewChildElement(String token)
- {
- String prefix = parentNode.getPrefix();
- prefix = (prefix == null) ? "" : (prefix + ":");
- Element childNode = getDocument().createElementNS(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, prefix + elementTag);
- if (getAttributes() != null)
- {
- List attributes = getAttributes();
- for (int i = 0; i < attributes.size(); i++)
- {
- DOMAttribute attr = (DOMAttribute) attributes.get(i);
- childNode.setAttribute(attr.getName(), attr.getValue());
- }
- }
- if (getRelativeNode() == null)
- {
- parentNode.appendChild(childNode);
- }
- else
- {
- ((Element)parentNode).insertBefore(childNode,getRelativeNode());
- }
- childNode.setAttribute("value", token);
- return childNode;
- }
-
- public void run()
- {
- Display display = Display.getCurrent();
- // if it is null, get the default one
- display = display == null ? Display.getDefault() : display;
- Shell parentShell = display.getActiveShell();
- EnumerationsDialog dialog = new EnumerationsDialog(parentShell);
- dialog.setBlockOnOpen(true);
- int result = dialog.open();
-
- if (result == Window.OK)
- {
- beginRecording(getDescription());
-
- String text = dialog.getText();
- String delimiter = dialog.getDelimiter();
- StringTokenizer tokenizer = new StringTokenizer(text, delimiter);
- while (tokenizer.hasMoreTokens())
- {
- String token = tokenizer.nextToken();
- if (dialog.isPreserveWhitespace() == false)
- {
- token = token.trim();
- }
-
- Element child = createAndAddNewChildElement(token);
- formatChild(child);
- }
- endRecording();
- }
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/AddModelGroupAction.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/AddModelGroupAction.java
deleted file mode 100644
index ac31566cc2..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/AddModelGroupAction.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.actions;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.wst.xml.core.internal.document.DocumentImpl;
-import org.eclipse.wst.xsd.ui.internal.commands.AddModelGroupCommand;
-import org.eclipse.wst.xsd.ui.internal.XSDEditorPlugin;
-import org.eclipse.xsd.XSDCompositor;
-import org.eclipse.xsd.XSDConcreteComponent;
-
-
-public class AddModelGroupAction extends Action
-{
- protected AddModelGroupCommand command;
- protected XSDConcreteComponent parent;
-
- public static String getLabel(XSDCompositor compositor)
- {
- String result = XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_SEQUENCE"); //$NON-NLS-1$
- if (compositor != null)
- {
- if (compositor == XSDCompositor.CHOICE_LITERAL)
- {
- result = XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_CHOICE"); //$NON-NLS-1$
- }
- else if (compositor == XSDCompositor.ALL_LITERAL)
- {
- result = XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_ALL");//$NON-NLS-1$
- }
- }
- return result;
- }
-
- public AddModelGroupAction(XSDConcreteComponent parent, XSDCompositor compositor)
- {
- command = new AddModelGroupCommand(parent, compositor);
- this.parent = parent;
- setText(getLabel(compositor));
- }
-
- public void run()
- {
- DocumentImpl doc = (DocumentImpl) parent.getElement().getOwnerDocument();
- doc.getModel().beginRecording(this, getText());
- command.run();
- doc.getModel().endRecording(this);
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/AddSchemaNodeAction.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/AddSchemaNodeAction.java
deleted file mode 100644
index 31a89501c6..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/AddSchemaNodeAction.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.actions;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.wst.xsd.ui.internal.XSDEditor;
-
-
-public class AddSchemaNodeAction extends Action
-{
- /**
- * Constructor for AddSchemaNodeAction.
- */
- public AddSchemaNodeAction()
- {
- super();
- }
-
- /**
- * Constructor for AddSchemaNodeAction.
- * @param text
- */
- public AddSchemaNodeAction(String text)
- {
- super(text);
- }
-
- /**
- * Constructor for AddSchemaNodeAction.
- * @param text
- * @param image
- */
- public AddSchemaNodeAction(String text, ImageDescriptor image)
- {
- super(text, image);
- }
-
- public void setEditor(XSDEditor editor)
- {
- this.editor = editor;
- }
-
- protected XSDEditor editor;
-
- /**
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run()
- {
- editor.createDefaultSchemaNode();
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/BackAction.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/BackAction.java
deleted file mode 100644
index 0ab518d244..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/BackAction.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.actions;
-
-import 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.wst.xsd.ui.internal.graph.XSDGraphViewer;
-import org.eclipse.xsd.XSDSchema;
-
-/**
- * @author kchong
- *
- * <a href="mailto:kchong@ca.ibm.com">kchong@ca.ibm.com</a>
- *
- */
-public class BackAction extends Action
-{
- ISelectionProvider selectionProvider;
- XSDGraphViewer xsdGraphViewer;
- XSDSchema xsdSchema;
-
- /**
- *
- */
- public BackAction()
- {
- super();
- }
-
- /**
- * @param text
- */
- public BackAction(String text)
- {
- super(text);
- }
-
- public BackAction(String text, XSDGraphViewer viewer)
- {
- super(text);
- xsdGraphViewer = viewer;
- }
-
- /**
- * @param text
- * @param image
- */
- public BackAction(String text, ImageDescriptor image)
- {
- super(text, image);
- }
-
- /**
- * @param text
- * @param style
- */
- public BackAction(String text, int style)
- {
- super(text, style);
- }
-
- public void setSelectionProvider(ISelectionProvider selectionProvider)
- {
- this.selectionProvider = selectionProvider;
- }
-
- public void setXSDSchema(XSDSchema xsdSchema)
- {
- this.xsdSchema = xsdSchema;
- }
-
- /*
- * @see IAction#run()
- */
- public void run()
- {
- StructuredSelection selection = new StructuredSelection(xsdSchema);
- selectionProvider.setSelection(selection);
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/CreateAnnotationAction.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/CreateAnnotationAction.java
deleted file mode 100644
index 698d433eea..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/CreateAnnotationAction.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.actions;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.util.XSDConstants;
-import org.w3c.dom.Element;
-
-public class CreateAnnotationAction extends CreateElementAction
-{
- XSDSchema xsdSchema;
- Element documentationNode;
-
- public CreateAnnotationAction()
- {
- super();
- }
-
- public CreateAnnotationAction(String text)
- {
- super(text);
- }
-
- public CreateAnnotationAction(String text, ImageDescriptor image)
- {
- super(text, image);
- }
-
- public Element createAndAddNewChildElement()
- {
- Element childNode = super.createAndAddNewChildElement();
-
- String prefix = parentNode.getPrefix();
- prefix = (prefix == null) ? "" : (prefix + ":");
- documentationNode = getDocument().createElementNS(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, prefix + XSDConstants.DOCUMENTATION_ELEMENT_TAG);
- childNode.appendChild(documentationNode);
-
- formatChild(childNode);
- formatChild(documentationNode);
- formatChild(childNode);
-
- return childNode;
- }
-
-}
-
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/CreateAttributeAndRequired.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/CreateAttributeAndRequired.java
deleted file mode 100644
index 6a634e2b88..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/CreateAttributeAndRequired.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.actions;
-
-import java.util.List;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.wst.sse.core.format.IStructuredFormatProcessor;
-import org.eclipse.wst.xml.core.document.XMLModel;
-import org.eclipse.wst.xml.core.document.XMLNode;
-import org.eclipse.wst.xml.core.format.FormatProcessorXML;
-import org.eclipse.wst.xml.core.internal.document.DocumentImpl;
-import org.eclipse.xsd.XSDComplexTypeDefinition;
-import org.eclipse.xsd.XSDElementDeclaration;
-import org.eclipse.xsd.XSDFactory;
-import org.eclipse.xsd.XSDSchema;
-import org.w3c.dom.Element;
-
-/*
- * Class which creates an Attribute and necessary Elements required before
- * an Attribute can be added. For example, if we wish to add an Attribute
- * to a GlobalElement without a ComplexType, a ComplexType will be created.
- */
-public class CreateAttributeAndRequired extends Action {
- String elementTag;
- String label;
- List attributes;
- XSDSchema xsdSchema;
- ISelectionProvider selectionProvider;
- Object parent;
-
- public CreateAttributeAndRequired(String elementTag, String label, List attributes, XSDSchema xsdSchema, ISelectionProvider selProvider, Object parent) {
- super(label);
-
- this.elementTag = elementTag;
- this.label = label;
- this.attributes = attributes;
- this.xsdSchema = xsdSchema;
- this.selectionProvider = selProvider;
- this.parent = parent;
- }
-
- public void run() {
- if (parent instanceof XSDElementDeclaration) {
- XSDElementDeclaration ed = (XSDElementDeclaration) parent;
- beginRecording(ed.getElement());
- ed.setTypeDefinition(null);
- XSDComplexTypeDefinition td = XSDFactory.eINSTANCE.createXSDComplexTypeDefinition();
- ed.setAnonymousTypeDefinition(td);
-
- CreateElementAction action = new CreateElementAction(label);
- action.setElementTag(elementTag);
- action.setAttributes(attributes);
- action.setParentNode(td.getElement());
- action.setRelativeNode(null);
- action.setXSDSchema(xsdSchema);
- action.setSelectionProvider(selectionProvider);
- action.run();
-
- formatChild(td.getElement());
- if (td.getAttributeContents().size() > 0)
- {
- selectObject(td.getAttributeContents().get(0));
- }
- endRecording(ed.getElement());
- }
- }
-
- protected void beginRecording(Element element) {
- ((DocumentImpl) element.getOwnerDocument()).getModel().beginRecording(this, getText());
- }
-
- protected void endRecording(Element element) {
- ((DocumentImpl) element.getOwnerDocument()).getModel().endRecording(this);
- }
-
- public void selectObject(Object object) {
- if (selectionProvider != null)
- {
- selectionProvider.setSelection(new StructuredSelection(object));
- }
- }
-
- protected void formatChild(Element child)
- {
- if (child instanceof XMLNode)
- {
- XMLModel model = ((XMLNode)child).getModel();
- try
- {
- // tell the model that we are about to make a big model change
- model.aboutToChangeModel();
-
- IStructuredFormatProcessor formatProcessor = new FormatProcessorXML();
- formatProcessor.formatNode(child);
- }
- finally
- {
- // tell the model that we are done with the big model change
- model.changedModel();
- }
- }
- }
-}
-
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/CreateElementAction.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/CreateElementAction.java
deleted file mode 100644
index 3190d532b7..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/CreateElementAction.java
+++ /dev/null
@@ -1,365 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.actions;
-import java.util.List;
-
-import org.eclipse.gef.GraphicalEditPart;
-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.format.IStructuredFormatProcessor;
-import org.eclipse.wst.xml.core.document.XMLModel;
-import org.eclipse.wst.xml.core.document.XMLNode;
-import org.eclipse.wst.xml.core.format.FormatProcessorXML;
-import org.eclipse.wst.xml.core.internal.document.DocumentImpl;
-import org.eclipse.wst.xsd.ui.internal.graph.editparts.ComplexTypeDefinitionEditPart;
-import org.eclipse.wst.xsd.ui.internal.graph.editparts.ElementDeclarationEditPart;
-import org.eclipse.wst.xsd.ui.internal.graph.editparts.ModelGroupDefinitionEditPart;
-import org.eclipse.wst.xsd.ui.internal.graph.editparts.TopLevelComponentEditPart;
-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.XSDElementDeclaration;
-import org.eclipse.xsd.XSDModelGroupDefinition;
-import org.eclipse.xsd.XSDNamedComponent;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.util.XSDConstants;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.Text;
-
-public class CreateElementAction extends Action
-{
- protected String description;
- protected Element parentNode;
-
- protected ISelectionProvider selectionProvider;
- protected XSDSchema xsdSchema;
-
- protected Object sourceContext;
-
- /**
- * Constructor for CreateElementAction.
- */
- public CreateElementAction()
- {
- super();
- }
- /**
- * Constructor for CreateElementAction.
- * @param text
- */
- public CreateElementAction(String text)
- {
- super(text);
- }
- /**
- * Constructor for CreateElementAction.
- * @param text
- * @param image
- */
- public CreateElementAction(String text, ImageDescriptor image)
- {
- super(text, image);
- }
-
- public void setXSDSchema(XSDSchema xsdSchema)
- {
- this.xsdSchema = xsdSchema;
- }
-
- public void setSelectionProvider(ISelectionProvider selectionProvider)
- {
- this.selectionProvider = selectionProvider;
- }
-
- public void setSourceContext(Object sourceContext)
- {
- this.sourceContext = sourceContext;
- }
-
- /**
- * Gets the parentNode.
- * @return Returns a Element
- */
- public Element getParentNode()
- {
- return parentNode;
- }
-
- /**
- * Sets the parentNode.
- * @param parentNode The parentNode to set
- */
- public void setParentNode(Element parentNode)
- {
- this.parentNode = parentNode;
- }
-
- boolean isGlobal = false;
-
- public void setIsGlobal(boolean isGlobal)
- {
- this.isGlobal = isGlobal;
- }
-
- public boolean getIsGlobal()
- {
- return isGlobal;
- }
-
- protected Node relativeNode;
- protected String elementTag;
- public void setElementTag(String elementTag)
- {
- this.elementTag = elementTag;
- }
-
- public DocumentImpl getDocument()
- {
- return (DocumentImpl) getParentNode().getOwnerDocument();
- }
-
- public void beginRecording(String description)
- {
- getDocument().getModel().beginRecording(this, description);
- }
-
- public void endRecording()
- {
- DocumentImpl doc = (DocumentImpl) getDocument();
-
- doc.getModel().endRecording(this);
- }
-
- public Element createAndAddNewChildElement()
- {
- String prefix = parentNode.getPrefix();
- prefix = (prefix == null) ? "" : (prefix + ":");
- Element childNode = getDocument().createElementNS(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, prefix + elementTag);
- if (getAttributes() != null)
- {
- List attributes = getAttributes();
- for (int i = 0; i < attributes.size(); i++)
- {
- DOMAttribute attr = (DOMAttribute) attributes.get(i);
- childNode.setAttribute(attr.getName(), attr.getValue());
- }
- }
- if (getRelativeNode() == null)
- {
- parentNode.appendChild(childNode);
- }
- else
- {
- ((Element)parentNode).insertBefore(childNode,getRelativeNode());
- }
-
- if (isGlobal && getRelativeNode() == null)
- {
- Text textNode = getDocument().createTextNode("\n\n");
- parentNode.appendChild(textNode);
- }
- else if (isGlobal && getRelativeNode() != null)
- {
- Text textNode = getDocument().createTextNode("\n\n");
- parentNode.insertBefore(textNode, getRelativeNode());
- }
-
- formatChild(childNode);
-
- return childNode;
- }
-
- protected void formatChild(Element child)
- {
- if (child instanceof XMLNode)
- {
- XMLModel model = ((XMLNode)child).getModel();
- try
- {
- // tell the model that we are about to make a big model change
- model.aboutToChangeModel();
-
- IStructuredFormatProcessor formatProcessor = new FormatProcessorXML();
- formatProcessor.formatNode(child);
- }
- finally
- {
- // tell the model that we are done with the big model change
- model.changedModel();
- }
- }
- }
- /*
- * @see IAction#run()
- */
- public void run()
- {
- beginRecording(getDescription());
- final Element child = createAndAddNewChildElement();
- endRecording();
-
- if (selectionProvider != null)
- {
- final XSDConcreteComponent comp = xsdSchema.getCorrespondingComponent(child);
-// selectionProvider.setSelection(new StructuredSelection(comp));
-
- Runnable runnable = new Runnable()
- {
- public void run()
- {
- if (comp instanceof XSDAttributeDeclaration)
- {
- if (((XSDAttributeDeclaration)comp).getContainer() instanceof XSDAttributeUse)
- {
- if (comp.getContainer().getContainer() instanceof XSDAttributeGroupDefinition)
- {
- selectionProvider.setSelection(new StructuredSelection(comp.getContainer()));
- }
- else if (comp.getContainer().getContainer() instanceof XSDComplexTypeDefinition)
- {
- if (XSDDOMHelper.inputEquals((Element)child, XSDConstants.ATTRIBUTE_ELEMENT_TAG, true))
- {
- selectionProvider.setSelection(new StructuredSelection(comp.getContainer()));
- }
- else
- {
- selectionProvider.setSelection(new StructuredSelection(comp));
- }
- }
- else
- {
- selectionProvider.setSelection(new StructuredSelection(comp));
- }
- }
- else
- {
- selectionProvider.setSelection(new StructuredSelection(comp));
- }
- }
- else
- {
- selectionProvider.setSelection(new StructuredSelection(comp));
- }
- if (comp instanceof XSDNamedComponent)
- {
- if (sourceContext instanceof AbstractEditPartViewer)
- {
- AbstractEditPartViewer viewer = (AbstractEditPartViewer)sourceContext;
-
- Object obj = viewer.getSelectedEditParts().get(0);
-
- if (obj instanceof GraphicalEditPart)
- {
- if (obj instanceof ElementDeclarationEditPart)
- {
- XSDElementDeclaration elem = ((ElementDeclarationEditPart)obj).getXSDElementDeclaration();
- if (!elem.isElementDeclarationReference())
- {
- ((ElementDeclarationEditPart)obj).doEditName();
- }
- }
- else if (obj instanceof ModelGroupDefinitionEditPart)
- {
- XSDModelGroupDefinition group = ((ModelGroupDefinitionEditPart)obj).getXSDModelGroupDefinition();
- if (!group.isModelGroupDefinitionReference())
- {
- ((ModelGroupDefinitionEditPart)obj).doEditName();
- }
- }
- else if (obj instanceof ComplexTypeDefinitionEditPart)
- {
- XSDComplexTypeDefinition ct = ((ComplexTypeDefinitionEditPart)obj).getXSDComplexTypeDefinition();
- if (ct.getName() != null)
- {
- ((ComplexTypeDefinitionEditPart)obj).doEditName();
- }
- }
- else if (obj instanceof TopLevelComponentEditPart)
- {
- ((TopLevelComponentEditPart)obj).doEditName();
- }
- }
-
- }
- }
- }
- };
- Display.getDefault().timerExec(50,runnable);
- }
- }
-
- /**
- * Gets the relativeNode.
- * @return Returns a Element
- */
- public Node getRelativeNode()
- {
- return relativeNode;
- }
-
- /**
- * Sets the relativeNode.
- * @param relativeNode The relativeNode to set
- */
- public void setRelativeNode(Node relativeNode)
- {
- this.relativeNode = relativeNode;
- }
-
- /**
- * Gets the description.
- * @return Returns a String
- */
- public String getDescription()
- {
- if (description == null)
- {
- return getText();
- }
- return description;
- }
-
- /**
- * Sets the description.
- * @param description The description to set
- */
- public void setDescription(String description)
- {
- this.description = description;
- }
-
- protected List attributes;
- /**
- * Gets the nameAttribute.
- * @return Returns a String
- */
- public List getAttributes()
- {
- return attributes;
- }
-
- /**
- * Sets the attributes.
- * @param attributes The attributes to set
- */
- public void setAttributes(List attributes)
- {
- this.attributes = attributes;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/CreateGroupAction.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/CreateGroupAction.java
deleted file mode 100644
index f9eadae541..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/CreateGroupAction.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.actions;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.util.XSDConstants;
-import org.w3c.dom.Element;
-
-
-public class CreateGroupAction extends CreateElementAction
-{
- XSDSchema xsdSchema;
-
- /**
- * Constructor for CreateGroupAction.
- */
- public CreateGroupAction()
- {
- super();
- }
- /**
- * Constructor for CreateGroupAction.
- * @param text
- */
- public CreateGroupAction(String text)
- {
- super(text);
- }
- /**
- * Constructor for CreateGroupAction.
- * @param text
- * @param XSDSchema
- */
- public CreateGroupAction(String text, XSDSchema xsdSchema)
- {
- super(text);
- this.xsdSchema = xsdSchema;
- }
- /**
- * Constructor for CreateGroupAction.
- * @param text
- * @param image
- */
- public CreateGroupAction(String text, ImageDescriptor image)
- {
- super(text, image);
- }
-
- public Element createAndAddNewChildElement()
- {
- XSDConcreteComponent xsdComp = xsdSchema.getCorrespondingComponent(parentNode);
- Element childNode = super.createAndAddNewChildElement();
-
- String prefix = parentNode.getPrefix();
- prefix = (prefix == null) ? "" : (prefix + ":");
- Element contentModelNode = getDocument().createElementNS(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, prefix + XSDConstants.SEQUENCE_ELEMENT_TAG);
- childNode.appendChild(contentModelNode);
-
- formatChild(childNode);
-
- xsdComp.setElement(parentNode);
-
- return childNode;
- }
-}
-
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/CreateIdentityConstraintsAction.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/CreateIdentityConstraintsAction.java
deleted file mode 100644
index ca933f334e..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/CreateIdentityConstraintsAction.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.actions;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.util.XSDConstants;
-import org.w3c.dom.Element;
-
-public class CreateIdentityConstraintsAction extends CreateElementAction
-{
- XSDSchema xsdSchema;
-
- /**
- * Constructor for CreateIdentityConstraintsAction.
- */
- public CreateIdentityConstraintsAction()
- {
- super();
- }
- /**
- * Constructor for CreateIdentityConstraintsAction.
- * @param text
- */
- public CreateIdentityConstraintsAction(String text)
- {
- super(text);
- }
- /**
- * Constructor for CreateIdentityConstraintsAction.
- * @param text
- * @param XSDSchema
- */
- public CreateIdentityConstraintsAction(String text, XSDSchema xsdSchema)
- {
- super(text);
- this.xsdSchema = xsdSchema;
- }
- /**
- * Constructor for CreateIdentityConstraintsAction.
- * @param text
- * @param image
- */
- public CreateIdentityConstraintsAction(String text, ImageDescriptor image)
- {
- super(text, image);
- }
-
- public Element createAndAddNewChildElement()
- {
- Element childNode = super.createAndAddNewChildElement();
-
- String prefix = parentNode.getPrefix();
- prefix = (prefix == null) ? "" : (prefix + ":");
- Element selectorNode = getDocument().createElementNS(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, prefix + XSDConstants.SELECTOR_ELEMENT_TAG);
-
- DOMAttribute attr = new DOMAttribute(XSDConstants.XPATH_ATTRIBUTE, "");
- selectorNode.setAttribute(attr.getName(), attr.getValue());
-
- childNode.appendChild(selectorNode);
-
- return childNode;
- }
-
-}
-
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/CreateLocalComplexTypeAction.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/CreateLocalComplexTypeAction.java
deleted file mode 100644
index e8b0cd027a..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/CreateLocalComplexTypeAction.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.actions;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.wst.xsd.ui.internal.util.XSDDOMHelper;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.util.XSDConstants;
-import org.w3c.dom.Element;
-
-
-public class CreateLocalComplexTypeAction extends CreateElementAction
-{
- /**
- * Constructor for CreateLocalComplexTypeAction.
- */
- public CreateLocalComplexTypeAction()
- {
- super();
- }
- /**
- * Constructor for CreateLocalComplexTypeAction.
- * @param text
- */
- public CreateLocalComplexTypeAction(String text)
- {
- super(text);
- }
- /**
- * Constructor for CreateLocalComplexTypeAction.
- * @param text
- * @param image
- */
- public CreateLocalComplexTypeAction(String text, ImageDescriptor image)
- {
- super(text, image);
- }
-
- public Element createAndAddNewChildElement()
- {
- XSDConcreteComponent xsdComp = xsdSchema.getCorrespondingComponent(parentNode);
-
- Element childNode = super.createAndAddNewChildElement();
-
- if (XSDDOMHelper.inputEquals(parentNode, XSDConstants.ELEMENT_ELEMENT_TAG, false))
- {
- parentNode.removeAttribute(XSDConstants.TYPE_ATTRIBUTE);
- }
-
- String prefix = parentNode.getPrefix();
- prefix = (prefix == null) ? "" : (prefix + ":");
- childNode.appendChild(getDocument().createElement(prefix + XSDConstants.SEQUENCE_ELEMENT_TAG));
-
- formatChild(childNode);
-
- xsdComp.setElement(parentNode);
-
- return childNode;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/CreateLocalSimpleTypeAction.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/CreateLocalSimpleTypeAction.java
deleted file mode 100644
index d2e1065c41..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/CreateLocalSimpleTypeAction.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.actions;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.wst.xsd.ui.internal.util.XSDDOMHelper;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.util.XSDConstants;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-
-public class CreateLocalSimpleTypeAction extends CreateElementAction
-{
- XSDSchema xsdSchema;
-
- /**
- * Constructor for CreateLocalSimpleTypeAction.
- */
- public CreateLocalSimpleTypeAction()
- {
- super();
- }
- /**
- * Constructor for CreateLocalSimpleTypeAction.
- * @param text
- */
- public CreateLocalSimpleTypeAction(String text)
- {
- super(text);
- }
-
- /**
- * Constructor for CreateLocalSimpleTypeAction.
- * @param text
- * @param image
- */
- public CreateLocalSimpleTypeAction(String text, ImageDescriptor image)
- {
- super(text, image);
- }
-
- public Element createAndAddNewChildElement()
- {
- Element childNode = super.createAndAddNewChildElement();
-
- if (XSDDOMHelper.inputEquals(parentNode, XSDConstants.UNION_ELEMENT_TAG, false))
- {
-// parentNode.removeAttribute(XSDConstants.MEMBERTYPES_ATTRIBUTE);
- }
- else if (XSDDOMHelper.inputEquals(parentNode, XSDConstants.LIST_ELEMENT_TAG, false))
- {
- parentNode.removeAttribute(XSDConstants.ITEMTYPE_ATTRIBUTE);
- }
- else if (XSDDOMHelper.inputEquals(parentNode, XSDConstants.ATTRIBUTE_ELEMENT_TAG, false))
- {
- parentNode.removeAttribute(XSDConstants.TYPE_ATTRIBUTE);
- }
- else if (XSDDOMHelper.inputEquals(parentNode, XSDConstants.RESTRICTION_ELEMENT_TAG, false))
- {
- Node parent = parentNode.getParentNode();
- if (XSDDOMHelper.inputEquals(parent, XSDConstants.SIMPLETYPE_ELEMENT_TAG, false))
- {
- parentNode.removeAttribute(XSDConstants.BASE_ATTRIBUTE);
- }
- }
- else if (XSDDOMHelper.inputEquals(parentNode, XSDConstants.ELEMENT_ELEMENT_TAG, false))
- {
- parentNode.removeAttribute(XSDConstants.TYPE_ATTRIBUTE);
- }
-
- formatChild(childNode);
-
- return childNode;
- }
-}
-
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/CreateSimpleContentAction.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/CreateSimpleContentAction.java
deleted file mode 100644
index 9c49936348..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/CreateSimpleContentAction.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.actions;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.wst.xsd.ui.internal.util.TypesHelper;
-import org.eclipse.wst.xsd.ui.internal.util.XSDDOMHelper;
-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;
-
-
-/**
- * @version 1.0
- * @author
- */
-public class CreateSimpleContentAction extends CreateElementAction
-{
- XSDSchema xsdSchema;
- //IDocument document;
-
- /**
- * Constructor for CreateSimpleContentAction.
- */
- public CreateSimpleContentAction()
- {
- super();
- }
- /**
- * Constructor for CreateSimpleContentAction.
- * @param text
- */
- public CreateSimpleContentAction(String text)
- {
- super(text);
- }
- /**
- * Constructor for CreateSimpleContentAction.
- * @param text
- * @param XSDSchema
- */
- public CreateSimpleContentAction(String text, XSDSchema xsdSchema)
- {
- super(text);
- this.xsdSchema = xsdSchema;
- }
- /**
- * Constructor for CreateSimpleContentAction.
- * @param text
- * @param image
- */
- public CreateSimpleContentAction(String text, ImageDescriptor image)
- {
- super(text, image);
- }
-
- public Element createAndAddNewChildElement()
- {
- Element childNode = super.createAndAddNewChildElement();
-
- String prefix = parentNode.getPrefix();
- prefix = (prefix == null) ? "" : (prefix + ":");
- Element derivedByNode = getDocument().createElementNS(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, prefix + "restriction");
- childNode.appendChild(derivedByNode);
- Element sequence = null;
-
- if (XSDDOMHelper.inputEquals(childNode, XSDConstants.COMPLEXCONTENT_ELEMENT_TAG, false))
- {
- sequence = getDocument().createElementNS(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, prefix + "sequence");
- derivedByNode.appendChild(sequence);
- }
-
- // now add the required base attribute for the derived by node
- TypesHelper typesHelper = new TypesHelper(xsdSchema);
- List listOfCT = typesHelper.getUserComplexTypeNamesList();
- String firstType = "";
- if (listOfCT.size() > 0)
- {
- firstType = (String)(listOfCT).get(0);
- }
- DOMAttribute attr = new DOMAttribute(XSDConstants.BASE_ATTRIBUTE, firstType);
- derivedByNode.setAttribute(attr.getName(), attr.getValue());
-
- formatChild(derivedByNode);
- if (sequence != null)
- {
- formatChild(sequence);
- formatChild(derivedByNode);
- }
- formatChild(childNode);
-
-
- return childNode;
- }
-
- /*
- * @see IAction#run()
- */
- public void run()
- {
- ArrayList message = new ArrayList();
- beginRecording(getDescription());
-
- Element child = createAndAddNewChildElement();
- endRecording();
-
- NodeList children = parentNode.getChildNodes();
-/*
- for (int i=0; i < children.getLength(); i++)
- {
- Node aChild = children.item(i);
- if (aChild != null && aChild instanceof Element)
- {
- if (XSDDOMHelper.inputEquals((Element)aChild, XSDConstants.ATTRIBUTE_ELEMENT_TAG, false) ||
- XSDDOMHelper.inputEquals((Element)aChild, XSDConstants.ATTRIBUTEGROUP_ELEMENT_TAG, true))
- {
- // REMOVE ATTRIBUTES AND ATTRIBUTE GROUP REFS FROM COMPLEX TYPES LIST OF CHILDREN
- message.addElement(new ModelMessage
- (XSDPlugin.getSchemaString("_INFO_REMOVE_ATTRIBUTE_FROM") +
- " <" + parentNode.getAttribute("name") + ">", aChild));
- }
- }
- }
- domainModel.createMarkers(message);
-*/
- for (int i=0; i < children.getLength(); i++)
- {
- Node aChild = children.item(i);
- if (aChild != null && aChild instanceof Element)
- {
- if (XSDDOMHelper.inputEquals((Element)aChild, XSDConstants.ATTRIBUTE_ELEMENT_TAG, false) ||
- XSDDOMHelper.inputEquals((Element)aChild, XSDConstants.ATTRIBUTE_ELEMENT_TAG, true) ||
- XSDDOMHelper.inputEquals((Element)aChild, XSDConstants.ANYATTRIBUTE_ELEMENT_TAG, false) ||
- XSDDOMHelper.inputEquals((Element)aChild, XSDConstants.ATTRIBUTEGROUP_ELEMENT_TAG, true))
- {
- // REMOVE ATTRIBUTES AND ATTRIBUTE GROUP REFS FROM COMPLEX TYPES LIST OF CHILDREN
-// KCPort TODO
-// ErrorMessage aTask = new ErrorMessage();
-// Node parent = aChild;
-// if (parent instanceof NodeImpl)
-// {
-// aTask.setModelObject(parent);
-// }
-// aTask.setLocalizedMessage(XSDPlugin.getSchemaString("_INFO_REMOVE_ATTRIBUTE_FROM") + " <" + parentNode.getAttribute("name") + ">");
-// message.add(aTask);
- }
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/CreateSimpleTypeAction.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/CreateSimpleTypeAction.java
deleted file mode 100644
index 5e5c29cce1..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/CreateSimpleTypeAction.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.actions;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.util.XSDConstants;
-import org.w3c.dom.Element;
-public class CreateSimpleTypeAction extends CreateElementAction
-{
- /**
- *
- */
- public CreateSimpleTypeAction()
- {
- super();
- }
-
- /**
- * @param text
- */
- public CreateSimpleTypeAction(String text)
- {
- super(text);
- }
-
- public CreateSimpleTypeAction(String text, XSDSchema xsdSchema)
- {
- super(text);
- this.xsdSchema = xsdSchema;
- }
-
- /**
- * @param text
- * @param image
- */
- public CreateSimpleTypeAction(String text, ImageDescriptor image)
- {
- super(text, image);
- }
-
- public Element createAndAddNewChildElement()
- {
- XSDConcreteComponent xsdComp = xsdSchema.getCorrespondingComponent(parentNode);
- Element childNode = super.createAndAddNewChildElement();
-
- String prefix = parentNode.getPrefix();
- prefix = (prefix == null) ? "" : (prefix + ":");
- Element contentModelNode = getDocument().createElementNS(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, prefix + XSDConstants.RESTRICTION_ELEMENT_TAG);
- contentModelNode.setAttribute(XSDConstants.BASE_ATTRIBUTE, prefix + "string");
- childNode.appendChild(contentModelNode);
-
- formatChild(childNode);
-
- xsdComp.setElement(parentNode);
-
- return childNode;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/DOMAttribute.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/DOMAttribute.java
deleted file mode 100644
index 5580b40fc4..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/DOMAttribute.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.actions;
-
-// TODO 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/org/eclipse/wst/xsd/ui/internal/actions/DeleteAction.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/DeleteAction.java
deleted file mode 100644
index 097a4a3fae..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/DeleteAction.java
+++ /dev/null
@@ -1,237 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.actions;
-
-import java.util.Iterator;
-
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.actions.SelectionListenerAction;
-import org.eclipse.wst.xml.core.document.XMLNode;
-import org.eclipse.wst.xml.core.internal.document.DocumentImpl;
-import org.eclipse.wst.xsd.ui.internal.XSDEditorPlugin;
-import org.eclipse.wst.xsd.ui.internal.refactor.delete.BaseGlobalCleanup;
-import org.eclipse.wst.xsd.ui.internal.refactor.delete.GlobalAttributeCleanup;
-import org.eclipse.wst.xsd.ui.internal.refactor.delete.GlobalAttributeGroupCleanup;
-import org.eclipse.wst.xsd.ui.internal.refactor.delete.GlobalElementCleanup;
-import org.eclipse.wst.xsd.ui.internal.refactor.delete.GlobalGroupCleanup;
-import org.eclipse.wst.xsd.ui.internal.refactor.delete.GlobalSimpleOrComplexTypeCleanup;
-import org.eclipse.wst.xsd.ui.internal.refactor.delete.XSDExternalFileCleanup;
-import org.eclipse.wst.xsd.ui.internal.util.TypesHelper;
-import org.eclipse.wst.xsd.ui.internal.util.XSDDOMHelper;
-import org.eclipse.xsd.XSDAttributeDeclaration;
-import org.eclipse.xsd.XSDAttributeGroupDefinition;
-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.XSDParticle;
-import org.eclipse.xsd.XSDRedefine;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.XSDSchemaDirective;
-import org.eclipse.xsd.XSDTypeDefinition;
-import org.eclipse.xsd.util.XSDConstants;
-import org.w3c.dom.Node;
-
-
-public class DeleteAction extends SelectionListenerAction
-{
- protected IEditorPart editor;
- protected XSDSchema xsdSchema;
- protected ISelectionProvider selectionProvider;
- protected XSDConcreteComponent parentXSDComponent;
-
- /**
- * Constructor for DeleteAction.
- * @param text
- */
- public DeleteAction(String text, IEditorPart editor, XSDSchema xsdSchema)
- {
- super(text);
- this.editor = editor;
- this.xsdSchema = xsdSchema;
- }
-
- public void setSelectionProvider(ISelectionProvider selectionProvider)
- {
- this.selectionProvider = selectionProvider;
- }
-
- public IEditorPart getEditor()
- {
- return editor;
- }
-
- public XSDSchema getSchema()
- {
- return xsdSchema;
- }
-
- public void setXSDSchema(XSDSchema xsdSchema)
- {
- this.xsdSchema = xsdSchema;
- }
-
- /*
- * @see IAction#run()
- */
- public void run()
- {
- IStructuredSelection selection = getStructuredSelection();
-
- if (selection.isEmpty())
- {
- return;
- }
-
- Iterator iter = selection.iterator();
- DocumentImpl doc = null;
- while (iter.hasNext())
- {
- Object obj = iter.next();
- Node node = null;
- if (obj instanceof Node)
- {
- node = (Node)obj;
- }
- else if (obj instanceof XSDConcreteComponent)
- {
- xsdSchema = ((XSDConcreteComponent)obj).getSchema();
-
- node = ((XSDConcreteComponent)obj).getElement();
- if (node instanceof XMLNode)
- {
- parentXSDComponent = ((XSDConcreteComponent)obj).getContainer();
-
- if (parentXSDComponent instanceof XSDParticle)
- {
- // need to get the modelGroup
- parentXSDComponent = parentXSDComponent.getContainer();
- }
- }
-
- }
- if (!XSDDOMHelper.inputEquals(node, XSDConstants.SCHEMA_ELEMENT_TAG, false))
- {
- if (node instanceof XMLNode)
- {
- if (doc == null)
- {
- doc = (DocumentImpl) node.getOwnerDocument();
- doc.getModel().beginRecording(this, XSDEditorPlugin.getXSDString("_UI_ACTION_DELETE_NODES"));
- }
-
- boolean refresh = cleanupReferences(node);
- if (node != null)
- {
- XSDDOMHelper.removeNodeAndWhitespace(node);
- }
-
- // Workaround to reset included elements in XSD model
- if (refresh)
- {
- // getEditor().reparseSchema();
- // getEditor().getGraphViewer().setSchema(getEditor().getXSDSchema());
- }
- }
- }
- }
-
- if (parentXSDComponent != null && selectionProvider != null)
- {
- selectionProvider.setSelection(new StructuredSelection(parentXSDComponent));
- }
-
- if (doc != null)
- {
- doc.getModel().endRecording(this);
- }
- }
-
- protected boolean cleanupReferences(Node deletedNode)
- {
- boolean refresh = false;
- XSDConcreteComponent comp = getSchema().getCorrespondingComponent(deletedNode);
-
- if (comp instanceof XSDInclude ||
- comp instanceof XSDImport ||
- comp instanceof XSDRedefine)
- {
- XSDSchema resolvedSchema = ((XSDSchemaDirective)comp).getResolvedSchema();
- XSDSchema referencedSchema = null;
- if (comp instanceof XSDInclude)
- {
- referencedSchema = ((XSDInclude)comp).getIncorporatedSchema();
- refresh = true;
- }
- else if (comp instanceof XSDRedefine)
- {
- referencedSchema = ((XSDRedefine)comp).getIncorporatedSchema();
- refresh = true;
- }
- else if (comp instanceof XSDImport)
- {
- XSDImport imp = (XSDImport)comp;
- referencedSchema = ((XSDImport)comp).getResolvedSchema();
- refresh = true;
- }
-
- if (referencedSchema != null)
- {
- XSDExternalFileCleanup cleanHelper = new XSDExternalFileCleanup(referencedSchema);
- cleanHelper.visitSchema(getSchema());
- // populate messages
-// TODO getEditor().createTasksInTaskList(cleanHelper.getMessages());
- }
- if (comp instanceof XSDImport)
- {
- TypesHelper typesHelper = new TypesHelper(getSchema());
- typesHelper.updateMapAfterDelete((XSDImport)comp);
- }
- }
- else if (getSchema().equals(comp.getContainer()))
- {
- BaseGlobalCleanup cleanHelper = null;
- // Only need to clean up references if the component being deleted is global scoped
- if (comp instanceof XSDElementDeclaration)
- {
- cleanHelper = new GlobalElementCleanup(comp);
- }
- else if (comp instanceof XSDModelGroupDefinition)
- {
- cleanHelper = new GlobalGroupCleanup(comp);
- }
- else if (comp instanceof XSDTypeDefinition)
- {
- cleanHelper = new GlobalSimpleOrComplexTypeCleanup(comp);
- }
- else if (comp instanceof XSDAttributeDeclaration)
- {
- cleanHelper = new GlobalAttributeCleanup(comp);
- }
- else if (comp instanceof XSDAttributeGroupDefinition)
- {
- cleanHelper = new GlobalAttributeGroupCleanup(comp);
- }
-
-
- if (cleanHelper != null)
- {
- cleanHelper.visitSchema(getSchema());
- }
- }
- return refresh;
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/GraphRenameAction.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/GraphRenameAction.java
deleted file mode 100644
index 4576bfa4f7..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/GraphRenameAction.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package org.eclipse.wst.xsd.ui.internal.actions;
-
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.jface.action.Action;
-import org.eclipse.wst.xsd.ui.internal.commands.RenameCommand;
-import org.eclipse.xsd.XSDNamedComponent;
-
-
-public class GraphRenameAction extends Action
-{
- protected RenameCommand command;
-
- public GraphRenameAction(XSDNamedComponent namedComponent, GraphicalEditPart editPart)
- {
- command = new RenameCommand(namedComponent, editPart);
- setText("Rename");
- }
-
- public void run()
- {
- command.run();
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/ISchemaEditorActionConstants.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/ISchemaEditorActionConstants.java
deleted file mode 100644
index 6033b722de..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/ISchemaEditorActionConstants.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.actions;
-
-public interface ISchemaEditorActionConstants
-{
- public static final String RETARGET_VALIDATE_SCHEMA_ACTION_ID = "retargetValidateSchemaAction"; //$NON-NLS-1$
- public static final String RETARGET_RELOAD_DEPENDENCIES_ACTION_ID = "retargetReloadDependenciesAction"; //$NON-NLS-1$
- public static final String RETARGET_GENERATE_JAVA_ACTION_ID = "retargetGenerateJavaAction"; //$NON-NLS-1$
- public static final String RETARGET_GENERATE_DTD_ACTION_ID = "retargetGenerateDtdAction"; //$NON-NLS-1$
- public static final String RETARGET_GENERATE_XML_ACTION_ID = "retargetGenerateXMLAction"; //$NON-NLS-1$
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/MakeAnonymousGlobal.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/MakeAnonymousGlobal.java
deleted file mode 100644
index 9a9638a03f..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/MakeAnonymousGlobal.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.actions;
-
-import org.eclipse.wst.xsd.ui.internal.util.TypesHelper;
-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 MakeAnonymousGlobal extends CreateElementAction
-{
- XSDSchema xsdSchema;
- Element type;
-
- public MakeAnonymousGlobal(String text, Element type, XSDSchema xsdSchema)
- {
- super(text);
- this.xsdSchema = xsdSchema;
- this.type = type;
- isGlobal = true;
- }
-
- public Element createAndAddNewChildElement()
- {
- // create the new global type
- Element childNode = super.createAndAddNewChildElement();
- // add the anonymous type's children to the new global type
- if (type.hasChildNodes())
- {
- NodeList nodes = type.getChildNodes();
- // use clones so we don't have a refresh problem
- for (int i = 0; i < nodes.getLength(); i++)
- {
- Node node = nodes.item(i);
- childNode.appendChild(node.cloneNode(true));
- }
- }
-
- // clean up the element whose type was anonymous
- // and set its type attribute to the new global type
- TypesHelper helper = new TypesHelper(xsdSchema);
- String prefix = helper.getPrefix(xsdSchema.getTargetNamespace(), true);
- helper = null;
-
- Element parentElementOfAnonymousType = (Element)type.getParentNode();
-
- parentElementOfAnonymousType.removeChild(type);
- parentElementOfAnonymousType.setAttribute(XSDConstants.TYPE_ATTRIBUTE, prefix + childNode.getAttribute(XSDConstants.NAME_ATTRIBUTE));
-
- formatChild(childNode);
-
- return childNode;
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/ModelMessage.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/ModelMessage.java
deleted file mode 100644
index aa30618d02..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/ModelMessage.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.actions;
-
-import org.w3c.dom.Node;
-
-public class ModelMessage
-{
- protected String message;
- protected Node node;
-
- public ModelMessage(String message, Node node)
- {
- this.message = message;
- this.node = node;
- }
-
- public String getMessage()
- {
- return message;
- }
-
- public Node getNode()
- {
- return node;
- }
-}
-
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/MoveAction.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/MoveAction.java
deleted file mode 100644
index 741f7d0dd2..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/MoveAction.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.actions;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.wst.xml.core.document.XMLModel;
-import org.eclipse.wst.xml.core.document.XMLNode;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.w3c.dom.Node;
-import org.w3c.dom.Text;
-
-public class MoveAction extends Action
-{
- protected List selectedNodes;
- protected Node parentNode;
- protected Node refChild;
-
- /**
- * Constructor for DeleteAction.
- * @param text
- */
- public MoveAction(Node parentNode, List selectedNodes, Node refChild)
- {
- this.parentNode = parentNode;
- this.selectedNodes = selectedNodes;
- this.refChild = refChild;
- }
-
- public MoveAction(XSDConcreteComponent parentComponent, List selectedComponents, XSDConcreteComponent refChildComponent)
- {
- selectedNodes = new ArrayList(selectedComponents.size());
- for (Iterator i = selectedComponents.iterator(); i.hasNext(); )
- {
- XSDConcreteComponent concreteComponent = (XSDConcreteComponent)i.next();
- selectedNodes.add(concreteComponent.getElement());
- }
- parentNode = parentComponent.getElement();
- refChild = refChildComponent != null ? refChildComponent.getElement() : null;
- }
-
- public boolean canMove()
- {
- // TODO... there are likely more restriction to consider here
- boolean result = true;
- for (Iterator i = selectedNodes.iterator(); i.hasNext(); )
- {
- Node child = (Node)i.next();
- if (isDecendantOrSelf(child, parentNode))
- {
- result = false;
- break;
- }
- }
- return result;
- }
-
- protected boolean isDecendantOrSelf(Node potentialParent, Node node)
- {
- boolean result = false;
- while (node != null)
- {
- if (node == potentialParent)
- {
- result = true;
- break;
- }
- node = node.getParentNode();
- }
- return result;
- }
-
-
- protected void beginRecording()
- {
- XMLModel model = getModel();
- if (model != null)
- {
- model.beginRecording(this, "Move");
- }
- }
-
- protected void endRecording()
- {
- XMLModel model = getModel();
- if (model != null)
- {
- model.endRecording(this);
- }
- }
-
- protected XMLModel getModel()
- {
- XMLModel model = null;
- if (parentNode instanceof XMLNode)
- {
- model = ((XMLNode)parentNode).getModel();
- }
- return model;
- }
-
-
-
- /*
- * @see IAction#run()
- */
- public void run()
- {
- beginRecording();
- try
- {
- for (Iterator i = selectedNodes.iterator(); i.hasNext(); )
- {
- Node child = (Node)i.next();
- repositionBefore(parentNode, child, refChild);
- }
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- endRecording();
- }
-
-
- public void repositionBefore(Node parent, Node child, Node refChild)
- {
- // TODO... when the refChild (inserting as the last element) we need to
- // special case the way we preserve indentation
- Node oldParent = child.getParentNode();
- if (oldParent != null && refChild != child)
- {
- // consider any indentation text node that preceeds the child
- //
- Node textNode = isWhitespaceTextNode(child.getPreviousSibling()) ? child.getPreviousSibling() : null;
-
- // remove the child
- //
- oldParent.removeChild(child);
-
- // Instead of inserting the child immediatlely infront of the refChild, we first check to see if there
- // is an indentation text node preceeding the refChild. If we find such a node, we perform the insertion
- // so that the child is inserted before the indentation text node.
- Node adjustedRefChild = refChild;
- if (refChild != null && isWhitespaceTextNode(refChild.getPreviousSibling()))
- {
- adjustedRefChild = refChild.getPreviousSibling();
- }
-
- // reposition the child and any indentation text node
- //
- parent.insertBefore(child, adjustedRefChild);
- if (textNode != null)
- {
- oldParent.removeChild(textNode);
- parent.insertBefore(textNode, child);
- }
- }
- }
-
-
- protected static boolean isWhitespaceTextNode(Node node)
- {
- boolean result = false;
- if (node != null && node.getNodeType() == Node.TEXT_NODE)
- {
- String data = ((Text)node).getData();
- result = (data == null || data.trim().length() == 0);
- }
- return result;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/OpenSchemaAction.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/OpenSchemaAction.java
deleted file mode 100644
index 6ba1ee9e9d..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/OpenSchemaAction.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.actions;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.wst.xml.uriresolver.util.URIHelper;
-import org.eclipse.wst.xsd.ui.internal.util.OpenOnSelectionHelper;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDSchemaDirective;
-import org.eclipse.xsd.impl.XSDImportImpl;
-import org.w3c.dom.Node;
-
-
-public class OpenSchemaAction extends Action
-{
- XSDConcreteComponent component;
- public OpenSchemaAction(String label, XSDConcreteComponent component)
- {
- super(label);
- this.component = component;
- }
-
- public void run()
- {
- if (component != null)
- {
- revealObject();
- }
- }
-
- boolean lastResult = false;
- protected boolean revealObject()
- {
- Node element = component.getElement();
- String schemaLocation = "";
- XSDSchemaDirective dir;
- if (component instanceof XSDSchemaDirective)
- {
- dir = (XSDSchemaDirective)component;
- // 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(schemaLocation);
- }
- }
- }
- return lastResult;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/ReloadDependenciesAction.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/ReloadDependenciesAction.java
deleted file mode 100644
index 73e239f2f1..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/ReloadDependenciesAction.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.actions;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.wst.xsd.ui.internal.XSDEditor;
-
-
-public class ReloadDependenciesAction extends Action
-{
- /**
- * Constructor for ReloadDependenciesAction.
- */
- public ReloadDependenciesAction()
- {
- super();
- }
-
- /**
- * Constructor for ReloadDependenciesAction.
- * @param text
- */
- public ReloadDependenciesAction(String text)
- {
- super(text);
- }
-
- /**
- * Constructor for ReloadDependenciesAction.
- * @param text
- * @param image
- */
- public ReloadDependenciesAction(String text, ImageDescriptor image)
- {
- super(text, image);
- }
-
- public void setEditor(XSDEditor editor)
- {
- this.editor = editor;
- }
-
- protected XSDEditor editor;
-
- public void run()
- {
- editor.reparseSchema();
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/SetBaseTypeAction.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/SetBaseTypeAction.java
deleted file mode 100644
index 27bbabbee7..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/SetBaseTypeAction.java
+++ /dev/null
@@ -1,384 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.actions;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.wst.sse.core.format.IStructuredFormatProcessor;
-import org.eclipse.wst.xml.core.document.XMLModel;
-import org.eclipse.wst.xml.core.document.XMLNode;
-import org.eclipse.wst.xml.core.format.FormatProcessorXML;
-import org.eclipse.wst.xml.core.internal.document.DocumentImpl;
-import org.eclipse.wst.xsd.ui.internal.XSDEditorPlugin;
-import org.eclipse.wst.xsd.ui.internal.util.TypesHelper;
-import org.eclipse.wst.xsd.ui.internal.util.XSDDOMHelper;
-import org.eclipse.wst.xsd.ui.internal.widgets.SetBaseTypeDialog;
-import org.eclipse.xsd.XSDComplexTypeDefinition;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.XSDTypeDefinition;
-import org.eclipse.xsd.util.XSDConstants;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-
-public class SetBaseTypeAction extends Action
-{
- XSDSchema xsdSchema;
- Element element;
- String type = "";
- String derivedByString = "";
- XSDDOMHelper domHelper;
-
- /**
- * Constructor for SetBaseTypeAction.
- */
- public SetBaseTypeAction()
- {
- super();
- domHelper = new XSDDOMHelper();
- }
- /**
- * Constructor for SetBaseTypeAction.
- * @param arg0
- */
- public SetBaseTypeAction(String arg0)
- {
- super(arg0);
- domHelper = new XSDDOMHelper();
- }
- /**
- * Constructor for SetBaseTypeAction.
- * @param arg0
- * @param arg1
- */
- public SetBaseTypeAction(String arg0, ImageDescriptor arg1)
- {
- super(arg0, arg1);
- domHelper = new XSDDOMHelper();
- }
- /**
- * Constructor for SetBaseTypeAction.
- * @param arg0
- * @param arg1
- */
- public SetBaseTypeAction(String arg0, int arg1)
- {
- super(arg0, arg1);
- domHelper = new XSDDOMHelper();
- }
-
-
- public void setXSDSchema(XSDSchema schema)
- {
- this.xsdSchema = schema;
- }
-
- public void setComplexTypeElement(Element element)
- {
- this.element = element;
- }
-
- public void setType(String type)
- {
- this.type = type;
- }
-
- public void setDerivedBy(String derivedByString)
- {
- this.derivedByString = derivedByString;
- }
-
- public void run()
- {
- Display display = Display.getCurrent();
- // if it is null, get the default one
- display = display == null ? Display.getDefault() : display;
- Shell parentShell = display.getActiveShell();
-
- SetBaseTypeDialog dialog = new SetBaseTypeDialog(parentShell, xsdSchema, element);
- dialog.setBlockOnOpen(true);
-
- Element contentModelElement = domHelper.getContentModelFromParent(element);
- if (contentModelElement != null)
- {
- // to set the current values to show in the dialog
- if (XSDDOMHelper.inputEquals(contentModelElement, XSDConstants.COMPLEXCONTENT_ELEMENT_TAG, false) ||
- XSDDOMHelper.inputEquals(contentModelElement, XSDConstants.SIMPLECONTENT_ELEMENT_TAG, false))
- {
- Element derivedByElement = domHelper.getDerivedByElementFromComplexType(element);
- if (derivedByElement != null)
- {
- String currentBaseType = derivedByElement.getAttribute(XSDConstants.BASE_ATTRIBUTE);
- dialog.setCurrentBaseType(currentBaseType);
- dialog.setCurrentDerivedBy(derivedByElement.getLocalName());
- }
- else
- {
- dialog.setCurrentBaseType("");
- dialog.setCurrentDerivedBy("");
- }
- }
- }
-
- int result = dialog.open();
-
- if (result == Window.OK)
- {
- type = dialog.getBaseType();
- derivedByString = dialog.getDerivedBy();
- performAction();
- }
- }
-
- XSDTypeDefinition newTypeDefinition = null;
- public XSDTypeDefinition getXSDTypeDefinition()
- {
- return newTypeDefinition;
- }
-
- public void performAction()
- {
- TypesHelper helper = new TypesHelper(xsdSchema);
-
- XSDConcreteComponent xsdComp = xsdSchema.getCorrespondingComponent(element);
-
- Element contentModelElement = domHelper.getContentModelFromParent(element);
- boolean contentModelExists = true;
- if (contentModelElement == null)
- {
- contentModelExists = false;
- }
-
-// get XSD component of the new type chosen
- newTypeDefinition = null;
- for (Iterator i = xsdSchema.getTypeDefinitions().iterator(); i.hasNext(); )
- {
- XSDTypeDefinition typeDef = (XSDTypeDefinition)i.next();
- if (typeDef.getQName().equals(type))
- {
- newTypeDefinition = typeDef;
- break;
- }
- }
-
- boolean needsComplexContent = false;
- boolean needsSimpleContent = false;
-
- if (helper.getBuiltInTypeNamesList().contains(type) ||
- helper.getUserSimpleTypeNamesList().contains(type))
-// if (newTypeDefinition instanceof XSDSimpleTypeDefinition)
- {
- needsSimpleContent = true;
- }
- else if (newTypeDefinition instanceof XSDComplexTypeDefinition)
- {
- needsComplexContent = true;
-// XSDComplexTypeDefinition newCTObj = (XSDComplexTypeDefinition)newTypeDefinition;
-// XSDContentTypeCategory category = newCTObj.getContentTypeCategory();
- }
-
- beginRecording(XSDEditorPlugin.getXSDString("_UI_LABEL_SET_BASE_TYPE"), element);
- String prefix = element.getPrefix();
- prefix = (prefix == null) ? "" : (prefix + ":");
-
- DOMAttribute attr = new DOMAttribute(XSDConstants.BASE_ATTRIBUTE, type);
- boolean hasChildrenElements = domHelper.hasElementChildren(element);
- if (!contentModelExists) // if no content model exists, then add the new nodes
- {
- if (helper.getBuiltInTypeNamesList().contains(type) ||
- helper.getUserSimpleTypeNamesList().contains(type))
- {
- updateModelAndDerivedByKind(prefix + XSDConstants.SIMPLECONTENT_ELEMENT_TAG, prefix + XSDConstants.EXTENSION_ELEMENT_TAG, attr);
- }
- else if (helper.getUserComplexTypeNamesList().contains(type))
- {
- if (derivedByString.equals("")) // default
- {
- derivedByString = XSDConstants.EXTENSION_ELEMENT_TAG;
- }
- Element derivedByElement = updateModelAndDerivedByKind(prefix + XSDConstants.COMPLEXCONTENT_ELEMENT_TAG, prefix + derivedByString, attr);
- Element newModelGroupElement = element.getOwnerDocument().createElementNS(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, prefix + XSDConstants.SEQUENCE_ELEMENT_TAG);
- derivedByElement.appendChild(newModelGroupElement);
- formatChild(derivedByElement);
- }
- }
- else // else there is a content model
- {
- if (type.equals("")) // the chosen type is blank, ie. there is no base type
- {
- Element derivedByElement = domHelper.getDerivedByElementFromComplexType(element);
- Element sourceContentModelElement = domHelper.getContentModelFromParent(derivedByElement);
- // Retain the content model if there is one from the complex or simple content derive by element
- if (XSDDOMHelper.inputEquals(sourceContentModelElement, XSDConstants.SEQUENCE_ELEMENT_TAG, false) ||
- XSDDOMHelper.inputEquals(sourceContentModelElement, XSDConstants.CHOICE_ELEMENT_TAG, false) ||
- XSDDOMHelper.inputEquals(sourceContentModelElement, XSDConstants.ALL_ELEMENT_TAG, false))
- {
- Element newNode = domHelper.cloneElement(element, sourceContentModelElement);
- element.replaceChild(newNode, contentModelElement);
- formatChild(element);
- }
- else // otherwise just add the nodes
- {
- XSDDOMHelper.removeNodeAndWhitespace(contentModelElement);
- Element newSequenceElement = element.getOwnerDocument().createElementNS(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, prefix + XSDConstants.SEQUENCE_ELEMENT_TAG);
- element.appendChild(newSequenceElement);
- formatChild(newSequenceElement);
- }
- }
- else // a base type is specified
- {
- Element sequenceChoiceOrAllElement = null; // copy the model to reposition it off of the new derived by element
- 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))
- {
- sequenceChoiceOrAllElement = domHelper.cloneElement(element, contentModelElement);
- }
-
- if (needsComplexContent)
- {
- if (!(XSDDOMHelper.inputEquals(contentModelElement, XSDConstants.COMPLEXCONTENT_ELEMENT_TAG, false)))
- {
- domHelper.changeContentModel(element, XSDConstants.COMPLEXCONTENT_ELEMENT_TAG, sequenceChoiceOrAllElement);
- contentModelElement = domHelper.getContentModelFromParent(element);
- }
- }
- if (needsSimpleContent)
- {
- if (!(XSDDOMHelper.inputEquals(contentModelElement, XSDConstants.SIMPLECONTENT_ELEMENT_TAG, false)))
- {
- // we don't want to append the element content to a simple content
- sequenceChoiceOrAllElement = null;
- domHelper.changeContentModel(element, XSDConstants.SIMPLECONTENT_ELEMENT_TAG, sequenceChoiceOrAllElement);
- contentModelElement = domHelper.getContentModelFromParent(element);
- }
- }
-
- Element derivedByElement = domHelper.getDerivedByElementFromComplexType(element);
- if (derivedByElement == null)
- {
- if (derivedByString == null || (derivedByString != null && derivedByString.equals("")))
- {
- derivedByString = XSDConstants.EXTENSION_ELEMENT_TAG; // since there is no derivedByElement
- }
- derivedByElement = element.getOwnerDocument().createElementNS(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, derivedByString);
- contentModelElement.appendChild(derivedByElement);
- formatChild(contentModelElement);
- if (sequenceChoiceOrAllElement != null)
- {
- derivedByElement.appendChild(sequenceChoiceOrAllElement);
- formatChild(derivedByElement);
- }
- }
- else
- {
- if (helper.getBuiltInTypeNamesList().contains(type) ||
- helper.getUserSimpleTypeNamesList().contains(type))
- {
- derivedByString = XSDConstants.EXTENSION_ELEMENT_TAG;
- Element aContentModelElement = domHelper.getContentModelFromParent(derivedByElement);
- if (aContentModelElement != null)
- {
- XSDDOMHelper.removeNodeAndWhitespace(aContentModelElement);
- }
- }
- domHelper.changeDerivedByType(contentModelElement, derivedByString, type);
- }
- derivedByElement.setAttribute(attr.getName(), attr.getValue());
- }
- }
-
- xsdComp.setElement(element);
- endRecording(element);
- }
-
- private Element updateModelAndDerivedByKind(String modelType, String derivedByKind, DOMAttribute attr)
- {
- Element newContentModelElement = element.getOwnerDocument().createElementNS(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, modelType);
- element.appendChild(newContentModelElement);
-
- Element newDerivedByElement = element.getOwnerDocument().createElementNS(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, derivedByKind);
- newContentModelElement.appendChild(newDerivedByElement);
-
- newDerivedByElement.setAttribute(attr.getName(), attr.getValue());
-
- NodeList children = element.getChildNodes();
- int length = children.getLength();
- ArrayList nodesToRemove = new ArrayList();
- for (int i = 0; i < length; i++)
- {
- Node node = children.item(i);
- if (XSDDOMHelper.inputEquals(node, XSDConstants.ATTRIBUTE_ELEMENT_TAG, false) ||
- XSDDOMHelper.inputEquals(node, XSDConstants.ATTRIBUTE_ELEMENT_TAG, true) ||
- XSDDOMHelper.inputEquals(node, XSDConstants.ATTRIBUTEGROUP_ELEMENT_TAG, true) ||
- XSDDOMHelper.inputEquals(node, XSDConstants.ANYATTRIBUTE_ELEMENT_TAG, false))
- {
- newDerivedByElement.appendChild(node.cloneNode(true));
- nodesToRemove.add(node);
- }
- }
- for (Iterator i = nodesToRemove.iterator(); i.hasNext(); )
- {
- XSDDOMHelper.removeNodeAndWhitespace((Node)i.next());
- }
-
- formatChild(newContentModelElement);
-
- return newDerivedByElement;
- }
-
- protected void formatChild(Element child)
- {
- if (child instanceof XMLNode)
- {
- XMLModel model = ((XMLNode)child).getModel();
- try
- {
- // tell the model that we are about to make a big model change
- model.aboutToChangeModel();
-
- IStructuredFormatProcessor formatProcessor = new FormatProcessorXML();
- formatProcessor.formatNode(child);
- }
- finally
- {
- // tell the model that we are done with the big model change
- model.changedModel();
- }
- }
-
- }
-
- public DocumentImpl getDocument(Element element)
- {
- return (DocumentImpl) element.getOwnerDocument();
- }
-
- public void beginRecording(String description, Element element)
- {
- getDocument(element).getModel().beginRecording(this, description);
- }
-
- public void endRecording(Element element)
- {
- DocumentImpl doc = (DocumentImpl) getDocument(element);
-
- doc.getModel().endRecording(this);
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/XSDEditNamespacesAction.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/XSDEditNamespacesAction.java
deleted file mode 100644
index 46699048fa..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/actions/XSDEditNamespacesAction.java
+++ /dev/null
@@ -1,221 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.actions;
-
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.wst.common.contentmodel.util.DOMNamespaceInfoManager;
-import org.eclipse.wst.common.contentmodel.util.NamespaceInfo;
-import org.eclipse.wst.xml.core.internal.document.DocumentImpl;
-import org.eclipse.wst.xml.ui.actions.ReplacePrefixAction;
-import org.eclipse.wst.xml.ui.util.XMLCommonResources;
-import org.eclipse.wst.xsd.ui.internal.XSDEditorPlugin;
-import org.eclipse.wst.xsd.ui.internal.refactor.rename.SchemaPrefixChangeHandler;
-import org.eclipse.wst.xsd.ui.internal.refactor.rename.TargetNamespaceChangeHandler;
-import org.eclipse.wst.xsd.ui.internal.util.XSDSchemaHelper;
-import org.eclipse.wst.xsd.ui.internal.widgets.XSDEditSchemaInfoDialog;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.util.XSDConstants;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-
-public class XSDEditNamespacesAction extends Action {
- private Element element;
- private Node node;
- 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.node = node;
- ///////////////////// This needs to be changed....
- this.resourceLocation = "dummy";
- }
-
- public XSDEditNamespacesAction(String label, Element element, Node node, XSDSchema schema) {
- this (label, element, node);
- xsdSchema = schema;
- }
-
- public void run() {
- if (element != null)
- {
- Shell shell = XMLCommonResources.getInstance().getWorkbench().getActiveWorkbenchWindow().getShell();
- String targetNamespace = null;
- if (xsdSchema != null) {
- targetNamespace = xsdSchema.getTargetNamespace();
- }
- XSDEditSchemaInfoDialog dialog = new XSDEditSchemaInfoDialog(shell, new Path(resourceLocation), targetNamespace);
-
- List namespaceInfoList = namespaceInfoManager.getNamespaceInfoList(element);
- List oldNamespaceInfoList = NamespaceInfo.cloneNamespaceInfoList(namespaceInfoList);
-
- // here we store a copy of the old info for each NamespaceInfo
- // this info will be used in createPrefixMapping() to figure out how to update the document
- // in response to these changes
- for (Iterator i = namespaceInfoList.iterator(); i.hasNext(); )
- {
- NamespaceInfo info = (NamespaceInfo)i.next();
- NamespaceInfo oldCopy = new NamespaceInfo(info);
- info.setProperty("oldCopy", oldCopy);
- }
-
- dialog.setNamespaceInfoList(namespaceInfoList);
- dialog.create();
- //dialog.getShell().setSize(500, 300);
- dialog.getShell().setText("Edit Schema Information");
-// dialog.getShell().setText(XMLCommonResources.getInstance().getString("_UI_MENU_EDIT_SCHEMA_INFORMATION_TITLE"));
- dialog.setBlockOnOpen(true);
- dialog.open();
- String xsdPrefix = "";
-
- if (dialog.getReturnCode() == Window.OK)
- {
- Element xsdSchemaElement = xsdSchema.getElement();
- DocumentImpl doc = (DocumentImpl) xsdSchemaElement.getOwnerDocument();
-
- List newInfoList = dialog.getNamespaceInfoList();
-
- // see if we need to rename any prefixes
- Map prefixMapping = createPrefixMapping(oldNamespaceInfoList, namespaceInfoList);
-
- Map map2 = new Hashtable();
- String xsdNS = "";
- for (Iterator iter = newInfoList.iterator(); iter.hasNext(); )
- {
- NamespaceInfo ni = (NamespaceInfo)iter.next();
- String pref = ni.prefix;
- String uri = ni.uri;
- if (pref == null) pref = "";
- if (uri == null) uri = "";
- if (XSDConstants.isSchemaForSchemaNamespace(uri))
- {
- xsdPrefix = pref;
- }
- map2.put(pref, uri);
- }
-
- if (map2.size() > 0)
- {
- try {
-
- doc.getModel().beginRecording(this, XSDEditorPlugin.getXSDString("_UI_NAMESPACE_CHANGE"));
-
- if (xsdPrefix != null && xsdPrefix.length() == 0)
- {
- xsdSchema.setSchemaForSchemaQNamePrefix(null);
- }
- else
- {
- xsdSchema.setSchemaForSchemaQNamePrefix(xsdPrefix);
- }
-
- SchemaPrefixChangeHandler spch = new SchemaPrefixChangeHandler(xsdSchema, xsdPrefix);
- spch.resolve();
-
- xsdSchema.setTargetNamespace(dialog.getTargetNamespace());
-
- namespaceInfoManager.removeNamespaceInfo(element);
- namespaceInfoManager.addNamespaceInfo(element, newInfoList, false);
-
-// manager.getModel().aboutToChangeModel();
- ReplacePrefixAction replacePrefixAction = new ReplacePrefixAction(null, element, prefixMapping);
- replacePrefixAction.run();
-
- TargetNamespaceChangeHandler targetNamespaceChangeHandler = new TargetNamespaceChangeHandler(xsdSchema, targetNamespace, dialog.getTargetNamespace());
- targetNamespaceChangeHandler.resolve();
-
- } catch (Exception e){ e.printStackTrace(); }finally {
-// manager.getModel().changedModel();
-
- XSDSchemaHelper.updateElement(xsdSchema);
- doc.getModel().endRecording(this);
- }
- }
- }
-
- }
- }
-
- protected Map createPrefixMapping(List oldList, List newList)
- {
- Map map = new Hashtable();
-
- Hashtable oldURIToPrefixTable = new Hashtable();
- for (Iterator i = oldList.iterator(); i.hasNext(); )
- {
- NamespaceInfo oldInfo = (NamespaceInfo)i.next();
- oldURIToPrefixTable.put(oldInfo.uri, oldInfo);
- }
-
- for (Iterator i = newList.iterator(); i.hasNext(); )
- {
- NamespaceInfo newInfo = (NamespaceInfo)i.next();
- NamespaceInfo oldInfo = (NamespaceInfo)oldURIToPrefixTable.get(newInfo.uri != null ? newInfo.uri : "");
-
-
- // if oldInfo is non null ... there's a matching URI in the old set
- // we can use its prefix to detemine out mapping
- //
- // if oldInfo is null ... we use the 'oldCopy' we stashed away
- // assuming that the user changed the URI and the prefix
- if (oldInfo == null)
- {
- oldInfo = (NamespaceInfo)newInfo.getProperty("oldCopy");
- }
-
- if (oldInfo != null)
- {
- String newPrefix = newInfo.prefix != null ? newInfo.prefix : "";
- String oldPrefix = oldInfo.prefix != null ? oldInfo.prefix : "";
- if (!oldPrefix.equals(newPrefix))
- {
- map.put(oldPrefix, newPrefix);
- }
- }
- }
- return map;
- }
-
-// private void updateAllNodes(Element element, String prefix)
-// {
-// element.setPrefix(prefix);
-// NodeList list = element.getChildNodes();
-// if (list != null)
-// {
-// for (int i=0; i < list.getLength(); i++)
-// {
-// Node child = list.item(i);
-// if (child != null && child instanceof Element)
-// {
-// child.setPrefix(prefix);
-// if (child.hasChildNodes())
-// {
-// updateAllNodes((Element)child, prefix);
-// }
-// }
-// }
-// }
-// }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/commands/AbstractCommand.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/commands/AbstractCommand.java
deleted file mode 100644
index 9d8c0a1e09..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/commands/AbstractCommand.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.commands;
-
-import org.eclipse.wst.sse.core.format.IStructuredFormatProcessor;
-import org.eclipse.wst.xml.core.document.XMLModel;
-import org.eclipse.wst.xml.core.document.XMLNode;
-import org.eclipse.wst.xml.core.format.FormatProcessorXML;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.w3c.dom.Element;
-
-public abstract class AbstractCommand
-{
- private XSDConcreteComponent parent;
- private XSDConcreteComponent model;
-
- protected AbstractCommand(XSDConcreteComponent parent)
- {
- this.parent = parent;
- }
-
- public abstract void run();
-
- protected XSDConcreteComponent getParent()
- {
- return parent;
- }
-
- public XSDConcreteComponent getModelObject()
- {
- return model;
- }
-
- protected void setModelObject(XSDConcreteComponent model)
- {
- this.model = model;
- }
-
- // Establish part-whole relationship
- protected abstract boolean adopt(XSDConcreteComponent model);
-
- protected void formatChild(Element child)
- {
- if (child instanceof XMLNode)
- {
- XMLModel model = ((XMLNode)child).getModel();
- try
- {
- // tell the model that we are about to make a big model change
- model.aboutToChangeModel();
-
- IStructuredFormatProcessor formatProcessor = new FormatProcessorXML();
- formatProcessor.formatNode(child);
- }
- finally
- {
- // tell the model that we are done with the big model change
- model.changedModel();
- }
- }
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/commands/AddAttributeDeclarationCommand.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/commands/AddAttributeDeclarationCommand.java
deleted file mode 100644
index 7be73f07d1..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/commands/AddAttributeDeclarationCommand.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.commands;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.xsd.XSDAttributeDeclaration;
-import org.eclipse.xsd.XSDAttributeUse;
-import org.eclipse.xsd.XSDComplexTypeDefinition;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDFactory;
-import org.eclipse.xsd.XSDTypeDefinition;
-
-public class AddAttributeDeclarationCommand extends AbstractCommand
-{
- XSDAttributeDeclaration refAttribute = null;
- /**
- * @param parent
- */
- public AddAttributeDeclarationCommand(XSDConcreteComponent parent)
- {
- super(parent);
- }
-
- public AddAttributeDeclarationCommand(XSDConcreteComponent parent, XSDAttributeDeclaration ref)
- {
- super(parent);
- this.refAttribute = ref;
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.xsd.ui.internal.commands.AbstractCommand#run()
- */
- public void run()
- {
- XSDConcreteComponent parent = getParent();
- if (parent instanceof XSDComplexTypeDefinition)
- {
- XSDComplexTypeDefinition ct = (XSDComplexTypeDefinition)parent;
-
- XSDAttributeDeclaration attribute = XSDFactory.eINSTANCE.createXSDAttributeDeclaration();
- attribute.setName(getNewName("Attribute")); //$NON-NLS-1$
- attribute.setTypeDefinition(ct.getSchema().getSchemaForSchema().resolveSimpleTypeDefinition("string")); //$NON-NLS-1$
-
- XSDAttributeUse attributeUse = XSDFactory.eINSTANCE.createXSDAttributeUse();
- attributeUse.setAttributeDeclaration(attribute);
- attributeUse.setContent(attribute);
-
- if (ct.getAttributeContents() != null)
- {
- ct.getAttributeContents().add(attributeUse);
- formatChild(attribute.getElement());
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.xsd.ui.internal.commands.AbstractCommand#adopt(org.eclipse.xsd.XSDConcreteComponent)
- */
- protected boolean adopt(XSDConcreteComponent model)
- {
- return false;
- }
-
- ArrayList names;
-
- protected String getNewName(String description)
- {
- String candidateName = "New" + description; //$NON-NLS-1$
- StringBuffer candidateNameSB = new StringBuffer("New" + description); //$NON-NLS-1$
- XSDConcreteComponent parent = getParent();
- names = new ArrayList();
- int i = 1;
- if (parent instanceof XSDComplexTypeDefinition)
- {
- XSDComplexTypeDefinition ct = (XSDComplexTypeDefinition)parent;
- walkUpInheritance(ct);
-
- boolean ready = false;
- while (!ready)
- {
- ready = true;
- for (Iterator iter = names.iterator(); iter.hasNext(); )
- {
- String attrName = (String)iter.next();
- if (candidateName.equals(attrName))
- {
- ready = false;
- candidateName = "New" + description + String.valueOf(i); //$NON-NLS-1$
- i++;
- }
- }
- }
- }
- return candidateName;
- }
-
- private void walkUpInheritance(XSDComplexTypeDefinition ct)
- {
- updateNames(ct);
- XSDTypeDefinition typeDef = ct.getBaseTypeDefinition();
- if (ct != ct.getRootType())
- {
- if (typeDef instanceof XSDComplexTypeDefinition)
- {
- XSDComplexTypeDefinition ct2 = (XSDComplexTypeDefinition)typeDef;
- walkUpInheritance(ct2);
- }
- }
- }
-
- private void updateNames(XSDComplexTypeDefinition ct)
- {
- Iterator iter = ct.getAttributeContents().iterator();
- while (iter.hasNext())
- {
- Object obj = iter.next();
- if (obj instanceof XSDAttributeUse)
- {
- XSDAttributeUse use = (XSDAttributeUse)obj;
- XSDAttributeDeclaration attr = use.getAttributeDeclaration();
- String attrName = attr.getName();
- if (attrName != null)
- {
- names.add(attrName);
- }
- }
- }
-
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/commands/AddComplexTypeDefinitionCommand.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/commands/AddComplexTypeDefinitionCommand.java
deleted file mode 100644
index 72da36a17a..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/commands/AddComplexTypeDefinitionCommand.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.commands;
-
-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;
-
-public final class AddComplexTypeDefinitionCommand extends AbstractCommand
-{
- private String name;
-
- public AddComplexTypeDefinitionCommand
- (XSDConcreteComponent parent,
- String name)
- {
- super(parent);
- this.name = name; // this may be null for anonymous type
- }
-
- public void run()
- {
- XSDComplexTypeDefinition typeDef =
- XSDFactory.eINSTANCE.createXSDComplexTypeDefinition();
- typeDef.setName(name);
-
- if (adopt(typeDef))
- setModelObject(typeDef);
- }
-
- protected boolean adopt(XSDConcreteComponent model)
- {
- XSDConcreteComponent parent = getParent();
- if (parent instanceof XSDSchema)
- ((XSDSchema)parent).getTypeDefinitions().add(model);
- else if (parent instanceof XSDElementDeclaration)
- ((XSDElementDeclaration)parent).setAnonymousTypeDefinition((XSDComplexTypeDefinition)model);
- else
- return false; // invalid parent
-
- return true;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/commands/AddElementDeclarationCommand.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/commands/AddElementDeclarationCommand.java
deleted file mode 100644
index cf161ec268..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/commands/AddElementDeclarationCommand.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.commands;
-
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDElementDeclaration;
-import org.eclipse.xsd.XSDFactory;
-import org.eclipse.xsd.XSDParticle;
-import org.eclipse.xsd.XSDSchema;
-
-public final class AddElementDeclarationCommand extends AbstractCommand
-{
- private String name; // element name
-
- public AddElementDeclarationCommand
- (XSDConcreteComponent parent,
- String name)
- {
- super(parent);
- this.name = name;
- }
-
- public void run()
- {
- XSDElementDeclaration elementDecl =
- XSDFactory.eINSTANCE.createXSDElementDeclaration();
- elementDecl.setName(name);
-
- if (adopt(elementDecl))
- setModelObject(elementDecl);
- }
-
- protected boolean adopt(XSDConcreteComponent model)
- {
- XSDConcreteComponent parent = getParent();
- if (parent instanceof XSDSchema)
- ((XSDSchema)parent).getElementDeclarations().add(model);
- else if (parent instanceof XSDParticle)
- ((XSDParticle)parent).setContent((XSDElementDeclaration)model);
- else
- return false; // invalid parent
-
- return true;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/commands/AddModelGroupCommand.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/commands/AddModelGroupCommand.java
deleted file mode 100644
index f5518e2dd4..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/commands/AddModelGroupCommand.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.commands;
-
-import org.eclipse.xsd.XSDComplexTypeDefinition;
-import org.eclipse.xsd.XSDCompositor;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDElementDeclaration;
-import org.eclipse.xsd.XSDFactory;
-import org.eclipse.xsd.XSDModelGroup;
-import org.eclipse.xsd.XSDParticle;
-import org.eclipse.xsd.XSDSimpleTypeDefinition;
-
-public class AddModelGroupCommand extends AbstractCommand
-{
- protected XSDCompositor compositor;
-
- public AddModelGroupCommand(XSDConcreteComponent parent, XSDCompositor compositor)
- {
- super(parent);
- this.compositor = compositor;
- }
-
- public void run()
- {
- XSDConcreteComponent parent = getParent();
- XSDConcreteComponent owner = null;
- if (parent instanceof XSDElementDeclaration)
- {
- XSDElementDeclaration ed = (XSDElementDeclaration)parent;
- if (ed.getTypeDefinition() != null)
- {
- if (ed.getAnonymousTypeDefinition() == null)
- {
- ed.setTypeDefinition(null);
- XSDComplexTypeDefinition td = XSDFactory.eINSTANCE.createXSDComplexTypeDefinition();
- ed.setAnonymousTypeDefinition(td);
- owner = ed.getTypeDefinition();
- }
- else
- {
- XSDComplexTypeDefinition td = XSDFactory.eINSTANCE.createXSDComplexTypeDefinition();
- ed.setAnonymousTypeDefinition(td);
- owner = td;
- }
- }
- else if (ed.getAnonymousTypeDefinition() == null)
- {
- XSDComplexTypeDefinition td = XSDFactory.eINSTANCE.createXSDComplexTypeDefinition();
- ed.setAnonymousTypeDefinition(td);
- owner = td;
- }
- else if (ed.getAnonymousTypeDefinition() instanceof XSDComplexTypeDefinition)
- {
- owner = ed.getAnonymousTypeDefinition();
- }
- else if (ed.getAnonymousTypeDefinition() instanceof XSDSimpleTypeDefinition)
- {
- XSDComplexTypeDefinition td = XSDFactory.eINSTANCE.createXSDComplexTypeDefinition();
- ed.setAnonymousTypeDefinition(td);
- owner = td;
- }
- }
- else if (parent instanceof XSDModelGroup)
- {
- ((XSDModelGroup) parent).getContents().add(createModelGroup());
- }
- else if (parent instanceof XSDComplexTypeDefinition)
- {
- owner = ((XSDComplexTypeDefinition)parent);
- }
- if (owner != null)
- {
- XSDParticle particle = XSDFactory.eINSTANCE.createXSDParticle();
- XSDModelGroup modelGroup = createModelGroup();
- particle.setContent(modelGroup);
-
- XSDComplexTypeDefinition ctd = (XSDComplexTypeDefinition)owner;
- ctd.setContent(particle);
- formatChild(parent.getElement());
- }
- }
-
- protected boolean adopt(XSDConcreteComponent model)
- {
- return false;
- }
-
- protected XSDModelGroup createModelGroup()
- {
- XSDModelGroup modelGroup = XSDFactory.eINSTANCE.createXSDModelGroup();
- modelGroup.setCompositor(compositor);
- return modelGroup;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/commands/AddSimpleTypeDefinitionCommand.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/commands/AddSimpleTypeDefinitionCommand.java
deleted file mode 100644
index b0c347b430..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/commands/AddSimpleTypeDefinitionCommand.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.commands;
-
-import org.eclipse.xsd.XSDAttributeDeclaration;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDElementDeclaration;
-import org.eclipse.xsd.XSDFactory;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.XSDSimpleTypeDefinition;
-
-public final class AddSimpleTypeDefinitionCommand extends AbstractCommand
-{
- private String name;
-
- public AddSimpleTypeDefinitionCommand
- (XSDConcreteComponent parent,
- String name)
- {
- super(parent);
- this.name = name; // this may be null for anonymous type
- }
-
- public void run()
- {
- XSDSimpleTypeDefinition typeDef =
- XSDFactory.eINSTANCE.createXSDSimpleTypeDefinition();
- typeDef.setName(name);
-
- if (adopt(typeDef))
- setModelObject(typeDef);
- }
-
- protected boolean adopt(XSDConcreteComponent model)
- {
- XSDConcreteComponent parent = getParent();
- if (parent instanceof XSDSchema)
- ((XSDSchema)parent).getTypeDefinitions().add(model);
- else if (parent instanceof XSDElementDeclaration)
- ((XSDElementDeclaration)parent).setAnonymousTypeDefinition((XSDSimpleTypeDefinition)model);
- else if (parent instanceof XSDAttributeDeclaration)
- ((XSDAttributeDeclaration)parent).setAnonymousTypeDefinition((XSDSimpleTypeDefinition)model);
- else
- return false; // invalid parent
-
- return true;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/commands/RenameCommand.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/commands/RenameCommand.java
deleted file mode 100644
index ade4b77c78..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/commands/RenameCommand.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package org.eclipse.wst.xsd.ui.internal.commands;
-
-import org.eclipse.draw2d.Label;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.wst.xsd.ui.internal.graph.editparts.ComplexTypeDefinitionEditPart;
-import org.eclipse.wst.xsd.ui.internal.graph.editparts.ElementDeclarationEditPart;
-import org.eclipse.wst.xsd.ui.internal.graph.editparts.ModelGroupDefinitionEditPart;
-import org.eclipse.wst.xsd.ui.internal.graph.editparts.TopLevelComponentEditPart;
-import org.eclipse.wst.xsd.ui.internal.graph.editpolicies.SimpleDirectEditPolicy;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDNamedComponent;
-
-
-/**
- * @author kchong
- *
- * <a href="mailto:kchong@ca.ibm.com">kchong@ca.ibm.com</a>
- *
- */
-public class RenameCommand
-{
- protected SimpleDirectEditPolicy simpleDirectEditPolicy = new SimpleDirectEditPolicy();
- Label label = new Label();
- XSDNamedComponent namedComponent;
- GraphicalEditPart editPart;
-
- public RenameCommand(XSDNamedComponent namedComponent, GraphicalEditPart editPart)
- {
- this.namedComponent = namedComponent;
- this.editPart = editPart;
- }
-
- /* (non-Javadoc)
- * @see com.ibm.xsd.edit.actions.AbstractCommand#run()
- */
- public void run()
- {
- if (editPart instanceof ElementDeclarationEditPart)
- {
- ElementDeclarationEditPart elementDeclarationEditPart = (ElementDeclarationEditPart)editPart;
- elementDeclarationEditPart.doEditName();
- }
- else if (editPart instanceof TopLevelComponentEditPart)
- {
- TopLevelComponentEditPart topLevelEditPart = (TopLevelComponentEditPart)editPart;
- topLevelEditPart.doEditName();
- }
- else if (editPart instanceof ComplexTypeDefinitionEditPart)
- {
- ((ComplexTypeDefinitionEditPart)editPart).doEditName();
- }
- else if (editPart instanceof ModelGroupDefinitionEditPart)
- {
- ((ModelGroupDefinitionEditPart)editPart).doEditName();
- }
- }
-
- /* (non-Javadoc)
- * @see com.ibm.xsd.edit.actions.AbstractCommand#adopt(org.eclipse.xsd.XSDConcreteComponent)
- */
- protected boolean adopt(XSDConcreteComponent model)
- {
- return false;
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/dialogs/types/ImportTypesDialog.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/dialogs/types/ImportTypesDialog.java
deleted file mode 100644
index 60fa5c0ed1..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/dialogs/types/ImportTypesDialog.java
+++ /dev/null
@@ -1,276 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.dialogs.types;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.Vector;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.List;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.wst.common.ui.dialogs.SelectSingleFileDialog;
-import org.eclipse.xsd.XSDNamedComponent;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.util.XSDResourceImpl;
-
-public class ImportTypesDialog extends SelectSingleFileDialog {
- private List importList;
- private Button importStyleCheckBox;
- private boolean isWSIStyleImport;
- private String kind = "type";
- private Object input;
- private ResourceSet resourceSet;
- private java.util.List importComponents;
- private Object listSelection;
- private boolean allowWSI;
- private Vector loaders;
-
- /*
- * String kind should be either "type" or "element"
- */
- public ImportTypesDialog(Shell parentShell, IStructuredSelection selection, boolean allowWSI, String kind) {
- super(parentShell, selection, true);
- this.allowWSI = allowWSI;
- this.kind = kind;
-
- loaders = new Vector();
- loaders.add(new XSDLoadAvaliableItems());
- }
-
- protected Control createDialogArea(Composite parent) {
- Control area = super.createDialogArea(parent);
- Composite base = new Composite((Composite) area, SWT.NONE);
- base.setLayout(new GridLayout());
-
- GridData compositeData = new GridData();
- compositeData.horizontalAlignment = GridData.FILL;
- compositeData.verticalAlignment = GridData.FILL;
- compositeData.grabExcessHorizontalSpace = true;
- compositeData.grabExcessVerticalSpace = true;
- base.setLayoutData(compositeData);
-
- Label listLabel = new Label(base, SWT.NONE);
- if (kind.equalsIgnoreCase("type")) {
- listLabel.setText("Types");
- }
- else {
- listLabel.setText("Elements");
- }
- importList = new List(base, SWT.SINGLE | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
-
- GridData importListData = new GridData();
- importListData.horizontalAlignment = GridData.FILL;
- importListData.verticalAlignment = GridData.FILL;
- importListData.grabExcessHorizontalSpace = true;
- importListData.grabExcessVerticalSpace = true;
- importList.setLayoutData(importListData);
-
- if (allowWSI) {
- importStyleCheckBox = new Button(base, SWT.CHECK);
-// importStyleCheckBox.setText(WSDLEditorPlugin.getWSDLString("_UI_USE_WS-I_STYLE_SCHEMA_IMPORT"));
- importStyleCheckBox.setText("WS-I style import");
- importStyleCheckBox.setSelection(true);
- isWSIStyleImport = true;
- importStyleCheckBox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
-
- SelectionAdapter selectionAdapter = new SelectionAdapter()
- {
- public void widgetSelected(SelectionEvent event)
- {
- if (event.widget == importList && importList.getSelectionCount() > 0) {
- listSelection = importComponents.get(importList.getSelectionIndex());
- }
- else if (event.widget == importStyleCheckBox) {
- isWSIStyleImport = importStyleCheckBox.getSelection();
- }
- }
- };
- importStyleCheckBox.addSelectionListener(new SelectionAdapter()
- {
- public void widgetSelected(SelectionEvent event) {
- isWSIStyleImport = importStyleCheckBox.getSelection();
- }
- });
-
- Label titleBarSeparator = new Label(base, SWT.HORIZONTAL | SWT.SEPARATOR);
- titleBarSeparator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- }
-
- selectSingleFileView.addSelectionChangedTreeListener(new TreeListener());
- importList.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- if (importList.getSelectionCount() > 0) {
- listSelection = importComponents.get(importList.getSelectionIndex());
- }
- }
- });
-
- return area;
- }
-
- public Object getListSelection() {
- return listSelection;
- }
-
- public boolean isWSIStyleImport() {
- if (allowWSI) {
- return isWSIStyleImport;
- }
- else {
- return false;
- }
- }
-
- public void addLoadAvaliableItemsClass(LoadAvaliableItems newLoader) {
- loaders.add(newLoader);
- }
-
- private class TreeListener implements ISelectionChangedListener {
- public TreeListener() {
- }
-
- public void selectionChanged(SelectionChangedEvent event) {
- if (delayedEvent != null) {
- delayedEvent.CANCEL = true;
- }
-
- delayedEvent = new DelayedEvent(event);
- Display.getCurrent().timerExec(500, delayedEvent);
-
- // Do not allow WS-I style imports on WSDL files
- ISelection selection = event.getSelection();
- if (selection instanceof IStructuredSelection && ((IStructuredSelection) selection).getFirstElement() instanceof IFile) {
- IFile iFile = (IFile) ((IStructuredSelection) selection).getFirstElement();
-
- String ext = iFile.getFileExtension();
- if (ext.equalsIgnoreCase("wsdl")) {
- importStyleCheckBox.setEnabled(false);
- isWSIStyleImport = false;
- }
- else if (ext.equalsIgnoreCase("xsd")) {
- importStyleCheckBox.setEnabled(true);
- isWSIStyleImport = importStyleCheckBox.getSelection();
- }
- }
- }
-
- private DelayedEvent delayedEvent;
-
- private class DelayedEvent implements Runnable {
- public boolean CANCEL = false;
- private SelectionChangedEvent event;
-
- public DelayedEvent(SelectionChangedEvent event) {
- this.event = event;
- }
- public void run() {
- if (!CANCEL) {
- // We clear the selection made in the List... it may no longer apply to the newly selected file
- listSelection = null;
- importComponents = Collections.EMPTY_LIST;
- importList.removeAll();
-
- // We populate the avaliable types/element list
- ISelection selection = event.getSelection();
- if (selection instanceof IStructuredSelection && ((IStructuredSelection) selection).getFirstElement() instanceof IFile) {
- IFile iFile = (IFile) ((IStructuredSelection) selection).getFirstElement();
-
- // Attempt to load the avaliable Types/Elements from the selected File
- int loaderIndex = 0;
- while (importComponents.size() < 1 && loaderIndex < loaders.size()) {
- importComponents = ((LoadAvaliableItems) loaders.elementAt(loaderIndex)).getAvaliableItems(iFile);
- loaderIndex++;
- }
-
- // Make the first item in the list the selection
- if (importComponents.size() > 0) {
- listSelection = importComponents.get(0);
- }
-
- for (Iterator it = ((java.util.List) importComponents).iterator(); it.hasNext();) {
- XSDNamedComponent comp = (XSDNamedComponent) it.next();
- importList.add(comp.getName());
- }
- }
- }
- }
- }
- }
-
- /*
- * Loads Avaliable Types/Elements from the given IFile. Handles XSD files
- */
- private class XSDLoadAvaliableItems extends LoadAvaliableItems {
- public XSDLoadAvaliableItems() {}
-
- protected java.util.List loadFile(IFile iFile) {
- java.util.List modelObjectList = Collections.EMPTY_LIST;
- try {
- if (iFile != null) {
- URI uri = URI.createPlatformResourceURI(iFile.getFullPath().toString());
-
- Object rootModelObject = null;
- if (uri.toString().endsWith("xsd")) {
- ResourceSet resourceSet = new ResourceSetImpl();
- Resource resource = resourceSet.getResource(uri, true);
- if (resource instanceof XSDResourceImpl) {
- rootModelObject = ((XSDResourceImpl) resource).getSchema();
- }
- }
-
- if (rootModelObject != null) {
- modelObjectList = new ArrayList(getModelObjects(rootModelObject));
- }
- }
- }
- catch (Exception e) {}
-
- return modelObjectList;
- }
-
- private Collection getModelObjects(Object rootModelObject) {
- ArrayList objects = new ArrayList();
-
- if (rootModelObject instanceof XSDSchema) {
- XSDSchema xsdSchema = (XSDSchema)rootModelObject;
- if (kind.equalsIgnoreCase("type")) {
- objects.addAll(((XSDSchema) xsdSchema).getTypeDefinitions());
- }
- else if (kind.equalsIgnoreCase("element")) {
- objects.addAll(((XSDSchema) xsdSchema).getElementDeclarations());
- }
- }
-
- return objects;
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/dialogs/types/LoadAvaliableItems.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/dialogs/types/LoadAvaliableItems.java
deleted file mode 100644
index 8decdda4e1..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/dialogs/types/LoadAvaliableItems.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.dialogs.types;
-
-import org.eclipse.core.resources.IFile;
-
-/*
- * Loads Avaliable Types/Elements from the given IFile. Implementors
- * needed to handle certain File types (xsd, wsdl, etc...)
- */
-public abstract class LoadAvaliableItems {
- public java.util.List getAvaliableItems(IFile file) {
- return loadFile(file);
- }
-
- protected abstract java.util.List loadFile(IFile iFile);
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/dialogs/types/NewComponentDialog.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/dialogs/types/NewComponentDialog.java
deleted file mode 100644
index fb37a200cc..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/dialogs/types/NewComponentDialog.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.dialogs.types;
-
-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.wst.xsd.ui.internal.XSDEditorPlugin;
-
-/*
- * This class is a copy of NewComponentDialog.java in org.eclipse.wst.wsdl.ui.
- * We have a copy because we want a similar look and feel to both editors.
- * We should remove NewComponentDialog.java in org.eclipse.wst.wsdl.ui and point
- * all references to this class.
- */
-public class NewComponentDialog extends Dialog implements ModifyListener
-{
- protected Text nameField;
- protected Button okButton;
- protected String defaultName;
- protected String title;
- protected Label errorMessageLabel;
- protected List usedNames;
-
- public NewComponentDialog(Shell parentShell, String title, String defaultName)
- {
- super(parentShell);
- setShellStyle(getShellStyle() | SWT.RESIZE);
- this.defaultName = defaultName;
- this.title = title;
- }
-
- public NewComponentDialog(Shell parentShell, String title, String defaultName, List usedNames)
- {
- super(parentShell);
- setShellStyle(getShellStyle() | SWT.RESIZE);
- this.defaultName = 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 createExtendedContent(Composite parent)
- {
- }
-
-
- protected Control createDialogArea(Composite parent)
- {
- Composite dialogArea = (Composite)super.createDialogArea(parent);
-
- 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(XSDEditorPlugin.getXSDString("_UI_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(defaultName);
- nameField.addModifyListener(this);
-
- createExtendedContent(dialogArea);
-
- // error message
- errorMessageLabel = new Label(dialogArea, SWT.NONE);
- errorMessageLabel.setText("error message goes here");
- GridData gd2 = new GridData();
- gd2.horizontalAlignment= GridData.FILL;
- gd2.grabExcessHorizontalSpace= true;
- gd2.widthHint = 200;
- errorMessageLabel.setLayoutData(gd2);
-// Color color = new Color(errorMessageLabel.getDisplay(), 200, 0, 0);
-// errorMessageLabel.setForeground(color);
-
- return dialogArea;
- }
-
- public void modifyText(ModifyEvent e)
- {
- updateErrorMessage();
- }
-
- protected String computeErrorMessage(String name)
- {
- if (usedNames == null)
- return null;
-
- Iterator iterator = usedNames.iterator();
- while (iterator.hasNext()) {
- if (name.equalsIgnoreCase((String) iterator.next())) {
- return "Warning: duplicate name already exists"; // Must be translated
- }
- }
-
- return null;
- }
-
- protected void updateErrorMessage()
- {
- String errorMessage = null;
- String name = nameField.getText().trim();
- if (name.length() > 0)
- {
- errorMessage = computeErrorMessage(name);
- }
- else
- {
- errorMessage = "";
- }
- errorMessageLabel.setText(errorMessage != null ? errorMessage : "");
-// okButton.setEnabled(errorMessage == null);
- }
-
- protected void buttonPressed(int buttonId)
- {
- if (buttonId == IDialogConstants.OK_ID)
- {
- defaultName = nameField.getText();
- }
- super.buttonPressed(buttonId);
- }
-
- public String getName()
- {
- return defaultName;
- }
-}
-
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/dialogs/types/NewTypeDialog.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/dialogs/types/NewTypeDialog.java
deleted file mode 100644
index be6f116fc6..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/dialogs/types/NewTypeDialog.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.dialogs.types;
-
-import java.util.List;
-
-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.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.wst.xsd.ui.internal.XSDEditorPlugin;
-
-/*
- * This class extends NewComponentDialog to allow additional widgets. More
- * specifically, the 'create complex type or simple type' checkbox
- */
-public class NewTypeDialog extends NewComponentDialog implements SelectionListener {
- protected Button complexRadio;
- protected Button simpleRadio;
- private boolean createComplexTypeBoolean;
-
- private List complexNames;
- private List simpleNames;
-
- public NewTypeDialog(Shell parentShell, String defaultName) {
- super(parentShell, "New Type", defaultName);
- }
-
- /*
- * The argument usedNames is the used names for the Complex Types.
- * See method setUsedComplexTypeNames(List) for more information.
- */
- public NewTypeDialog(Shell parentShell, String defaultName, List usedNames) {
- super(parentShell, "New Type", defaultName, usedNames);
- setUsedComplexTypeNames(usedNames);
- }
-
- protected void createExtendedContent(Composite parent) {
- Composite child = new Composite (parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- child.setLayout(layout);
-
- complexRadio = new Button(child, SWT.RADIO);
- complexRadio.addSelectionListener(this);
- complexRadio.setSelection(true);
- complexRadio.setText(XSDEditorPlugin.getXSDString("_UI_PAGE_HEADING_COMPLEXTYPE"));
-
- simpleRadio = new Button(child, SWT.RADIO);
- simpleRadio.addSelectionListener(this);
- simpleRadio.setText(XSDEditorPlugin.getXSDString("_UI_PAGE_HEADING_SIMPLETYPE"));
- }
-
- public boolean isComplexType() {
- return createComplexTypeBoolean;
- }
-
- protected void buttonPressed(int buttonId) {
- if (buttonId == IDialogConstants.OK_ID) {
- createComplexTypeBoolean = complexRadio.getSelection();
- }
- super.buttonPressed(buttonId);
- }
-
- /*
- * Used to set the used names for complex types. If the user enters a name (for a complex
- * type) which is in this list, a warning message will appear.
- *
- * Note:
- * The used names list supplied in the constructor is meant for the complex names list.
- * So, this method does not need to be called. If this method is called, the list
- * supplied by this method will be used instead of the list supplied from the constructor.
- */
- public void setUsedComplexTypeNames(List complexNames) {
- this.complexNames = complexNames;
- }
-
- /*
- * Used to set the used names for simple types. If the user enters a name (for a simple
- * type) which is in this list, a warning message will appear.
- */
- public void setUsedSimpleTypeNames(List simpleNames) {
- this.simpleNames = simpleNames;
- }
-
- /*
- * SelectionListener methods
- */
- public void widgetSelected(SelectionEvent event) {
- // We need to update the usedNames list
- if (complexRadio.getSelection()) {
- if (simpleRadio.getSelection()) {
- simpleRadio.setSelection(false);
- }
-
- usedNames = complexNames;
- updateErrorMessage();
- }
- else if (simpleRadio.getSelection()){
- if (complexRadio.getSelection()) {
- complexRadio.setSelection(false);
- }
-
- usedNames = simpleNames;
- updateErrorMessage();
- }
- }
-
- public void widgetDefaultSelected(SelectionEvent event) {
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/dialogs/types/SetTypeDialog.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/dialogs/types/SetTypeDialog.java
deleted file mode 100644
index 820c3adb90..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/dialogs/types/SetTypeDialog.java
+++ /dev/null
@@ -1,354 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.dialogs.types;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.xsd.XSDComplexTypeDefinition;
-import org.eclipse.xsd.XSDNamedComponent;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.XSDSimpleTypeDefinition;
-
-/*
- * Abstract class used to set the Type or Element.
- */
-public abstract class SetTypeDialog extends Dialog {
- protected Object input;
- protected String kind;
- private String dialogTitle;
-
- // widgets
- protected Text textFilter;
- private Button createButton;
- private Button removeButton;
- private Button importButton;
- protected Button viewTypeCheckBox;
-
- protected SetTypeTreeView treeView; // A Tree Viewer helper class
- protected TypesDialogTreeObject treeRootViewerInput; // Root Input object for our Tree
-
- public SetTypeDialog(Shell shell, Object input, String dialogTitle, String kind) {
- super(shell);
- this.input = input;
- this.kind = kind;
- this.dialogTitle = dialogTitle;
- }
-
- public Control createDialogArea(Composite parent) {
- getShell().setText(dialogTitle);
-
- Composite base = (Composite) super.createDialogArea(parent);
- GridData gData = (GridData) base.getLayoutData();
- gData.heightHint = 500;
- gData.widthHint = 400;
-
- // Create Text textFilter
- Label filterLabel = new Label(base, SWT.NONE);
- filterLabel.setText("(? = any character, * = any string)");
- textFilter = new Text(base, SWT.SINGLE | SWT.BORDER);
- textFilter.addModifyListener(new SetTypeModifyAdapter());
- GridData textFilterData = new GridData();
- textFilterData.horizontalAlignment = GridData.FILL;
- textFilterData.grabExcessHorizontalSpace = true;
- textFilter.setLayoutData(textFilterData);
-
- // Create and expand entire Tree when we first open the dialog
- createTree(base);
- treeView.expandAll();
-
- SetTypeSelectionAdapter selectionAdapter = new SetTypeSelectionAdapter();
-
- // Create viewTypeCheckBox
- viewTypeCheckBox = createCheckBox(base, "Flat View");
- viewTypeCheckBox.setSelection(false);
- viewTypeCheckBox.addSelectionListener(selectionAdapter);
-
- // Create Composite 2
- Composite comp2 = new Composite(base, SWT.NONE);
- GridLayout layout2 = new GridLayout();
- layout2.numColumns = 2;
- comp2.setLayout(layout2);
-
- GridData gdk = new GridData();
- gdk.grabExcessHorizontalSpace = true;
- gdk.horizontalAlignment = SWT.CENTER;
- comp2.setLayoutData(gdk);
-
- // Create Add and Remove Buttons
- createButton = createPushButton(comp2, "Create New");
- // removeButton = createPushButton(comp2, "Remove");
- createButton.addSelectionListener(selectionAdapter);
-
- // Create Composite 3
- Composite comp3 = new Composite(base, SWT.NONE);
- GridLayout layout3 = new GridLayout();
- layout3.numColumns = 2;
- comp3.setLayout(layout3);
-
- // Create Browse Button
- importButton = createPushButton(comp2, "import...");
- importButton.addSelectionListener(selectionAdapter);
-
- // Build the separator line
- Label titleBarSeparator = new Label(base, SWT.HORIZONTAL
- | SWT.SEPARATOR);
- titleBarSeparator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- return base;
- }
-
- /**
- * Helper method for creating buttons.
- */
- public static Button createPushButton(Composite parent, String label) {
- Button button = new Button(parent, SWT.PUSH);
- 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;
- }
-
- private void createTree(Composite base) {
- String title;
- if (kind.equalsIgnoreCase("type")) {
- title = "Avaliable Types";
- } else {
- title = "Avaliable Elements";
- }
-
- treeView = new SetTypeTreeView(base, title);
- treeView.addTreeSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- updateCanFinish(event.getSelection());
- }
- });
-
- populateTreeViewer(false, "", false, false);
- }
-
- protected void populateTreeViewer(boolean isFlatView, String filterString,
- boolean saveExpansionState, boolean restoreExpansionState) {
- if (saveExpansionState) {
- treeView.storeExpansionState();
- }
-
- treeRootViewerInput = new TypesDialogTreeObject("root");
- if (isFlatView) {
- // Flat View
- createFlatView(treeRootViewerInput, filterString);
- }
- else {
- // Tree View
- createTreeView(treeRootViewerInput, filterString);
- }
- treeView.setInput(treeRootViewerInput);
-
- if (restoreExpansionState) {
- treeView.restoreExpansionState();
- }
- }
-
- private String insertString(String target, String newString, String string) {
- ArrayList list = new ArrayList();
- StringBuffer stringBuffer = new StringBuffer(string);
-
- int index = stringBuffer.indexOf(target);
- while (index != -1) {
- stringBuffer = stringBuffer.insert(index, newString);
- index = stringBuffer.indexOf(target, index + newString.length()
- + target.length());
- }
-
- return stringBuffer.toString();
- }
-
- /*
- * If supported metacharacters are used in the filter string, we need to insert
- * a "." before each metacharacter.
- */
- private String processFilterString(String inputString) {
- if (!(inputString.equals(""))) {
- inputString = insertString("*", ".", inputString);
- inputString = insertString("?", ".", inputString);
- inputString = inputString + ".*";
- } else {
- inputString = ".*";
- }
-
- return inputString.toLowerCase();
- }
-
- private class SetTypeModifyAdapter implements ModifyListener {
- public void modifyText(ModifyEvent e) {
- if (e.widget == textFilter) {
- if (delayedEvent != null) {
- delayedEvent.CANCEL = true;
- }
-
- delayedEvent = new DelayedEvent();
- Display.getCurrent().timerExec(400, delayedEvent);
- }
- }
- }
-
- private DelayedEvent delayedEvent;
-
- private class DelayedEvent implements Runnable {
- public boolean CANCEL = false;
-
- public void run() {
- if (!CANCEL) {
- populateTreeViewer(viewTypeCheckBox.getSelection(),
- processFilterString(textFilter.getText()),
- false, false);
-
- // Expand all and select first item which matches
- treeView.expandAll();
- treeView.selectFirstItem();
- }
- }
- }
-
- private class SetTypeSelectionAdapter extends SelectionAdapter {
- public void widgetSelected(SelectionEvent e) {
- if (e.widget == viewTypeCheckBox) {
- // Toggle between Flat view and Tree view
- if (viewTypeCheckBox.getSelection()) {
- populateTreeViewer(viewTypeCheckBox.getSelection(),
- processFilterString(textFilter.getText()), true,
- false);
- }
- else {
- populateTreeViewer(viewTypeCheckBox.getSelection(),
- processFilterString(textFilter.getText()), false,
- true);
- }
- }
- else if (e.widget == createButton) {
- createButtonPressed();
- }
- else if (e.widget == importButton) {
- importButtonPressed();
- }
- }
- }
-
- protected void createButtonsForButtonBar(Composite parent) {
- super.createButtonsForButtonBar(parent);
- getButton(IDialogConstants.OK_ID).setEnabled(false);
- }
-
-
- protected List getUsedComplexTypeNames(XSDSchema schema) {
- List usedNames = new ArrayList();
- Iterator names = schema.getTypeDefinitions().iterator();
- while (names.hasNext()) {
- XSDNamedComponent comp = (XSDNamedComponent) names.next();
- if (comp instanceof XSDComplexTypeDefinition) {
- usedNames.add(comp.getName());
- }
- }
-
- return usedNames;
- }
-
- protected List getUsedSimpleTypeNames(XSDSchema schema) {
- List usedNames = new ArrayList();
- Iterator names = schema.getTypeDefinitions().iterator();
- while (names.hasNext()) {
- XSDNamedComponent comp = (XSDNamedComponent) names.next();
- if (comp instanceof XSDSimpleTypeDefinition) {
- usedNames.add(comp.getName());
- }
- }
-
- return usedNames;
- }
-
- protected List getUsedElementNames(XSDSchema schema) {
- List usedNames = new ArrayList();
- Iterator names = schema.getElementDeclarations().iterator();
- while (names.hasNext()) {
- XSDNamedComponent comp = (XSDNamedComponent) names.next();
- usedNames.add(comp.getName());
- }
-
- return usedNames;
- }
-
- /*
- * This method should be subclassed.
- */
- protected abstract void createButtonPressed();
-
- /*
- * This method should be subclassed
- */
- protected abstract void importButtonPressed();
-
- /*
- * This method should be subclassed
- */
- protected abstract void createTreeView(TypesDialogTreeObject root, String filterString);
-
- /*
- * This methods should be subclassed
- */
- protected abstract void createFlatView(TypesDialogTreeObject root, String filterString);
-
- /*
- * This method should be subclassed
- */
- protected abstract void updateCanFinish(Object object);
-
- /*
- * This method should be subclassed
- */
- protected void okPressed() {
- super.okPressed();
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/dialogs/types/SetTypeTreeView.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/dialogs/types/SetTypeTreeView.java
deleted file mode 100644
index 64f0598d6a..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/dialogs/types/SetTypeTreeView.java
+++ /dev/null
@@ -1,237 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.dialogs.types;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeItem;
-
-public class SetTypeTreeView {
- private TreeViewer treeViewer;
- private TypesDialogTreeObject rootTreeObject;
- private HashMap expansionStateMap;
-
- public SetTypeTreeView(Composite base, String stringLabel) {
- Label label = new Label(base, SWT.NONE);
- label.setText(stringLabel);
-
- treeViewer = new TreeViewer(new Tree(base, SWT.SINGLE | SWT.BORDER));
- treeViewer.setContentProvider(new TreeObjectContentProvider());
- treeViewer.setLabelProvider(new TreeObjectLabelProvider());
-
- Control treeWidget = treeViewer.getTree();
- GridData gd = new GridData(GridData.FILL_BOTH);
- treeWidget.setLayoutData(gd);
-
- expansionStateMap = new HashMap();
- }
-
- public void setInput(TypesDialogTreeObject input) {
- rootTreeObject = input;
- treeViewer.setInput(input);
- treeViewer.refresh();
- }
-
- /*
- * Take a snapshot of the current expansion state. We will use this
- * snapshot to restore the expanded state of TreeViewer based on the new input.
- * Usage: setTypeTreeView.storeExpansionState()
- * setTypeTreeView.setInput(input);
- * setTypeTreeView.restoreExpansionState()
- */
- public void storeExpansionState() {
- // Easy to record expansion state since expansion should only
- // occur at the 'top' level
- if (rootTreeObject != null) {
- expansionStateMap = new HashMap(rootTreeObject.getChildren().size());
- Iterator childrenIt = rootTreeObject.getChildren().iterator();
- while (childrenIt.hasNext()) {
- TypesDialogTreeObject item = (TypesDialogTreeObject) childrenIt.next();
- expansionStateMap.put(item.getDataObject(), isExpanded(item));
- }
- }
- }
-
- public void restoreExpansionState() {
- Iterator childrenIt = rootTreeObject.getChildren().iterator();
- while (childrenIt.hasNext()) {
- TypesDialogTreeObject item = (TypesDialogTreeObject) childrenIt.next();
- Boolean expand = (Boolean) expansionStateMap.get(item.getDataObject());
- if (expand == Boolean.TRUE) {
- TreeItem treeItem = getTreeItem(item);
- if (treeItem != null && treeItem.getItemCount() > 0) {
- // Expand the TreeItem by calling showItem() on the first child of TreeItem
- treeViewer.getTree().showItem(treeItem.getItems()[0]);
- }
- }
- }
- }
-
- private Boolean isExpanded(TypesDialogTreeObject item) {
- TreeItem treeItem = getTreeItem(item);
- return Boolean.valueOf(treeItem.getExpanded());
- }
-
- private TreeItem getTreeItem(TreeItem root, TypesDialogTreeObject item) {
- TreeItem treeItem = null;
-
- if (root.getData().equals(item)) {
- treeItem = root;
- }
- else {
- // Check it's children
- TreeItem items[] = root.getItems();
- for (int index = 0; index < items.length; index++) {
- if (items[index].getData() != null) {
- treeItem = getTreeItem(items[index], item);
- if (treeItem != null) {
- break;
- }
- }
- }
- }
-
- return treeItem;
- }
-
- public TreeItem getTreeItem(TypesDialogTreeObject item) {
- boolean found = false;
- TreeItem treeItem = null;
- TreeItem treeItems[] = treeViewer.getTree().getItems();
- for (int index = 0; index < treeItems.length; index++) {
- if (treeItems[index].getData() != null) {
- treeItem = getTreeItem(treeItems[index], item);
- if (treeItem != null) {
- break;
- }
- }
- }
-
- return treeItem;
- }
-
- public TypesDialogTreeObject getSelection() {
- return (TypesDialogTreeObject) ((StructuredSelection) treeViewer.getSelection()).getFirstElement();
- }
-
- public void selectTreeObject(TypesDialogTreeObject selectionObject) {
- if (selectionObject != null) {
- StructuredSelection structuredSelection = new StructuredSelection(selectionObject);
- treeViewer.setSelection(structuredSelection, true);
- }
- }
-
- public void expandAll() {
- treeViewer.expandAll();
- }
-
- public void setRedraw(boolean redraw) {
- treeViewer.getTree().setRedraw(redraw);
- }
-
- /*
- * Select the first TypesDialogTreeObject avaliable (where the TypesDialogTreeObject is not a direct
- * child of the input (rootTreeObject). For example, select the first avaliable
- * Complex or Simple type. Not the Headings)
- */
- public void selectFirstItem() {
- Iterator rootChildren = rootTreeObject.getChildren().iterator();
- while (rootChildren.hasNext()) {
- TypesDialogTreeObject rootChild = (TypesDialogTreeObject) rootChildren.next();
- if (rootChild.getChildren().size() > 0) {
- selectTreeObject((TypesDialogTreeObject) rootChild.getChildren().get(0));
- break;
- }
- }
- }
-
- public void addTreeSelectionChangedListener(ISelectionChangedListener listener) {
- treeViewer.addSelectionChangedListener(listener);
- }
-
-/////////////////////////////////////////////////////////////////////////
- /*
- * TreeContentProvider for TypesDialogTreeObject.java
- */
- private class TreeObjectContentProvider implements ITreeContentProvider {
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
-
- }
-
- public Object[] getElements(Object inputElement) {
- if (inputElement instanceof TypesDialogTreeObject) {
- return ((TypesDialogTreeObject) inputElement).getChildren().toArray();
- }
- return (new ArrayList()).toArray();
- }
-
- public void dispose() {
- }
-
- public Object[] getChildren(Object parentElement) {
- if (parentElement instanceof TypesDialogTreeObject) {
- return ((TypesDialogTreeObject) parentElement).getChildren().toArray();
- }
- return (new ArrayList()).toArray();
- }
-
- public Object getParent(Object element) {
- if (element instanceof TypesDialogTreeObject) {
- return ((TypesDialogTreeObject) element).getParent();
- }
- return null;
- }
-
- public boolean hasChildren(Object element) {
- if (element instanceof TypesDialogTreeObject) {
- if (((TypesDialogTreeObject) element).getChildren().size() > 0) {
- return true;
- }
- }
- return false;
- }
- }
-
- /*
- * TreeLabelProvider for TypesDialogTreeObject.java
- */
- private class TreeObjectLabelProvider extends LabelProvider {
- public Image getImage(Object element) {
- if (element instanceof TypesDialogTreeObject) {
- return ((TypesDialogTreeObject) element).getImage();
- }
-
- return null;
- }
-
- public String getText(Object element) {
- if (element instanceof TypesDialogTreeObject) {
- return ((TypesDialogTreeObject) element).getEntireLabel();
- }
- return null;
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/dialogs/types/TypesDialogTreeObject.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/dialogs/types/TypesDialogTreeObject.java
deleted file mode 100644
index 2e70e64cc7..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/dialogs/types/TypesDialogTreeObject.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.dialogs.types;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.wst.xsd.ui.internal.XSDEditorPlugin;
-import org.eclipse.xsd.XSDComplexTypeDefinition;
-import org.eclipse.xsd.XSDElementDeclaration;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.XSDSimpleTypeDefinition;
-
-public class TypesDialogTreeObject {
- private Object dataObject;
- private TypesDialogTreeObject parent;
- private ArrayList children;
- private String label;
- private String appendLabel = "";
- private int type;
-
- // Used to determine the type of object we're dealing with.
- // If dataObject is String, we need more info.... so we look at the type (below).
- public final static int UNKNOWN_TYPE = 0;
- public final static int BUILT_IN_TYPE = 1;
- public final static int INLINE_SCHEMA = 2;
- public final static int ANONYMOUS_COMPLEX_TYPE = 3;
- public final static int ANONYMOUS_SIMPLE_TYPE = 4;
-
- public TypesDialogTreeObject(Object dataObject) {
- this.dataObject = dataObject;
- children = new ArrayList();
- type = TypesDialogTreeObject.UNKNOWN_TYPE;
- }
-
- public TypesDialogTreeObject(Object dataObject, int type) {
- this(dataObject);
- this.type = type;
- }
-
- public void addChild(TypesDialogTreeObject child) {
- children.add(child);
- child.setParent(this);
- }
-
- public void addAll(List kids) {
- Iterator it = kids.iterator();
- while (it.hasNext()) {
- Object item = it.next();
- if (item instanceof TypesDialogTreeObject) {
- addChild((TypesDialogTreeObject) item);
- }
- }
- }
-
- public List getChildren() {
- return children;
- }
-
- public TypesDialogTreeObject getParent() {
- return parent;
- }
-
- public void setParent(TypesDialogTreeObject newParent) {
- parent = newParent;
- }
-
- /*
- * We should move getImage() and computeDefaultLabel() code out of TypesDialogTreeObject to make
- * it more generic...... but since this class was created specifically for the TypesDialog we'll
- * leave it here.
- */
- private void computeDefaultLabel() {
- if (dataObject instanceof XSDSchema) {
- XSDSchema schema = (XSDSchema) dataObject;
- URI schemaURI = URI.createURI(schema.getSchemaLocation());
- label = schemaURI.lastSegment();
- }
- else if (dataObject instanceof XSDComplexTypeDefinition) {
- label = ((XSDComplexTypeDefinition) dataObject).getName();
- }
- else if (dataObject instanceof XSDSimpleTypeDefinition) {
- label = ((XSDSimpleTypeDefinition) dataObject).getName();
- }
- else if (dataObject instanceof String) {
- label = (String) dataObject;
- }
- else {
- label = "";
- }
- }
-
- public void setLabel(String newLabel) {
- label = newLabel;
- }
-
- public String getLabel() {
- if (label == null) {
- computeDefaultLabel();
- }
- return label;
- }
-
- public void setAppendLabel(String newLabel) {
- appendLabel = newLabel;
- }
-
- public String getAppendLabel() {
- return appendLabel;
- }
-
- public String getEntireLabel() {
- return getLabel() + getAppendLabel();
- }
-
- /*
- * We should move getImage() and computeDefaultLabel() code out of TypesDialogTreeObject to make
- * it more generic...... but since this class was created specifically for the TypesDialog we'll
- * leave it here.
- */
- public Image getImage() {
- if (dataObject instanceof XSDSchema) {
- return XSDEditorPlugin.getXSDImage("icons/XSDFile.gif");
- }
- else if (dataObject instanceof XSDComplexTypeDefinition) {
- return XSDEditorPlugin.getXSDImage("icons/XSDComplexType.gif");
- }
- else if (dataObject instanceof XSDSimpleTypeDefinition) {
- return XSDEditorPlugin.getPlugin().getIconImage("obj16/smpl_restrict_obj");
- }
- else if (dataObject instanceof XSDElementDeclaration) {
- return XSDEditorPlugin.getXSDImage("icons/XSDElement.gif");
- }
- else if (dataObject instanceof String && getType() == TypesDialogTreeObject.BUILT_IN_TYPE) {
- return XSDEditorPlugin.getPlugin().getIconImage("obj16/smpl_restrict_obj");
- }
- else if (dataObject instanceof String && getType() == TypesDialogTreeObject.ANONYMOUS_COMPLEX_TYPE) {
- return XSDEditorPlugin.getXSDImage("icons/XSDComplexType.gif");
- }
- else if (dataObject instanceof String && getType() == TypesDialogTreeObject.ANONYMOUS_SIMPLE_TYPE) {
- return XSDEditorPlugin.getPlugin().getIconImage("obj16/smpl_restrict_obj");
- }
-
- else {
- return XSDEditorPlugin.getXSDImage("icons/XSDSimpleType.gif");
- }
- }
-
- public Object getDataObject() {
- return dataObject;
- }
-
- public void setType(int type) {
- this.type = type;
- }
-
- public int getType() {
- return type;
- }
-
- /*
- * Search for the first match of the given fileName with the return value of
- * TypesDialogTreeObject.getLabel(). This method will search the children of
- * the given TypesDialogTreeObject. It will not search recursively.
- */
- public static TypesDialogTreeObject getTreeObject(TypesDialogTreeObject rootObject, String fileName) {
- Iterator rootChildrenIt = rootObject.getChildren().iterator();
- TypesDialogTreeObject rootChild = null;
- boolean found = false;
-
- while (rootChildrenIt.hasNext()) {
- rootChild = (TypesDialogTreeObject) rootChildrenIt.next();
- if (rootChild.getLabel().equals(fileName)) {
- found = true;
- break;
- }
- }
-
- if (found) {
- return rootChild;
- }
- else {
- return null;
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/dialogs/types/XSDSetTypeDialog.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/dialogs/types/XSDSetTypeDialog.java
deleted file mode 100644
index bbbb64e1b3..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/dialogs/types/XSDSetTypeDialog.java
+++ /dev/null
@@ -1,679 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.dialogs.types;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.wst.xml.uriresolver.util.URIHelper;
-import org.eclipse.wst.xsd.ui.internal.XSDEditorPlugin;
-import org.eclipse.wst.xsd.ui.internal.actions.CreateElementAction;
-import org.eclipse.wst.xsd.ui.internal.actions.CreateSimpleTypeAction;
-import org.eclipse.wst.xsd.ui.internal.actions.DOMAttribute;
-import org.eclipse.wst.xsd.ui.internal.refactor.delete.XSDExternalFileCleanup;
-import org.eclipse.wst.xsd.ui.internal.util.TypesHelper;
-import org.eclipse.wst.xsd.ui.internal.util.XSDDOMHelper;
-import org.eclipse.xsd.XSDComplexTypeDefinition;
-import org.eclipse.xsd.XSDImport;
-import org.eclipse.xsd.XSDInclude;
-import org.eclipse.xsd.XSDNamedComponent;
-import org.eclipse.xsd.XSDRedefine;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.XSDSchemaContent;
-import org.eclipse.xsd.XSDSimpleTypeDefinition;
-import org.eclipse.xsd.impl.XSDImportImpl;
-import org.eclipse.xsd.util.XSDConstants;
-import org.eclipse.xsd.util.XSDParser;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-public class XSDSetTypeDialog extends SetTypeDialog {
- private boolean showAnonymous = true;
- boolean showComplexTypes = true;
- private XSDSchema xsdSchema;
-
- /*
- * input should be of type Element..... For example, if our current selection is a GlobalElement, input should
- * be the Element of the GlobalElement
- */
- public XSDSetTypeDialog(Shell shell, Element input, String dialogTitle, XSDSchema xsdSchema) {
- super(shell, input, dialogTitle, "type");
- this.xsdSchema = xsdSchema;
- }
-
- protected void createTreeView(TypesDialogTreeObject root, String filterString) {
- TypesDialogTreeObject builtInRoot = new TypesDialogTreeObject("Built-in simple type");
- root.addChild(builtInRoot);
- createBuiltInTypes(builtInRoot, filterString);
-
- TypesDialogTreeObject typesRoot = new TypesDialogTreeObject("Types");
- root.addChild(typesRoot);
- createComplexTypes(typesRoot, filterString);
- createSimpleTypes(typesRoot, filterString);
- createFromImport(root, filterString, false);
- createFromInclude(root, filterString, false);
- createFromRedefine(root, filterString, false);
- }
-
- protected void createFlatView(TypesDialogTreeObject root, String filterString) {
- createComplexTypes(treeRootViewerInput, filterString);
- createSimpleTypes(treeRootViewerInput, filterString);
- createFromImport(root, filterString, true);
- createFromInclude(root, filterString, true);
- createFromRedefine(root, filterString, true);
- createBuiltInTypes(treeRootViewerInput, filterString);
- }
-
- public void createBuiltInTypes(TypesDialogTreeObject root, String filterString) {
- Iterator iterator = getBuiltInTypes().iterator();
- Pattern regex = Pattern.compile(filterString);
- if (iterator.hasNext()) {
- while (iterator.hasNext()) {
- Object item = iterator.next();
- String itemString = item.toString();
- Matcher m = regex.matcher(itemString.toLowerCase());
- if (itemString.toLowerCase().startsWith(filterString) || m.matches()) {
- TypesDialogTreeObject treeObject = new TypesDialogTreeObject(item, TypesDialogTreeObject.BUILT_IN_TYPE);
- root.addChild(treeObject);
- }
- }
- }
- }
-
- public void createComplexTypes(TypesDialogTreeObject root, String filterString) {
- TypesHelper typesHelper = new TypesHelper(xsdSchema);
- filterString = filterString.toLowerCase();
- Pattern regex = java.util.regex.Pattern.compile(filterString);
-
- // Add anonymous
- addAnonymousType(root, regex, filterString);
-
- List complexTypes = typesHelper.getUserComplexTypes();
- createComplexSimpleTreeObject(root, complexTypes, filterString, true);
- }
-
- public void createSimpleTypes(TypesDialogTreeObject root, String filterString) {
- TypesHelper typesHelper = new TypesHelper(xsdSchema);
- filterString = filterString.toLowerCase();
- Pattern regex = java.util.regex.Pattern.compile(filterString);
-
- // Add anonymous
- addAnonymousType(root, regex, filterString);
-
- // Add anyType
- Matcher m = regex.matcher("anyType");
- if ("anyType".startsWith(filterString) || m.matches()) {
- TypesDialogTreeObject simpleTreeObject = new TypesDialogTreeObject("anyType");
- root.addChild(simpleTreeObject);
- simpleTreeObject.setLabel(typesHelper.getPrefix(xsdSchema.getSchemaForSchemaNamespace(), true) + "anyType");
- }
-
- List simpleTypes = typesHelper.getUserSimpleTypes();
- createComplexSimpleTreeObject(root, simpleTypes, filterString, true);
- }
-
- private void addAnonymousType(TypesDialogTreeObject root, Pattern regex, String filterString) {
- if (showAnonymous)
- {
- Matcher m = regex.matcher("**anonymous**");
- if ("**anonymous**".startsWith(filterString) || m.matches()) {
- TypesDialogTreeObject simpleTreeObject = new TypesDialogTreeObject("**anonymous**");
- simpleTreeObject.setType(TypesDialogTreeObject.ANONYMOUS_SIMPLE_TYPE);
- root.addChild(simpleTreeObject);
- }
- }
- }
-
- private void createFromImport(TypesDialogTreeObject root, String filterString, boolean isFlatView) {
- Iterator imports = getXSDImports().iterator();
- while (imports.hasNext()) {
- XSDImport importItem = (XSDImport) imports.next();
- if (importItem.getSchemaLocation() != null) {
- ((XSDImportImpl) importItem).importSchema();
- TypesHelper helper = new TypesHelper(importItem.getResolvedSchema());
-
- TypesDialogTreeObject importRoot = root;
- if (!isFlatView) {
- // Create the TypesDialogTreeObject
- importRoot = new TypesDialogTreeObject(importItem.getResolvedSchema());
- root.addChild(importRoot);
- importRoot.setAppendLabel(" (Import)");
- }
-
- List types = helper.getUserComplexTypes();
- types.addAll(helper.getUserSimpleTypes());
- createComplexSimpleTreeObject(importRoot, types, filterString, false);
- }
- }
- }
-
- private void createFromInclude(TypesDialogTreeObject root, String filterString, boolean isFlatView) {
- Iterator imports = getXSDIncludes().iterator();
- while (imports.hasNext()) {
- XSDInclude includeItem = (XSDInclude) imports.next();
- if (includeItem.getSchemaLocation() != null) {
- TypesHelper helper = new TypesHelper(includeItem.getResolvedSchema());
-
- TypesDialogTreeObject includeRoot = root;
- if (!isFlatView) {
- // Create the TypesDialogTreeObject
- includeRoot = new TypesDialogTreeObject(includeItem.getResolvedSchema());
- root.addChild(includeRoot);
- includeRoot.setAppendLabel(" (Include)");
- }
-
- List types = helper.getUserComplexTypes();
- types.addAll(helper.getUserSimpleTypes());
- createComplexSimpleTreeObject(includeRoot, types, filterString, false);
- }
- }
- }
-
- private void createFromRedefine(TypesDialogTreeObject root, String filterString, boolean isFlatView) {
- Iterator redefines = getXSDRedefines().iterator();
- while (redefines.hasNext()) {
- XSDRedefine redefineItem = (XSDRedefine) redefines.next();
- if (redefineItem.getSchemaLocation() != null) {
- TypesHelper helper = new TypesHelper(redefineItem.getResolvedSchema());
-
- TypesDialogTreeObject includeRoot = root;
- if (!isFlatView) {
- // Create the TypesDialogTreeObject
- includeRoot = new TypesDialogTreeObject(redefineItem.getResolvedSchema());
- root.addChild(includeRoot);
- includeRoot.setAppendLabel(" (Redefine)");
- }
-
- List types = helper.getUserComplexTypes();
- types.addAll(helper.getUserSimpleTypes());
- createComplexSimpleTreeObject(includeRoot, types, filterString, false);
- }
- }
- }
-
- private void createComplexSimpleTreeObject(TypesDialogTreeObject root, List complexTypes, String filterString, boolean sameNS) {
- Pattern regex = java.util.regex.Pattern.compile(filterString);
- boolean proceed = true;
-
- for (int i = 0; i < complexTypes.size(); i++) {
- XSDNamedComponent item = (XSDNamedComponent) complexTypes.get(i);
-
- if (sameNS) {
- // We do this check because Types from Includes might show up. However, we don't want to show them
- String itemLocation = item.getSchema().getSchemaLocation();
- String currentSchemaLocation = xsdSchema.getSchemaLocation();
- if (itemLocation != null) {
- proceed = itemLocation.equals(currentSchemaLocation);
- }
- else {
- proceed = false;
- }
- }
-
- if (proceed) {
- String itemString = item.getName();
- Matcher m = regex.matcher(itemString.toLowerCase());
-
- if (itemString.toLowerCase().startsWith(filterString) || m.matches()) {
- TypesDialogTreeObject treeObject = new TypesDialogTreeObject(item);
- root.addChild(treeObject);
- treeObject.setLabel(itemString);
- }
- }
- }
- }
-
- private List getXSDImports() {
- List imports = new ArrayList();
-
- Iterator contents = xsdSchema.getContents().iterator();
- while (contents.hasNext()) {
- XSDSchemaContent content = (XSDSchemaContent) contents.next();
- if (content instanceof XSDImport) {
- imports.add(content);
- }
- }
-
- return imports;
- }
-
- private List getXSDIncludes() {
- List includes = new ArrayList();
-
- Iterator contents = xsdSchema.getContents().iterator();
- while (contents.hasNext()) {
- XSDSchemaContent content = (XSDSchemaContent) contents.next();
- if (content instanceof XSDInclude) {
- includes.add(content);
- }
- }
-
- return includes;
- }
-
- private List getXSDRedefines() {
- List includes = new ArrayList();
-
- Iterator contents = xsdSchema.getContents().iterator();
- while (contents.hasNext()) {
- XSDSchemaContent content = (XSDSchemaContent) contents.next();
- if (content instanceof XSDRedefine) {
- includes.add(content);
- }
- }
-
- return includes;
- }
-
- public java.util.List getBuiltInTypes() {
- TypesHelper helper = new TypesHelper(xsdSchema);
- return helper.getBuiltInTypeNamesList();
- }
-
- private String getUniqueName(String baseName, List usedNames) {
- String uniqueName = baseName;
- int number = 1;
- boolean foundMatch = true;
-
- while (foundMatch) {
- foundMatch = false;
- Iterator names = usedNames.iterator();
- while (names.hasNext()) {
- String name = (String) names.next();
-
- if (uniqueName.equalsIgnoreCase(name)) {
- foundMatch = true;
- uniqueName = baseName + String.valueOf(number++);
- break;
- }
- }
- }
-
- return uniqueName;
- }
-
- protected void createButtonPressed() {
- List usedComplexNames = getUsedComplexTypeNames(xsdSchema);
- List usedSimpleNames = getUsedSimpleTypeNames(xsdSchema);
- String newItemName = getUniqueName("NewComplexType", usedComplexNames);
-
- NewTypeDialog dialog = new NewTypeDialog(XSDEditorPlugin.getShell(), newItemName, usedComplexNames);
- dialog.setUsedSimpleTypeNames(usedSimpleNames);
-
- int rc = dialog.createAndOpen();
- if (rc == IDialogConstants.OK_ID) {
- newItemName = dialog.getName();
- ArrayList attributes = new ArrayList();
- attributes.add(new DOMAttribute(XSDConstants.NAME_ATTRIBUTE, newItemName));
-
- if (dialog.isComplexType()) {
- CreateElementAction action = new CreateElementAction(XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_COMPLEX_TYPE"));
- action.setElementTag(XSDConstants.COMPLEXTYPE_ELEMENT_TAG);
- action.setAttributes(attributes);
- action.setParentNode(xsdSchema.getElement());
- action.setXSDSchema(xsdSchema);
- action.run();
- }
- else {
- CreateSimpleTypeAction action = new CreateSimpleTypeAction(XSDEditorPlugin.getXSDString("_UI_ACTION_ADD_COMPLEX_TYPE"));
- action.setElementTag(XSDConstants.SIMPLETYPE_ELEMENT_TAG);
- action.setAttributes(attributes);
- action.setParentNode(xsdSchema.getElement());
- action.setXSDSchema(xsdSchema);
- action.run();
- }
-
- // Update tree view
- if (viewTypeCheckBox.getSelection()) {
- populateTreeViewer(viewTypeCheckBox.getSelection(), textFilter.getText(), false, false);
- treeView.selectTreeObject(TypesDialogTreeObject.getTreeObject(treeRootViewerInput, newItemName));
- }
- else {
- populateTreeViewer(viewTypeCheckBox.getSelection(), textFilter.getText(), true, true);
-
- TypesDialogTreeObject parentTreeObject = TypesDialogTreeObject.getTreeObject(treeRootViewerInput, "Types");
- treeView.selectTreeObject(TypesDialogTreeObject.getTreeObject(parentTreeObject, newItemName));
- }
- }
- }
-
- protected void importButtonPressed() {
- ImportTypesDialog dialog = new ImportTypesDialog(XSDEditorPlugin.getShell(), null, false, kind);
- String [] filters = { "xsd" };
-// IFile currentWFile = ((IFileEditorInput)editorPart.getEditorInput()).getFile();
-// IFile [] excludedFiles = { currentFile };
- IFile[] excludedFiles = new IFile[0];
-
- dialog.addFilterExtensions(filters, excludedFiles);
- dialog.create();
-
- // Translate strings below
- dialog.getShell().setText("Select");
- dialog.setTitle("Select File");
- dialog.setMessage("Select a XSD file to import");
-
- int rc = dialog.open();
- if (rc == IDialogConstants.OK_ID) {
- XSDNamedComponent selection = (XSDNamedComponent) dialog.getListSelection();
- IFile importFile = dialog.getFile();
- XSDSchema externalSchema = doLoadExternalModel(importFile);
-
- // Compare namespaces to determine if we should treat this as an Import or Include
- boolean isInclude = false;
- String externalNamespace = externalSchema.getTargetNamespace();
- if (externalNamespace.equalsIgnoreCase(xsdSchema.getTargetNamespace())) {
- isInclude = true;
- }
-
- // Determine schemaLocation
- IFile currentIFile = ((IFileEditorInput)getActiveEditor().getEditorInput()).getFile();
- String locationAttribute = URIHelper.getRelativeURI(importFile.getLocation(), currentIFile.getLocation());
-
- if (externalSchema != null) { // In case we have problems loading the file.... we should display an error message.
- Element newElement;
- if (isInclude) {
- List attributes = new ArrayList();
- attributes.add(new DOMAttribute(XSDConstants.SCHEMALOCATION_ATTRIBUTE, locationAttribute));
- newElement = createElement(XSDConstants.INCLUDE_ELEMENT_TAG, attributes);
- }
- else if (!isInclude) {
- List attributes = new ArrayList();
- attributes.add(new DOMAttribute(XSDConstants.NAMESPACE_ATTRIBUTE, externalNamespace));
- attributes.add(new DOMAttribute(XSDConstants.SCHEMALOCATION_ATTRIBUTE, locationAttribute));
- newElement = createElement(XSDConstants.IMPORT_ELEMENT_TAG, attributes);
- handleImportNS(newElement, externalSchema);
- }
- }
-
- // We need to refresh our tree view
- if (viewTypeCheckBox.getSelection()) {
- populateTreeViewer(viewTypeCheckBox.getSelection(), textFilter.getText(), false, false);
- treeView.selectTreeObject(TypesDialogTreeObject.getTreeObject(treeRootViewerInput, selection.getName()));
- }
- else {
- populateTreeViewer(viewTypeCheckBox.getSelection(), textFilter.getText(), true, true);
-
- // We now want to expand the newly imported file and selected the proper type/element
- TypesDialogTreeObject parentTreeObject = TypesDialogTreeObject.getTreeObject(treeRootViewerInput, dialog.getFile().getName());
- treeView.selectTreeObject(TypesDialogTreeObject.getTreeObject(parentTreeObject, selection.getName()));
- }
-
- }
- }
-
- private Element createElement(String elementTag, List attributes) {
- Node relativeNode = XSDDOMHelper.getNextElementNode(xsdSchema.getElement().getFirstChild());
-
- CreateElementAction action = new CreateElementAction("");
- action.setElementTag(elementTag);
- action.setAttributes(attributes);
- action.setParentNode(xsdSchema.getElement());
- action.setRelativeNode(relativeNode);
- action.setXSDSchema(xsdSchema);
- return action.createAndAddNewChildElement();
- }
-
- private IEditorPart getActiveEditor()
- {
- IWorkbench workbench = XSDEditorPlugin.getPlugin().getWorkbench();
- IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
- IEditorPart editorPart = workbenchWindow.getActivePage().getActiveEditor();
-
- return editorPart;
- }
-
- /**
- * Create a MOF model for the imported file
- */
- protected XSDSchema doLoadExternalModel(IFile iFile)
- {
- String xsdModelFile = iFile.getLocation().toOSString();
- String xsdFileName = iFile.getName();
- IProgressMonitor monitor = new NullProgressMonitor();
- String errorMessage = null;
- String currentNameSpace = xsdSchema.getTargetNamespace();
-
- monitor.beginTask("Loading XML Schema", 100);
- monitor.worked(50);
-
- XSDParser parser = new XSDParser();
- parser.parse(xsdModelFile);
-
- XSDSchema externalSchema = parser.getSchema();
- if (externalSchema != null)
- {
- if (externalSchema.getDiagnostics() != null &&
- externalSchema.getDiagnostics().size() > 0)
- {
- errorMessage = XSDEditorPlugin.getPlugin().getString("_UI_INCORRECT_XML_SCHEMA", xsdFileName);
- }
- }
- else
- {
- errorMessage = XSDEditorPlugin.getPlugin().getString("_UI_INCORRECT_XML_SCHEMA", xsdFileName);
- }
- if (errorMessage != null) {
-// System.out.println("\nError loading XML Schema:\n" + errorMessage);
- }
-
- monitor.subTask("Finish Loading");
- monitor.worked(80);
-
- return externalSchema;
- }
-
- private void handleImportNS(Element importElement, XSDSchema externalSchema) {
- String namespace = externalSchema.getTargetNamespace();
- if (namespace == null) namespace = "";
-
- XSDImport xsdImport = (XSDImport) xsdSchema.getCorrespondingComponent(importElement);
- xsdImport.setResolvedSchema(externalSchema);
-
- java.util.Map map = xsdSchema.getQNamePrefixToNamespaceMap();
-
-// System.out.println("changed Import Map is " + map.values());
-// System.out.println("changed import Map keys are " + map.keySet());
-
- // Referential integrity on old import
- // How can we be sure that if the newlocation is the same as the oldlocation
- // the file hasn't changed
-
- XSDSchema referencedSchema = xsdImport.getResolvedSchema();
- if (referencedSchema != null)
- {
- XSDExternalFileCleanup cleanHelper = new XSDExternalFileCleanup(referencedSchema);
- cleanHelper.visitSchema(xsdSchema);
- }
-
- Element schemaElement = xsdSchema.getElement();
-
- // update the xmlns in the schema element first, and then update the import element next
- // so that the last change will be in the import element. This keeps the selection
- // on the import element
- TypesHelper helper = new TypesHelper(externalSchema);
- String prefix = helper.getPrefix(namespace, false);
-
- if (map.containsKey(prefix))
- {
- prefix = null;
- }
-
- if (prefix == null || (prefix !=null && prefix.length() == 0))
- {
- StringBuffer newPrefix = new StringBuffer("pref"); //$NON-NLS-1$
- int prefixExtension = 1;
- while (map.containsKey(newPrefix.toString()) && prefixExtension < 100)
- {
- newPrefix = new StringBuffer("pref" + String.valueOf(prefixExtension));
- prefixExtension++;
- }
- prefix = newPrefix.toString();
- }
-
- if (namespace.length() > 0)
- {
- // if ns already in map, use its corresponding prefix
- if (map.containsValue(namespace))
- {
- TypesHelper typesHelper = new TypesHelper(xsdSchema);
- prefix = typesHelper.getPrefix(namespace, false);
- }
- else // otherwise add to the map
- {
- schemaElement.setAttribute("xmlns:"+prefix, namespace);
- }
- }
-
-
-// System.out.println("changed Import Map is " + map.values());
-// System.out.println("changed import Map keys are " + map.keySet());
- }
-
- protected void updateCanFinish(Object object) {
- if (object instanceof StructuredSelection) {
- Object selectionObject = ((StructuredSelection) object).getFirstElement();
- if (selectionObject instanceof TypesDialogTreeObject) {
- TypesDialogTreeObject treeObject = (TypesDialogTreeObject) selectionObject;
- if (treeObject.getDataObject() instanceof XSDComplexTypeDefinition ||
- treeObject.getDataObject() instanceof XSDSimpleTypeDefinition ||
- (treeObject.getDataObject() instanceof String && treeObject.getDataObject().toString().equals("anyType")) ||
- (treeObject.getDataObject() instanceof String && treeObject.getDataObject().toString().equals("**anonymous**") ||
- (treeObject.getDataObject() instanceof String && treeObject.getType() == TypesDialogTreeObject.BUILT_IN_TYPE))) {
-
- getButton(IDialogConstants.OK_ID).setEnabled(true);
- }
- else {
- getButton(IDialogConstants.OK_ID).setEnabled(false);
- }
- }
- else {
- getButton(IDialogConstants.OK_ID).setEnabled(false);
- }
- }
- }
-
- protected void okPressed() {
- Element element = (Element) input;
- String typeObject = "";
- TypesDialogTreeObject treeObject = (TypesDialogTreeObject) treeView.getSelection();
-
- // Get the new type --> typeObject
- if (treeObject.getDataObject() instanceof String) {
- // Should be a built-in type or anonymous or anyType
- typeObject = (String) treeObject.getDataObject();
- }
- else {
- XSDNamedComponent item = (XSDNamedComponent) treeObject.getDataObject();
- typeObject = item.getName();
-
- TypesHelper typesHelper = new TypesHelper(item.getSchema());
- List prefixedNames = typesHelper.getPrefixedNames(item.getTargetNamespace(), item.getName());
- if (prefixedNames.size() > 0) {
- // Grab the first prefixed name
- typeObject = (String) prefixedNames.get(0);
- }
- }
-
- // Get the previous type --> previousStringType
- String previousStringType = "";
- Attr attr = element.getAttributeNode("type");
- if (attr != null) {
- String value = attr.getValue();
- }
-
- if (!XSDDOMHelper.inputEquals(element, XSDConstants.UNION_ELEMENT_TAG, false))
- {
- if (typeObject.equals("**anonymous**"))
- {
- if (treeObject.getType() == TypesDialogTreeObject.ANONYMOUS_SIMPLE_TYPE)
- {
- if (!previousStringType.equals("**anonymous**"))
- {
- updateElementToAnonymous(element, XSDConstants.SIMPLETYPE_ELEMENT_TAG);
- }
- }
- else
- {
- if (!previousStringType.equals("**anonymous**"))
- {
- updateElementToAnonymous(element, XSDConstants.COMPLEXTYPE_ELEMENT_TAG);
- }
- }
- // element.removeAttribute(XSDConstants.TYPE_ATTRIBUTE);
- element.removeAttribute("type");
- }
- else
- {
- XSDDOMHelper.updateElementToNotAnonymous(element);
- //element.setAttribute(XSDConstants.TYPE_ATTRIBUTE, typeObject.toString());
- element.setAttribute("type", typeObject.toString());
- }
- }
-
- super.okPressed();
- }
-
- private void updateElementToAnonymous(Element element, String xsdType) {
- String prefix = element.getPrefix();
- prefix = (prefix == null) ? "" : (prefix + ":");
- XSDDOMHelper.updateElementToNotAnonymous(element);
- boolean hasChildrenElements = hasElementChildren(element);
- Element childNode = null;
- if (xsdType.equals(XSDConstants.COMPLEXTYPE_ELEMENT_TAG)) {
- childNode = element.getOwnerDocument().createElementNS(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, prefix + XSDConstants.COMPLEXTYPE_ELEMENT_TAG);
- }
- else if (xsdType.equals(XSDConstants.SIMPLETYPE_ELEMENT_TAG)) {
- childNode = element.getOwnerDocument().createElementNS(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, prefix + XSDConstants.SIMPLETYPE_ELEMENT_TAG);
- }
-
- if (childNode != null) {
- XSDDOMHelper helper = new XSDDOMHelper();
- Node annotationNode = helper.getChildNode(element, XSDConstants.ANNOTATION_ELEMENT_TAG);
- if (annotationNode == null) {
- Node firstChild = element.getFirstChild();
- element.insertBefore(childNode, firstChild);
- } else {
- Node nextSibling = annotationNode.getNextSibling();
- element.insertBefore(childNode, nextSibling);
- }
- XSDDOMHelper.formatChild(childNode);
- }
- }
-
- private boolean hasElementChildren(Node parentNode) {
- boolean hasChildrenElements = false;
- if (parentNode != null && parentNode.hasChildNodes()) {
- NodeList nodes = parentNode.getChildNodes();
- for (int i = 0; i < nodes.getLength(); i++) {
- if (nodes.item(i) instanceof Element) {
- hasChildrenElements = true;
- break;
- }
- }
- }
- return hasChildrenElements;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/dnd/BaseDragNodesCommand.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/dnd/BaseDragNodesCommand.java
deleted file mode 100644
index 142d4ed02d..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/dnd/BaseDragNodesCommand.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.dnd;
-
-import java.util.Collection;
-
-import org.eclipse.wst.common.ui.dnd.DefaultDragAndDropCommand;
-import org.eclipse.wst.xml.core.document.XMLModel;
-import org.eclipse.wst.xml.core.internal.document.DocumentImpl;
-import org.eclipse.wst.xsd.ui.internal.util.XSDDOMHelper;
-import org.eclipse.xsd.util.XSDConstants;
-import org.w3c.dom.Node;
-
-
-public abstract class BaseDragNodesCommand extends DefaultDragAndDropCommand
-{
- /**
- * Constructor for BaseDragNodesCommand.
- * @param target
- * @param location
- * @param operations
- * @param operation
- * @param sources
- */
- public BaseDragNodesCommand(
- Object target,
- float location,
- int operations,
- int operation,
- Collection sources)
- {
- super(target, location, operations, operation, sources);
- }
-
- protected boolean isDirectSchemaChild(Node node)
- {
- Node parent = node.getParentNode();
- if (XSDDOMHelper.inputEquals(parent, XSDConstants.SCHEMA_ELEMENT_TAG, false) &&
- parent.getParentNode().equals(parent.getOwnerDocument()))
- {
- return true;
- }
- return false;
- }
-
- protected boolean isSiblingNodes(Node first, Node second)
- {
- if (first.getParentNode() != null)
- {
- return first.getParentNode().equals(second.getParentNode());
- }
- return false;
- }
-
- protected void beginRecording()
- {
- if (target != null)
- {
- XMLModel model = getModel((Node)target);
-
- if (model != null)
- {
- model.beginRecording(this, "Move");
- }
- }
- }
-
- protected void endRecording()
- {
- if (target != null)
- {
- XMLModel model = getModel((Node)target);
-
- if (model != null)
- {
- model.endRecording(this);
- }
- }
- }
- protected XMLModel getModel(Node node)
- {
- Object object = node.getOwnerDocument();
- if (object instanceof DocumentImpl)
- {
- return ((DocumentImpl) object).getModel();
- }
- return null;
- }
-
- protected void moveNode(Node referenceNode, Node nodeToMove, boolean isBefore)
- {
- XSDDOMHelper.moveNode(referenceNode, nodeToMove, isBefore);
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/dnd/DragNodesCommand.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/dnd/DragNodesCommand.java
deleted file mode 100644
index b3692cffb3..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/dnd/DragNodesCommand.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.dnd;
-
-import java.util.Collection;
-import java.util.Iterator;
-
-import org.eclipse.wst.xml.core.document.XMLNode;
-import org.eclipse.wst.xml.core.format.NodeFormatter;
-import org.w3c.dom.Node;
-
-public class DragNodesCommand extends BaseDragNodesCommand
-{
- /**
- * Constructor for DragNodesCommand.
- * @param target
- * @param location
- * @param operations
- * @param operation
- * @param sources
- */
- public DragNodesCommand(
- Object target,
- float location,
- int operations,
- int operation,
- Collection sources)
- {
- super(target, location, operations, operation, sources);
- }
-
- /**
- * @see org.eclipse.wst.common.ui.dnd.DragAndDropCommand#canExecute()
- */
- public boolean canExecute()
- {
- if (sources.size() > 0)
- {
- Node firstSource = (Node) sources.toArray()[0];
- return isSiblingNodes((Node) target, firstSource);
- }
- return false;
-// return isDirectSchemaChild((Node)target);
- }
-
-
- /**
- * @see org.eclipse.wst.common.ui.dnd.DragAndDropCommand#execute()
- */
- public void execute()
- {
- NodeFormatter formatProcessor = new NodeFormatter();
- Node referenceNode = (Node) target;
- Iterator iter = sources.iterator();
- beginRecording();
-
- while (iter.hasNext())
- {
- Node node = (Node) iter.next();
- if (isSiblingNodes(referenceNode,node))
- {
- moveNode(referenceNode, node, !isAfter());
- formatProcessor.format((XMLNode)node);
- }
- }
-// formatProcessor.format((XMLNode)referenceNode.getParentNode());
- endRecording();
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/dnd/XSDDragAndDropManager.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/dnd/XSDDragAndDropManager.java
deleted file mode 100644
index b00c642e19..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/dnd/XSDDragAndDropManager.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.dnd;
-
-import java.util.Collection;
-
-import org.eclipse.wst.common.ui.dnd.DragAndDropCommand;
-import org.eclipse.wst.common.ui.dnd.DragAndDropManager;
-import org.eclipse.wst.xsd.ui.internal.util.XSDDOMHelper;
-import org.eclipse.xsd.util.XSDConstants;
-import org.w3c.dom.Node;
-
-public class XSDDragAndDropManager implements DragAndDropManager
-{
- /**
- * Constructor for XSDDragAndDropManager.
- */
- public XSDDragAndDropManager()
- {
- }
-
- protected boolean isDirectSchemaChild(Node node)
- {
- Node parent = node.getParentNode();
- if (XSDDOMHelper.inputEquals(parent, XSDConstants.SCHEMA_ELEMENT_TAG, false) &&
- parent.getParentNode().equals(parent.getOwnerDocument()))
- {
- return true;
- }
- return false;
- }
-
- /**
- * @see org.eclipse.wst.common.ui.dnd.DragAndDropManager#createCommand(Object, float, int, int, Collection)
- */
- public DragAndDropCommand createCommand(
- Object target,
- float location,
- int operations,
- int operation,
- Collection source)
- {
- if (target instanceof Node)
- {
- Node node = (Node) target;
-// if (isDirectSchemaChild(node))
-// {
- return new DragNodesCommand(target, location, operations, operation, source);
-// }
- }
- return null;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/gef/util/editparts/AbstractComponentViewerRootEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/gef/util/editparts/AbstractComponentViewerRootEditPart.java
deleted file mode 100644
index caef3974c8..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/gef/util/editparts/AbstractComponentViewerRootEditPart.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.gef.util.editparts;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Panel;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
-import org.eclipse.wst.xsd.ui.internal.gef.util.figures.ContainerLayout;
-
-
-public abstract class AbstractComponentViewerRootEditPart extends AbstractGraphicalEditPart
-{
- protected final static String MESSAGE_PLACE_HOLDER = "MESSAGE_PLACE_HOLDER";
- protected Object input;
-
- public void setInput(Object input)
- {
- this.input = input;
- refreshChildren();
- }
-
- protected IFigure createFigure()
- {
- Panel panel = new Panel();
- ContainerLayout layout = new ContainerLayout();
- layout.setBorder(60);
- panel.setLayoutManager(layout);
- return panel;
- }
-
-
- protected List getModelChildren()
- {
- List list = new ArrayList();
- if (input != null)
- {
- list.add(input);
- }
- else
- {
- list.add(MESSAGE_PLACE_HOLDER);
- }
- return list;
- }
-
- protected abstract EditPart createChild(Object model);
-
- protected void createEditPolicies()
- {
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/gef/util/figures/ConnectedEditPartFigure.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/gef/util/figures/ConnectedEditPartFigure.java
deleted file mode 100644
index f25f67787d..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/gef/util/figures/ConnectedEditPartFigure.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.gef.util.figures;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
-
-
-public class ConnectedEditPartFigure extends ContainerFigure implements IConnectedEditPartFigure
-{
- protected EditPart editPart;
- protected boolean childConnectionsEnabled = true;
- protected List connectedFigures = new ArrayList();
- protected int connectionType = RIGHT_CONNECTION;
-
- public ConnectedEditPartFigure(EditPart editPart)
- {
- this.editPart = editPart;
- }
-
- public void setChildConnectionsEnabled(boolean enabled)
- {
- childConnectionsEnabled = enabled;
- }
-
- protected IConnectedEditPartFigure getParentGraphNodeFigure()
- {
- IConnectedEditPartFigure result = null;
- for (EditPart parentEditPart = editPart.getParent(); parentEditPart != null; parentEditPart = parentEditPart.getParent())
- {
- IFigure figure = ((AbstractGraphicalEditPart)parentEditPart).getFigure();
- if (figure instanceof IConnectedEditPartFigure)
- {
- IConnectedEditPartFigure graphNodeFigure = (IConnectedEditPartFigure)figure;
- if (graphNodeFigure.getConnectionFigure() != null)
- {
- result = graphNodeFigure;
- break;
- }
- }
- }
- return result;
- }
-
- public void addNotify()
- {
- super.addNotify();
- if (getConnectionFigure() != null)
- {
- IConnectedEditPartFigure parentGraphNodeFigure = getParentGraphNodeFigure();
- if (parentGraphNodeFigure != null)
- {
- parentGraphNodeFigure.addConnectedFigure(this);
- }
- }
- }
-
- public void removeNotify()
- {
- super.removeNotify();
- if (getConnectionFigure() != null)
- {
- IConnectedEditPartFigure parentGraphNodeFigure = getParentGraphNodeFigure();
- if (parentGraphNodeFigure != null)
- {
- parentGraphNodeFigure.removeConnectedFigure(this);
- }
- }
- }
-
- public void addConnectedFigure(IConnectedEditPartFigure figure)
- {
- if (childConnectionsEnabled)
- {
- // this test is required since we sometimes receive the 'addNotify' call twice
- //
- if (!connectedFigures.contains(figure))
- {
- connectedFigures.add(figure);
- }
- }
- }
-
- public void removeConnectedFigure(IConnectedEditPartFigure figure)
- {
- if (childConnectionsEnabled)
- {
- connectedFigures.remove(figure);
- }
- }
-
- public IFigure getSelectionFigure()
- {
- return this;
- }
-
- public IFigure getConnectionFigure()
- {
- return this;
- }
-
- public List getConnectedFigures(int type)
- {
- List list = new ArrayList();
- for (Iterator i = connectedFigures.iterator(); i.hasNext(); )
- {
- IConnectedEditPartFigure figure = (IConnectedEditPartFigure)i.next();
- //if (type == 0 || type == figure.getConnectionType())
- {
- list.add(figure);
- }
- }
- return list;
- }
-
- public int getConnectionType()
- {
- return connectionType;
- }
-
- public void setConnectionType(int type)
- {
- connectionType = type;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/gef/util/figures/ConnectionRenderingFigure.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/gef/util/figures/ConnectionRenderingFigure.java
deleted file mode 100644
index 7192108cd9..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/gef/util/figures/ConnectionRenderingFigure.java
+++ /dev/null
@@ -1,215 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.gef.util.figures;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.RectangleFigure;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.PointList;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.GraphicalEditPart;
-
-
-public class ConnectionRenderingFigure extends RectangleFigure
-{
- protected boolean isOutlined = true;
- protected IFigure primaryLayer;
-
- public ConnectionRenderingFigure(IFigure primaryLayer)
- {
- setOpaque(false);
- this.primaryLayer = primaryLayer;
- //setFocusTraversable(false);
- //setEnabled(false);
- }
-
- protected boolean isMouseEventTarget()
- {
- return false;
- }
-
- public boolean containsPoint(int x, int y)
- {
- return false;
- }
-
- protected void fillShape(Graphics graphics)
- {
- graphics.setForegroundColor(ColorConstants.black);
- drawLines(graphics, primaryLayer);
- }
-
- protected void outlineShape(Graphics graphics)
- {
- if (isOutlined)
- {
- super.outlineShape(graphics);
- }
- }
-
- protected void drawLines(Graphics graphics, IFigure figure)
- {
- if (figure instanceof IConnectedEditPartFigure)
- {
- IConnectedEditPartFigure graphNodeFigure = (IConnectedEditPartFigure)figure;
- List connectedFigures = graphNodeFigure.getConnectedFigures(IConnectedEditPartFigure.RIGHT_CONNECTION);
- int connectedFiguresSize = connectedFigures.size();
-
- if (connectedFiguresSize > 0)
- {
- IConnectedEditPartFigure firstGraphNodeFigure = (IConnectedEditPartFigure)connectedFigures.get(0);
- Rectangle r = graphNodeFigure.getConnectionFigure().getBounds();
-
- int x1 = r.x + r.width;
- int y1 = r.y + r.height/2;
-
- int startOfChildBox = firstGraphNodeFigure.getConnectionFigure().getBounds().x;
- int x2 = x1 + (startOfChildBox - x1) / 3;
- int y2 = y1;
-
- if (connectedFiguresSize == 1)
- {
- graphics.drawLine(x1, y1, startOfChildBox, y2);
- }
- else // (connectedFigures.length > 1)
- {
- graphics.drawLine(x1, y1, x2, y2);
-
- int minY = Integer.MAX_VALUE;
- int maxY = -1;
-
- for (Iterator i = connectedFigures.iterator(); i.hasNext(); )
- {
- IConnectedEditPartFigure connectedFigure = (IConnectedEditPartFigure)i.next();
- Rectangle childConnectionRectangle = connectedFigure.getConnectionFigure().getBounds();
- int y = childConnectionRectangle.y + childConnectionRectangle.height / 2;
- minY = Math.min(minY, y);
- maxY = Math.max(maxY, y);
- graphics.drawLine(x2, y, childConnectionRectangle.x, y);
- }
- graphics.drawLine(x2, minY, x2, maxY);
- }
- }
- }
-
- //boolean visitChildren = true;
- List children = figure.getChildren();
- for (Iterator i = children.iterator(); i.hasNext(); )
- {
- IFigure child = (IFigure)i.next();
- drawLines(graphics, child);
- }
- }
-
- // This method supports the preview connection line function related to drag and drop
- //
- public PointList getConnectionPoints(GraphicalEditPart parentEditPart, GraphicalEditPart 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);
- //pointList.addPoint(new Point(draggedFigureBounds.x, draggedFigureBoundsY));
-
- if (data[0] == 0) // insert between 2 items
- {
- int x = a.x + (draggedFigureBounds.x - a.x)/2;
- 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(GraphicalEditPart parentEditPart, GraphicalEditPart childRefEditPart, int[] data)
- {
- Point point = null;
- List childList = parentEditPart.getChildren();
-
- if (parentEditPart.getFigure() instanceof IConnectedEditPartFigure && childList.size() > 0)
- {
- point = new Point();
-
- GraphicalEditPart prev = null;
- GraphicalEditPart next = null;
-
- for (Iterator i = childList.iterator(); i.hasNext(); )
- {
- Object o = i.next();
- if (o instanceof GraphicalEditPart)
- {
- GraphicalEditPart childEditPart = (GraphicalEditPart)o;
- if (childEditPart.getFigure() instanceof IConnectedEditPartFigure)
- {
- if (childEditPart == childRefEditPart)
- {
- next = childEditPart;
- break;
- }
- prev = childEditPart;
- }
- }
- }
-
-
- if (next != null && prev != null)
- {
- int ya = getConnectedEditPartConnectionBounds(prev).getCenter().y;
- int yb = getConnectedEditPartConnectionBounds(next).getCenter().y;
- point.y = ya + (yb - ya)/2;
- data[0] = 0;
- }
- else if (prev != null) // add it last
- {
- point.y = getConnectedEditPartConnectionBounds(prev).getCenter().y;
- data[0] = 1;
- }
- else if (next != null) // add it first!
- {
- point.y = getConnectedEditPartConnectionBounds(next).getCenter().y;
- data[0] = -1;
- }
-
- if (next != null || prev != null)
- {
- GraphicalEditPart child = prev != null ? prev : next;
- int startOfChildBox = getConnectedEditPartConnectionBounds(child).x;
- Rectangle r = getConnectedEditPartConnectionBounds(parentEditPart);
- int x1 = r.x + r.width;
- point.x = x1 + (startOfChildBox - x1) / 3;
- }
- }
- return point;
- }
-
- protected Rectangle getConnectedEditPartConnectionBounds(GraphicalEditPart editPart)
- {
- return ((IConnectedEditPartFigure)editPart.getFigure()).getConnectionFigure().getBounds();
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/gef/util/figures/ContainerFigure.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/gef/util/figures/ContainerFigure.java
deleted file mode 100644
index d7a77ac685..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/gef/util/figures/ContainerFigure.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.gef.util.figures;
-
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.RectangleFigure;
-
-public class ContainerFigure extends RectangleFigure implements IExpandable
-{
- protected boolean isOutlined = false;
- protected boolean isExpanded = true;
-
- public ContainerFigure()
- {
- setLayoutManager(new ContainerLayout());
- setFill(false);
- }
-
- public void doLayout()
- {
- layout();
- setValid(true);
- }
-
- public ContainerLayout getContainerLayout()
- {
- return (ContainerLayout)getLayoutManager();
- }
-
- public void setOutlined(boolean isOutlined)
- {
- this.isOutlined = isOutlined;
- }
-
- protected void outlineShape(Graphics graphics)
- {
- if (isOutlined)
- {
- super.outlineShape(graphics);
- }
- }
-
- public boolean isExpanded()
- {
- return isExpanded;
- }
-
- public void setExpanded(boolean isExpanded)
- {
- this.isExpanded = isExpanded;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/gef/util/figures/ContainerLayout.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/gef/util/figures/ContainerLayout.java
deleted file mode 100644
index 12f654bd5b..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/gef/util/figures/ContainerLayout.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.gef.util.figures;
-
-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 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;
- }
- }
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/gef/util/figures/FillLayout.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/gef/util/figures/FillLayout.java
deleted file mode 100644
index 1b2976b64e..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/gef/util/figures/FillLayout.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.gef.util.figures;
-
-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.
- * @since 2.0
- */
-
- 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/org/eclipse/wst/xsd/ui/internal/gef/util/figures/IConnectedEditPartFigure.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/gef/util/figures/IConnectedEditPartFigure.java
deleted file mode 100644
index 4c778d7e20..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/gef/util/figures/IConnectedEditPartFigure.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.gef.util.figures;
-
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-
-public interface IConnectedEditPartFigure extends IConnectedFigure
-{
- public static final int UP_CONNECTION = 1;
- public static final int DOWN_CONNECTION = 2;
- public static final int LEFT_CONNECTION = 3;
- public static final int RIGHT_CONNECTION = 4;
-
- public IFigure getSelectionFigure();
- public IFigure getConnectionFigure();
- public List getConnectedFigures(int type);
- public int getConnectionType();
- public void addConnectedFigure(IConnectedEditPartFigure figure);
- public void removeConnectedFigure(IConnectedEditPartFigure figure);
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/gef/util/figures/IConnectedFigure.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/gef/util/figures/IConnectedFigure.java
deleted file mode 100644
index 4a6d7ded2c..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/gef/util/figures/IConnectedFigure.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.gef.util.figures;
-
-import org.eclipse.draw2d.IFigure;
-
-public interface IConnectedFigure extends IFigure
-{
- public IFigure getConnectionFigure();
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/gef/util/figures/IConnectionRenderingViewer.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/gef/util/figures/IConnectionRenderingViewer.java
deleted file mode 100644
index 6ed611d9d7..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/gef/util/figures/IConnectionRenderingViewer.java
+++ /dev/null
@@ -1,16 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.gef.util.figures;
-
-public interface IConnectionRenderingViewer
-{
- public ConnectionRenderingFigure getConnectionRenderingFigure();
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/gef/util/figures/IExpandable.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/gef/util/figures/IExpandable.java
deleted file mode 100644
index 161581bb00..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/gef/util/figures/IExpandable.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.gef.util.figures;
-
-import org.eclipse.draw2d.IFigure;
-
-public interface IExpandable extends IFigure
-{
- boolean isExpanded();
- void setExpanded(boolean isExpanded);
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/gef/util/figures/SpacingFigure.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/gef/util/figures/SpacingFigure.java
deleted file mode 100644
index e245d6960c..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/gef/util/figures/SpacingFigure.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.gef.util.figures;
-
-import org.eclipse.draw2d.RectangleFigure;
-import org.eclipse.draw2d.geometry.Dimension;
-
-public class SpacingFigure extends RectangleFigure
-{
- public SpacingFigure()
- {
- setFill(false);
- setPreferredSize(new Dimension(0, 0));
- }
-
- //protected void outlineShape(Graphics graphics)
- //{
- //}
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/BaseGraphicalViewer.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/BaseGraphicalViewer.java
deleted file mode 100644
index f471d52d60..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/BaseGraphicalViewer.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph;
-
-import java.util.Iterator;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.StackLayout;
-import org.eclipse.gef.DefaultEditDomain;
-import org.eclipse.gef.EditDomain;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.KeyHandler;
-import org.eclipse.gef.LayerConstants;
-import org.eclipse.gef.editparts.ScalableRootEditPart;
-import org.eclipse.gef.tools.SelectionTool;
-import org.eclipse.gef.ui.parts.ScrollingGraphicalViewer;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.wst.xsd.ui.internal.XSDEditor;
-import org.eclipse.wst.xsd.ui.internal.XSDMenuListener;
-import org.eclipse.wst.xsd.ui.internal.gef.util.figures.ConnectionRenderingFigure;
-import org.eclipse.wst.xsd.ui.internal.gef.util.figures.IConnectionRenderingViewer;
-import org.eclipse.wst.xsd.ui.internal.graph.figures.CenterLayout;
-import org.eclipse.xsd.XSDConcreteComponent;
-
-
-/**
- * @author ernest
- *
- * To change this generated comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-public abstract class BaseGraphicalViewer extends ScrollingGraphicalViewer implements IConnectionRenderingViewer
-{
- protected FigureCanvasKeyboardHandler figureCanvasKeyboardHandler;
-
- protected EditDomain editDomain;
-
- protected boolean isInputEnabled = true;
-
- protected boolean isSelectionEnabled = true;
-
- protected ISelectionProvider menuSelectionProvider;
-
- protected GraphContextMenuProvider menuProvider;
-
- protected XSDEditor editor;
-
- protected XSDConcreteComponent input;
-
- protected ConnectionRenderingFigure connectionRenderingFigure;
-
- public BaseGraphicalViewer(XSDEditor editor, ISelectionProvider selectionProvider)
- {
- super();
- this.editor = editor;
- menuSelectionProvider = selectionProvider;
- }
-
- public ConnectionRenderingFigure getConnectionRenderingFigure()
- {
- return connectionRenderingFigure;
- }
-
- public void setInputEnabled(boolean enabled)
- {
- isInputEnabled = enabled;
- }
-
- public void setSelectionEnabled(boolean enabled)
- {
- isSelectionEnabled = enabled;
- }
-
- public XSDMenuListener getMenuListener()
- {
- return menuProvider.getMenuListener();
- }
-
- protected static Color white = null;
- protected void hookControl()
- {
- super.hookControl();
-
- if (white == null)
- {
- white = new Color(getControl().getDisplay(), 255, 255, 255);
- }
- getControl().setBackground(white);
-
- editDomain = new DefaultEditDomain(null);
- ((DefaultEditDomain)editDomain).setDefaultTool(new SelectionTool());
- editDomain.loadDefaultTool();
- editDomain.addViewer(this);
-
- //jvh - gef port - moved this from below so it is available when adding context menu below
- menuProvider = new GraphContextMenuProvider(this, menuSelectionProvider, editor.getXSDTextEditor());
- setContextMenu(menuProvider);
-
- // add context menu to the graph
- MenuManager manager = new MenuManager();
- manager.addMenuListener(getMenuListener()); //jvh - gef port
- manager.setRemoveAllWhenShown(true);
- Menu menu = manager.createContextMenu(getControl());
- getControl().setMenu(menu);
-
- KeyAdapter keyListener = new KeyAdapter()
- {
- /**
- * @see org.eclipse.swt.events.KeyAdapter#keyReleased(KeyEvent)
- */
- public void keyReleased(KeyEvent e)
- {
- if (e.character == SWT.DEL)
- {
- getMenuListener().getDeleteAction().run();
- }
- }
- };
-
- setKeyHandler(new XSDGraphicalViewerKeyHandler(this).setParent(new KeyHandler()));
-
-// getControl().addKeyListener(keyListener);
-
- figureCanvasKeyboardHandler = new FigureCanvasKeyboardHandler(this);
- getFigureCanvas().addKeyListener(figureCanvasKeyboardHandler);
-
- getRootEditPart().activate();
-
- ScalableRootEditPart graphicalRootEditPart = (ScalableRootEditPart)getRootEditPart();
-
- // set the layout for the primary layer so that the children are always centered
- //
- graphicalRootEditPart.getLayer(LayerConstants.PRIMARY_LAYER).setLayoutManager(new CenterLayout());
-
- // add the ConnectionRenderingFigure which is responsible for drawing all of the lines in the view
- //
- IFigure figure = graphicalRootEditPart.getLayer(LayerConstants.HANDLE_LAYER);
- figure.setLayoutManager(new StackLayout());
- connectionRenderingFigure = new ConnectionRenderingFigure(graphicalRootEditPart.getLayer(LayerConstants.PRIMARY_LAYER));
- figure.add(connectionRenderingFigure);
-
- figure.validate();
- }
-
- public XSDConcreteComponent getInput()
- {
- return input;
- }
-
- protected EditPart getEditPart(EditPart parent, Object object)
- {
- EditPart result = null;
- for (Iterator i = parent.getChildren().iterator(); i.hasNext(); )
- {
- EditPart editPart = (EditPart)i.next();
- if (editPart.getModel() == object)
- {
- result = editPart;
- break;
- }
- }
-
- if (result == null)
- {
- for (Iterator i = parent.getChildren().iterator(); i.hasNext(); )
- {
- EditPart editPart = getEditPart((EditPart)i.next(), object);
- if (editPart != null)
- {
- result = editPart;
- break;
- }
- }
- }
-
- return result;
- }
-
- public abstract void setInput(XSDConcreteComponent comp);
-
- public abstract void setSelection(XSDConcreteComponent comp);
-
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/FigureCanvasKeyboardHandler.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/FigureCanvasKeyboardHandler.java
deleted file mode 100644
index 012e15eedd..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/FigureCanvasKeyboardHandler.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph;
-
-import org.eclipse.draw2d.FigureCanvas;
-import org.eclipse.draw2d.RangeModel;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Widget;
-import org.eclipse.wst.xsd.ui.internal.graph.editparts.CategoryEditPart;
-import org.eclipse.wst.xsd.ui.internal.graph.editparts.TopLevelComponentEditPart;
-
-public class FigureCanvasKeyboardHandler extends KeyAdapter
-{
- public static final int H_SCROLL_INCREMENT = 5;
- public static final int V_SCROLL_INCREMENT = 30;
-
- BaseGraphicalViewer viewer;
-
- /**
- * Constructor for FigureCanvasKeyboardHandler.
- */
- public FigureCanvasKeyboardHandler(BaseGraphicalViewer viewer)
- {
- super();
- this.viewer = viewer;
- }
-
- public void keyPressed(KeyEvent e)
- {
- Widget w = e.widget;
- if (w instanceof FigureCanvas)
- {
- processKey(e.keyCode, (FigureCanvas)w);
- update();
- }
- }
-
- private void processKey(int keyCode, FigureCanvas figureCanvas)
- {
- switch (keyCode)
- {
- case SWT.ARROW_DOWN :
- scrollVertical(figureCanvas, false);
- break;
- case SWT.ARROW_UP :
- scrollVertical(figureCanvas, true);
- break;
- case SWT.ARROW_LEFT :
- scrollHorizontal(figureCanvas, true);
- break;
- case SWT.ARROW_RIGHT :
- scrollHorizontal(figureCanvas, false);
- break;
- case SWT.PAGE_UP :
- scrollPage(figureCanvas, true);
- break;
- case SWT.PAGE_DOWN :
- scrollPage(figureCanvas, false);
- break;
- }
- }
-
- private int verifyScrollBarOffset(RangeModel model, int value)
- {
- value = Math.max(model.getMinimum(), value);
- return Math.min(model.getMaximum() - model.getExtent(), value);
- }
-
- private void scrollVertical(FigureCanvas figureCanvas, boolean up)
- {
- Point location = figureCanvas.getViewport().getViewLocation();
- int vOffset = up ? -V_SCROLL_INCREMENT : V_SCROLL_INCREMENT;
- int x = verifyScrollBarOffset(figureCanvas.getViewport().getHorizontalRangeModel(), location.x);
- int y = verifyScrollBarOffset(figureCanvas.getViewport().getVerticalRangeModel(), location.y + vOffset);
- figureCanvas.scrollSmoothTo(x, y);
- }
-
- private void scrollHorizontal(FigureCanvas figureCanvas, boolean left)
- {
- Point location = figureCanvas.getViewport().getViewLocation();
- int hOffset = left ? -H_SCROLL_INCREMENT : H_SCROLL_INCREMENT;
- int x = verifyScrollBarOffset(figureCanvas.getViewport().getHorizontalRangeModel(), location.x + hOffset);
- int y = verifyScrollBarOffset(figureCanvas.getViewport().getVerticalRangeModel(), location.y);
- figureCanvas.scrollSmoothTo(x, y);
- }
-
- private void scrollPage(FigureCanvas figureCanvas, boolean up)
- {
- Rectangle clientArea = figureCanvas.getClientArea();
- int increment = up ? -clientArea.height : clientArea.height;
- Point location = figureCanvas.getViewport().getViewLocation();
- int x = verifyScrollBarOffset(figureCanvas.getViewport().getHorizontalRangeModel(), location.x);
- int y = verifyScrollBarOffset(figureCanvas.getViewport().getVerticalRangeModel(), location.y + increment);
- figureCanvas.scrollSmoothTo(x, y);
- }
-
- private void update()
- {
- StructuredSelection s = (StructuredSelection)viewer.getSelection();
- Object newSelectedEditPart = s.getFirstElement();
-
- if (newSelectedEditPart instanceof TopLevelComponentEditPart)
- {
- TopLevelComponentEditPart topLevel = (TopLevelComponentEditPart) newSelectedEditPart;
- CategoryEditPart categoryEP = (CategoryEditPart) topLevel.getParent();
- categoryEP.scrollTo(topLevel);
- viewer.reveal((TopLevelComponentEditPart)newSelectedEditPart);
- }
- }
-
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/GraphContextMenuProvider.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/GraphContextMenuProvider.java
deleted file mode 100644
index 3215418902..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/GraphContextMenuProvider.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph;
-
-import org.eclipse.gef.ContextMenuProvider;
-import org.eclipse.gef.EditPartViewer;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.wst.xsd.ui.internal.XSDMenuListener;
-import org.eclipse.wst.xsd.ui.internal.XSDTextEditor;
-
-
-public class GraphContextMenuProvider extends ContextMenuProvider
-{
-
- XSDMenuListener xsdMenuListener;
-
- /**
- * Constructor for GraphContextMenuProvider.
- * @param selectionProvider
- * @param editor
- */
- public GraphContextMenuProvider(
- EditPartViewer viewer,
- ISelectionProvider selectionProvider,
- XSDTextEditor editor)
- {
- super(viewer);
- this.viewer = viewer;
- xsdMenuListener = new XSDMenuListener(selectionProvider);
- xsdMenuListener.setSourceContext(viewer);
- }
-
- public XSDMenuListener getMenuListener()
- {
- return xsdMenuListener;
- }
-
-
- /**
- * @see org.eclipse.gef.ui.parts.ContextMenuProvider#buildContextMenu(org.eclipse.jface.action.IMenuManager, org.eclipse.gef.EditPartViewer)
- */
- public void buildContextMenu(IMenuManager arg0)
- {
- xsdMenuListener.menuAboutToShow(arg0);
- }
-
- protected EditPartViewer viewer;
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/GraphicsConstants.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/GraphicsConstants.java
deleted file mode 100644
index 691996dec0..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/GraphicsConstants.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.widgets.Display;
-
-/**
- * A collection of color-related constants.
- */
-public interface GraphicsConstants
-{
- public final static Display display = Display.getDefault();
- public final static Color categoryBorderColor = new Color(null, 118, 134, 164);
- public final static Color elementBorderColor = new Color(null, 138, 154, 184);
- public final static Color elementBackgroundColor = new Color(null, 236, 242, 252);
- public final static Color elementLabelColor = new Color(null, 80, 96, 144);
- public final static Color readOnlyBorderColor = new Color(null, 164, 164, 164);
-
- public final static Color readOnlyBackgroundColor = ColorConstants.white;
-
- public final static Font smallFont = new Font(Display.getCurrent(), "Small Fonts", 6, SWT.NONE);
- public final static Font medium = new Font(Display.getCurrent(), "Tahoma", 8, SWT.NONE);
- public final static Font mediumBoldFont = new Font(Display.getCurrent(), "Tahoma", 8, SWT.BOLD);
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/LinkedGraphViewer.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/LinkedGraphViewer.java
deleted file mode 100644
index 09645a1830..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/LinkedGraphViewer.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.gef.EditPart;
-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.swt.SWT;
-import org.eclipse.swt.custom.SashForm;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.wst.xml.core.document.XMLNode;
-import org.eclipse.wst.xsd.ui.internal.XSDEditor;
-import org.eclipse.wst.xsd.ui.internal.util.ViewUtility;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.w3c.dom.Element;
-
-
-
-public class LinkedGraphViewer
-{
-
- protected ISelectionProvider menuSelectionProvider;
- protected XSDEditor editor;
- protected BaseGraphicalViewer majorViewer, minorViewer;
-
- /**
- *
- */
- public LinkedGraphViewer(XSDEditor editor, ISelectionProvider selectionProvider)
- {
- menuSelectionProvider = selectionProvider;
- this.editor = editor;
- }
-
- public void setMajorViewer(BaseGraphicalViewer majorViewer)
- {
- this.majorViewer = majorViewer;
- }
-
- public void setMinorViewer(BaseGraphicalViewer minorViewer)
- {
- this.minorViewer = minorViewer;
- }
-
- protected Composite control;
- protected SashForm sashForm;
-
- public Control createControl(Composite parent)
- {
- //control = new Composite(parent, SWT.DEFAULT);
-
- control = sashForm = new SashForm(parent, SWT.VERTICAL | SWT.BORDER);
- sashForm.setLayoutData(ViewUtility.createFill());
-
- majorViewer.createControl(sashForm);
- minorViewer.createControl(sashForm);
-// control.setLayout(new GridLayout());
-// control.setLayoutData(ViewUtility.createFill());
- return control;
- }
-
- public void addSelectionChangedListener(ISelectionChangedListener selectionListener)
- {
- if (majorViewer != null)
- {
- majorViewer.addSelectionChangedListener(selectionListener);
- majorViewer.addSelectionChangedListener(majorViewerListener);
- }
- if (minorViewer != null)
- {
- minorViewer.addSelectionChangedListener(selectionListener);
- }
- }
-
- /**
- * @return Composite
- */
- public Composite getControl()
- {
- return control;
- }
-
- /**
- *
- */
- protected XSDConcreteComponent getInput()
- {
- return majorViewer.getInput();
- }
-
- /**
- * @param schema
- */
- protected void setInput(XSDConcreteComponent input)
- {
- majorViewer.setInput(input);
- minorViewer.setInput(input);
- }
-
- /**
- * @param component
- */
- public void setSelection(XSDConcreteComponent component)
- {
- majorViewer.setSelection(component);
- }
-
- protected MajorViewerSelectionChangedListener majorViewerListener = new MajorViewerSelectionChangedListener();
-
- private class MajorViewerSelectionChangedListener implements ISelectionChangedListener
- {
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
- */
- public void selectionChanged(SelectionChangedEvent event)
- {
- ISelection editPartSelection = event.getSelection();
- List nodeList = new ArrayList();
- if (editPartSelection instanceof IStructuredSelection)
- {
- for (Iterator i = ((IStructuredSelection)editPartSelection).iterator(); i.hasNext(); )
- {
- EditPart editPart = (EditPart)i.next();
- if (editPart != null)
- {
- Object model = editPart.getModel();
- if (model instanceof XSDConcreteComponent)
- {
- Element element = ((XSDConcreteComponent)model).getElement();
-
- // this test ensures that we don't attempt to select an element for an external schema
- //
- if (element instanceof XMLNode)
- {
- // now update the minor viewer based on the selected component in the major viewer
- minorViewer.setInput((XSDConcreteComponent)model);
- minorViewer.setSelection((XSDConcreteComponent)model);
- }
- }
- }
- }
- }
- }
-
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/PrintGraphAction.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/PrintGraphAction.java
deleted file mode 100644
index 53df913a12..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/PrintGraphAction.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.ImageData;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.printing.PrintDialog;
-import org.eclipse.swt.printing.Printer;
-import org.eclipse.swt.printing.PrinterData;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-
-
-public class PrintGraphAction extends Action
-{
- protected XSDComponentViewer componentViewer;
-
- public PrintGraphAction(XSDComponentViewer componentViewer)
- {
- super("Print");
- this.componentViewer = componentViewer;
- }
-
- public void run()
- {
- try
- {
- PrintDialog dialog = new PrintDialog(Display.getCurrent().getActiveShell());
- PrinterData data = dialog.open();
- Printer printer = new Printer(data);
-
- Control control = componentViewer.getControl();
- Display display = Display.getCurrent();
- Image graphImage = new Image(display, control.getSize().x, control.getSize().y);
- GC graphGC = new GC(control);
- graphGC.copyArea(graphImage, 0, 0);
-
- ImageData graphImageData = graphImage.getImageData();
- graphImageData.transparentPixel = -1;
-
- Point screenDPI = display.getDPI();
- Point printerDPI = printer.getDPI();
- int scaleFactor = printerDPI.x / screenDPI.x;
- Rectangle trim = printer.computeTrim(0, 0, 0, 0);
- if (printer.startJob("Print XML Schema Graph"))
- {
- GC gc = new GC(printer);
- if (printer.startPage())
- {
- gc.drawImage(
- graphImage,
- 0,
- 0,
- graphImageData.width,
- graphImageData.height,
- -trim.x,
- -trim.y,
- scaleFactor * graphImageData.width,
- scaleFactor * graphImageData.height);
- printer.endPage();
- }
- printer.endJob();
- }
- printer.dispose();
- graphGC.dispose();
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/XSDChildUtility.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/XSDChildUtility.java
deleted file mode 100644
index 887889cc36..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/XSDChildUtility.java
+++ /dev/null
@@ -1,285 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.xsd.XSDAttributeUse;
-import org.eclipse.xsd.XSDComplexTypeDefinition;
-import org.eclipse.xsd.XSDElementDeclaration;
-import org.eclipse.xsd.XSDModelGroup;
-import org.eclipse.xsd.XSDModelGroupDefinition;
-import org.eclipse.xsd.XSDParticle;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.XSDTypeDefinition;
-import org.eclipse.xsd.XSDWildcard;
-import org.eclipse.xsd.util.XSDSwitch;
-
-
-public class XSDChildUtility
-{
- static public List getModelChildren(Object model)
- {
- XSDChildVisitor visitor = new XSDChildVisitor(model);
- visitor.visitXSDObject(model);
- return visitor.list;
- }
-
- static public List getImmediateDerivedTypes(XSDComplexTypeDefinition complexType)
- {
- ArrayList typesDerivedFrom = new ArrayList();
-
- // A handy convenience method quickly gets all
- // typeDefinitions within our schema; note that
- // whether or not this returns types in included,
- // imported, or redefined schemas is subject to change
- List typedefs = complexType.getSchema().getTypeDefinitions();
-
- for (Iterator iter = typedefs.iterator(); iter.hasNext(); )
- {
- XSDTypeDefinition typedef = (XSDTypeDefinition)iter.next();
- // Walk the baseTypes from this typedef seeing if any
- // of them match the requested one
- if (complexType.equals(typedef.getBaseType()))
- {
- // We found it, return the original one and continue
- typesDerivedFrom.add(typedef);
- }
- }
- return typesDerivedFrom;
- }
- // TODO... use the XSDVisitor defined in xsdeditor.util instead
- //
- public static class XSDChildVisitor extends XSDVisitor
- {
- Object root;
- List list = new ArrayList();
-
- public XSDChildVisitor(Object root)
- {
- this.root = root;
- }
-
- public void visitXSDModelGroup(XSDModelGroup xsdModelGroup)
- {
- if (xsdModelGroup != root)
- {
- list.add(xsdModelGroup);
- }
- else
- {
- super.visitXSDModelGroup(xsdModelGroup);
- }
- }
-
- public void visitXSDModelGroupDefinition(XSDModelGroupDefinition xsdModelGroupDefinition)
- {
- if (xsdModelGroupDefinition != root)
- {
- list.add(xsdModelGroupDefinition);
- }
- else
- {
- super.visitXSDModelGroupDefinition(xsdModelGroupDefinition);
- }
- }
-
- public void visitXSDElementDeclaration(XSDElementDeclaration xsdElementDeclaration)
- {
- if (xsdElementDeclaration != root)
- {
- list.add(xsdElementDeclaration);
- }
- else
- {
- super.visitXSDElementDeclaration(xsdElementDeclaration);
- }
- }
-
- public void visitXSDComplexTypeDefinition(XSDComplexTypeDefinition xsdComplexTypeDefinition)
- {
- if (xsdComplexTypeDefinition != root)
- {
- if (xsdComplexTypeDefinition.getName() != null || getModelChildren(xsdComplexTypeDefinition).size() > 0)
- {
- list.add(xsdComplexTypeDefinition);
- }
- }
- else
- {
- super.visitXSDComplexTypeDefinition(xsdComplexTypeDefinition);
- }
- }
-
- public void visitXSDWildcard(XSDWildcard xsdWildCard)
- {
- if (xsdWildCard != root)
- {
- list.add(xsdWildCard);
- }
- else
- {
- super.visitXSDWildcard(xsdWildCard);
- }
- }
- }
-
-
- public static class XSDVisitor
- {
- int indent = 0;
-
- public void visitXSDObject(Object object)
- {
- if (object == null)
- return;
-
- XSDSwitch theSwitch = new XSDSwitch()
- {
- public Object caseXSDComplexTypeDefinition(XSDComplexTypeDefinition object)
- {
- visitXSDComplexTypeDefinition(object);
- return null;
- }
-
- public Object caseXSDAttributeUse(XSDAttributeUse object)
- {
- visitXSDAttributeUse(object);
- return null;
- }
-
- public Object caseXSDElementDeclaration(XSDElementDeclaration object)
- {
- visitXSDElementDeclaration(object);
- return null;
- }
-
- public Object caseXSDModelGroupDefinition(XSDModelGroupDefinition object)
- {
- visitXSDModelGroupDefinition(object);
- return super.caseXSDModelGroupDefinition(object);
- }
-
- public Object caseXSDModelGroup(XSDModelGroup object)
- {
- visitXSDModelGroup(object);
- return super.caseXSDModelGroup(object);
- }
-
- public Object caseXSDParticle(XSDParticle object)
- {
- visitXSDParticle(object);
- return null;
- }
-
- public Object caseXSDSchema(XSDSchema object)
- {
- visitXSDSchema(object);
- return null;
- }
-
- public Object caseXSDWildcard(XSDWildcard object)
- {
- visitXSDWildcard(object);
- return null;
- }
- };
- theSwitch.doSwitch((EObject)object);
- }
-
- public void visitXSDAttributeUse(XSDAttributeUse xsdAttributeUse)
- {
-// printIndented("@" + xsdAttributeUse.getAttributeDeclaration().getName());
- }
-
- public void visitXSDSchema(XSDSchema xsdSchema)
- {
-// printIndented("XSDSchema");
- indent += 2;
- for (Iterator iterator = xsdSchema.getElementDeclarations().iterator(); iterator.hasNext(); )
- {
- visitXSDObject(iterator.next());
- }
- indent -= 2;
- }
-
- public void visitXSDElementDeclaration(XSDElementDeclaration xsdElementDeclaration)
- {
-// printIndented(xsdElementDeclaration.getName());
- indent += 2;
- XSDTypeDefinition td = xsdElementDeclaration.getTypeDefinition();
- if (td == null)
- {
- td = xsdElementDeclaration.getAnonymousTypeDefinition();
- }
- visitXSDObject(td);
- indent -= 2;
- }
-
- public void visitXSDComplexTypeDefinition(XSDComplexTypeDefinition xsdComplexTypeDefinition)
- {
-// printIndented("XSDComplexTypeDefinition : " + xsdComplexTypeDefinition.getContent());
- indent += 2;
- for (Iterator i = xsdComplexTypeDefinition.getAttributeUses().iterator(); i.hasNext(); )
- {
- visitXSDObject((XSDAttributeUse)i.next());
- }
- visitXSDObject(xsdComplexTypeDefinition.getContent());
- indent -= 2;
- }
-
- public void visitXSDModelGroup(XSDModelGroup xsdModelGroup)
- {
-// printIndented("XSDModelGroup");
- indent += 2;
- for (Iterator iterator = xsdModelGroup.getContents().iterator(); iterator.hasNext(); )
- {
- visitXSDObject(iterator.next());
- }
- indent -= 2;
- }
-
- public void visitXSDModelGroupDefinition(XSDModelGroupDefinition xsdModelGroupDefinition)
- {
-// printIndented("XSDModelGroupDefinition");
- indent += 2;
- visitXSDObject(xsdModelGroupDefinition.getResolvedModelGroupDefinition().getModelGroup());
- indent -= 2;
- }
-
- public void visitXSDParticle(XSDParticle xsdParticle)
- {
-// printIndented("XSDParticle");
- indent += 2;
- if (xsdParticle.getContent() != null)
- visitXSDObject(xsdParticle.getContent());
- indent -= 2;
- }
-
- public void visitXSDWildcard(XSDWildcard object)
- {
-// printIndented("XSDWildcard");
- }
-
- public void printIndented(String string)
- {
- //String spaces = "";
- //for (int i = 0; i < indent; i++)
- //{
- // spaces += " ";
- //}
- //System.out.println(spaces + string);
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/XSDComponentViewer.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/XSDComponentViewer.java
deleted file mode 100644
index c5aa0b2a6d..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/XSDComponentViewer.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.draw2d.geometry.Rectangle;
-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.wst.xsd.ui.internal.XSDEditor;
-import org.eclipse.wst.xsd.ui.internal.graph.editparts.ComponentViewerRootEditPart;
-import org.eclipse.xsd.XSDComplexTypeDefinition;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDElementDeclaration;
-import org.eclipse.xsd.XSDModelGroup;
-import org.eclipse.xsd.XSDModelGroupDefinition;
-import org.eclipse.xsd.XSDSchema;
-
-
-public class XSDComponentViewer extends BaseGraphicalViewer
-{
- protected ComponentViewerRootEditPart componentViewerRootEditPart;
- public XSDComponentViewer(XSDEditor editor, ISelectionProvider menuSelectionProvider)
- {
- super(editor, menuSelectionProvider);
- }
-
- public void setInput(XSDConcreteComponent component)
- {
- if (isInputEnabled)
- {
- input = null;
-
- if (component instanceof XSDElementDeclaration ||
- component instanceof XSDSchema ||
- component instanceof XSDModelGroup ||
- component instanceof XSDModelGroupDefinition ||
- component instanceof XSDComplexTypeDefinition)
- {
- input = component;
- }
-
- componentViewerRootEditPart.setInput(input);
- if (!(input instanceof XSDSchema))
- {
- editor.getGraphViewer().backButton.setEnabled(true);
- }
- }
- }
-
- public void setSelection(XSDConcreteComponent component)
- {
- if (isSelectionEnabled)
- {
- //System.out.println("XSDComponentViewer.setSelection(" + component + ")");
- List editPartList = new ArrayList();
- StructuredSelection selection = new StructuredSelection();
- if (component instanceof XSDElementDeclaration ||
- component instanceof XSDSchema ||
- component instanceof XSDModelGroup ||
- component instanceof XSDModelGroupDefinition ||
- component instanceof XSDComplexTypeDefinition)
- {
- if (component != null)
- {
- EditPart editPart = getEditPart(componentViewerRootEditPart, component);
- if (editPart != null)
- {
- // TODO ... take a look at this to figure our why a newly added component
- // seems to have the wrong bounds at this point... is this a layout issue?
- // As a temp hack I'm ignoring the selection of component with bounds (x, y) == (0, 0)
- // Perhaps a delayed selection is required?
- Rectangle bounds = ((GraphicalEditPart)editPart).getFigure().getBounds();
- if (bounds.x > 0 || bounds.y > 0)
- {
- editPartList.add(editPart);
- }
- }
- }
- }
- setSelection(new StructuredSelection(editPartList));
- }
- }
- /* (non-Javadoc)
- * @see org.eclipse.gef.ui.parts.AbstractEditPartViewer#hookControl()
- */
- protected void hookControl()
- {
- super.hookControl();
- componentViewerRootEditPart = new ComponentViewerRootEditPart();
- setContents(componentViewerRootEditPart);
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/XSDGraphUtil.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/XSDGraphUtil.java
deleted file mode 100644
index a19f20b5c4..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/XSDGraphUtil.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph;
-
-import org.eclipse.wst.xml.core.document.XMLNode;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.w3c.dom.Element;
-
-
-public class XSDGraphUtil
-{
- public static boolean isEditable(Object model)
- {
- boolean result = false;
- if (model instanceof XSDConcreteComponent)
- {
- Element element = ((XSDConcreteComponent)model).getElement();
- // this test ensures that we don't attempt to select an element for an external schema
- //
- if (element instanceof XMLNode)
- {
- result = true;
- }
- }
- return result;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/XSDGraphViewer.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/XSDGraphViewer.java
deleted file mode 100644
index a15cfc71c7..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/XSDGraphViewer.java
+++ /dev/null
@@ -1,598 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.gef.EditPart;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.SashForm;
-import org.eclipse.swt.custom.ViewForm;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.TraverseEvent;
-import org.eclipse.swt.events.TraverseListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.swt.widgets.ToolBar;
-import org.eclipse.swt.widgets.ToolItem;
-import org.eclipse.ui.part.PageBook;
-import org.eclipse.wst.xsd.ui.internal.XSDEditor;
-import org.eclipse.wst.xsd.ui.internal.XSDEditorPlugin;
-import org.eclipse.wst.xsd.ui.internal.XSDSelectionManager;
-import org.eclipse.wst.xsd.ui.internal.graph.editparts.TopLevelComponentEditPart;
-import org.eclipse.wst.xsd.ui.internal.provider.CategoryAdapter;
-import org.eclipse.wst.xsd.ui.internal.util.ViewUtility;
-import org.eclipse.xsd.XSDAttributeGroupContent;
-import org.eclipse.xsd.XSDAttributeGroupDefinition;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDNotationDeclaration;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.XSDSchemaDirective;
-import org.eclipse.xsd.XSDSimpleTypeDefinition;
-import org.eclipse.xsd.XSDWildcard;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.Text;
-public class XSDGraphViewer implements ISelectionChangedListener
-{
- protected PageBook pageBook;
- protected Control componentViewerControl;
- protected Control inheritanceViewerControl;
- protected Control subGroupsViewerControl;
- protected XSDComponentViewer componentViewer;
- protected XSDInheritanceViewer inheritanceViewer;
- protected XSDSubstitutionGroupsViewer subGroupsViewer;
- protected XSDSelectionManager xsdSelectionManager;
- protected XSDSchema schema;
- protected InternalSelectionProvider internalSelectionProvider = new InternalSelectionProvider();
- protected XSDEditor editor;
- protected PrintGraphAction printGraphAction;
- protected SashForm sashForm;
- protected ToolItem backButton;
-
- public XSDGraphViewer(XSDEditor editor)
- {
- super();
- this.editor = editor;
- }
-
- public void setSchema(XSDSchema schema)
- {
- this.schema = schema;
- }
- ToolBar graphToolBar; // the toolbar at the top of the graph view
- ToolItem toolItem; // the view tool item
- ViewForm form; // view form for holding all the views
- Composite frameBar; // The composite that contains the toolbar
- Composite c; // temporary blank page. Clean this up when all views completed
- LinkedGraphViewer linkInheritanceViewer;
-
- protected void createInheritanceViewer(Composite parent)
- {
- linkInheritanceViewer = new LinkedGraphViewer(editor, internalSelectionProvider);
- BaseGraphicalViewer graphViewer = new XSDInheritanceViewer(editor, internalSelectionProvider);
- linkInheritanceViewer.setMajorViewer(graphViewer);
- graphViewer = new XSDComponentViewer(editor, editor.getSelectionManager());
- linkInheritanceViewer.setMinorViewer(graphViewer);
- linkInheritanceViewer.createControl(parent);
- }
- LinkedGraphViewer linkSubstitutionGroupViewer;
-
- protected void createSubstitutionGroupViewer(Composite parent)
- {
- linkSubstitutionGroupViewer = new LinkedGraphViewer(editor, internalSelectionProvider);
- BaseGraphicalViewer graphViewer = new XSDSubstitutionGroupsViewer(editor, internalSelectionProvider);
- linkSubstitutionGroupViewer.setMajorViewer(graphViewer);
- graphViewer = new XSDComponentViewer(editor, internalSelectionProvider);
- linkSubstitutionGroupViewer.setMinorViewer(graphViewer);
- linkSubstitutionGroupViewer.createControl(parent);
- }
- static private Color dividerColor;
-
- public Control createControl(Composite parent)
- {
- pageBook = new PageBook(parent, 0);
-
- //componentViewer = new XSDComponentViewer(editor, internalSelectionProvider);
- componentViewer = new XSDComponentViewer(editor, editor.getSelectionManager());
- ViewUtility util = new ViewUtility();
- final Composite client;
- String designLayoutPosition = XSDEditorPlugin.getPlugin().getDesignLayoutPosition();
- form = new ViewForm(pageBook, SWT.NONE);
- frameBar = new Composite(form, SWT.NONE);
- org.eclipse.swt.layout.GridLayout frameLayout = new org.eclipse.swt.layout.GridLayout();
- frameLayout.marginWidth = 0;
- frameLayout.marginHeight = 0;
- frameBar.setLayout(frameLayout);
- graphToolBar = new ToolBar(frameBar, SWT.FLAT);
- graphToolBar.addTraverseListener(new TraverseListener()
- {
- public void keyTraversed(TraverseEvent e)
- {
- if (e.detail == SWT.TRAVERSE_MNEMONIC)
- e.doit = false;
- }
- });
- backButton = new ToolItem(graphToolBar, SWT.PUSH);
- backButton.setImage(XSDEditorPlugin.getXSDImage("icons/back.gif")); //$NON-NLS-1$
- backButton.setToolTipText(XSDEditorPlugin.getXSDString("_UI_HOVER_BACK_TO_SCHEMA_VIEW")); //$NON-NLS-1$
- backButton.setEnabled(false);
- backButton.addSelectionListener(new SelectionAdapter()
- {
- public void widgetSelected(SelectionEvent e)
- {
- editor.getGraphViewer().setInput(editor.getXSDSchema());
- // internalSelectionProvider.setSelection(new StructuredSelection(editor.getXSDSchema()));
- editor.getSelectionManager().setSelection(new StructuredSelection(editor.getXSDSchema()));
- }
- });
- // TEMPORARILY REMOVE DIFFERENT VIEWS
- // toolItem = new ToolItem(graphToolBar, SWT.DROP_DOWN);
- //
- // // set default to containment
- //// toolItem.setText(XSDEditorPlugin.getXSDString("_UI_CONTAINMENT"));
- // toolItem.addSelectionListener(new SelectionAdapter()
- // {
- // public void widgetSelected(SelectionEvent e)
- // {
- // Menu menu = new Menu(graphToolBar);
- // if (menu != null)
- // {
- // if (!showGraphMenu(menu))
- // {
- // frameBar.setVisible(false);
- // return;
- // }
- // Rectangle b = toolItem.getBounds();
- // org.eclipse.swt.graphics.Point p = toolItem.getParent().toDisplay(new
- // org.eclipse.swt.graphics.Point(b.x, b.y + b.height));
- // menu.setLocation(p.x, p.y);
- // menu.setVisible(true);
- // }
- // }
- // });
- form.setTopLeft(frameBar);
- // createInheritanceViewer(form);
- // createSubstitutionGroupViewer(form);
- componentViewerControl = componentViewer.createControl(form);
- //inheritanceViewerControl = inheritanceViewer.createControl(form);
- //subGroupsViewerControl = subGroupsViewer.createControl(form);
- c = ViewUtility.createComposite(form, 1);
- form.setContent(componentViewerControl);
- // componentViewerControl.setData("layout ratio", new Float(0.65));
- form.setData("layout ratio", new Float(0.65));
- if (dividerColor == null)
- {
- dividerColor = new Color(componentViewerControl.getDisplay(), 143, 141, 138);
- }
- //KCPort
- // client.addPaintListener(new PaintListener()
- // {
- // /**
- // * @see org.eclipse.swt.events.PaintListener#paintControl(PaintEvent)
- // */
- // public void paintControl(PaintEvent e)
- // {
- // Object source = e.getSource();
- // if (source instanceof Composite)
- // {
- // Composite comp = (Composite)source;
- // Rectangle boundary = comp.getClientArea();
- // e.gc.setForeground(dividerColor);
- // e.gc.drawLine(boundary.x, boundary.y, boundary.x + boundary.width,
- // boundary.y);
- // editor.setDesignWeights(sashForm.getWeights(), true);
- // }
- // }
- // });
- // KCPort
- // designView = new DesignViewer(editor);
- // final Control design = designView.createControl(client);
- // design.setLayoutData(ViewUtility.createFill());
- // client.setData("layout ratio", new Float(0.35));
- // enableDesignView(editor.isCombinedDesignAndSourceView());
- // pageBook.showPage(sashForm);
- pageBook.showPage(form);
- componentViewer.addSelectionChangedListener(internalSelectionProvider);
- //inheritanceViewer.addSelectionChangedListener(this);
- // Temporarily remove graph tool bar
- // linkInheritanceViewer.addSelectionChangedListener(this);
- // linkSubstitutionGroupViewer.addSelectionChangedListener(this);
- printGraphAction = new PrintGraphAction(componentViewer);
- return pageBook;
- // return form;
- }
-
- private boolean showGraphMenu(Menu menu)
- {
- MenuItem containmentMenuItem = new MenuItem(menu, SWT.RADIO);
- containmentMenuItem.setText(XSDEditorPlugin.getXSDString("_UI_CONTAINMENT"));
- containmentMenuItem.addSelectionListener(new SelectionAdapter()
- {
- public void widgetSelected(SelectionEvent e)
- {
- toolItem.setText(XSDEditorPlugin.getXSDString("_UI_CONTAINMENT"));
- frameBar.layout(true);
- graphToolBar.layout(true);
- form.setContent(componentViewerControl);
- // retrieve latest input which could have changed...from designView ??
- // get it directly?
- // KCPort
- // setInput(designView.getInput());
- }
- });
- MenuItem inheritanceMenuItem = new MenuItem(menu, SWT.RADIO);
- inheritanceMenuItem.setText(XSDEditorPlugin.getXSDString("_UI_INHERITANCE"));
- inheritanceMenuItem.addSelectionListener(new SelectionAdapter()
- {
- public void widgetSelected(SelectionEvent e)
- {
- toolItem.setText(XSDEditorPlugin.getXSDString("_UI_INHERITANCE"));
- frameBar.layout(true);
- graphToolBar.layout(true);
- // form.setContent(inheritanceViewerControl);
- form.setContent(linkInheritanceViewer.getControl());
- if (linkInheritanceViewer.getInput() == null)
- {
- linkInheritanceViewer.setInput(schema);
- }
- }
- });
- MenuItem subGroupsMenuItem = new MenuItem(menu, SWT.RADIO);
- subGroupsMenuItem.setText(XSDEditorPlugin.getXSDString("_UI_SUBSTITUTION_GROUPS"));
- subGroupsMenuItem.addSelectionListener(new SelectionAdapter()
- {
- public void widgetSelected(SelectionEvent e)
- {
- toolItem.setText(XSDEditorPlugin.getXSDString("_UI_SUBSTITUTION_GROUPS"));
- frameBar.layout(true);
- graphToolBar.layout(true);
- form.setContent(linkSubstitutionGroupViewer.getControl());
- // retrieve latest input which could have changed...from designView ??
- // get it directly?
- // setInput(designView.getInput());
- if (linkSubstitutionGroupViewer.getInput() == null)
- {
- linkSubstitutionGroupViewer.setInput(schema);
- }
- }
- });
- if (toolItem.getText().equals(XSDEditorPlugin.getXSDString("_UI_CONTAINMENT")))
- {
- containmentMenuItem.setSelection(true);
- }
- else if (toolItem.getText().equals(XSDEditorPlugin.getXSDString("_UI_INHERITANCE")))
- {
- inheritanceMenuItem.setSelection(true);
- }
- else if (toolItem.getText().equals(XSDEditorPlugin.getXSDString("_UI_SUBSTITUTION_GROUPS")))
- {
- subGroupsMenuItem.setSelection(true);
- }
- return true;
- }
-
- public Action getPrintGraphAction()
- {
- return printGraphAction;
- }
-
- public void updateDesignLayout(int newLayout)
- {
- sashForm.setOrientation(newLayout);
- sashForm.layout();
- }
-
- public SashForm getSashForm()
- {
- return sashForm;
- }
-
- public void enableDesignView(boolean enable)
- {
- }
-
- public XSDComponentViewer getComponentViewer()
- {
- return componentViewer;
- }
-
- public void setBackButtonEnabled(boolean state)
- {
- backButton.setEnabled(state);
- }
-
- public void setInput(Object object)
- {
- if (object instanceof XSDConcreteComponent)
- {
- XSDConcreteComponent xsdComp = (XSDConcreteComponent) object;
- if (xsdComp instanceof XSDSchema)
- {
- setBackButtonEnabled(false);
- }
- else
- {
- setBackButtonEnabled(true);
- }
- componentViewer.setInput(xsdComp);
- componentViewer.setSelection(xsdComp);
- }
- }
-
- protected boolean isDeleted(XSDConcreteComponent component)
- {
- boolean result = false;
- if (component != null && component.getElement() != null)
- {
- result = component.getElement().getParentNode() == null;
- }
- return result;
- }
-
- public void setSelectionManager(XSDSelectionManager newSelectionManager)
- {
- // disconnect from old one
- if (xsdSelectionManager != null)
- {
- xsdSelectionManager.removeSelectionChangedListener(this);
- internalSelectionProvider.removeSelectionChangedListener(xsdSelectionManager);
- }
- xsdSelectionManager = newSelectionManager;
- // connect to new one
- if (xsdSelectionManager != null)
- {
- xsdSelectionManager.addSelectionChangedListener(this);
- internalSelectionProvider.addSelectionChangedListener(xsdSelectionManager);
- }
- }
-
- // this method is called by the SelectionManager to notify the graph view
- // that the editor selection has changed
- //
- public void selectionChanged(SelectionChangedEvent event)
- {
- // here we check the selection source to ensure that this selection came
- // from a different view (not from the graph view)
- if (event.getSource() != getComponentViewer())
- {
- handleSelection(event, true);
- }
- }
-
- protected XSDConcreteComponent getTopLevelComponent(XSDConcreteComponent component)
- {
- XSDConcreteComponent prev = component;
- XSDConcreteComponent container = component;
- while ( container != null && !(container instanceof XSDSchema))
- {
- prev = container;
- container = container.getContainer();
- }
- return container != null ? prev : null;
- }
-
- // TODO.. we need to clean this method up and add comments to clarify what's going on
- //
- protected void handleSelection(SelectionChangedEvent event, boolean isSelectionRequired)
- {
- StructuredSelection s = (StructuredSelection)event.getSelection();
- Object obj = s.getFirstElement();
- if (obj instanceof XSDConcreteComponent)
- {
- XSDConcreteComponent selectedComponent = (XSDConcreteComponent)obj;
- Object currentInput = getComponentViewer().getInput();
-
- // in this case we're looking at a top level view
- // so if the selection is a 'non-top-level' component we need to do a set input
- XSDSchema topLevelSchema = null;
- if (currentInput instanceof XSDSchema)
- {
- if (selectedComponent instanceof XSDSchema ||
- selectedComponent.getContainer() instanceof XSDSchema)
- {
- topLevelSchema = (XSDSchema)currentInput;
- }
- }
- if (selectedComponent instanceof XSDSchemaDirective ||
- selectedComponent instanceof XSDNotationDeclaration)
- {
- topLevelSchema = selectedComponent.getSchema();
- }
- else if (selectedComponent instanceof XSDAttributeGroupContent ||
- selectedComponent instanceof XSDWildcard)
- {
- if (selectedComponent.getContainer() instanceof XSDAttributeGroupDefinition)
- {
- topLevelSchema = selectedComponent.getSchema();
- }
- }
- else if (selectedComponent instanceof XSDSimpleTypeDefinition)
- {
- XSDSimpleTypeDefinition st = (XSDSimpleTypeDefinition)selectedComponent;
- EditPart editPart = componentViewer.getEditPart(componentViewer.getRootEditPart(), st);
- if (editPart == null)
- {
- if (st.getContainer() == editor.getXSDSchema())
- {
- topLevelSchema = selectedComponent.getSchema();
- }
- }
- }
-
- if (topLevelSchema != null)
- {
- setInput(topLevelSchema);
- // TODO... this is not 'quite' right
- // it should be possible to view in
- }
- else
- {
- EditPart editPart = getComponentViewer().getEditPart(getComponentViewer().getRootEditPart(), obj);
- if (editPart == null)
- {
- XSDConcreteComponent topLevelComponent = getTopLevelComponent(selectedComponent);
- if (topLevelComponent != null)
- {
- setInput(topLevelComponent);
- }
- }
- }
- // now we handle the selection
- //
- if (isSelectionRequired)
- {
- EditPart editPart = getComponentViewer().getRootEditPart();
- EditPart newSelectedEditPart = getComponentViewer().getEditPart(editPart, obj);
- if (newSelectedEditPart != null)
- {
- if (newSelectedEditPart instanceof TopLevelComponentEditPart)
- {
- ((TopLevelComponentEditPart)newSelectedEditPart).setScroll(true);
- }
- getComponentViewer().setSelection(new StructuredSelection(newSelectedEditPart));
- }
- }
- }
- else if (obj instanceof CategoryAdapter)
- {
- setInput(((CategoryAdapter)obj).getXSDSchema());
- }
- }
-
- protected Element getElementNode(Node node)
- {
- while (!(node instanceof Element))
- {
- if (node instanceof Attr)
- {
- node = ((Attr) node).getOwnerElement();
- }
- else if (node instanceof Text)
- {
- Node sibling = node.getNextSibling();
- if (sibling == null)
- {
- break;
- }
- node = sibling;
- }
- else
- {
- Node parent = node.getParentNode();
- if (parent == null)
- {
- break;
- }
- node = node.getParentNode();
- }
- }
- return node instanceof Element ? (Element) node : null;
- }
-
-
-
- // This class listens to the graph view and converts edit part selection
- // events
- // into XSD component selection events that can be 'fired' to the
- // selectionManager
- //
- class InternalSelectionProvider implements ISelectionProvider, ISelectionChangedListener
- {
- protected List listenerList = new ArrayList();
- protected ISelection selection = new StructuredSelection();
-
- public void addSelectionChangedListener(ISelectionChangedListener listener)
- {
- listenerList.add(listener);
- }
-
- public void removeSelectionChangedListener(ISelectionChangedListener listener)
- {
- listenerList.remove(listener);
- }
-
- public ISelection getSelection()
- {
- return selection;
- }
-
- protected void notifyListeners(SelectionChangedEvent event)
- {
- for (Iterator i = listenerList.iterator(); i.hasNext();)
- {
- ISelectionChangedListener listener = (ISelectionChangedListener) i.next();
- listener.selectionChanged(event);
- }
- }
-
- public StructuredSelection convertSelectionFromEditPartToModel(ISelection editPartSelection)
- {
- List selectedModelObjectList = new ArrayList();
- if (editPartSelection instanceof IStructuredSelection)
- {
- for (Iterator i = ((IStructuredSelection) editPartSelection).iterator(); i.hasNext();)
- {
- Object obj = i.next();
- Object model = null;
- if (obj instanceof EditPart)
- {
- EditPart editPart = (EditPart) obj;
- model = editPart.getModel();
- // Convert category to XSDSchema
- // if (editPart instanceof CategoryEditPart)
- // {
- // model = ((Category)((CategoryEditPart)editPart).getModel()).getXSDSchema();
- // }
- }
- else if (obj instanceof XSDConcreteComponent)
- {
- //cs .. not sure why would we'd ever hit this case?
- model = obj;
- }
- if (model != null)//&& model instanceof XSDConcreteComponent)
- {
- selectedModelObjectList.add(model);
- }
- }
- }
- return new StructuredSelection(selectedModelObjectList);
- }
-
- public void setSelection(ISelection selection)
- {
- this.selection = selection;
- }
-
- // This method gets called when an edit part in the graph view is selected
- //
- public void selectionChanged(SelectionChangedEvent event)
- {
- ISelection newSelection = convertSelectionFromEditPartToModel(event.getSelection());
- this.selection = newSelection;
- SelectionChangedEvent newEvent = new SelectionChangedEvent(getComponentViewer(), newSelection);
- notifyListeners(newEvent);
- }
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/XSDGraphicalViewerKeyHandler.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/XSDGraphicalViewerKeyHandler.java
deleted file mode 100644
index b6c80263ec..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/XSDGraphicalViewerKeyHandler.java
+++ /dev/null
@@ -1,352 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph;
-import java.lang.ref.WeakReference;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.PositionConstants;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.ConnectionEditPart;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gef.GraphicalViewer;
-import org.eclipse.gef.KeyHandler;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.wst.xsd.ui.internal.graph.editparts.ExpandableGraphNodeEditPart;
-
-
-public class XSDGraphicalViewerKeyHandler extends KeyHandler
-{
- public XSDGraphicalViewerKeyHandler(GraphicalViewer viewer)
- {
- this.viewer = viewer;
- }
-
- private WeakReference cachedNode;
- int counter;
- private GraphicalViewer viewer;
-
- private boolean acceptConnection(KeyEvent event)
- {
- return event.character == '/'
- || event.character == '?'
- || event.character == '\\'
- || event.character == '|';
- }
- private boolean acceptIntoContainer(KeyEvent event)
- {
- return (((event.stateMask & SWT.ALT) != 0)
- && (event.keyCode == SWT.ARROW_RIGHT)) || (event.keyCode == SWT.ARROW_RIGHT);
-// return (event.keyCode == SWT.ARROW_RIGHT);
- }
- private boolean acceptLeaveConnection(KeyEvent event)
- {
- int key = event.keyCode;
- if (getFocus() instanceof ConnectionEditPart)
- if ((key == SWT.ARROW_UP)
- || (key == SWT.ARROW_RIGHT)
- || (key == SWT.ARROW_DOWN)
- || (key == SWT.ARROW_LEFT))
- return true;
- return false;
- }
- private boolean acceptLeaveContents(KeyEvent event)
- {
- int key = event.keyCode;
- return getFocus() == getViewer().getContents()
- && ((key == SWT.ARROW_UP)
- || (key == SWT.ARROW_RIGHT)
- || (key == SWT.ARROW_DOWN)
- || (key == SWT.ARROW_LEFT));
- }
- private boolean acceptOutOf(KeyEvent event)
- {
- return (((event.stateMask & SWT.ALT) != 0) && (event.keyCode == SWT.ARROW_LEFT)) || (event.keyCode == SWT.ARROW_LEFT);
-// return (event.keyCode == SWT.ARROW_LEFT);
- }
- private ConnectionEditPart findConnection(
- GraphicalEditPart node,
- ConnectionEditPart current,
- boolean forward)
- {
- List connections = new ArrayList(node.getSourceConnections());
- connections.addAll(node.getTargetConnections());
- if (connections.isEmpty())
- return null;
- if (forward)
- counter++;
- else
- counter--;
- while (counter < 0)
- counter += connections.size();
- counter %= connections.size();
- return (ConnectionEditPart) connections.get(counter % connections.size());
- }
- /*
- * pStart is a point in absolute coordinates.
- */
- private GraphicalEditPart findSibling(
- List siblings,
- Point pStart,
- int direction,
- EditPart exclude)
- {
- GraphicalEditPart epCurrent;
- GraphicalEditPart epFinal = null;
- IFigure figure;
- Point pCurrent;
- int distance = Integer.MAX_VALUE;
- Iterator iter = siblings.iterator();
- while (iter.hasNext())
- {
- epCurrent = (GraphicalEditPart) iter.next();
- if (epCurrent == exclude)
- continue;
- figure = epCurrent.getFigure();
- pCurrent = getInterestingPoint(figure);
- figure.translateToAbsolute(pCurrent);
- if (pStart.getPosition(pCurrent) != direction)
- continue;
- int d = pCurrent.getDistanceOrthogonal(pStart);
- if (d < distance)
- {
- distance = d;
- epFinal = epCurrent;
- }
- }
- return epFinal;
- }
- Point getInterestingPoint(IFigure figure)
- {
-// return figure.getBounds().getCenter();
- return figure.getBounds().getTopLeft();
- }
- /**
- * Returns the cached node. It is possible that the node is not longer in the viewer but has
- * not been garbage collected yet.
- */
- private GraphicalEditPart getCachedNode()
- {
- if (cachedNode == null)
- return null;
- if (cachedNode.isEnqueued())
- return null;
- return (GraphicalEditPart) cachedNode.get();
- }
- GraphicalEditPart getFocus()
- {
- return (GraphicalEditPart) getViewer().getFocusEditPart();
- }
- List getNavigationSiblings()
- {
- return getFocus().getParent().getChildren();
- }
- protected GraphicalViewer getViewer()
- {
- return viewer;
- }
- public boolean keyPressed(KeyEvent event)
- {
- if (event.character == ' ')
- {
- processSelect(event);
- return true;
- }
- else if (acceptIntoContainer(event))
- {
- navigateIntoContainer(event);
- return true;
- }
- else if (acceptOutOf(event))
- {
- navigateOut(event);
- return true;
- }
- else if (acceptConnection(event))
- {
- navigateConnections(event);
- return true;
- }
- else if (acceptLeaveConnection(event))
- {
- navigateOutOfConnection(event);
- return true;
- }
- else if (acceptLeaveContents(event))
- {
- navigateIntoContainer(event);
- return true;
- }
- switch (event.keyCode)
- {
- case SWT.ARROW_LEFT :
- return navigateNextSibling(event, PositionConstants.WEST);
- case SWT.ARROW_RIGHT :
- return navigateNextSibling(event, PositionConstants.EAST);
- case SWT.ARROW_UP :
- return navigateNextSibling(event, PositionConstants.NORTH);
- case SWT.ARROW_DOWN :
- return navigateNextSibling(event, PositionConstants.SOUTH);
- case SWT.HOME :
- return navigateJumpSibling(event, PositionConstants.WEST);
- case SWT.END :
- return navigateJumpSibling(event, PositionConstants.EAST);
- case SWT.PAGE_DOWN :
- return navigateJumpSibling(event, PositionConstants.SOUTH);
- case SWT.PAGE_UP :
- return navigateJumpSibling(event, PositionConstants.NORTH);
- }
- return super.keyPressed(event);
- }
- private void navigateConnections(KeyEvent event)
- {
- GraphicalEditPart focus = getFocus();
- ConnectionEditPart current = null;
- GraphicalEditPart node = getCachedNode();
- if (focus instanceof ConnectionEditPart)
- {
- current = (ConnectionEditPart) focus;
- if (node == null
- || (node != current.getSource() && node != current.getTarget()))
- {
- node = (GraphicalEditPart) current.getSource();
- counter = 0;
- }
- }
- else
- {
- node = focus;
- }
- setCachedNode(node);
- boolean forward = event.character == '/' || event.character == '?';
- ConnectionEditPart next = findConnection(node, current, forward);
- navigateTo(next, event);
- }
- private void navigateIntoContainer(KeyEvent event)
- {
- GraphicalEditPart focus = getFocus();
- List childList = focus.getChildren();
-
- if (focus instanceof ExpandableGraphNodeEditPart)
- {
- if (!((ExpandableGraphNodeEditPart)focus).isExpanded())
- {
- ((ExpandableGraphNodeEditPart)focus).doPerformExpandOrCollapse();
- }
- }
-
- Point tl = focus.getContentPane().getBounds().getTopLeft();
- int minimum = Integer.MAX_VALUE;
- int current;
- GraphicalEditPart closestPart = null;
- for (int i = 0; i < childList.size(); i++)
- {
- GraphicalEditPart ged = (GraphicalEditPart) childList.get(i);
- Rectangle childBounds = ged.getFigure().getBounds();
- current = (childBounds.x - tl.x) + (childBounds.y - tl.y);
- if (current < minimum)
- {
- minimum = current;
- closestPart = ged;
- }
- }
- if (closestPart != null)
- navigateTo(closestPart, event);
- }
- private boolean navigateJumpSibling(KeyEvent event, int direction)
- {
- return false;
- }
- private boolean navigateNextSibling(KeyEvent event, int direction)
- {
- GraphicalEditPart epStart = getFocus();
- IFigure figure = epStart.getFigure();
- Point pStart = getInterestingPoint(figure);
- figure.translateToAbsolute(pStart);
- EditPart next =
- findSibling(getNavigationSiblings(), pStart, direction, epStart);
- if (next == null)
- return false;
- navigateTo(next, event);
- return true;
- }
- private void navigateOut(KeyEvent event)
- {
- if (getFocus() == null
- || getFocus() == getViewer().getContents()
- || getFocus().getParent() == getViewer().getContents())
- return;
-
- EditPart parent = getFocus().getParent();
- if (((event.stateMask & SWT.ALT) != 0) && (event.keyCode == SWT.ARROW_LEFT))
- {
- if ((parent != null) && (parent instanceof ExpandableGraphNodeEditPart))
- {
- if (((ExpandableGraphNodeEditPart)parent).isExpanded())
- {
- ((ExpandableGraphNodeEditPart)parent).doPerformExpandOrCollapse();
- }
- }
- }
- navigateTo(parent, event);
-// navigateTo(getFocus().getParent(), event);
- }
- private void navigateOutOfConnection(KeyEvent event)
- {
- GraphicalEditPart cached = getCachedNode();
- ConnectionEditPart conn = (ConnectionEditPart) getFocus();
- if (cached != null
- && (cached == conn.getSource() || cached == conn.getTarget()))
- navigateTo(cached, event);
- else
- navigateTo(conn.getSource(), event);
- }
- void navigateTo(EditPart part, KeyEvent event)
- {
- if (part == null)
- return;
- if ((event.stateMask & SWT.SHIFT) != 0)
- {
- getViewer().appendSelection(part);
- getViewer().setFocus(part);
- }
- else if ((event.stateMask & SWT.CONTROL) != 0)
- getViewer().setFocus(part);
- else
- getViewer().select(part);
- }
- private void processSelect(KeyEvent event)
- {
- EditPart part = getViewer().getFocusEditPart();
- if ((event.stateMask & SWT.CONTROL) != 0
- && part.getSelected() != EditPart.SELECTED_NONE)
- {
- getViewer().deselect(part);
- }
- else
- {
- getViewer().appendSelection(part);
- }
- getViewer().setFocus(part);
- }
- private void setCachedNode(GraphicalEditPart node)
- {
- if (node == null)
- cachedNode = null;
- else
- cachedNode = new WeakReference(node);
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/XSDInheritanceViewer.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/XSDInheritanceViewer.java
deleted file mode 100644
index 71a82051fa..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/XSDInheritanceViewer.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.draw2d.geometry.Rectangle;
-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.wst.xsd.ui.internal.XSDEditor;
-import org.eclipse.wst.xsd.ui.internal.graph.editparts.SubstitutionGroupViewerRootEditPart;
-import org.eclipse.xsd.XSDComplexTypeDefinition;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDElementDeclaration;
-import org.eclipse.xsd.XSDModelGroup;
-import org.eclipse.xsd.XSDModelGroupDefinition;
-import org.eclipse.xsd.XSDSchema;
-
-
-public class XSDInheritanceViewer extends BaseGraphicalViewer
-{
- protected SubstitutionGroupViewerRootEditPart inheritanceViewerRootEditPart;
- public XSDInheritanceViewer(XSDEditor editor, ISelectionProvider menuSelectionProvider)
- {
- super(editor, menuSelectionProvider);
- }
-
- public void setInput(XSDConcreteComponent component)
- {
- if (isInputEnabled)
- {
- input = null;
-
- if (component instanceof XSDSchema ||
- component instanceof XSDComplexTypeDefinition)
- {
- input = component;
- }
-
- inheritanceViewerRootEditPart.setInput(input);
- }
- }
-
- public void setSelection(XSDConcreteComponent component)
- {
- if (isSelectionEnabled)
- {
- //System.out.println("XSDComponentViewer.setSelection(" + component + ")");
- List editPartList = new ArrayList();
- StructuredSelection selection = new StructuredSelection();
- if (component instanceof XSDElementDeclaration ||
- component instanceof XSDSchema ||
- component instanceof XSDModelGroup ||
- component instanceof XSDModelGroupDefinition ||
- component instanceof XSDComplexTypeDefinition)
- {
- if (component != null)
- {
- EditPart editPart = getEditPart(inheritanceViewerRootEditPart, component);
- if (editPart != null)
- {
- // TODO ... take a look at this to figure our why a newly added component
- // seems to have the wrong bounds at this point... is this a layout issue?
- // As a temp hack I'm ignoring the selection of component with bounds (x, y) == (0, 0)
- // Perhaps a delayed selection is required?
- Rectangle bounds = ((GraphicalEditPart)editPart).getFigure().getBounds();
- if (bounds.x > 0 || bounds.y > 0)
- {
- editPartList.add(editPart);
- }
- }
- }
- }
- setSelection(new StructuredSelection(editPartList));
- }
- }
- /* (non-Javadoc)
- * @see org.eclipse.gef.ui.parts.AbstractEditPartViewer#hookControl()
- */
- protected void hookControl()
- {
- super.hookControl();
- inheritanceViewerRootEditPart = new SubstitutionGroupViewerRootEditPart();
- setContents(inheritanceViewerRootEditPart);
- }
-
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/XSDSubstitutionGroupChildUtility.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/XSDSubstitutionGroupChildUtility.java
deleted file mode 100644
index 9fa84bd867..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/XSDSubstitutionGroupChildUtility.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.xsd.XSDElementDeclaration;
-
-/**
- * @author ernest
- *
- * To change this generated comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-public class XSDSubstitutionGroupChildUtility
-{
-
- /**
- * @param declaration
- * @return List
- */
- public static List getModelChildren(XSDElementDeclaration declaration)
- {
- ArrayList children = new ArrayList();
- List substitutionGroup = declaration.getSubstitutionGroup();
- for (int i = 0, size = substitutionGroup.size(); i < size; i++)
- {
- XSDElementDeclaration element = (XSDElementDeclaration) substitutionGroup.get(i);
- if (declaration.equals(element.getSubstitutionGroupAffiliation()))
- {
- children.add(element);
- }
- }
- return children;
-
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/XSDSubstitutionGroupsViewer.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/XSDSubstitutionGroupsViewer.java
deleted file mode 100644
index 5598fdfb56..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/XSDSubstitutionGroupsViewer.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.draw2d.geometry.Rectangle;
-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.wst.xsd.ui.internal.XSDEditor;
-import org.eclipse.wst.xsd.ui.internal.graph.editparts.SubstitutionGroupViewerRootEditPart;
-import org.eclipse.xsd.XSDComplexTypeDefinition;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDElementDeclaration;
-import org.eclipse.xsd.XSDModelGroup;
-import org.eclipse.xsd.XSDModelGroupDefinition;
-import org.eclipse.xsd.XSDSchema;
-
-
-public class XSDSubstitutionGroupsViewer extends BaseGraphicalViewer
-{
- protected SubstitutionGroupViewerRootEditPart subGroupViewerRootEditPart;
- public XSDSubstitutionGroupsViewer(XSDEditor editor, ISelectionProvider menuSelectionProvider)
- {
- super(editor, menuSelectionProvider);
- }
-
- public void setInput(XSDConcreteComponent component)
- {
- if (isInputEnabled)
- {
- input = null;
-
- if (component instanceof XSDElementDeclaration ||
- component instanceof XSDSchema)
- {
- input = component;
- }
-
- subGroupViewerRootEditPart.setInput(input);
- }
- }
-
- public void setSelection(XSDConcreteComponent component)
- {
- if (isSelectionEnabled)
- {
- //System.out.println("XSDComponentViewer.setSelection(" + component + ")");
- List editPartList = new ArrayList();
- StructuredSelection selection = new StructuredSelection();
- if (component instanceof XSDElementDeclaration ||
- component instanceof XSDSchema ||
- component instanceof XSDModelGroup ||
- component instanceof XSDModelGroupDefinition ||
- component instanceof XSDComplexTypeDefinition)
- {
- if (component != null)
- {
- EditPart editPart = getEditPart(subGroupViewerRootEditPart, component);
- if (editPart != null)
- {
- // TODO ... take a look at this to figure our why a newly added component
- // seems to have the wrong bounds at this point... is this a layout issue?
- // As a temp hack I'm ignoring the selection of component with bounds (x, y) == (0, 0)
- // Perhaps a delayed selection is required?
- Rectangle bounds = ((GraphicalEditPart)editPart).getFigure().getBounds();
- if (bounds.x > 0 || bounds.y > 0)
- {
- editPartList.add(editPart);
- }
- }
- }
- }
- setSelection(new StructuredSelection(editPartList));
- }
- }
- /* (non-Javadoc)
- * @see org.eclipse.gef.ui.parts.AbstractEditPartViewer#hookControl()
- */
- protected void hookControl()
- {
- super.hookControl();
- subGroupViewerRootEditPart = new SubstitutionGroupViewerRootEditPart();
- setContents(subGroupViewerRootEditPart);
- }
-
-}
-
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/BaseEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/BaseEditPart.java
deleted file mode 100644
index f98da1abb1..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/BaseEditPart.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.editparts;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
-import org.eclipse.wst.xsd.ui.internal.graph.GraphicsConstants;
-import org.eclipse.wst.xsd.ui.internal.graph.model.ModelAdapterListener;
-import org.eclipse.wst.xsd.ui.internal.graph.model.XSDModelAdapterFactory;
-
-
-public abstract class BaseEditPart extends AbstractGraphicalEditPart implements ModelAdapterListener, GraphicsConstants, IFeedbackHandler
-{
- protected boolean isSelected = false;
- /**
- * Activates the <code>EditPart</code> by setting the
- * appropriate flags, and activating its children.
- * activation signals to the EditPart that is should start observing
- * it's model, and that is should support editing at this time.
- * An EditPart will have a parent prior to activiation.
- * @see #deactivate()
- */
- public void activate()
- {
- super.activate();
- XSDModelAdapterFactory.addModelAdapterListener(getModel(), this);
- }
- /**
- * Apart from the deactivation done in super, the source
- * and target connections are deactivated, and the visual
- * part of the this is removed.
- *
- * @see #activate()
- */
- public void deactivate()
- {
- XSDModelAdapterFactory.removeModelAdapterListener(getModel(), this);
- super.deactivate();
- }
-
- protected void createEditPolicies()
- {
- }
-
- protected EditPart createChild(Object model)
- {
- return XSDEditPartFactory.getInstance().createEditPart(this, model);
- }
-
- public void propertyChanged(Object object, String property)
- {
- refresh();
- }
-
- //public BaseGraphicalViewer getBaseGraphicalViewer()
- //{
- // return (BaseGraphicalViewer)getViewer();
- //}
-
- public IFigure getSelectionFigure()
- {
- return getFigure();
- }
-
-
- public void addFeedback()
- {
- isSelected = true;
- refreshVisuals();
- }
-
- public void removeFeedback()
- {
- isSelected = false;
- refreshVisuals();
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/CategoryEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/CategoryEditPart.java
deleted file mode 100644
index afffaad700..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/CategoryEditPart.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.editparts;
-
-import java.util.List;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.MarginBorder;
-import org.eclipse.draw2d.RectangleFigure;
-import org.eclipse.draw2d.ScrollPane;
-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.wst.xsd.ui.internal.graph.GraphicsConstants;
-import org.eclipse.wst.xsd.ui.internal.graph.editpolicies.SelectionHandlesEditPolicyImpl;
-import org.eclipse.wst.xsd.ui.internal.graph.figures.ContainerFigure;
-import org.eclipse.wst.xsd.ui.internal.graph.figures.ContainerLayout;
-import org.eclipse.wst.xsd.ui.internal.graph.figures.FillLayout;
-import org.eclipse.wst.xsd.ui.internal.graph.figures.RoundedLineBorder;
-import org.eclipse.wst.xsd.ui.internal.graph.model.Category;
-
-
-public class CategoryEditPart extends BaseEditPart
-{
- protected ScrollPane scrollpane;
- protected Label label;
- protected ContainerFigure outerPane, r;
- protected SelectionHandlesEditPolicyImpl selectionHandlesEditPolicy;
-
- public int getType()
- {
- return ((Category)getModel()).getGroupType();
- }
-
- protected IFigure createFigure()
- {
- outerPane = new ContainerFigure();
- outerPane.setBorder(new RoundedLineBorder(1, 6));
- outerPane.setForegroundColor(categoryBorderColor);
-
- r = new ContainerFigure();
- r.setOutline(false);
- r.setMinimumSize(new Dimension(0, 0));
- r.setFill(true);
- r.setBackgroundColor(GraphicsConstants.elementBackgroundColor);
- outerPane.add(r);
-
- int minHeight = 250;
- switch (getType())
- {
- case Category.DIRECTIVES :
- case Category.NOTATIONS :
- {
- minHeight = 50;
- break;
- }
- case Category.ATTRIBUTES :
- case Category.GROUPS :
- {
- minHeight = 100;
- break;
- }
- }
-
- final int theMinHeight = minHeight;
- FillLayout outerLayout = new FillLayout()
- {
- protected Dimension calculatePreferredSize(IFigure parent, int width, int height)
- {
- Dimension d = super.calculatePreferredSize(parent, width, height);
- d.union(new Dimension(100, theMinHeight));
- return d;
- }
- };
- //outerLayout.setHorizontal(false);
- outerPane.setLayoutManager(outerLayout);
-
-
- label = new Label();
- label.setForegroundColor(ColorConstants.black);
- label.setBorder(new MarginBorder(2, 4, 2, 4));
- r.add(label); //Holder);
-
- RectangleFigure line = new RectangleFigure();
- line.setPreferredSize(20, 1);
- outerPane.add(line);
-
-
- scrollpane = new ScrollPane();
- scrollpane.setForegroundColor(ColorConstants.black);
- scrollpane.setVerticalScrollBarVisibility(ScrollPane.AUTOMATIC); //ScrollPane.ALWAYS);
- outerPane.add(scrollpane);
-
- ContainerFigure pane = new ContainerFigure();
- 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);
- d.height = Math.min(d.height, theMinHeight - 25); //getViewer().getControl().getBounds().height);
- return d;
- }
- };
- viewport.setLayoutManager(viewportLayout);
-
- scrollpane.setViewport(viewport);
- scrollpane.setContents(pane);
-
- return outerPane;
- }
-
- protected List getModelChildren()
- {
- return ((Category)getModel()).getChildren();
- }
-
- public void refreshVisuals()
- {
- outerPane.setBorder(new RoundedLineBorder(isSelected ? ColorConstants.black : categoryBorderColor, isSelected ? 1 : 1, 6));
- outerPane.repaint();
-// Uncomment this for coloured titles
-// r.setBackgroundColor(isSelected ? ColorConstants.blue : GraphicsConstants.elementBackgroundColor);
-// label.setForegroundColor(isSelected ? ColorConstants.white : ColorConstants.black);
-// r.repaint();
-// outerPane.setForegroundColor(isSelected ? ColorConstants.black : elementBorderColor);
-
- Category category = (Category)getModel();
- // temp hack --- added empty space to make the min width of groups bigger
- label.setText(" " + category.getName() + " ");
- }
-
- public ScrollPane getScrollPane()
- {
- return scrollpane;
- }
-
- public IFigure getContentPane()
- {
- return scrollpane.getContents();
- }
-
- public void scrollTo(AbstractGraphicalEditPart topLevel)
- {
- Rectangle topLevelBounds = topLevel.getFigure().getBounds();
- Rectangle categoryBounds = getFigure().getBounds();
- int scrollValue = scrollpane.getVerticalScrollBar().getValue();
- int location = topLevelBounds.y + scrollValue - categoryBounds.y;
- scrollpane.scrollVerticalTo(location - categoryBounds.height/2);
- }
-
- protected EditPart createChild(Object model)
- {
- EditPart editPart = new TopLevelComponentEditPart();
- editPart.setModel(model);
- editPart.setParent(this);
- return editPart;
- }
-
- protected void createEditPolicies()
- {
- selectionHandlesEditPolicy = new SelectionHandlesEditPolicyImpl();
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, selectionHandlesEditPolicy);
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/ComplexTypeDefinitionEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/ComplexTypeDefinitionEditPart.java
deleted file mode 100644
index daac88d270..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/ComplexTypeDefinitionEditPart.java
+++ /dev/null
@@ -1,215 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.editparts;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.MarginBorder;
-import org.eclipse.draw2d.RectangleFigure;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.RequestConstants;
-import org.eclipse.gef.requests.LocationRequest;
-import org.eclipse.wst.xsd.ui.internal.graph.XSDChildUtility;
-import org.eclipse.wst.xsd.ui.internal.graph.XSDGraphUtil;
-import org.eclipse.wst.xsd.ui.internal.graph.editpolicies.ComponentNameDirectEditManager;
-import org.eclipse.wst.xsd.ui.internal.graph.editpolicies.SimpleDirectEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.graph.figures.CenteredIconFigure;
-import org.eclipse.wst.xsd.ui.internal.graph.figures.ContainerFigure;
-import org.eclipse.wst.xsd.ui.internal.graph.figures.FillLayout;
-import org.eclipse.wst.xsd.ui.internal.graph.figures.GraphNodeFigure;
-import org.eclipse.wst.xsd.ui.internal.graph.figures.RoundedLineBorder;
-import org.eclipse.xsd.XSDComplexTypeDefinition;
-
-
-
-public class ComplexTypeDefinitionEditPart extends GraphNodeEditPart
-{
- protected ContainerFigure contentFigure;
- protected Label label;
- protected SimpleDirectEditPolicy simpleDirectEditPolicy = new SimpleDirectEditPolicy();
- protected CenteredIconFigure centeredIconFigure;
- protected RectangleFigure preceedingSpace;
- protected ContainerFigure contentPane;
-
- public XSDComplexTypeDefinition getXSDComplexTypeDefinition()
- {
- return (XSDComplexTypeDefinition)getModel();
- }
-
- protected boolean isConnectedEditPart()
- {
- return false;
- }
-
- protected GraphNodeFigure createGraphNodeFigure()
- {
- XSDComplexTypeDefinition ctd = (XSDComplexTypeDefinition)getModel();
- GraphNodeFigure figure = new GraphNodeFigure();
-
- figure.getOutlinedArea().setBorder(new RoundedLineBorder(1, 6));
- figure.getOutlinedArea().setFill(true);
- figure.getOutlinedArea().setLayoutManager(new FillLayout(true));
-
- figure.getInnerContentArea().getContainerLayout().setHorizontal(true);
-
- preceedingSpace = new RectangleFigure();
- preceedingSpace.setVisible(false);
- figure.getInnerContentArea().add(preceedingSpace, 0);
-
- contentPane = new ContainerFigure();
- contentPane.getContainerLayout().setHorizontal(false);
- contentPane.getContainerLayout().setSpacing(5);
- contentPane.setBorder(new MarginBorder(5, 5, 5, 5));
- figure.getInnerContentArea().add(contentPane);
-
- label = new Label();
- label.setBorder(new MarginBorder(0, 5, 5, 5));
- figure.getIconArea().add(label);
- label.setFont(mediumBoldFont);
-
- figure.getInnerContentArea().getContainerLayout().setSpacing(5);
- figure.getInnerContentArea().setBorder(new MarginBorder(5, 5, 5, 5));
-
- return figure;
- }
-
- protected EditPart createChild(Object model)
- {
- EditPart editPart = null;
- if (model == getModel())
- {
- editPart = new ComplexTypeInheritedContentEditPart();
- editPart.setModel(model);
- editPart.setParent(this);
- }
- else
- {
- editPart = super.createChild(model);
- }
- return editPart;
- }
-
- protected List getModelChildren()
- {
- List list = new ArrayList();
-
- XSDComplexTypeDefinition ct = (XSDComplexTypeDefinition)getModel();
-
- if (ct.getDerivationMethod().getName().equals("extension"))
- {
- list.add(getModel());
- }
-
- list.addAll(XSDChildUtility.getModelChildren(getModel()));
- return list;
- }
-
- public IFigure getContentPane()
- {
- return contentPane;
- }
-
- protected void refreshVisuals()
- {
- XSDComplexTypeDefinition ctd = (XSDComplexTypeDefinition)getModel();
-
- String name = ctd.getName();
- if (name == null)
- {
- try
- {
- if (label != null)
- {
- graphNodeFigure.getIconArea().remove(label);
- }
- label = null;
- }
- catch (Exception e)
- {
- }
- }
- else
- {
- if (label == null)
- {
- label = new Label();
- label.setBorder(new MarginBorder(0, 5, 5, 5));
- ((GraphNodeFigure)getFigure()).getIconArea().add(label);
- label.setFont(mediumBoldFont);
- }
- graphNodeFigure.getIconArea().add(label);
- label.setText(name);
- }
-
- // provides some room if we need to draw lines for the inherited
- boolean includesInheritedContent = getModelChildren().contains(getModel());
- preceedingSpace.setPreferredSize(includesInheritedContent ? new Dimension(10, 1) : new Dimension(0, 0));
-
- if (XSDGraphUtil.isEditable(getModel()))
- {
- graphNodeFigure.setForegroundColor(isSelected ? ColorConstants.black : elementBorderColor);
- if (label != null)
- label.setForegroundColor(elementBorderColor);
- }
- else
- {
- graphNodeFigure.setForegroundColor(isSelected ? ColorConstants.black : readOnlyBorderColor);
- if (label != null)
- label.setForegroundColor(readOnlyBorderColor);
- }
- }
-
- protected void performDirectEdit()
- {
- ComponentNameDirectEditManager manager = new ComponentNameDirectEditManager(this, label, (XSDComplexTypeDefinition)getModel());
- simpleDirectEditPolicy.setDelegate(manager);
- manager.show();
- }
-
-
- protected void createEditPolicies()
- {
- super.createEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, simpleDirectEditPolicy);
- }
-
-
- public void performRequest(Request request)
- {
- if (request.getType() == RequestConstants.REQ_DIRECT_EDIT ||
- request.getType() == RequestConstants.REQ_OPEN)
- {
- if (XSDGraphUtil.isEditable(getModel()))
- {
- LocationRequest locationRequest = (LocationRequest)request;
- Point p = locationRequest.getLocation();
-
- if (label != null && hitTest(label, p))
- {
- performDirectEdit();
- }
- }
- }
- }
-
- public void doEditName()
- {
- performDirectEdit();
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/ComplexTypeInheritedContentEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/ComplexTypeInheritedContentEditPart.java
deleted file mode 100644
index cfa8811319..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/ComplexTypeInheritedContentEditPart.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.editparts;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.RequestConstants;
-import org.eclipse.wst.xsd.ui.internal.graph.XSDChildUtility;
-import org.eclipse.wst.xsd.ui.internal.graph.XSDGraphUtil;
-import org.eclipse.wst.xsd.ui.internal.graph.editpolicies.ComponentNameDirectEditManager;
-import org.eclipse.wst.xsd.ui.internal.graph.editpolicies.SimpleDirectEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.graph.figures.ContainerFigure;
-import org.eclipse.wst.xsd.ui.internal.graph.figures.RoundedLineBorder;
-import org.eclipse.xsd.XSDComplexTypeDefinition;
-import org.eclipse.xsd.XSDTypeDefinition;
-
-
-// This is a dashed box that displays the inherited content of a complex type
-//
-public class ComplexTypeInheritedContentEditPart extends BaseEditPart
-{
- protected Label label;
- protected SimpleDirectEditPolicy simpleDirectEditPolicy = new SimpleDirectEditPolicy();
- protected boolean isParentExpanded;
-
- public ComplexTypeInheritedContentEditPart()
- {
- super();
- }
-
- public XSDComplexTypeDefinition getXSDComplexTypeDefinition()
- {
- return (XSDComplexTypeDefinition)getModel();
- }
-
- protected IFigure createFigure()
- {
- ContainerFigure figure = new ContainerFigure();
- figure.getContainerLayout().setHorizontal(false);
- figure.getContainerLayout().setBorder(5);
- figure.getContainerLayout().setSpacing(5);
- figure.setBorder(new RoundedLineBorder(ColorConstants.gray, 1, 6, Graphics.LINE_DASH));
- return figure;
- }
-
- protected List getModelChildren()
- {
- XSDComplexTypeDefinition ct = (XSDComplexTypeDefinition)getModel();
-
- List list = new ArrayList();
-
- if (ct.getDerivationMethod().getName().equals("extension") && !isParentExpanded)
- {
- XSDTypeDefinition type = ct.getBaseTypeDefinition();
- Iterator iter = XSDChildUtility.getModelChildren(type).iterator();
- boolean cont = true;
- while (cont)
- {
- while (iter.hasNext())
- {
- list.add(0, iter.next());
- }
-
- if (type instanceof XSDComplexTypeDefinition)
- {
- XSDComplexTypeDefinition ctd = (XSDComplexTypeDefinition)type;
- type = ctd.getBaseTypeDefinition();
-
- // defect 264957 - workbench hangs when modifying complex content
- // Since we don't filter out the current complexType from
- // the combobox, we can potentially have an endless loop
- if (ctd == type)
- {
- cont = false;
- break;
- }
-
- if (ctd.getDerivationMethod().getName().equals("extension"))
- {
- iter = XSDChildUtility.getModelChildren(type).iterator();
- }
- else
- {
- cont = false;
- }
- }
- else
- {
- cont = false;
- }
- }
- }
- return list;
- }
-
- protected void refreshVisuals()
- {
- XSDComplexTypeDefinition ctd = (XSDComplexTypeDefinition)getModel();
- List children = getModelChildren();
- figure.setVisible(children.size() > 0);
- // todo set preferredSize to 0 ?
- }
-
- protected void performDirectEdit()
- {
- // Why are we allowing direct editing when the label is null?
- // Should remove the policy
- if (label != null)
- {
- ComponentNameDirectEditManager manager = new ComponentNameDirectEditManager(this, label, (XSDComplexTypeDefinition)getModel());
- simpleDirectEditPolicy.setDelegate(manager);
- manager.show();
- }
- }
-
-
- protected void createEditPolicies()
- {
- super.createEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, simpleDirectEditPolicy);
- }
-
-
- public void performRequest(Request request)
- {
- if (request.getType() == RequestConstants.REQ_DIRECT_EDIT)
- {
- if (XSDGraphUtil.isEditable(getModel()))
- {
- performDirectEdit();
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/ComponentViewerRootEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/ComponentViewerRootEditPart.java
deleted file mode 100644
index fa8d191fd4..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/ComponentViewerRootEditPart.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.editparts;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Panel;
-import org.eclipse.gef.EditPart;
-import org.eclipse.wst.xsd.ui.internal.graph.figures.ContainerLayout;
-
-
-
-public class ComponentViewerRootEditPart extends BaseEditPart
-{
- protected final static String MESSAGE_PLACE_HOLDER = "MESSAGE_PLACE_HOLDER";
- protected Object input;
-
- public void setInput(Object input)
- {
- this.input = input;
- refreshChildren();
- }
-
- protected IFigure createFigure()
- {
- Panel panel = new Panel();
- ContainerLayout layout = new ContainerLayout();
- layout.setBorder(60);
- panel.setLayoutManager(layout);
- return panel;
- }
-
-
- protected List getModelChildren()
- {
- List list = new ArrayList();
- if (input != null)
- {
- list.add(input);
- }
- else
- {
- list.add(MESSAGE_PLACE_HOLDER);
- }
- return list;
- }
-
- protected EditPart createChild(Object model)
- {
- EditPart editPart = null;
- if (model == MESSAGE_PLACE_HOLDER)
- {
- editPart = new MessageEditPart();
- editPart.setModel(model);
- }
- else
- {
- editPart = super.createChild(model);
- }
- return editPart;
- }
-
- protected void createEditPolicies()
- {
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/ElementDeclarationEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/ElementDeclarationEditPart.java
deleted file mode 100644
index 1ccb7861f9..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/ElementDeclarationEditPart.java
+++ /dev/null
@@ -1,425 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.editparts;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.LineBorder;
-import org.eclipse.draw2d.MarginBorder;
-import org.eclipse.draw2d.RectangleFigure;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.RequestConstants;
-import org.eclipse.gef.requests.LocationRequest;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.wst.xsd.ui.internal.XSDEditorPlugin;
-import org.eclipse.wst.xsd.ui.internal.gef.util.figures.SpacingFigure;
-import org.eclipse.wst.xsd.ui.internal.graph.XSDChildUtility;
-import org.eclipse.wst.xsd.ui.internal.graph.XSDGraphUtil;
-import org.eclipse.wst.xsd.ui.internal.graph.XSDSubstitutionGroupChildUtility;
-import org.eclipse.wst.xsd.ui.internal.graph.XSDSubstitutionGroupsViewer;
-import org.eclipse.wst.xsd.ui.internal.graph.editpolicies.ComboBoxCellEditorManager;
-import org.eclipse.wst.xsd.ui.internal.graph.editpolicies.ComponentNameDirectEditManager;
-import org.eclipse.wst.xsd.ui.internal.graph.editpolicies.SimpleDirectEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.graph.editpolicies.TypeReferenceDirectEditManager;
-import org.eclipse.wst.xsd.ui.internal.graph.figures.ContainerFigure;
-import org.eclipse.wst.xsd.ui.internal.graph.figures.ExpandableGraphNodeFigure;
-import org.eclipse.wst.xsd.ui.internal.graph.figures.FillLayout;
-import org.eclipse.wst.xsd.ui.internal.graph.figures.GraphNodeFigure;
-import org.eclipse.wst.xsd.ui.internal.graph.model.XSDModelAdapterFactory;
-import org.eclipse.wst.xsd.ui.internal.util.TypesHelper;
-import org.eclipse.xsd.XSDComplexTypeDefinition;
-import org.eclipse.xsd.XSDElementDeclaration;
-import org.eclipse.xsd.XSDParticle;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.XSDSimpleTypeDefinition;
-import org.eclipse.xsd.XSDTypeDefinition;
-
-
-
-public class ElementDeclarationEditPart extends ExpandableGraphNodeEditPart
-{
- public Label label;
- protected Label contentIconLabel;
- protected Label typeValueLabel;
- protected SimpleDirectEditPolicy simpleDirectEditPolicy = new SimpleDirectEditPolicy();
- protected boolean isContentIconLabelSelected = false;
-
- protected final static String ELEMENT_TYPE_PLACE_HOLDER = "ELEMENT_TYPE_PLACE_HOLDER";
-
- public XSDParticle getXSDParticle()
- {
- Object o = getXSDElementDeclaration().getContainer();
- return (o instanceof XSDParticle) ? (XSDParticle)o : null;
- }
-
- public XSDElementDeclaration getXSDElementDeclaration()
- {
- return (XSDElementDeclaration)getModel();
- }
-
- protected boolean isDefaultExpanded()
- {
- // hack to expand up to its content. The previous test didn't appear to work
- int depth = 0;
- for (EditPart part = this; part != null; part = part.getParent())
- {
- depth++;
- }
- return depth <= 3;
- }
-
- protected GraphNodeFigure createGraphNodeFigure()
- {
- ExpandableGraphNodeFigure figure = new ExpandableGraphNodeFigure();
-
- figure.getOutlinedArea().setFill(true);
- figure.getOutlinedArea().setLayoutManager(new FillLayout());
-
- label = new Label();
- figure.getIconArea().add(label);
- label.setFont(mediumBoldFont);
-
- SpacingFigure spacingFigure = new SpacingFigure();
- figure.getIconArea().add(spacingFigure);
-
- contentIconLabel = new Label();
- //contentIcon.setBorder(new MarginBorder(2, 2, 2, 10));
- figure.getIconArea().add(contentIconLabel);
-
- // A sneaky null check.... getViewer() does a getRoot(), but getRoot() might be null
- // same with getParent()
- if (getParent() != null && getRoot() != null && getViewer() instanceof XSDSubstitutionGroupsViewer)
- {
- figure.getOuterContentArea().getContainerLayout().setSpacing(5);
- }
- else
- {
- RectangleFigure line = new RectangleFigure();
- line.setPreferredSize(20, 1);
- figure.getOutlinedArea().add(line, 1);
-
- figure.getInnerContentArea().setLayoutManager(new FillLayout(2));
- figure.getInnerContentArea().setBorder(new MarginBorder(2,2,2,1));
-
- ContainerFigure labelGroup = new ContainerFigure();
- Label typeLabel = new Label("type");
- labelGroup.add(typeLabel);
- labelGroup.setBorder(new MarginBorder(0, 4, 0, 4));
-
- Label equalsLabel = new Label(" = ");
- labelGroup.add(equalsLabel);
-
- typeValueLabel = new Label();
- labelGroup.add(typeValueLabel);
- figure.getOutlinedArea().add(labelGroup, 2);
- }
- return figure;
- }
-
- protected ExpandableGraphNodeFigure getExpandableGraphNodeFigure()
- {
- return (ExpandableGraphNodeFigure)graphNodeFigure;
- }
-
- protected List getModelChildren()
- {
- XSDTypeDefinition typeDef = getXSDElementDeclaration().getTypeDefinition();
-
- // Special case simple type. Need to add it to the list as well
- List list = new ArrayList();
- if (typeDef instanceof XSDSimpleTypeDefinition)
- {
- list.add((XSDSimpleTypeDefinition)typeDef);
- if (getExpandableGraphNodeFigure().isExpanded())
- {
- list.addAll(getModelChildrenHelper());
- }
- return list;
- }
- return getExpandableGraphNodeFigure().isExpanded() ? getModelChildrenHelper() : Collections.EMPTY_LIST;
- }
-
- protected List getModelChildrenHelper()
- {
- if (getViewer() instanceof XSDSubstitutionGroupsViewer)
- {
- return XSDSubstitutionGroupChildUtility.getModelChildren(getXSDElementDeclaration().getResolvedElementDeclaration());
- }
- else
- {
- return XSDChildUtility.getModelChildren(getXSDElementDeclaration().getResolvedElementDeclaration());
- }
- }
-
- protected void refreshContentIcon()
- {
- String iconName = null;
- XSDTypeDefinition td = getXSDElementDeclaration().getResolvedElementDeclaration().getTypeDefinition();
-
- if (td instanceof XSDComplexTypeDefinition)
- {
- XSDComplexTypeDefinition complexTypeDefinition = (XSDComplexTypeDefinition)td;
- if (complexTypeDefinition.getAttributeUses().size() > 0)
- {
- iconName = "icons/XSDAttribute.gif";
- }
- }
- Image image = iconName != null ? XSDEditorPlugin.getXSDImage(iconName) : null;
- contentIconLabel.setIcon(image);
- }
-
- protected void refreshVisuals()
- {
- String text = getXSDElementDeclaration().isElementDeclarationReference() ?
- getXSDElementDeclaration().getResolvedElementDeclaration().getQName(getXSDElementDeclaration().getSchema()) :
- getXSDElementDeclaration().getName();
-
- label.setText(text);
-
- ContainerFigure rectangle = graphNodeFigure.getOutlinedArea();
- if (XSDGraphUtil.isEditable(getXSDElementDeclaration()))
- {
- rectangle.setBorder(new LineBorder(isSelected ? ColorConstants.black : elementBorderColor, 2));
- rectangle.setBackgroundColor(elementBackgroundColor);
- rectangle.setForegroundColor(elementBorderColor);
-
- graphNodeFigure.getInnerContentArea().setForegroundColor(ColorConstants.black);
- if (XSDGraphUtil.isEditable(getXSDElementDeclaration().getResolvedElementDeclaration()))
- {
- // give label 'editable' colour
- graphNodeFigure.getInnerContentArea().setForegroundColor(elementLabelColor);
- }
- else
- {
- // give label 'read only' colour
- graphNodeFigure.getInnerContentArea().setForegroundColor(elementBorderColor);
- }
- label.setBackgroundColor(elementBackgroundColor);
- label.setForegroundColor(elementLabelColor);
- }
- else
- {
- rectangle.setBorder(new LineBorder(isSelected ? ColorConstants.black : readOnlyBorderColor, 2));
- rectangle.setBackgroundColor(readOnlyBackgroundColor);
- rectangle.setForegroundColor(readOnlyBorderColor);
- graphNodeFigure.getInnerContentArea().setForegroundColor(readOnlyBorderColor);
- label.setBackgroundColor(readOnlyBackgroundColor);
- }
-
- if (getXSDElementDeclaration().isElementDeclarationReference())
- {
- label.setIcon(XSDEditorPlugin.getXSDImage("icons/GraphViewElementRef.gif"));
- label.setBorder(new MarginBorder(0, 0, 0, 4));
- }
- else
- {
- label.setIcon(null);
- label.setBorder(new MarginBorder(0, 6, 0, 4));
- }
-
- if (getXSDParticle() != null)
- {
- refreshOccurenceLabel(getXSDParticle().getMinOccurs(), getXSDParticle().getMaxOccurs());
- }
-
-
- if (typeValueLabel != null)
- {
- XSDElementDeclaration ed = getXSDElementDeclaration();
- if (ed.getElement() != null)
- {
- String type = ed.getElement().getAttribute("type");
- if (type == null)
- {
- type = "";
- }
- if (!getXSDElementDeclaration().isElementDeclarationReference())
- {
- typeValueLabel.setText(type.equals("") ? "<anonymous>" : type);
- }
- else // if it is a ref, we show the resolved type
- {
- String resolvedType = "";
- if (ed.getResolvedElementDeclaration() != null)
- {
- if (ed.getResolvedElementDeclaration().getTypeDefinition() != null)
- {
- resolvedType = ed.getResolvedElementDeclaration().getTypeDefinition().getQName(ed.getSchema());
-
- // if null, it has an anonymous type that has no resolved type
- if (resolvedType == null)
- {
- resolvedType = "<anonymous>";
- }
- }
- }
- typeValueLabel.setText(resolvedType);
- }
- }
- }
- refreshContentIcon();
- }
-
-
- public void performRequest(Request request)
- {
- if (request.getType() == RequestConstants.REQ_DIRECT_EDIT ||
- request.getType() == RequestConstants.REQ_OPEN)
- {
- if (XSDGraphUtil.isEditable(getXSDElementDeclaration()))
- {
- if (request instanceof LocationRequest)
- {
- LocationRequest locationRequest = (LocationRequest)request;
- Point p = locationRequest.getLocation();
- isContentIconLabelSelected = false;
-
- if (hitTest(label, p))
- {
- performDirectEditForLabel();
- }
- else if (hitTest(typeValueLabel, p))
- {
- performDirectEditForTypeValueLabel();
- }
- }
- }
- }
- }
-
- private void performDirectEditForTypeValueLabel()
- {
- if (!getXSDElementDeclaration().isElementDeclarationReference())
- {
- TypeReferenceDirectEditManager manager = new TypeReferenceDirectEditManager(this, getXSDElementDeclaration(), typeValueLabel);
- simpleDirectEditPolicy.setDelegate(manager);
- manager.show();
- }
- // just ignore type edit for element ref's
- }
-
-
- private void performDirectEditForLabel()
- {
- if (getXSDElementDeclaration().isElementDeclarationReference())
- {
- ComboBoxCellEditorManager manager = new ComboBoxCellEditorManager(this, label)
- {
- protected List computeComboContent()
- {
- XSDSchema schema = getXSDElementDeclaration().getSchema();
- List globalElementNameList = new ArrayList();
- if (schema != null)
- {
- TypesHelper typesHelper = new TypesHelper(schema);
- globalElementNameList = typesHelper.getGlobalElements();
- }
- return globalElementNameList;
- }
-
- public void performModify(String value)
- {
- getXSDElementDeclaration().getElement().setAttribute("ref", value);
- }
- };
- simpleDirectEditPolicy.setDelegate(manager);
- manager.show();
- }
- else
- {
- ComponentNameDirectEditManager manager = new ComponentNameDirectEditManager(this, label, getXSDElementDeclaration());
- simpleDirectEditPolicy.setDelegate(manager);
- manager.show();
- }
- }
-
-
- protected void createEditPolicies()
- {
- super.createEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, simpleDirectEditPolicy);
- }
-
-
- public void activate()
- {
- super.activate();
- if (getXSDParticle() != null)
- {
- XSDModelAdapterFactory.addModelAdapterListener(getXSDParticle(), this);
- }
- }
- /**
- * Apart from the deactivation done in super, the source
- * and target connections are deactivated, and the visual
- * part of the this is removed.
- *
- * @see #activate()
- */
- public void deactivate()
- {
- if (getXSDParticle() != null)
- {
- XSDModelAdapterFactory.removeModelAdapterListener(getXSDParticle(), this);
- }
- super.deactivate();
- }
-
- public boolean isContentIconLabelSelected()
- {
- return isContentIconLabelSelected;
- }
-
- protected void addChildVisual(EditPart childEditPart, int index)
- {
- IFigure child = ((GraphicalEditPart)childEditPart).getFigure();
- if (childEditPart instanceof SimpleTypeDefinitionEditPart)
- {
- graphNodeFigure.getIconArea().add(child, index+ 1);
- SpacingFigure spacingFigure = new SpacingFigure();
- graphNodeFigure.getIconArea().add(spacingFigure, index+1);
- }
- else
- {
- getContentPane().add(child, index);
- }
- }
-
- protected void removeChildVisual(EditPart childEditPart)
- {
- IFigure child = ((GraphicalEditPart)childEditPart).getFigure();
- if (childEditPart instanceof SimpleTypeDefinitionEditPart)
- {
- graphNodeFigure.getIconArea().remove(child);
- }
- else
- {
- super.removeChildVisual(childEditPart);
- }
- }
-
- public void doEditName()
- {
- ComponentNameDirectEditManager manager = new ComponentNameDirectEditManager(this, label, getXSDElementDeclaration());
- simpleDirectEditPolicy.setDelegate(manager);
- manager.show();
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/ExpandableGraphNodeEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/ExpandableGraphNodeEditPart.java
deleted file mode 100644
index 1ad4057fed..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/ExpandableGraphNodeEditPart.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.editparts;
-
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.draw2d.ActionEvent;
-import org.eclipse.draw2d.ActionListener;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.LayoutManager;
-import org.eclipse.draw2d.MouseEvent;
-import org.eclipse.draw2d.MouseListener;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
-import org.eclipse.wst.xsd.ui.internal.graph.figures.ExpandableGraphNodeFigure;
-import org.eclipse.wst.xsd.ui.internal.graph.figures.GraphNodeFigure;
-
-
-
-public abstract class ExpandableGraphNodeEditPart extends RepeatableGraphNodeEditPart implements MouseListener, ActionListener
-{
- protected boolean needToPerformDefaultExpansion = true;
-
- protected GraphNodeFigure createGraphNodeFigure()
- {
- return new ExpandableGraphNodeFigure();
- }
-
- protected void addGraphNodeFigureListeners()
- {
- getExpandableGraphNodeFigure().getInteractor().addMouseListener(this);
- }
-
- protected ExpandableGraphNodeFigure getExpandableGraphNodeFigure()
- {
- return (ExpandableGraphNodeFigure)graphNodeFigure;
- }
-
- public IFigure getContentPane()
- {
- return getExpandableGraphNodeFigure().getOuterContentArea();
- }
-
- protected boolean isDefaultExpanded()
- {
- return false;
- }
-
- protected boolean hasChildren()
- {
- return getModelChildrenHelper().size() > 0;
- }
-
- protected abstract List getModelChildrenHelper();
-
-
- protected List getModelChildren()
- {
- return getExpandableGraphNodeFigure().isExpanded() ? getModelChildrenHelper() : Collections.EMPTY_LIST;
- }
-
- protected void refreshChildren()
- {
- if (needToPerformDefaultExpansion && isDefaultExpanded())
- {
- needToPerformDefaultExpansion = false;
- performExpandOrCollapseHelper();
-
- super.refreshChildren();
-
- EditPart root = getRoot();
- if (root instanceof AbstractGraphicalEditPart)
- {
- getContentPane().setVisible(true);
-
- IFigure rootFigure = ((AbstractGraphicalEditPart)root).getFigure();
- invalidateAll(rootFigure);
- rootFigure.validate();
- rootFigure.repaint();
- }
- getExpandableGraphNodeFigure().getInteractor().repaint();
- }
- else
- {
- super.refreshChildren();
- }
- getExpandableGraphNodeFigure().getInteractor().setVisible(hasChildren());
- }
-
-
- protected void performExpandOrCollapseHelper()
- {
- boolean isButtonExpanded = !getExpandableGraphNodeFigure().isExpanded();
- getExpandableGraphNodeFigure().setExpanded(isButtonExpanded);
- }
-
- public void doPerformExpandOrCollapse()
- {
- performExpandOrCollapse();
- }
-
- public boolean isExpanded()
- {
- return getExpandableGraphNodeFigure().isExpanded();
- }
-
- protected void performExpandOrCollapse()
- {
- performExpandOrCollapseHelper();
-
- boolean isButtonExpanded = getExpandableGraphNodeFigure().isExpanded();
-
- refreshChildren();
-
- EditPart root = getRoot();
- if (root instanceof AbstractGraphicalEditPart)
- {
- getContentPane().setVisible(isButtonExpanded);
-
- IFigure rootFigure = ((AbstractGraphicalEditPart)root).getFigure();
- invalidateAll(rootFigure);
- rootFigure.validate();
- rootFigure.repaint();
- }
- getExpandableGraphNodeFigure().getInteractor().repaint();
- }
-
-
- protected void refreshOccurenceLabel(int min, int max)
- {
- super.refreshOccurenceLabel(min, max);
-
- // TODO: revisit the 'hack' to understand why we need to do this
- // in order to get the view to layout propetly
- //
- IFigure thisFigure = getFigure();
- invalidateAll(thisFigure);
- thisFigure.validate();
- thisFigure.repaint();
- }
-
- protected void invalidateAll(IFigure figure)
- {
- figure.invalidate();
- LayoutManager manager = figure.getLayoutManager();
- if (manager != null)
- {
- manager.invalidate();
- }
- for (Iterator i = figure.getChildren().iterator(); i.hasNext(); )
- {
- IFigure child = (IFigure)i.next();
- invalidateAll(child);
- }
- }
-
-
- // implements MouseListener
- //
- public void mouseDoubleClicked(MouseEvent me)
- {
- }
-
- public void mousePressed(MouseEvent me)
- {
- me.consume();
- needToPerformDefaultExpansion = false;
- performExpandOrCollapse();
- }
-
- public void mouseReleased(MouseEvent me)
- {
- }
-
- public void actionPerformed(ActionEvent event)
- {
- performExpandOrCollapse();
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/GraphNodeEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/GraphNodeEditPart.java
deleted file mode 100644
index ce6ad0a9cb..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/GraphNodeEditPart.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.editparts;
-
-import org.eclipse.draw2d.IFigure;
-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.requests.LocationRequest;
-import org.eclipse.wst.xsd.ui.internal.gef.util.figures.ConnectedEditPartFigure;
-import org.eclipse.wst.xsd.ui.internal.graph.editpolicies.GraphNodeDragTracker;
-import org.eclipse.wst.xsd.ui.internal.graph.editpolicies.SelectionHandlesEditPolicyImpl;
-import org.eclipse.wst.xsd.ui.internal.graph.figures.GraphNodeFigure;
-
-
-
-public abstract class GraphNodeEditPart extends BaseEditPart
-{
- protected GraphNodeFigure graphNodeFigure;
- protected SelectionHandlesEditPolicyImpl selectionHandlesEditPolicy;
-
- protected boolean isConnectedEditPart()
- {
- return true;
- }
-
- protected IFigure createFigure()
- {
- IFigure result = graphNodeFigure = createGraphNodeFigure();
- addGraphNodeFigureListeners();
-
- if (isConnectedEditPart())
- {
- ConnectedEditPartFigure connectedEditPartFigure = createConnectedEditPartFigure();
- connectedEditPartFigure.add(graphNodeFigure);
- result = connectedEditPartFigure;
- }
- return result;
- }
-
- protected ConnectedEditPartFigure createConnectedEditPartFigure()
- {
- ConnectedEditPartFigure connectedEditPartFigure = new ConnectedEditPartFigure(this)
- {
- public IFigure getSelectionFigure()
- {
- return graphNodeFigure.getOutlinedArea();
- }
-
- public IFigure getConnectionFigure()
- {
- return graphNodeFigure.getConnectionFigure();
- }
- };
- return connectedEditPartFigure;
- }
-
- protected abstract GraphNodeFigure createGraphNodeFigure();
-
- protected void addGraphNodeFigureListeners()
- {
- }
-
- public IFigure getSelectionFigure()
- {
- return graphNodeFigure.getOutlinedArea();
- }
-
- public Rectangle getConnectionRectangle()
- {
- return graphNodeFigure.getConnectionRectangle();
- }
-
- protected void createEditPolicies()
- {
- //installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new NonResizableEditPolicy());
- selectionHandlesEditPolicy = new SelectionHandlesEditPolicyImpl();
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, selectionHandlesEditPolicy);
- }
-
- public DragTracker getDragTracker(Request request)
- {
- return new GraphNodeDragTracker((EditPart)this);
- }
-
- protected EditPart getApplicableEditPart(EditPart editPart, Point p)
- {
- while (true)
- {
- EditPart parent = null;
- if (editPart instanceof GraphNodeEditPart)
- {
- IFigure f = ((GraphNodeEditPart)editPart).getSelectionFigure();
- if (!hitTest(f, p))
- {
- parent = editPart.getParent();
- }
- }
-
- if (parent != null)
- {
- editPart = parent;
- }
- else
- {
- break;
- }
- }
- return editPart;
- }
-
- public EditPart getTargetEditPart(Request request)
- {
- EditPart editPart = null;
- if (request.getType() == REQ_SELECTION)
- {
- if (request instanceof LocationRequest)
- {
- LocationRequest locationRequest = (LocationRequest)request;
- Point p = locationRequest.getLocation();
- editPart = getApplicableEditPart(this, p);
- }
- }
- return (editPart != null) ? editPart : super.getTargetEditPart(request);
- }
-
- public boolean hitTest(IFigure target, Point location)
- {
- Rectangle b = target.getBounds().getCopy();
- target.translateToAbsolute(b);
- return b.contains(location);
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/IFeedbackHandler.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/IFeedbackHandler.java
deleted file mode 100644
index 24a05377c7..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/IFeedbackHandler.java
+++ /dev/null
@@ -1,17 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.editparts;
-
-public interface IFeedbackHandler
-{
- public void addFeedback();
- public void removeFeedback();
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/MessageEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/MessageEditPart.java
deleted file mode 100644
index bbb7f92dd2..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/MessageEditPart.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.editparts;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.wst.xsd.ui.internal.XSDEditorPlugin;
-
-
-
-public class MessageEditPart extends BaseEditPart
-{
- public MessageEditPart()
- {
- }
-
- protected IFigure createFigure()
- {
- Label label = new Label(XSDEditorPlugin.getXSDString("_UI_GRAPH_VIEW_NOT_AVAILABLE"));
- return label;
- }
-
- protected List getModelChildren()
- {
- return Collections.EMPTY_LIST;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/ModelGroupDefinitionEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/ModelGroupDefinitionEditPart.java
deleted file mode 100644
index af5804abb2..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/ModelGroupDefinitionEditPart.java
+++ /dev/null
@@ -1,204 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.editparts;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.MarginBorder;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.RequestConstants;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.wst.xsd.ui.internal.XSDEditorPlugin;
-import org.eclipse.wst.xsd.ui.internal.graph.XSDChildUtility;
-import org.eclipse.wst.xsd.ui.internal.graph.XSDGraphUtil;
-import org.eclipse.wst.xsd.ui.internal.graph.editpolicies.ComboBoxCellEditorManager;
-import org.eclipse.wst.xsd.ui.internal.graph.editpolicies.ComponentNameDirectEditManager;
-import org.eclipse.wst.xsd.ui.internal.graph.editpolicies.SimpleDirectEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.graph.figures.GraphNodeFigure;
-import org.eclipse.wst.xsd.ui.internal.graph.figures.RepeatableGraphNodeFigure;
-import org.eclipse.wst.xsd.ui.internal.graph.figures.RoundedLineBorder;
-import org.eclipse.wst.xsd.ui.internal.util.TypesHelper;
-import org.eclipse.xsd.XSDModelGroupDefinition;
-import org.eclipse.xsd.XSDParticle;
-import org.eclipse.xsd.XSDSchema;
-
-
-public class ModelGroupDefinitionEditPart extends RepeatableGraphNodeEditPart
-{
- protected Label label;
- protected SimpleDirectEditPolicy simpleDirectEditPolicy = new SimpleDirectEditPolicy();
-
- public XSDModelGroupDefinition getXSDModelGroupDefinition()
- {
- return (XSDModelGroupDefinition)getModel();
- }
-
- protected boolean isConnectedEditPart()
- {
- return false;
- }
-
- public XSDParticle getXSDParticle()
- {
- Object o = getXSDModelGroupDefinition().getContainer();
- return (o instanceof XSDParticle) ? (XSDParticle)o : null;
- }
-
- protected GraphNodeFigure createGraphNodeFigure()
- {
- RepeatableGraphNodeFigure figure = new RepeatableGraphNodeFigure();
- figure.getOutlinedArea().setBorder(new RoundedLineBorder(1, 6));
- figure.getInnerContentArea().setBorder(new MarginBorder(10, 0, 10, 0));
-
- label = new Label();
- label.setFont(mediumBoldFont);
- figure.getIconArea().add(label);
-
-
- return figure;
- }
-
- public IFigure getContentPane()
- {
- return graphNodeFigure.getInnerContentArea();
- }
-
- protected List getModelChildren()
- {
- return XSDChildUtility.getModelChildren(getModel());
- }
-
- protected void createEditPolicies()
- {
- super.createEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, simpleDirectEditPolicy);
- }
-
- protected void refreshVisuals()
- {
- super.refreshVisuals();
-
- if (getXSDModelGroupDefinition().isModelGroupDefinitionReference())
- {
- label.setText(getXSDModelGroupDefinition().getResolvedModelGroupDefinition().getQName());
- label.setIcon(XSDEditorPlugin.getXSDImage("icons/GraphViewElementRef.gif"));
- label.setBorder(new MarginBorder(0, 0, 0, 4));
-
- // todo update occurence label
- //
- }
- else
- {
- label.setText(getXSDModelGroupDefinition().getName());
- label.setIcon(null);
- label.setBorder(new MarginBorder(0, 6, 0, 4));
- }
-
- if (XSDGraphUtil.isEditable(getModel()))
- {
- graphNodeFigure.getOutlinedArea().setForegroundColor(isSelected ? ColorConstants.black : elementBorderColor);
- label.setForegroundColor(elementLabelColor);
- }
- else
- {
- graphNodeFigure.getOutlinedArea().setForegroundColor(readOnlyBackgroundColor);
- label.setForegroundColor(readOnlyBackgroundColor);
- }
-
- refreshOccurenceLabel(getXSDParticle());
- }
-
-
- protected void performDirectEdit()
- {
- if (getXSDModelGroupDefinition().isModelGroupDefinitionReference())
- {
- ComboBoxCellEditorManager manager = new ComboBoxCellEditorManager(this, label)
- {
- protected List computeComboContent()
- {
- XSDSchema schema = getXSDModelGroupDefinition().getSchema();
- List nameList = new ArrayList();
- if (schema != null)
- {
- TypesHelper typesHelper = new TypesHelper(schema);
- nameList = typesHelper.getModelGroups();
- }
- return nameList;
- }
-
- public void performModify(String value)
- {
- Display.getCurrent().asyncExec(new DelayedModelGroupRenameAction(getXSDModelGroupDefinition(), value));
- }
- };
- simpleDirectEditPolicy.setDelegate(manager);
- manager.show();
- }
- else
- {
- ComponentNameDirectEditManager manager = new ComponentNameDirectEditManager(this, label, getXSDModelGroupDefinition());
- simpleDirectEditPolicy.setDelegate(manager);
- manager.show();
- }
- }
-
-
- protected class DelayedModelGroupRenameAction implements Runnable
- {
- XSDModelGroupDefinition modelGroupDefinition;
- String value;
-
- DelayedModelGroupRenameAction(XSDModelGroupDefinition modelGroupDefinition, String value)
- {
- this.modelGroupDefinition = modelGroupDefinition;
- this.value = value;
- }
-
- public void run()
- {
- modelGroupDefinition.getElement().setAttribute("ref", value);
- }
- }
-
-
- public void performRequest(Request request)
- {
- if (request.getType() == RequestConstants.REQ_DIRECT_EDIT)
- {
- if (XSDGraphUtil.isEditable(getModel()))
- {
- performDirectEdit();
- }
- }
- }
-
- // TODO... I added this as a quick fix to makesure the title gets redrawn when the groupRef is changed
- // we should probably fix the ModelListenerUtil to fire both call both 'change' methods for the ref property
- //public void modelChildrenChanged()
- //{
- // super.modelChildrenChanged();
- // refreshVisuals();
- //}
-
- public void doEditName()
- {
- ComponentNameDirectEditManager manager = new ComponentNameDirectEditManager(this, label, getXSDModelGroupDefinition());
- simpleDirectEditPolicy.setDelegate(manager);
- manager.show();
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/ModelGroupEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/ModelGroupEditPart.java
deleted file mode 100644
index b793ebab46..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/ModelGroupEditPart.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.editparts;
-
-import java.util.List;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.wst.xsd.ui.internal.XSDEditorPlugin;
-import org.eclipse.wst.xsd.ui.internal.graph.XSDChildUtility;
-import org.eclipse.wst.xsd.ui.internal.graph.XSDGraphUtil;
-import org.eclipse.wst.xsd.ui.internal.graph.editpolicies.DragAndDropEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.graph.figures.CenteredIconFigure;
-import org.eclipse.wst.xsd.ui.internal.graph.figures.ContainerFigure;
-import org.eclipse.wst.xsd.ui.internal.graph.figures.ExpandableGraphNodeFigure;
-import org.eclipse.wst.xsd.ui.internal.graph.figures.GraphNodeFigure;
-import org.eclipse.wst.xsd.ui.internal.graph.figures.RoundedLineBorder;
-import org.eclipse.wst.xsd.ui.internal.graph.model.XSDModelAdapterFactory;
-import org.eclipse.xsd.XSDCompositor;
-import org.eclipse.xsd.XSDModelGroup;
-import org.eclipse.xsd.XSDParticle;
-
-
-
-public class ModelGroupEditPart extends ExpandableGraphNodeEditPart
-{
- protected CenteredIconFigure centeredIconFigure;
-
- protected static Color editableBackgroundColor = null;
- protected static Color editableForegroundColor = null;
- protected static Color nonEditableForegroundColor = null;
-
- public XSDParticle getXSDParticle()
- {
- Object o = getXSDModelGroup().getContainer();
- return (o instanceof XSDParticle) ? (XSDParticle)o : null;
- }
-
- public XSDModelGroup getXSDModelGroup()
- {
- return (XSDModelGroup)getModel();
- }
-
- protected GraphNodeFigure createGraphNodeFigure()
- {
- ExpandableGraphNodeFigure figure = new ExpandableGraphNodeFigure();
-
- centeredIconFigure = new CenteredIconFigure();
- centeredIconFigure.setPreferredSize(new Dimension(32, 20));
- //centeredIconFigure.setBackgroundColor(new Color(Display.getCurrent(), 255, 0, 0));
- figure.getIconArea().add(centeredIconFigure);
- //figure.getIconArea().setLayout(new CenterLayout());
-
- ContainerFigure outlinedArea = figure.getOutlinedArea();
- outlinedArea.setBorder(new RoundedLineBorder(1, 10));
- //outlinedArea.setPreferredSize(new Dimension(32, 20));
-
- // set layout so that children are aligned vertically with some spacing
- //
- figure.getOuterContentArea().getContainerLayout().setHorizontal(false);
- figure.getOuterContentArea().getContainerLayout().setSpacing(10);
-
- return figure;
- }
-
- protected List getModelChildrenHelper()
- {
- return XSDChildUtility.getModelChildren(getXSDModelGroup());
- }
-
- protected void refreshVisuals()
- {
- String iconName = "icons/XSDSequence.gif";
- switch (getXSDModelGroup().getCompositor().getValue())
- {
- case XSDCompositor.ALL : { iconName = "icons/XSDAll.gif"; break; }
- case XSDCompositor.CHOICE : { iconName = "icons/XSDChoice.gif"; break; }
- case XSDCompositor.SEQUENCE : { iconName = "icons/XSDSequence.gif"; break; }
- }
- centeredIconFigure.image = XSDEditorPlugin.getXSDImage(iconName);
- centeredIconFigure.repaint();
-
-
- ContainerFigure outlinedArea = graphNodeFigure.getOutlinedArea() ;
- if (XSDGraphUtil.isEditable(getXSDModelGroup()))
- {
- if (editableForegroundColor == null)
- editableForegroundColor = new Color(Display.getCurrent(), 120, 152, 184);
-
- if (editableBackgroundColor == null)
- editableBackgroundColor = new Color(Display.getCurrent(), 232, 240, 248);
-
- outlinedArea.setForegroundColor(isSelected ? ColorConstants.black : editableForegroundColor);
- outlinedArea.setBackgroundColor(editableBackgroundColor);
- }
- else
- {
- if (nonEditableForegroundColor == null)
- nonEditableForegroundColor = new Color(Display.getCurrent(), 164, 164, 164);
-
- outlinedArea.setForegroundColor(isSelected ? ColorConstants.black : nonEditableForegroundColor);
- outlinedArea.setBackgroundColor(ColorConstants.white);
- }
-
- refreshOccurenceLabel(getXSDParticle());
- }
-
- protected boolean isChildLayoutHorizontal()
- {
- return false;
- }
-
- protected boolean isDefaultExpanded()
- {
- return isPossibleCycle() ? false : true;
- }
-
- // This test ensures that we don't end up with an infinite default expansion (e.g. when a group contains a cyclic group ref)
- // TODO... we probably need some more extensible 'OO' way of computing this information
- protected boolean isPossibleCycle()
- {
- boolean result = false;
- if (getParent() instanceof ModelGroupDefinitionEditPart)
- {
- ModelGroupDefinitionEditPart group = (ModelGroupDefinitionEditPart)getParent();
- for (EditPart parent = group.getParent(); parent != null; parent = parent.getParent())
- {
- if (parent.getModel() instanceof ElementDeclarationEditPart)
- {
- break;
- }
- else
- {
- if (parent.getModel() == group.getModel())
- {
- result = true;
- break;
- }
- }
- }
- }
- return result;
- }
-
- protected void createEditPolicies()
- {
- super.createEditPolicies();
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DragAndDropEditPolicy(getViewer(), selectionHandlesEditPolicy));
- }
-
- public void activate()
- {
- super.activate();
- if (getXSDParticle() != null)
- {
- XSDModelAdapterFactory.addModelAdapterListener(getXSDParticle(), this);
- }
- }
- /**
- * Apart from the deactivation done in super, the source
- * and target connections are deactivated, and the visual
- * part of the this is removed.
- *
- * @see #activate()
- */
- public void deactivate()
- {
- if (getXSDParticle() != null)
- {
- XSDModelAdapterFactory.removeModelAdapterListener(getXSDParticle(), this);
- }
- super.deactivate();
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/RepeatableGraphNodeEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/RepeatableGraphNodeEditPart.java
deleted file mode 100644
index 6fdf7d61ca..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/RepeatableGraphNodeEditPart.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.editparts;
-
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.wst.xsd.ui.internal.graph.editpolicies.DragAndDropEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.graph.figures.GraphNodeFigure;
-import org.eclipse.wst.xsd.ui.internal.graph.figures.RepeatableGraphNodeFigure;
-import org.eclipse.xsd.XSDElementDeclaration;
-import org.eclipse.xsd.XSDParticle;
-import org.eclipse.xsd.XSDSchema;
-
-
-
-public class RepeatableGraphNodeEditPart extends GraphNodeEditPart
-{
- protected RepeatableGraphNodeFigure getRepeatableGraphNodeFigure()
- {
- return (RepeatableGraphNodeFigure)graphNodeFigure;
- }
-
- protected GraphNodeFigure createGraphNodeFigure()
- {
- return new RepeatableGraphNodeFigure();
- }
-
- protected void refreshOccurenceLabel(XSDParticle particle)
- {
- if (particle != null)
- {
- refreshOccurenceLabel(particle.getMinOccurs(), particle.getMaxOccurs());
- }
- }
-
- protected void refreshOccurenceLabel(int min, int max)
- {
- if (min == 1 && max == 1)
- {
- getRepeatableGraphNodeFigure().getOccurenceLabel().setText("");
- }
- else
- {
- String maxString = max == -1 ? "*" : "" + max;
- getRepeatableGraphNodeFigure().getOccurenceLabel().setText(min + ".." + maxString);
- }
- getRepeatableGraphNodeFigure().getOccurenceLabel().repaint();
- }
-
- protected void createEditPolicies()
- {
- super.createEditPolicies();
-
- if (getModel() instanceof XSDElementDeclaration) {
- Object parent = ((XSDElementDeclaration) getModel()).eContainer();
-
- if (!(parent instanceof XSDSchema)) {
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DragAndDropEditPolicy(getViewer(), selectionHandlesEditPolicy));
- }
- }
- else {
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DragAndDropEditPolicy(getViewer(), selectionHandlesEditPolicy));
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/RootComplexTypeDefinitionEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/RootComplexTypeDefinitionEditPart.java
deleted file mode 100644
index 853a2dfa19..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/RootComplexTypeDefinitionEditPart.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.editparts;
-
-import java.util.List;
-
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.MarginBorder;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.RequestConstants;
-import org.eclipse.wst.xsd.ui.internal.graph.XSDChildUtility;
-import org.eclipse.wst.xsd.ui.internal.graph.XSDGraphUtil;
-import org.eclipse.wst.xsd.ui.internal.graph.XSDInheritanceViewer;
-import org.eclipse.wst.xsd.ui.internal.graph.editpolicies.ComponentNameDirectEditManager;
-import org.eclipse.wst.xsd.ui.internal.graph.editpolicies.SelectionHandlesEditPolicyImpl;
-import org.eclipse.wst.xsd.ui.internal.graph.editpolicies.SimpleDirectEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.graph.figures.ExpandableGraphNodeFigure;
-import org.eclipse.wst.xsd.ui.internal.graph.figures.FillLayout;
-import org.eclipse.wst.xsd.ui.internal.graph.figures.GraphNodeFigure;
-import org.eclipse.wst.xsd.ui.internal.graph.figures.RoundedLineBorder;
-import org.eclipse.xsd.XSDComplexTypeDefinition;
-
-
-
-public class RootComplexTypeDefinitionEditPart extends ExpandableGraphNodeEditPart
-{
- public Label label;
- protected SimpleDirectEditPolicy simpleDirectEditPolicy = new SimpleDirectEditPolicy();
-
-
- protected GraphNodeFigure createGraphNodeFigure()
- {
- ExpandableGraphNodeFigure figure = new ExpandableGraphNodeFigure();
- figure.getOutlinedArea().setBorder(new RoundedLineBorder(1, 6));
- figure.getOutlinedArea().setLayoutManager(new FillLayout());
- figure.getOutlinedArea().setFill(true);
-
- if (getViewer() instanceof XSDInheritanceViewer)
- {
- figure.getOuterContentArea().getContainerLayout().setSpacing(10);
- }
-
- label = new Label();
- label.setFont(mediumBoldFont);
- label.setBorder(new MarginBorder(5, 8, 5, 8));
- figure.getIconArea().add(label);
-
- return figure;
- }
-
-
- protected void refreshVisuals()
- {
- super.refreshVisuals();
-
- XSDComplexTypeDefinition ctd = (XSDComplexTypeDefinition)getModel();
- label.setText(ctd.getName() != null ? ctd.getName(): "");
-
- if (XSDGraphUtil.isEditable(ctd))
- {
- figure.setForegroundColor(elementBorderColor);
- label.setForegroundColor(elementBorderColor);
- }
- else
- {
- figure.setForegroundColor(readOnlyBorderColor);
- label.setForegroundColor(readOnlyBorderColor);
- }
- }
-
-
- protected List getModelChildrenHelper()
- {
- XSDComplexTypeDefinition ct = (XSDComplexTypeDefinition)getModel();
- if (getViewer() instanceof XSDInheritanceViewer)
- {
- return XSDChildUtility.getImmediateDerivedTypes(ct);
- }
- else
- {
- return XSDChildUtility.getModelChildren(getModel());
- }
- }
-
-
- protected void createEditPolicies()
- {
- SelectionHandlesEditPolicyImpl policy = new SelectionHandlesEditPolicyImpl();
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, policy);
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, simpleDirectEditPolicy);
- }
-
-
- protected void performDirectEdit()
- {
- ComponentNameDirectEditManager manager = new ComponentNameDirectEditManager(this, label, (XSDComplexTypeDefinition)getModel());
- simpleDirectEditPolicy.setDelegate(manager);
- manager.show();
- }
-
-
- public void performRequest(Request request)
- {
- if (request.getType() == RequestConstants.REQ_DIRECT_EDIT)
- {
- if (XSDGraphUtil.isEditable(getModel()))
- {
- performDirectEdit();
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/RootModelGroupDefinitionEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/RootModelGroupDefinitionEditPart.java
deleted file mode 100644
index 35f4486708..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/RootModelGroupDefinitionEditPart.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.editparts;
-
-import java.util.List;
-
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.MarginBorder;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.RequestConstants;
-import org.eclipse.wst.xsd.ui.internal.graph.XSDChildUtility;
-import org.eclipse.wst.xsd.ui.internal.graph.XSDGraphUtil;
-import org.eclipse.wst.xsd.ui.internal.graph.editpolicies.ComponentNameDirectEditManager;
-import org.eclipse.wst.xsd.ui.internal.graph.editpolicies.SelectionHandlesEditPolicyImpl;
-import org.eclipse.wst.xsd.ui.internal.graph.editpolicies.SimpleDirectEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.graph.figures.ExpandableGraphNodeFigure;
-import org.eclipse.wst.xsd.ui.internal.graph.figures.FillLayout;
-import org.eclipse.wst.xsd.ui.internal.graph.figures.GraphNodeFigure;
-import org.eclipse.wst.xsd.ui.internal.graph.figures.RoundedLineBorder;
-import org.eclipse.xsd.XSDModelGroupDefinition;
-
-
-public class RootModelGroupDefinitionEditPart extends ExpandableGraphNodeEditPart
-{
- public Label label;
- protected SimpleDirectEditPolicy simpleDirectEditPolicy = new SimpleDirectEditPolicy();
-
-
- protected GraphNodeFigure createGraphNodeFigure()
- {
- ExpandableGraphNodeFigure figure = new ExpandableGraphNodeFigure();
- figure.getOutlinedArea().setBorder(new RoundedLineBorder(1, 6));
- figure.getOutlinedArea().setLayoutManager(new FillLayout());
- figure.getOutlinedArea().setFill(true);
-
- label = new Label();
- label.setFont(mediumBoldFont);
- label.setBorder(new MarginBorder(5, 8, 5, 8));
- figure.getIconArea().add(label);
-
- return figure;
- }
-
- protected void refreshVisuals()
- {
- super.refreshVisuals();
-
- XSDModelGroupDefinition mgd = (XSDModelGroupDefinition)getModel();
- String name = mgd.getResolvedModelGroupDefinition().getName();
- label.setText(name);
-
- if (XSDGraphUtil.isEditable(getModel()))
- {
- figure.setForegroundColor(elementBorderColor);
- label.setForegroundColor(elementBorderColor);
- }
- else
- {
- figure.setForegroundColor(readOnlyBorderColor);
- label.setForegroundColor(readOnlyBorderColor);
- }
- }
-
- protected List getModelChildrenHelper()
- {
- return XSDChildUtility.getModelChildren(getModel());
- }
-
-
- protected void createEditPolicies()
- {
- SelectionHandlesEditPolicyImpl policy = new SelectionHandlesEditPolicyImpl();
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, policy);
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, simpleDirectEditPolicy);
- }
-
-
- protected void performDirectEdit()
- {
- ComponentNameDirectEditManager manager = new ComponentNameDirectEditManager(this, label, ((XSDModelGroupDefinition)getModel()).getResolvedModelGroupDefinition());
- simpleDirectEditPolicy.setDelegate(manager);
- manager.show();
- }
-
-
- public void performRequest(Request request)
- {
- if (request.getType() == RequestConstants.REQ_DIRECT_EDIT)
- {
- if (XSDGraphUtil.isEditable(getModel()))
- {
- performDirectEdit();
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/SchemaDirectiveEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/SchemaDirectiveEditPart.java
deleted file mode 100644
index c0697d5fc5..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/SchemaDirectiveEditPart.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.editparts;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.MarginBorder;
-import org.eclipse.wst.xsd.ui.internal.XSDEditorPlugin;
-import org.eclipse.wst.xsd.ui.internal.graph.figures.CenteredIconFigure;
-import org.eclipse.wst.xsd.ui.internal.graph.figures.ContainerFigure;
-import org.eclipse.wst.xsd.ui.internal.graph.figures.FillLayout;
-import org.eclipse.wst.xsd.ui.internal.graph.figures.RoundedLineBorder;
-import org.eclipse.xsd.XSDSchemaDirective;
-
-
-public class SchemaDirectiveEditPart extends BaseEditPart
-{
- protected CenteredIconFigure centeredIconFigure;
- protected Label label;
- /**
- * @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#createFigure()
- */
- protected IFigure createFigure()
- {
-
- ContainerFigure figure = new ContainerFigure();
-
- figure.setLayoutManager(new FillLayout());
- figure.setBorder(new RoundedLineBorder(1, 8));
-
- ContainerFigure fig = new ContainerFigure();
- fig.setLayoutManager(new FillLayout());
- fig.setBorder(new MarginBorder(10, 0, 10, 0));
- figure.add(fig);
-
-
- label = new Label();
- label.setBorder(new MarginBorder(4, 2, 2, 10));
- fig.add(label);
-
- return figure;
- }
-
- public void refreshVisuals()
- {
- XSDSchemaDirective directive = (XSDSchemaDirective)getModel();
- String schemaLocation = directive.getSchemaLocation();
- if (schemaLocation == null) schemaLocation = "(" + XSDEditorPlugin.getXSDString("_UI_LABEL_NO_LOCATION_SPECIFIED") + ")";
- if (schemaLocation.equals("")) schemaLocation = "(" + XSDEditorPlugin.getXSDString("_UI_LABEL_NO_LOCATION_SPECIFIED") + ")";
- label.setText(" " + directive.getElement().getLocalName() + " " + schemaLocation);
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/SchemaEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/SchemaEditPart.java
deleted file mode 100644
index b23821c3a7..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/SchemaEditPart.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.editparts;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.Figure;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.MarginBorder;
-import org.eclipse.draw2d.RectangleFigure;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.gef.EditPart;
-import org.eclipse.wst.xsd.ui.internal.XSDEditorPlugin;
-import org.eclipse.wst.xsd.ui.internal.graph.GraphicsConstants;
-import org.eclipse.wst.xsd.ui.internal.graph.figures.ContainerFigure;
-import org.eclipse.wst.xsd.ui.internal.graph.figures.FillLayout;
-import org.eclipse.wst.xsd.ui.internal.graph.figures.RoundedLineBorder;
-import org.eclipse.wst.xsd.ui.internal.graph.model.Category;
-import org.eclipse.wst.xsd.ui.internal.graph.model.XSDModelAdapterFactory;
-import org.eclipse.xsd.XSDSchema;
-
-public class SchemaEditPart extends BaseEditPart
-{
- protected ContainerFigure containerFigure;
- protected Label label;
-
- //protected ContainerFigure childExpansionContainer;
- public IFigure getContentPane()
- {
- return containerFigure;
- }
-
- protected IFigure createFigure()
- {
- ContainerFigure outer = new ContainerFigure();
- outer.setBorder(new RoundedLineBorder(1, 6));
- outer.setForegroundColor(categoryBorderColor);
- FillLayout fillLayout = new FillLayout(4);
- outer.setLayoutManager(fillLayout);
- //outer.getContainerLayout().setHorizontal(false);
-
- ContainerFigure r = new ContainerFigure();
- r.setOutline(false);
- r.setMinimumSize(new Dimension(0, 0));
- r.setFill(true);
- r.setBackgroundColor(GraphicsConstants.elementBackgroundColor);
- outer.add(r);
-
- final int theMinHeight = 200;
- FillLayout outerLayout = new FillLayout()
- {
- protected Dimension calculatePreferredSize(IFigure parent, int width, int height)
- {
- Dimension d = super.calculatePreferredSize(parent, width, height);
- d.union(new Dimension(100, theMinHeight));
- return d;
- }
- };
- outerLayout.setHorizontal(false);
- outer.setLayoutManager(outerLayout);
-
- label = new Label();
- label.setForegroundColor(ColorConstants.black);
- label.setBorder(new MarginBorder(2, 4, 2, 4));
- r.add(label);
-
- RectangleFigure line = new RectangleFigure();
- line.setPreferredSize(20, 1);
- outer.add(line);
-
- containerFigure = new ContainerFigure();
- //containerFigure.setBackgroundColor(ColorConstants.red);
- containerFigure.setBorder(new MarginBorder(4, 4, 4, 4));
- fillLayout = new FillLayout(4);
- containerFigure.setLayoutManager(fillLayout);
- //containerFigure.setLayoutManager(new FillLayout(false));
- /*
- * FlowLayout layout1 = new FlowLayout(false); layout1.setMajorSpacing(0);
- * layout1.setMinorSpacing(0); layout1.setStretchMinorAxis(true);
- * containerFigure.setLayoutManager(layout1);
- */
- outer.add(containerFigure);
- //childExpansionContainer = new ContainerFigure();
- //childExpansionContainer.getContainerLayout().setHorizontal(false);
- //childExpansionContainer.setOutlined(true);
- return outer;
- }
-
- protected List getModelChildren()
- {
- XSDSchema schema = (XSDSchema) getModel();
- List list = new ArrayList();
- list.add(CategoryRowEditPart.DIRECTIVES_AND_NOTATIONS);
- list.add(CategoryRowEditPart.ELEMENTS_AND_TYPES);
- list.add(CategoryRowEditPart.MODEL_GROUPS_AND_ATTRIBUTES);
- return list;
- }
-
- protected EditPart createChild(Object model)
- {
- CategoryRowEditPart result = new CategoryRowEditPart();
- result.setModel(model);
- result.setParent(this);
- result.setSchema((XSDSchema)getModel());
- return result;
- }
-
-
- protected void refreshVisuals()
- {
- super.refreshVisuals();
- String targetNamespaceValue = ((XSDSchema)getModel()).getTargetNamespace();
- if (targetNamespaceValue == null || targetNamespaceValue.length() == 0)
- {
- targetNamespaceValue = XSDEditorPlugin.getXSDString("_UI_GRAPH_XSDSCHEMA_NO_NAMESPACE");
- }
- label.setText(XSDEditorPlugin.getXSDString("_UI_GRAPH_XSDSCHEMA") + " : " + targetNamespaceValue);
- }
-}
-
-class CategoryRowEditPart extends BaseEditPart
-{
- public static final int[] ELEMENTS_AND_TYPES = {Category.ELEMENTS, Category.TYPES };
- public static final int[] DIRECTIVES_AND_NOTATIONS = {Category.DIRECTIVES, Category.NOTATIONS };
- public static final int[] MODEL_GROUPS_AND_ATTRIBUTES = {Category.GROUPS, Category.ATTRIBUTES};//, Category.COMPLEX_TYPES };
-
- protected XSDSchema schema;
- protected Figure contentPane;
-
- protected IFigure createFigure()
- {
- ContainerFigure containerFigure = new ContainerFigure();
- //containerFigure.setBackgroundColor(ColorConstants.red);
- containerFigure.setFill(true);
- containerFigure.setBorder(new MarginBorder(4, 4, 4, 4));
- org.eclipse.wst.xsd.ui.internal.gef.util.figures.FillLayout fillLayout = new org.eclipse.wst.xsd.ui.internal.gef.util.figures.FillLayout(4);
- fillLayout.setHorizontal(true);
- containerFigure.setLayoutManager(fillLayout);
- //containerFigure.setLayoutManager(new FillLayout(4));
- return containerFigure;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#getContentPane()
- */
- public IFigure getContentPane()
- {
- return super.getContentPane();
- }
-
- public XSDSchema getSchema()
- {
- return schema;
- }
-
- public void setSchema(XSDSchema schema)
- {
- this.schema = schema;
- }
-
-
- protected List getModelChildren()
- {
- List categoryList = (List) XSDModelAdapterFactory.getAdapter(schema).getProperty(schema, "groups");
- return filterCategoryList(categoryList);
- }
-
- protected List filterCategoryList(List list)
- {
- List result = new ArrayList();
- int[] categoryTypes = (int[])getModel();
- for (Iterator i = list.iterator(); i.hasNext(); )
- {
- Category category = (Category)i.next();
- if (isMatching(categoryTypes, category))
- {
- result.add(category);
- }
- }
- return result;
- }
-
- private boolean isMatching(int[] categoryTypes, Category category)
- {
- boolean result = false;
- for (int i = 0; i < categoryTypes.length; i++)
- {
- if (categoryTypes[i] == category.getGroupType())
- {
- result = true;
- break;
- }
- }
- return result;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/SimpleTypeDefinitionEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/SimpleTypeDefinitionEditPart.java
deleted file mode 100644
index 27c52e3115..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/SimpleTypeDefinitionEditPart.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.editparts;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.ImageFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.MouseEvent;
-import org.eclipse.draw2d.MouseMotionListener;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.wst.xsd.ui.internal.XSDEditorPlugin;
-import org.eclipse.wst.xsd.ui.internal.graph.editpolicies.SelectionHandlesEditPolicyImpl;
-import org.eclipse.wst.xsd.ui.internal.graph.figures.RoundedLineBorder;
-
-public class SimpleTypeDefinitionEditPart extends BaseEditPart implements MouseMotionListener
-{
- protected Label label;
- protected SelectionHandlesEditPolicyImpl selectionHandlesEditPolicy;
-
- ImageFigure figure;
- Color color;
-
- protected IFigure createFigure()
- {
- String iconName = "icons/XSDSimpleType.gif";
- Image image = XSDEditorPlugin.getXSDImage(iconName);
-
- figure = new ImageFigure(image);
- RoundedLineBorder lb = new RoundedLineBorder(1, 6);
- figure.setOpaque(true);
- figure.setBorder(lb);
- figure.setBackgroundColor(ColorConstants.white);
- figure.setForegroundColor(elementBorderColor);
- figure.addMouseMotionListener(this);
- return figure;
- }
-
- protected void refreshVisuals()
- {
- // figure.setBorder(new RoundedLineBorder(isSelected ? ColorConstants.black : elementBackgroundColor, 1, 6));
- ((RoundedLineBorder)figure.getBorder()).setColor(isSelected ? ColorConstants.black : elementBackgroundColor);
- figure.repaint();
- }
-
- protected boolean isConnectedEditPart()
- {
- return false;
- }
-
- protected void createEditPolicies()
- {
- selectionHandlesEditPolicy = new SelectionHandlesEditPolicyImpl();
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, selectionHandlesEditPolicy);
- }
-
- public void deactivate()
- {
- figure.removeMouseMotionListener(this);
- super.deactivate();
- if (color != null)
- {
- color.dispose();
- }
- }
-
- public void mouseDragged(MouseEvent me)
- {
- }
-
- public void mouseEntered(MouseEvent me)
- {
-// ((RoundedLineBorder)figure.getBorder()).setColor(ColorConstants.blue);
-// figure.setBackgroundColor(elementBorderColor);
-// figure.repaint();
- }
-
- public void mouseExited(MouseEvent me)
- {
-// ((RoundedLineBorder)figure.getBorder()).setColor(elementBackgroundColor);
-// figure.setBackgroundColor(elementBackgroundColor);
-// figure.repaint();
- }
-
- public void mouseHover(MouseEvent me)
- {
- }
-
- public void mouseMoved(MouseEvent me)
- {
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/SubstitutionGroupViewerRootEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/SubstitutionGroupViewerRootEditPart.java
deleted file mode 100644
index 3899e8e6f3..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/SubstitutionGroupViewerRootEditPart.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.editparts;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Panel;
-import org.eclipse.gef.EditPart;
-import org.eclipse.wst.xsd.ui.internal.graph.figures.ContainerLayout;
-
-
-
-public class SubstitutionGroupViewerRootEditPart extends BaseEditPart
-{
- protected final static String MESSAGE_PLACE_HOLDER = "MESSAGE_PLACE_HOLDER";
- protected Object input;
-
- public void setInput(Object input)
- {
- this.input = input;
- refreshChildren();
- }
-
- protected IFigure createFigure()
- {
- Panel panel = new Panel();
- ContainerLayout layout = new ContainerLayout();
- layout.setBorder(60);
- panel.setLayoutManager(layout);
- return panel;
- }
-
-
- protected List getModelChildren()
- {
- List list = new ArrayList();
- if (input != null)
- {
- list.add(input);
- }
- else
- {
- list.add(MESSAGE_PLACE_HOLDER);
- }
- return list;
- }
-
- protected EditPart createChild(Object model)
- {
- EditPart editPart = null;
- if (model == MESSAGE_PLACE_HOLDER)
- {
- editPart = new MessageEditPart();
- editPart.setModel(model);
- }
- else
- {
- editPart = super.createChild(model);
- }
- return editPart;
- }
-
- protected void createEditPolicies()
- {
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/TopLevelComponentEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/TopLevelComponentEditPart.java
deleted file mode 100644
index 2d96719458..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/TopLevelComponentEditPart.java
+++ /dev/null
@@ -1,316 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.editparts;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.MarginBorder;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.RequestConstants;
-import org.eclipse.gef.editpolicies.SelectionEditPolicy;
-import org.eclipse.gef.requests.LocationRequest;
-import org.eclipse.gef.ui.parts.AbstractEditPartViewer;
-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.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.wst.xsd.ui.internal.gef.util.editparts.AbstractComponentViewerRootEditPart;
-import org.eclipse.wst.xsd.ui.internal.gef.util.figures.FillLayout;
-import org.eclipse.wst.xsd.ui.internal.graph.GraphicsConstants;
-import org.eclipse.wst.xsd.ui.internal.graph.XSDComponentViewer;
-import org.eclipse.wst.xsd.ui.internal.graph.XSDGraphUtil;
-import org.eclipse.wst.xsd.ui.internal.graph.editpolicies.ComponentNameDirectEditManager;
-import org.eclipse.wst.xsd.ui.internal.graph.editpolicies.SelectionHandlesEditPolicyImpl;
-import org.eclipse.wst.xsd.ui.internal.graph.editpolicies.SimpleDirectEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.graph.figures.ContainerFigure;
-import org.eclipse.wst.xsd.ui.internal.graph.model.ModelAdapter;
-import org.eclipse.wst.xsd.ui.internal.graph.model.XSDModelAdapterFactory;
-import org.eclipse.xsd.XSDComplexTypeDefinition;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDElementDeclaration;
-import org.eclipse.xsd.XSDModelGroupDefinition;
-import org.eclipse.xsd.XSDNamedComponent;
-
-
-public class TopLevelComponentEditPart extends BaseEditPart implements IFeedbackHandler
-{
- protected Label label;
- //protected Label arrowLabel;
- protected ContainerFigure labelHolder = new ContainerFigure();
- protected SelectionHandlesEditPolicyImpl selectionHandlesEditPolicy;
- protected SimpleDirectEditPolicy simpleDirectEditPolicy = new SimpleDirectEditPolicy();
- protected boolean isReadOnly;
- protected boolean isSelected;
-
- protected IFigure createFigure()
- {
- ContainerFigure typeGroup = new ContainerFigure();
- typeGroup.getContainerLayout().setHorizontal(true);
-
- //arrowLabel = new Label();
- //arrowLabel.setIcon(XSDEditorPlugin.getPlugin().getImage("icons/forward.gif"));
- //typeGroup.add(arrowLabel);
-
- labelHolder = new ContainerFigure();
- FillLayout fillLayout = new FillLayout();
- labelHolder.setLayoutManager(fillLayout);
- labelHolder.setFill(true);
- typeGroup.add(labelHolder);
-
- label = new Label();
- label.setBorder(new MarginBorder(0, 2, 2, 1));
- label.setForegroundColor(ColorConstants.black);
- labelHolder.add(label);
-
- try
- {
- // evil hack to provide underlines
- Object model = getModel();
-
- boolean isLinux = java.io.File.separator.equals("/");
- if (model instanceof XSDComplexTypeDefinition ||
- model instanceof XSDElementDeclaration ||
- model instanceof XSDModelGroupDefinition)
- {
- if (!isLinux)
- {
- FontData oldData = GraphicsConstants.medium.getFontData()[0];
- FontData fontData = new FontData(oldData.getName(), oldData.getHeight(), SWT.NONE);
-
- // TODO... clean this awful code up... we seem to be leaking here too
- // we can't call this directly since the methods are OS dependant
- // fontData.data.lfUnderline = 1
- // so instead we use reflection
- Object data = fontData.getClass().getField("data").get(fontData);
-// System.out.println("data" + data.getClass());
- data.getClass().getField("lfUnderline").setByte(data, (byte)1);
- Font font = new Font(Display.getCurrent(), fontData);
- label.setFont(font);
-
- }
- }
- }
- catch (Exception e)
- {
-
- }
- //FontData data = label.getFont().getFontData()[0];
- //data.data.lfUnderline = 1;
-
- //RectangleFigure line = new RectangleFigure();
- //line.setPreferredSize(2, 1);
- //labelHolder.add(line, 1);
-
- //label.getFont().getFontData()[0].setStyle()
-
- return typeGroup;
- }
-
- public void refreshVisuals()
- {
- ModelAdapter adapter = XSDModelAdapterFactory.getAdapter(getModel());
- if (adapter != null)
- {
- // isReadOnly = Boolean.TRUE.equals(adapter.getProperty(getModel(), "isReadOnly"));
- isReadOnly = !XSDGraphUtil.isEditable(getModel());
- label.setForegroundColor(computeLabelColor());
- label.setText((String)adapter.getProperty(getModel(), ModelAdapter.LABEL_PROPERTY));
- Image image = (Image)adapter.getProperty(getModel(), ModelAdapter.IMAGE_PROPERTY);
- if (image != null) label.setIcon(image);
- //arrowLabel.setVisible(Boolean.TRUE.equals(adapter.getProperty(getModel(), "drillDown")));
- }
- else
- {
- label.setText("unknown object" + getModel().getClass().getName());
- //arrowLabel.setVisible(false);
- }
-
- if (reselect)
- {
- getViewer().select(this);
- setReselect(false);
- }
- }
-
-
- public XSDNamedComponent getXSDNamedComponent()
- {
- return (XSDNamedComponent) getModel();
- }
-
- public List getModelChildren()
- {
- return Collections.EMPTY_LIST;
- }
-
- protected void 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, simpleDirectEditPolicy);
- }
-
- public Color computeLabelColor()
- {
- Color color = ColorConstants.black;
- if (isSelected)
- {
- color = ColorConstants.white;
- }
- else if (isReadOnly)
- {
- color = ColorConstants.gray;
- }
- return color;
- }
-
-
- public void addFeedback()
- {
- isSelected = true;
-
- labelHolder.setBackgroundColor(ColorConstants.black);
- 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)
- {
- if (request.getType() == RequestConstants.REQ_DIRECT_EDIT ||
- request.getType() == RequestConstants.REQ_OPEN)
- {
-
- Object model = getModel();
- if (model instanceof XSDComplexTypeDefinition ||
- model instanceof XSDElementDeclaration ||
- model instanceof XSDModelGroupDefinition)
- {
- if (request instanceof LocationRequest)
- {
- LocationRequest locationRequest = (LocationRequest)request;
- Point p = locationRequest.getLocation();
-
- if (hitTest(labelHolder, p))
- {
- performDrillDownAction();
- }
- }
- }
- }
- }
-
- 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()
- {
- //((XSDComponentViewer)getViewer()).setInput((XSDConcreteComponent)getModel());
-
- EditPart editPart = ((AbstractEditPartViewer)getViewer()).getRootEditPart().getContents();
- if (editPart instanceof AbstractComponentViewerRootEditPart)
- {
- AbstractComponentViewerRootEditPart rootEditPart = (AbstractComponentViewerRootEditPart)editPart;
- rootEditPart.setInput((XSDConcreteComponent)getModel());
- }
- else if (editPart instanceof BaseEditPart)
- {
- ((XSDComponentViewer)getViewer()).setInput((XSDConcreteComponent)getModel());
- }
- }
- };
- Display.getCurrent().asyncExec(runnable);
- }
-
- public void doEditName()
- {
- removeFeedback();
- Object object = getModel();
- if (object instanceof XSDNamedComponent)
- {
- ComponentNameDirectEditManager manager = new ComponentNameDirectEditManager(this, label, (XSDNamedComponent)object);
- simpleDirectEditPolicy.setDelegate(manager);
- manager.show();
- }
- }
-
-
- static boolean reselect = false;
-
- public void setReselect(boolean state)
- {
- reselect = state;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/TypeEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/TypeEditPart.java
deleted file mode 100644
index 37a83e11ba..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/TypeEditPart.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.editparts;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.MarginBorder;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.wst.xsd.ui.internal.graph.editpolicies.SelectionHandlesEditPolicyImpl;
-import org.eclipse.wst.xsd.ui.internal.graph.editpolicies.SimpleDirectEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.graph.figures.ContainerFigure;
-import org.eclipse.xsd.XSDTypeDefinition;
-
-
-public class TypeEditPart extends BaseEditPart
-{
- protected SimpleDirectEditPolicy simpleDirectEditPolicy = new SimpleDirectEditPolicy();
-
- protected IFigure createFigure()
- {
- ContainerFigure typeGroup = new ContainerFigure();
-// typeGroup.setBorder(new SimpleRaisedBorder(1));
-// typeGroup.setBorder(new LineBorder(1));
-// typeGroup.setBorder(new RoundedLineBorder(1,5));
-
- Label typeLabel = new Label("type");
- typeLabel.setBorder(new MarginBorder(0,2,2,1));
- typeGroup.add(typeLabel);
-
- return typeGroup;
- }
-
- protected void refreshVisuals()
- {
- super.refreshVisuals();
- }
-
- public XSDTypeDefinition getXSDTypeDefinition()
- {
- return (XSDTypeDefinition)getModel();
- }
-
-
- public List getModelChildren()
- {
- return Collections.EMPTY_LIST;
- }
-
- protected void createEditPolicies()
- {
- SelectionHandlesEditPolicyImpl policy = new SelectionHandlesEditPolicyImpl();
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, policy);
- }
-
-
- public void performRequest(Request request)
- {
- super.performRequest(request);
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/WildcardEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/WildcardEditPart.java
deleted file mode 100644
index 53a86a19d0..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/WildcardEditPart.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.editparts;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.LineBorder;
-import org.eclipse.draw2d.MarginBorder;
-import org.eclipse.wst.xsd.ui.internal.XSDEditorPlugin;
-import org.eclipse.wst.xsd.ui.internal.graph.XSDGraphUtil;
-import org.eclipse.wst.xsd.ui.internal.graph.figures.ContainerFigure;
-import org.eclipse.wst.xsd.ui.internal.graph.figures.GraphNodeFigure;
-import org.eclipse.wst.xsd.ui.internal.graph.figures.RepeatableGraphNodeFigure;
-import org.eclipse.xsd.XSDParticle;
-import org.eclipse.xsd.XSDWildcard;
-
-
-public class WildcardEditPart extends RepeatableGraphNodeEditPart
-{
- protected Label label;
-
-
- public XSDParticle getXSDParticle()
- {
- Object o = getXSDWildcard().getContainer();
- return (o instanceof XSDParticle) ? (XSDParticle)o : null;
- }
-
-
- public XSDWildcard getXSDWildcard()
- {
- return (XSDWildcard)getModel();
- }
-
-
- protected GraphNodeFigure createGraphNodeFigure()
- {
- RepeatableGraphNodeFigure figure = new RepeatableGraphNodeFigure();
- figure.setConnected(true);
- figure.getOutlinedArea().setFill(true);
-
- label = new Label();
- label.setText(XSDEditorPlugin.getXSDString("_UI_ANY_ELEMENT"));
- label.setBorder(new MarginBorder(0, 6, 0, 4));
- label.setFont(mediumBoldFont);
-
- figure.getIconArea().add(label);
-
- return figure;
- }
-
-
- protected void refreshVisuals()
- {
- ContainerFigure rectangle = graphNodeFigure.getOutlinedArea();
- if (XSDGraphUtil.isEditable(getModel()))
- {
- rectangle.setBorder(new LineBorder(2));
- rectangle.setBackgroundColor(elementBackgroundColor);
- rectangle.setForegroundColor(isSelected ? ColorConstants.black : elementBorderColor);
-
- label.setBackgroundColor(elementBackgroundColor);
- label.setForegroundColor(elementLabelColor);
- }
- else
- {
- rectangle.setBorder(new LineBorder(readOnlyBorderColor, 2));
- rectangle.setBackgroundColor(readOnlyBackgroundColor);
- rectangle.setForegroundColor(isSelected ? ColorConstants.black : readOnlyBorderColor);
-
- label.setBackgroundColor(readOnlyBackgroundColor);
- label.setForegroundColor(readOnlyBorderColor);
- }
-
- refreshOccurenceLabel(getXSDParticle());
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/XSDEditPartFactory.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/XSDEditPartFactory.java
deleted file mode 100644
index 5d6ed1e13b..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editparts/XSDEditPartFactory.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.editparts;
-
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPartFactory;
-import org.eclipse.wst.xsd.ui.internal.graph.XSDInheritanceViewer;
-import org.eclipse.wst.xsd.ui.internal.graph.model.Category;
-import org.eclipse.xsd.XSDComplexTypeDefinition;
-import org.eclipse.xsd.XSDElementDeclaration;
-import org.eclipse.xsd.XSDModelGroup;
-import org.eclipse.xsd.XSDModelGroupDefinition;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.XSDSimpleTypeDefinition;
-import org.eclipse.xsd.XSDWildcard;
-
-
-
-public class XSDEditPartFactory implements EditPartFactory
-{
- protected static XSDEditPartFactory instance;
-
- public static XSDEditPartFactory getInstance()
- {
- if (instance == null)
- {
- instance = new XSDEditPartFactory();
- }
- return instance;
- }
-
- public EditPart createEditPart(EditPart parent, Object model)
- {
- EditPart editPart = null;
-
- if (model instanceof Category)
- {
- editPart = new CategoryEditPart();
- }
- else if (model instanceof XSDElementDeclaration)
- {
- editPart = new ElementDeclarationEditPart();
- }
- else if (model instanceof XSDComplexTypeDefinition)
- {
- if (parent.getViewer() instanceof XSDInheritanceViewer)
- {
- editPart = new RootComplexTypeDefinitionEditPart();
- }
- else
- {
- if (parent instanceof CategoryEditPart)
- editPart = new RootComplexTypeDefinitionEditPart();
- else
- editPart = new ComplexTypeDefinitionEditPart();
- }
- }
- else if (model instanceof XSDModelGroup)
- {
- editPart = new ModelGroupEditPart();
- }
- else if (model instanceof XSDModelGroupDefinition)
- {
- if (parent instanceof CategoryEditPart)
- editPart = new RootModelGroupDefinitionEditPart();
- else
- editPart = new ModelGroupDefinitionEditPart();
- }
- else if (model instanceof XSDSchema)
- {
- editPart = new SchemaEditPart();
- }
- else if (model instanceof XSDWildcard)
- {
- editPart = new WildcardEditPart();
- }
- else if (model instanceof XSDSimpleTypeDefinition)
- {
- editPart = new SimpleTypeDefinitionEditPart();
- }
-
- if (editPart != null)
- {
- editPart.setModel(model);
- editPart.setParent(parent);
- }
- else
- {
-// System.out.println("can't create editPart for " + model);
-// Thread.dumpStack();
- }
- return editPart;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editpolicies/ComboBoxCellEditorManager.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editpolicies/ComboBoxCellEditorManager.java
deleted file mode 100644
index bf58f17b10..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editpolicies/ComboBoxCellEditorManager.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.editpolicies;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gef.tools.CellEditorLocator;
-import org.eclipse.gef.tools.DirectEditManager;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.ComboBoxCellEditor;
-import org.eclipse.jface.viewers.ICellEditorListener;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-
-public abstract class ComboBoxCellEditorManager extends DirectEditManager implements DirectEditPolicyDelegate
-{
- protected Label label;
-
- public ComboBoxCellEditorManager(GraphicalEditPart source, Label label)
- {
- super(source, ComboBoxCellEditor.class, new InternalCellEditorLocator(label));
- this.label = label;
- }
-
- protected void initCellEditor()
- {
- String initialLabelText = label.getText();
-
- CCombo combo = (CCombo)getCellEditor().getControl();
- combo.setFont(label.getFont());
- combo.setForeground(label.getForegroundColor());
- combo.setBackground(label.getBackgroundColor());
- /*
- combo.addKeyListener(new KeyAdapter() {
- // hook key pressed - see PR 14201
- public void keyPressed(KeyEvent keyEvent) {
- if (keyEvent.character == 'z') {
- getCellEditor().applyEditorValue();
- }
- }
- });
-*/
- ICellEditorListener cellEditorListener = new ICellEditorListener()
- {
- public void cancelEditor()
- {
-// System.out.println("cancelEditor");
- }
- public void applyEditorValue()
- {
-// System.out.println("applyEditorValue");
- }
- public void editorValueChanged(boolean old, boolean newState)
- {
-// System.out.println("editorValueChanged");
- }
- };
- getCellEditor().addListener(cellEditorListener);
-
- String[] item = combo.getItems();
- int index = 0;
- for (int i = 0; i < item.length; i++)
- {
- if (item[i].equals(initialLabelText))
- {
- getCellEditor().setValue(new Integer(i));
- break;
- }
- }
- }
-
- // hack... for some reason the ComboBoxCellEditor does't fire an editorValueChanged to set the dirty flag
- // unless we overide this method to return true, the manager is not notified of changes made in the cell editor
- protected boolean isDirty()
- {
- return true;
- }
-
- protected CellEditor createCellEditorOn(Composite composite)
- {
- boolean isLabelTextInList = false;
- List list = computeComboContent();
- for (Iterator i = list.iterator(); i.hasNext(); )
- {
- String string = (String)i.next();
- if (string.equals(label.getText()))
- {
- isLabelTextInList = true;
- break;
- }
- }
-
- if (!isLabelTextInList)
- {
- list.add(label.getText());
- }
-
- List sortedList = computeSortedList(list);
- String[] stringArray = new String[sortedList.size()];
- for (int i = 0; i < stringArray.length; i++)
- {
- stringArray[i] = (String)sortedList.get(i);
- }
- return new ComboBoxCellEditor(composite, stringArray);
- }
-
- protected List computeSortedList(List list)
- {
- return list;
- }
-
- protected abstract List computeComboContent();
-
- protected abstract void performModify(String value);
-
- public static class InternalCellEditorLocator implements CellEditorLocator
- {
- protected Label label;
-
- public InternalCellEditorLocator(Label label)
- {
- this.label = label;
- }
-
- public void relocate(CellEditor celleditor)
- {
- CCombo combo = (CCombo)celleditor.getControl();
- Point pref = combo.computeSize(-1, -1);
- Rectangle rect = label.getTextBounds().getCopy();
- label.translateToAbsolute(rect);
- combo.setBounds(rect.x-4, rect.y-1, pref.x+1, pref.y+1);
- }
- }
-
- // implements DirectEditPolicyDelegate
- //
- public void performEdit(CellEditor cellEditor)
- {
- CCombo combo = (CCombo)getCellEditor().getControl();
- int index = combo.getSelectionIndex();
- if (index != -1)
- {
- String value = combo.getItem(index);
- performModify(combo.getItem(index));
- }
- else
- {
- String typedValue = combo.getText();
- if (combo.indexOf(typedValue) != -1)
- {
- performModify(typedValue);
- }
- else
- {
- String closeMatch = getCloseMatch(typedValue, combo.getItems());
- if (closeMatch != null)
- {
- performModify(closeMatch);
- }
- else
- {
- Display.getCurrent().beep();
- }
- }
- }
- }
-
- protected String getCloseMatch(String value, String[] items)
- {
- int matchIndex = -1;
-
- for (int i = 0; i < items.length; i++)
- {
- String item = items[i];
- String a = getLocalName(value);
- String b = getLocalName(item);
- if (a.equalsIgnoreCase(b))
- {
- matchIndex = i;
- break;
- }
- }
- return matchIndex != -1 ? items[matchIndex] : null;
- }
-
- protected String getLocalName(String string)
- {
- int index = string.indexOf(":");
- return (index != -1) ? string.substring(index + 1) : string;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editpolicies/ComponentNameDirectEditManager.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editpolicies/ComponentNameDirectEditManager.java
deleted file mode 100644
index 87a9326049..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editpolicies/ComponentNameDirectEditManager.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.editpolicies;
-
-import org.eclipse.draw2d.Label;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.wst.xsd.ui.internal.graph.editparts.TopLevelComponentEditPart;
-import org.eclipse.wst.xsd.ui.internal.refactor.rename.GlobalElementRenamer;
-import org.eclipse.wst.xsd.ui.internal.refactor.rename.GlobalGroupRenamer;
-import org.eclipse.wst.xsd.ui.internal.refactor.rename.GlobalSimpleOrComplexTypeRenamer;
-import org.eclipse.xsd.XSDElementDeclaration;
-import org.eclipse.xsd.XSDModelGroupDefinition;
-import org.eclipse.xsd.XSDNamedComponent;
-import org.eclipse.xsd.XSDTypeDefinition;
-import org.eclipse.xsd.util.XSDSwitch;
-
-
-
-public class ComponentNameDirectEditManager extends TextCellEditorManager
-{
- protected XSDNamedComponent component;
- protected static GraphicalEditPart mySource;
-
- public ComponentNameDirectEditManager(GraphicalEditPart source, Label label, XSDNamedComponent component)
- {
- super(source, label);
- this.component = component;
- mySource = source;
- }
-
- public void performModify(final String value)
- {
- if (value.length() > 0)
- {
- DelayedRenameRunnable runnable = new DelayedRenameRunnable(component, value);
- Display.getCurrent().asyncExec(runnable);
- }
- }
-
- protected static class DelayedRenameRunnable implements Runnable
- {
- protected XSDNamedComponent component;
- protected String name;
-
- public DelayedRenameRunnable(XSDNamedComponent component, String name)
- {
- this.component = component;
- this.name = name;
- }
-
- public void run()
- {
- XSDSwitch xsdSwitch = new XSDSwitch()
- {
- public Object caseXSDTypeDefinition(XSDTypeDefinition object)
- {
- new GlobalSimpleOrComplexTypeRenamer(object, name).visitSchema(object.getSchema());
- return null;
- }
-
- public Object caseXSDElementDeclaration(XSDElementDeclaration object)
- {
- if (object.isGlobal())
- {
- new GlobalElementRenamer(object, name).visitSchema(object.getSchema());
- }
- return null;
- }
-
- public Object caseXSDModelGroupDefinition(XSDModelGroupDefinition object)
- {
- new GlobalGroupRenamer(object, name).visitSchema(object.getSchema());
- return null;
- }
- };
- xsdSwitch.doSwitch(component);
- component.setName(name);
- if (mySource instanceof TopLevelComponentEditPart)
- {
- ((TopLevelComponentEditPart)mySource).setReselect(true);
- }
- }
- }
-
- protected void bringDown()
- {
- if (mySource != null)
- {
- if (mySource instanceof TopLevelComponentEditPart)
- {
- ((TopLevelComponentEditPart)mySource).setReselect(true);
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editpolicies/DirectEditPolicyDelegate.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editpolicies/DirectEditPolicyDelegate.java
deleted file mode 100644
index b5cce8b090..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editpolicies/DirectEditPolicyDelegate.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.editpolicies;
-
-import org.eclipse.jface.viewers.CellEditor;
-
-public interface DirectEditPolicyDelegate
-{
- public void performEdit(CellEditor cellEditor);
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editpolicies/DragAndDropCommand.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editpolicies/DragAndDropCommand.java
deleted file mode 100644
index e84f7e3603..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editpolicies/DragAndDropCommand.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.editpolicies;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.PointList;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPartViewer;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.requests.ChangeBoundsRequest;
-import org.eclipse.wst.xsd.ui.internal.actions.MoveAction;
-import org.eclipse.wst.xsd.ui.internal.gef.util.figures.IConnectionRenderingViewer;
-import org.eclipse.wst.xsd.ui.internal.graph.editparts.ComplexTypeDefinitionEditPart;
-import org.eclipse.wst.xsd.ui.internal.graph.editparts.GraphNodeEditPart;
-import org.eclipse.wst.xsd.ui.internal.graph.editparts.ModelGroupDefinitionEditPart;
-import org.eclipse.wst.xsd.ui.internal.graph.editparts.ModelGroupEditPart;
-import org.eclipse.xsd.XSDConcreteComponent;
-
-
-public class DragAndDropCommand extends Command //AbstractCommand
-{
- protected EditPartViewer viewer;
- protected ChangeBoundsRequest request;
- protected GraphNodeEditPart childRefEditPart;
- public GraphNodeEditPart parentEditPart;
- public Point location;
- protected MoveAction action;
- protected boolean canExecute;
-
- public DragAndDropCommand(EditPartViewer viewer, ChangeBoundsRequest request)
- {
- this.viewer = viewer;
- this.request = request;
-
- location = request.getLocation();
- EditPart target = viewer.findObjectAt(location);
- ((GraphicalEditPart)viewer.getRootEditPart()).getFigure().translateToRelative(location);
-
- List list = request.getEditParts();
- if (list.size() > 0)
- {
- parentEditPart = getParentEditPart(target);
- if (parentEditPart != null)
- {
- for (Iterator i = parentEditPart.getChildren().iterator(); i.hasNext(); )
- {
- EditPart child = (EditPart)i.next();
- if (child instanceof GraphNodeEditPart)
- {
- GraphNodeEditPart childGraphNodeEditPart = (GraphNodeEditPart)child;
- Rectangle rectangle = childGraphNodeEditPart.getSelectionFigure().getBounds();
-
- if (location.y < rectangle.getCenter().y)
- {
- childRefEditPart = childGraphNodeEditPart;
- break;
- }
- }
- }
-
- List editPartsList = request.getEditParts();
- List concreteComponentList = new ArrayList(editPartsList.size());
- for (Iterator i = editPartsList.iterator(); i.hasNext(); )
- {
- EditPart editPart = (EditPart)i.next();
- concreteComponentList.add((XSDConcreteComponent)editPart.getModel());
- }
- XSDConcreteComponent refComponent = childRefEditPart != null ? (XSDConcreteComponent)childRefEditPart.getModel() : null;
-
- action = new MoveAction((XSDConcreteComponent)parentEditPart.getModel(), concreteComponentList, refComponent);
- canExecute = action.canMove();
- }
- }
- }
-
- protected GraphNodeEditPart getParentEditPart(EditPart target)
- {
- GraphNodeEditPart result = null;
- while (target != null)
- {
- if (target instanceof ModelGroupEditPart)
- {
- result = (GraphNodeEditPart)target;
- break;
- }
- else if (target instanceof ComplexTypeDefinitionEditPart ||
- target instanceof ModelGroupDefinitionEditPart)
- {
- List list = target.getChildren();
- for (Iterator i = list.iterator(); i.hasNext(); )
- {
- Object child = i.next();
- if (child instanceof ModelGroupEditPart)
- {
- result = (GraphNodeEditPart)child;
- break;
- }
- }
- if (result != null)
- {
- break;
- }
- }
- target = target.getParent();
- }
- return result;
- }
-
- public void execute()
- {
- if (canExecute)
- {
- action.run();
- }
- }
-
- public void redo()
- {
-
- }
-
- public void undo()
- {
- }
-
- public boolean canExecute()
- {
- return canExecute;
- }
-
- public PointList getConnectionPoints(Rectangle draggedFigureBounds)
- {
- PointList pointList = null;
- if (parentEditPart != null && childRefEditPart != null && viewer instanceof IConnectionRenderingViewer)
- {
- pointList = ((IConnectionRenderingViewer)viewer).getConnectionRenderingFigure().getConnectionPoints(parentEditPart, childRefEditPart, draggedFigureBounds);
- }
- return pointList != null ? pointList : new PointList();
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editpolicies/DragAndDropEditPolicy.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editpolicies/DragAndDropEditPolicy.java
deleted file mode 100644
index 18468c8457..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editpolicies/DragAndDropEditPolicy.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.editpolicies;
-
-import org.eclipse.gef.EditPartViewer;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.ChangeBoundsRequest;
-
-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;
- }
-
- static int count2 = 0;
- boolean theCommandResult = true;
-
- public org.eclipse.gef.commands.Command getCommand(Request request)
- {
- // this block is commented out to disable move for now
- DragAndDropCommand command = null;
- if (request instanceof ChangeBoundsRequest)
- {
- command = new DragAndDropCommand(viewer, (ChangeBoundsRequest)request);
- selectionHandlesEditPolicy.setDragAndDropCommand(command);
- }
- return command;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editpolicies/GraphNodeDragTracker.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editpolicies/GraphNodeDragTracker.java
deleted file mode 100644
index 58fbaac656..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editpolicies/GraphNodeDragTracker.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.editpolicies;
-
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.tools.DragEditPartsTracker;
-
-
-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);
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editpolicies/SelectionHandlesEditPolicyImpl.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editpolicies/SelectionHandlesEditPolicyImpl.java
deleted file mode 100644
index d09b53a7c1..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editpolicies/SelectionHandlesEditPolicyImpl.java
+++ /dev/null
@@ -1,257 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.editpolicies;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.FigureUtilities;
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Polyline;
-import org.eclipse.draw2d.RectangleFigure;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.PointList;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.editpolicies.SelectionHandlesEditPolicy;
-import org.eclipse.gef.handles.MoveHandle;
-import org.eclipse.gef.handles.MoveHandleLocator;
-import org.eclipse.gef.requests.ChangeBoundsRequest;
-import org.eclipse.swt.graphics.Cursor;
-import org.eclipse.wst.xsd.ui.internal.graph.editparts.BaseEditPart;
-import org.eclipse.wst.xsd.ui.internal.graph.editparts.IFeedbackHandler;
-import org.eclipse.wst.xsd.ui.internal.graph.figures.BogusLayout;
-import org.eclipse.wst.xsd.ui.internal.graph.figures.ContainerFigure;
-
-
-
-
-
-public class SelectionHandlesEditPolicyImpl extends SelectionHandlesEditPolicy
-{
- protected IFigure feedback;
- protected Rectangle originalLocation;
- protected DragAndDropCommand dragAndDropCommand;
-
- protected List createSelectionHandles()
- {
- List list = new ArrayList();
- EditPart editPart = getHost();
-
- if (editPart instanceof GraphicalEditPart)
- {
- GraphicalEditPart graphicalEditPart = (GraphicalEditPart)editPart;
- IFigure figure = (graphicalEditPart instanceof BaseEditPart) ?
- ((BaseEditPart)graphicalEditPart).getSelectionFigure() :
- graphicalEditPart.getFigure();
-
- Cursor cursorFigure = figure.getCursor();
- MoveHandleLocator loc = new MoveHandleLocator(figure);
- MoveHandle moveHandle = new MoveHandle(graphicalEditPart, loc);
- moveHandle.setCursor(cursorFigure);
- list.add(moveHandle);
- }
-
- return list;
- }
-
-
- public boolean understandsRequest(Request request)
- {
- boolean result = false;
-
- if (REQ_MOVE.equals(request.getType()))
- {
- result = false; // return false to disable move for now
- }
- else
- {
- result = super.understandsRequest(request);
- }
- return result;
- }
-
-
- public org.eclipse.gef.commands.Command getCommand(Request request)
- {
- return null;
- }
-
- public void setDragAndDropCommand(DragAndDropCommand dragAndDropCommand)
- {
- this.dragAndDropCommand = dragAndDropCommand;
- }
-
- protected org.eclipse.gef.commands.Command getMoveCommand(ChangeBoundsRequest request)
- {
- ChangeBoundsRequest req = new ChangeBoundsRequest(REQ_MOVE_CHILDREN);
- req.setEditParts(getHost());
-
- req.setMoveDelta(request.getMoveDelta());
- req.setSizeDelta(request.getSizeDelta());
- req.setLocation(request.getLocation());
-
- return getHost().getParent().getCommand(req);
- }
-
- public void showSourceFeedback(Request request)
- {
- if (REQ_MOVE.equals(request.getType()) ||
- REQ_ADD.equals(request.getType()))
- showChangeBoundsFeedback((ChangeBoundsRequest)request);
- }
-
- protected void showChangeBoundsFeedback(ChangeBoundsRequest request)
- {
- IFigure p = getDragSourceFeedbackFigure();
- Rectangle r = originalLocation.getTranslated(request.getMoveDelta());
- Dimension resize = request.getSizeDelta();
- r.width += resize.width;
- r.height+= resize.height;
-
- ((GraphicalEditPart)getHost()).getFigure().translateToAbsolute(r);
- p.translateToRelative(r);
-
- Rectangle pBounds = r.getCopy();
-
- if (dragAndDropCommand != null && dragAndDropCommand.canExecute())
- {
- int size = request.getEditParts().size();
- if (size > 0 && request.getEditParts().get(size - 1) == getHost())
- {
- PointList pointList = dragAndDropCommand.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));
- }
- }
- }
- }
- p.setBounds(pBounds);
- ghostShape.setBounds(r);
- p.validate();
- }
-
-
-
-
- protected IFigure getDragSourceFeedbackFigure()
- {
- EditPart editPart = getHost();
- if (feedback == null && editPart instanceof BaseEditPart)
- {
- BaseEditPart baseEditPart = (BaseEditPart)editPart;
- originalLocation = new Rectangle(baseEditPart.getSelectionFigure().getBounds());
- feedback = createDragSourceFeedbackFigure(baseEditPart.getSelectionFigure());
- }
- return feedback;
- }
-
- Polyline polyLine;
- RectangleFigure ghostShape;
-
- protected IFigure createDragSourceFeedbackFigure(IFigure draggedFigure)
- {
- // Use a ghost rectangle for feedback
- ContainerFigure panel = new ContainerFigure();
- panel.setLayoutManager(new BogusLayout());//new FreeformLayout());
-
- ghostShape = new RectangleFigure();
- FigureUtilities.makeGhostShape(ghostShape);
- ghostShape.setLineStyle(Graphics.LINE_DASHDOT);
- ghostShape.setForegroundColor(ColorConstants.white);
-
- Rectangle r = draggedFigure.getBounds();
- panel.setOpaque(false);
- panel.add(ghostShape);
-
- polyLine = new Polyline();
- //polyLine.setLineStyle(Graphics.LINE_DASHDOT);
- polyLine.setLineWidth(3);
- panel.add(polyLine);
-
- panel.setBounds(r);
- ghostShape.setBounds(r);
-
- addFeedback(panel);
-
- return panel;
- }
-
- 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);
- }
- }
-
- 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();
- }
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editpolicies/SimpleDirectEditPolicy.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editpolicies/SimpleDirectEditPolicy.java
deleted file mode 100644
index 531eef2c86..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editpolicies/SimpleDirectEditPolicy.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.editpolicies;
-
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.editpolicies.DirectEditPolicy;
-import org.eclipse.gef.requests.DirectEditRequest;
-
-public class SimpleDirectEditPolicy extends DirectEditPolicy
-{
- protected DirectEditPolicyDelegate delegate;
-
- public void setDelegate(DirectEditPolicyDelegate delegate)
- {
- this.delegate = delegate;
- }
-
- protected org.eclipse.gef.commands.Command getDirectEditCommand(final DirectEditRequest request)
- {
- return new Command() //AbstractCommand()
- {
- public void execute()
- {
- if (delegate != null)
- {
- delegate.performEdit(request.getCellEditor());
- }
- }
-
- public void redo()
- {
- }
-
- public void undo()
- {
- }
-
- public boolean canExecute()
- {
- return true;
- }
- };
- }
-
- protected void showCurrentEditValue(DirectEditRequest request)
- {
- //hack to prevent async layout from placing the cell editor twice.
- getHostFigure().getUpdateManager().performUpdate();
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editpolicies/TextCellEditorManager.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editpolicies/TextCellEditorManager.java
deleted file mode 100644
index 6409937fc3..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editpolicies/TextCellEditorManager.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.editpolicies;
-
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gef.tools.CellEditorLocator;
-import org.eclipse.gef.tools.DirectEditManager;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.TextCellEditor;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Text;
-
-public abstract class TextCellEditorManager extends DirectEditManager implements DirectEditPolicyDelegate
-{
- protected Label label;
-
- public TextCellEditorManager(GraphicalEditPart source, Label label)
- {
- super(source, TextCellEditor.class, new InternalCellEditorLocator(label));
- this.label = label;
- }
-
- protected void initCellEditor()
- {
- String initialLabelText = label.getText();
- getCellEditor().setValue(initialLabelText);
- Text text = (Text)getCellEditor().getControl();
- text.setFont(label.getFont());
- text.setForeground(label.getForegroundColor());
- text.setBackground(label.getBackgroundColor());
- text.selectAll();
- }
-
- protected abstract void performModify(String value);
-
- public static class InternalCellEditorLocator implements CellEditorLocator
- {
- protected Label label;
-
- public InternalCellEditorLocator(Label label)
- {
- this.label = label;
- }
-
- public void relocate(CellEditor celleditor)
- {
- Text text = (Text)celleditor.getControl();
- Point sel = text.getSelection();
- Point pref = text.computeSize(-1, -1);
- Rectangle rect = label.getTextBounds().getCopy();
- label.translateToAbsolute(rect);
- text.setBounds(rect.x-4, rect.y-1, pref.x+1, pref.y+1);
- text.setSelection(0);
- text.setSelection(sel);
- }
- }
-
- // implements DirectEditPolicyDelegate
- //
- public void performEdit(CellEditor cellEditor)
- {
- performModify((String)cellEditor.getValue());
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editpolicies/TypeReferenceDirectEditManager.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editpolicies/TypeReferenceDirectEditManager.java
deleted file mode 100644
index c62d1e9515..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/editpolicies/TypeReferenceDirectEditManager.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.editpolicies;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.draw2d.Label;
-import org.eclipse.gef.EditPart;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.wst.xsd.ui.internal.graph.editparts.BaseEditPart;
-import org.eclipse.wst.xsd.ui.internal.util.TypesHelper;
-import org.eclipse.wst.xsd.ui.internal.util.XSDDOMHelper;
-import org.eclipse.xsd.XSDElementDeclaration;
-import org.eclipse.xsd.XSDSchema;
-
-
-
-public class TypeReferenceDirectEditManager extends ComboBoxCellEditorManager
-{
- protected BaseEditPart editPart;
- protected XSDElementDeclaration ed;
-
-
- public TypeReferenceDirectEditManager(BaseEditPart source, XSDElementDeclaration ed, Label label)
- {
- super(source, label);
- editPart = source;
- this.ed = ed;
- }
-
- protected List computeComboContent()
- {
- XSDSchema schema = ed.getSchema();
- List typeNameList = new ArrayList();
- if (schema != null)
- {
- TypesHelper typesHelper = new TypesHelper(schema);
- typeNameList.addAll(typesHelper.getUserSimpleTypeNamesList());
- typeNameList.addAll(typesHelper.getUserComplexTypeNamesList());
- typeNameList.addAll(typesHelper.getBuiltInTypeNamesList());
- }
- return typeNameList;
- }
-
- public void performModify(String value)
- {
- // we need to perform an asyncExec here since the 'host' editpart may be removed
- // as a side effect of performing the action
- DelayedRenameRunnable runnable = new DelayedRenameRunnable(editPart, ed, value);
- Display.getCurrent().asyncExec(runnable);
- }
-
-
- protected List computeSortedList(List list)
- {
- return TypesHelper.sortList(list);
- }
-
- protected static class DelayedRenameRunnable implements Runnable
- {
- protected BaseEditPart editPart;
- protected EditPart editPartParent;
- protected XSDElementDeclaration ed;
- protected String name;
-
- public DelayedRenameRunnable(BaseEditPart editPart, XSDElementDeclaration ed, String name)
- {
- this.editPart = editPart;
- editPartParent = editPart.getParent();
- this.ed = ed;
- this.name = name;
- }
-
- public void run()
- {
- //BaseGraphicalViewer viewer = editPart.getBaseGraphicalViewer();
- //viewer.setInputEnabled(false);
- //viewer.setSelectionEnabled(false);
- if (name.equals("<anonymous>"))
- {
- try
- {
- ed.getResolvedElementDeclaration().getElement().removeAttribute("type");
- }
- catch (Exception e)
- {
- }
- }
- else
- {
- if (ed.getResolvedElementDeclaration().getAnonymousTypeDefinition() != null) // isSetAnonymousTypeDefinition())
- {
- if (!(name.equals("<anonymous>")))
- {
- ed.getResolvedElementDeclaration().getElement().setAttribute("type", name);
- XSDDOMHelper.updateElementToNotAnonymous(ed.getResolvedElementDeclaration().getElement());
-// ed.getResolvedElementDeclaration().setAnonymousTypeDefinition(null);
- return;
- }
- }
- ed.getResolvedElementDeclaration().getElement().setAttribute("type", name);
- }
- //viewer.setInputEnabled(true);
- //viewer.setSelectionEnabled(true);
- //viewer.setSelection(new StructuredSelection(editPartParent));
- }
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/BogusLayout.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/BogusLayout.java
deleted file mode 100644
index cfa8c75b4a..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/BogusLayout.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.figures;
-
-import org.eclipse.draw2d.AbstractLayout;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Dimension;
-
-
-/**
- * Figures using the StackLayout as their layout manager have
- * their children placed on top of one another. Order of
- * placement is determined by the order in which the children
- * were added, first child added placed on the bottom.
- */
-public class BogusLayout
- extends AbstractLayout
-{
-
-protected int spacing;
-
-public BogusLayout(){}
-
-protected Dimension calculatePreferredSize(IFigure figure, int w, int h)
-{
- Dimension d = new Dimension();
- 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.
- */
-/*jvh - final
-public Dimension getMinimumSize(IFigure figure){
- return new Dimension();
-}
-
-public Dimension getPreferredSize(IFigure figure){
- return new Dimension();
-} */
-
-/*
- * 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){
-
-}
-
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/CenterLayout.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/CenterLayout.java
deleted file mode 100644
index 2932e6d3f4..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/CenterLayout.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.figures;
-
-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;
-
-
-/**
- * Figures using the StackLayout as their layout manager have
- * their children placed on top of one another. Order of
- * placement is determined by the order in which the children
- * were added, first child added placed on the bottom.
- */
-public class CenterLayout
- extends AbstractLayout
-{
-
-protected int spacing;
-
-public CenterLayout(){}
-public CenterLayout(int spacing){ this.spacing = spacing; }
-
-/**
- * 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.
- * @since 2.0
- */
-protected Dimension calculatePreferredSize(IFigure figure, int w, int h){
- Dimension d = calculatePreferredClientAreaSize(figure);
- /*d.expand(figure.getInsets().getWidth(),
- figure.getInsets().getHeight()); */
- d.expand(w,
- h);
- 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();
- d.height += childSize.height;
- d.width = Math.max(childSize.width, d.width);
- }
- int childrenSize = children.size();
- if (childrenSize > 0)
- {
- d.height += spacing * children.size() - 1;
- }
- 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 wHint, int hHint){
- 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 wHint, int hHint){
- return calculatePreferredSize(figure, wHint, hHint);
-}
-
-
-/*
- * 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){
- Rectangle r = figure.getClientArea();
- List children = figure.getChildren();
-
- Dimension preferredClientAreaSize = calculatePreferredClientAreaSize(figure);
- int x = r.x + (r.width - preferredClientAreaSize.width) / 2;
- int y = r.y + (r.height - preferredClientAreaSize.height) / 2;
-
- for (Iterator i = children.iterator(); i.hasNext(); )
- {
- IFigure child = (IFigure)i.next();
- Dimension childSize = child.getPreferredSize();
- child.setBounds(new Rectangle(x, y, childSize.width, childSize.height));
- y += childSize.height + spacing;
- }
-}
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/CenteredIconFigure.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/CenteredIconFigure.java
deleted file mode 100644
index 3426bb00d8..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/CenteredIconFigure.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.figures;
-
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.swt.graphics.Image;
-
-
-public class CenteredIconFigure extends ContainerFigure
-{
- public Image image;
-
- public CenteredIconFigure()
- {
- super();
- setFill(true);
- }
-
- protected void fillShape(Graphics g)
- {
- super.fillShape(g);
- if (image != null)
- {
- Rectangle r = getBounds();
- Dimension imageSize = new Dimension(16, 16);
- g.drawImage(image, r.x + (r.width - imageSize.width)/2, r.y + (r.height - imageSize.height)/2);
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/ConnectionFigure.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/ConnectionFigure.java
deleted file mode 100644
index aaa05f11c2..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/ConnectionFigure.java
+++ /dev/null
@@ -1,210 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.figures;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.RectangleFigure;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.PointList;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.wst.xsd.ui.internal.graph.editparts.GraphNodeEditPart;
-
-
-
-public class ConnectionFigure extends RectangleFigure
-{
- protected boolean isOutlined = true;
- protected IFigure xsdFigure;
-
- public ConnectionFigure(IFigure xsdFigure)
- {
- setOpaque(false);
- this.xsdFigure = xsdFigure;
- //setFocusTraversable(false);
- //setEnabled(false);
- }
-
- protected boolean isMouseEventTarget()
- {
- return false;
- }
-
- public boolean containsPoint(int x, int y){return false;}
-
- protected void fillShape(Graphics graphics)
- {
- graphics.setForegroundColor(ColorConstants.black);
- drawLines(graphics, xsdFigure);
- }
-
- protected void drawLines(Graphics graphics, IFigure figure)
- {
- if (figure instanceof GraphNodeFigure)
- {
- GraphNodeFigure graphNodeFigure = (GraphNodeFigure)figure;
- if (graphNodeFigure.isConnected() && graphNodeFigure.isExpanded())
- {
- List childList = graphNodeFigure.getChildGraphNodeFigures();
- if (childList.size() > 0)
- {
- Rectangle r = graphNodeFigure.getConnectionRectangle();
-
- int x1 = r.x + r.width;
- int y1 = r.y + r.height/2;
-
- int startOfChildBox = ((GraphNodeFigure)childList.get(0)).getConnectionRectangle().x;
-
- int x2 = x1 + (startOfChildBox - x1) / 3;
- int y2 = y1;
-
- if (childList.size() > 1)
- {
- graphics.drawLine(x1, y1, x2, y2);
-
- int minY = Integer.MAX_VALUE;
- int maxY = -1;
-
- for (Iterator i = childList.iterator(); i.hasNext(); )
- {
- GraphNodeFigure childGraphNodeFigure = (GraphNodeFigure)i.next();
- Rectangle childConnectionRectangle = childGraphNodeFigure.getConnectionRectangle();
- int y = childConnectionRectangle.y + childConnectionRectangle.height / 2;
-
- minY = Math.min(minY, y);
- maxY = Math.max(maxY, y);
- graphics.drawLine(x2, y, childConnectionRectangle.x, y);
- }
- graphics.drawLine(x2, minY, x2, maxY);
- }
- else
- {
- graphics.drawLine(x1, y1, startOfChildBox, y2);
- }
- }
- }
- }
-
- //boolean visitChildren = true;
- List children = figure.getChildren();
- for (Iterator i = children.iterator(); i.hasNext(); )
- {
- IFigure child = (IFigure)i.next();
- drawLines(graphics, child);
- }
- }
-
-
- // This method supports the preview connection line function related to drag and drop
- //
- public PointList getConnectionPoints(GraphNodeEditPart parentEditPart, GraphNodeEditPart 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);
- //pointList.addPoint(new Point(draggedFigureBounds.x, draggedFigureBoundsY));
-
- if (data[0] == 0) // insert between 2 items
- {
- int x = a.x + (draggedFigureBounds.x - a.x)/2;
- 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(GraphNodeEditPart parentEditPart, GraphNodeEditPart childRefEditPart, int[] data)
- {
- Point point = null;
- List childList = parentEditPart.getChildren();
-
- //TreeNodeIconFigure icon = ((TreeNodeFigure)parent.getFigure()).treeNodeIconFigure;
-
- if (childList.size() > 0)
- {
- point = new Point();
-
- GraphNodeEditPart prev = null;
- GraphNodeEditPart next = null;
-
- for (Iterator i = childList.iterator(); i.hasNext(); )
- {
- Object o = i.next();
- if (o instanceof GraphNodeEditPart)
- {
- GraphNodeEditPart childEditPart = (GraphNodeEditPart)o;
- if (childEditPart == childRefEditPart)
- {
- next = childEditPart;
- break;
- }
- prev = childEditPart;
- }
- }
-
- if (next != null && prev != null)
- {
- int ya = prev.getConnectionRectangle().getCenter().y;
- int yb = next.getConnectionRectangle().getCenter().y;
- point.y = ya + (yb - ya)/2;
- data[0] = 0;
- }
- else if (prev != null) // add it last
- {
- point.y = prev.getConnectionRectangle().getCenter().y;
- data[0] = 1;
- }
- else if (next != null) // add it first!
- {
- point.y = next.getConnectionRectangle().getCenter().y;
- data[0] = -1;
- }
-
- if (next != null || prev != null)
- {
- GraphNodeEditPart child = prev != null ? prev : next;
- int startOfChildBox = child.getConnectionRectangle().x;
- Rectangle r = parentEditPart.getConnectionRectangle();
- int x1 = r.x + r.width;
- point.x = x1 + (startOfChildBox - x1) / 3;
- }
- }
- return point;
- }
-
-
- protected void outlineShape(Graphics graphics)
- {
- if (isOutlined)
- {
- super.outlineShape(graphics);
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/ContainerFigure.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/ContainerFigure.java
deleted file mode 100644
index 8594005a03..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/ContainerFigure.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.figures;
-
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.LayoutManager;
-import org.eclipse.draw2d.RectangleFigure;
-
-public class ContainerFigure extends RectangleFigure
-{
- protected boolean isOutlined = false;
-
- public ContainerFigure()
- {
- setLayoutManager(new ContainerLayout());
- setFill(false);
- }
-
- public void doLayout()
- {
- layout();
- setValid(true);
- }
-
- public ContainerLayout getContainerLayout()
- {
- return (ContainerLayout)getLayoutManager();
- }
-
- public void setOutlined(boolean isOutlined)
- {
- this.isOutlined = isOutlined;
- }
-
- protected void outlineShape(Graphics graphics)
- {
- if (isOutlined)
- {
- super.outlineShape(graphics);
- }
- }
-
-
- public void validate()
- {
- if (isValid())
- {
- return;
- }
- super.validate();
- postLayout();
- }
-
-
- protected void postLayout()
- {
- LayoutManager layoutManager = getLayoutManager();
- if (layoutManager instanceof PostLayoutManager)
- {
- ((PostLayoutManager)layoutManager).postLayout(this);
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/ContainerLayout.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/ContainerLayout.java
deleted file mode 100644
index 0a13f10b6c..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/ContainerLayout.java
+++ /dev/null
@@ -1,249 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.figures;
-
-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;
-import org.eclipse.wst.xsd.ui.internal.gef.util.figures.SpacingFigure;
-
-public class ContainerLayout extends AbstractLayout implements PostLayoutManager
-{
- 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;
- }
-
- /**
- * 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 calculatePreferredSize(IFigure parent, int w, int h)
- {
- Dimension preferred = null;
-
- // Here we ensure that an unexpanded container is given a size of (0,0)
- //
- if (parent instanceof GraphNodeContainerFigure)
- {
- GraphNodeContainerFigure graphNodeContainerFigure = (GraphNodeContainerFigure)parent;
- if (!graphNodeContainerFigure.isExpanded())
- {
- preferred = new Dimension();
- }
- }
-
- if (preferred == null)
- {
- 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 (child instanceof Interactor)
- {
- childSize.width = 9;
- childSize.height = 9;
- }*/
-
- 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 int alignFigure(IFigure parent, IFigure child)
- {
- int y = -1;
- return y;
- }
-
- public void layout(IFigure parent)
- {
- List children = parent.getChildren();
- Dimension preferred = new Dimension();
-
- int rx = 0;
- for (int i=0; i < children.size(); i++)
- {
- IFigure child = (IFigure)children.get(i);
- Dimension childSize = child.getPreferredSize();
- if (isHorizontal)
- {
- preferred.height = Math.max(preferred.height, childSize.height);
- rx += childSize.width;
- }
- else
- {
- preferred.width = Math.max(preferred.width, childSize.width);
- }
- }
-
- if (isHorizontal)
- {
- preferred.height += border*2;
- preferred.width += border;
- }
- else
- {
- preferred.width += border*2;
- preferred.height += border;
- }
-
- int childrenSize = children.size();
- for (int i=0; i < childrenSize; i++)
- {
- IFigure child = (IFigure)children.get(i);
- Dimension childSize = child.getPreferredSize();
-
- if (isHorizontal)
- {
- int y = alignFigure(parent, child);
-
-
- if (y == -1)
- {
- y = (preferred.height - childSize.height) / 2;
- }
-
- Rectangle rectangle = new Rectangle(preferred.width, y, childSize.width, childSize.height);
- rectangle.translate(parent.getClientArea().getLocation());
-
- child.setBounds(rectangle);
- preferred.width += childSize.width;
- preferred.width += spacing;
-
- if (child instanceof SpacingFigure)
- {
- int availableHorizontalSpace = parent.getClientArea().width - rx;
- preferred.width += availableHorizontalSpace;
- }
- }
- else
- {
- Rectangle rectangle = new Rectangle(0, preferred.height, childSize.width, childSize.height);
- rectangle.translate(parent.getClientArea().getLocation());
- child.setBounds(rectangle);
- preferred.height += childSize.height;
- preferred.height += spacing;
- }
- }
- }
-
- public void postLayout(IFigure figure)
- {
- // This method attempts to align a 'FloatableFigure' (e.g. an Element node)
- // with any content that it is connected to. This way a chain of connected figures
- // will be vertically aligned (e.g. element -> modelgroup -> element). Any visible clipping of the
- // figures in the graph is probably a result of a bug in this code that results in a 'FloatableFigure' being
- // repositioned beyond the bounds of its parent.
- //
- for (Iterator i = figure.getChildren().iterator(); i.hasNext();)
- {
- IFigure child = (IFigure)i.next();
- if (child instanceof FloatableFigure)
- {
- FloatableFigure floatableFigure = (FloatableFigure)child;
- GraphNodeFigure graphNodeFigure = floatableFigure.getGraphNodeFigure();
- if (graphNodeFigure.isExpanded() && graphNodeFigure.getChildGraphNodeFigures().size() == 1)
- {
- GraphNodeFigure alignedChild = (GraphNodeFigure)graphNodeFigure.getChildGraphNodeFigures().get(0);
- Rectangle alignedChildBounds = alignedChild.getConnectionRectangle();
- Rectangle childBounds = child.getBounds();
-
- int l = childBounds.y + childBounds.height/2;
- int r = alignedChildBounds.y + alignedChildBounds.height/2;
- int delta = r - l;
-
- fixUp(child, delta);
- }
- }
- }
- }
-
- protected void fixUp(IFigure figure, int delta)
- {
- Rectangle bounds = figure.getBounds();
- bounds.y += delta;
- figure.setBounds(bounds);
-
- for (Iterator i = figure.getChildren().iterator(); i.hasNext(); )
- {
- IFigure child = (IFigure)i.next();
- fixUp(child, delta);
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/ExpandableGraphNodeFigure.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/ExpandableGraphNodeFigure.java
deleted file mode 100644
index e3391037ba..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/ExpandableGraphNodeFigure.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.figures;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.RectangleFigure;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Rectangle;
-
-
-// ------------------------------------------------------------
-// | ExpandableGraphNodeFigure |
-// | |
-// | ---------------------------------- --------------- |
-// | | verticalGroup | | | |
-// | | | | | |
-// | | ----------------------------- | | | |
-// | | | horizontalGroup | | | | |
-// | | | | | | | |
-// | | | --------------------- | | | | |
-// | | | | outlinedArea | | | | | |
-// | | | | ----------------- | | | | outer | |
-// | | | | | iconArea | | | | | Content | |
-// | | | | ----------------- | [+] | | | Area | |
-// | | | | ----------------- | | | | | |
-// | | | | | innerContent | | | | | | |
-// | | | | ----------------- | | | | | |
-// | | | --------------------- | | | | |
-// | | ----------------------------- | | | |
-// | | | | | |
-// | | ------------------ | | | |
-// | | | occurenceArea | | | | |
-// | | ------------------ | | | |
-// | ---------------------------------- --------------- |
-// ------------------------------------------------------------
-
-public class ExpandableGraphNodeFigure extends RepeatableGraphNodeFigure
-{
- protected ContainerFigure horizontalGroup;
- protected Interactor interactor;
- protected ContainerFigure outerContentArea;
-
- public boolean isExpanded()
- {
- return interactor.isExpanded();
- }
-
- public void setExpanded(boolean isExpanded)
- {
- interactor.setExpanded(isExpanded);
- }
-
- public ExpandableGraphNodeFigure()
- {
- super();
- isConnected = true;
- }
-
- protected void createFigure()
- {
- createPreceedingSpace(this);
- createVerticalGroup(this);
- createHorizontalGroup(verticalGroup);
- createOutlinedArea(horizontalGroup);
- createInteractor(horizontalGroup);
- createOccurenceArea(verticalGroup);
- createOuterContentArea(this);
- }
-
- protected void createVerticalGroup(IFigure parent)
- {
- verticalGroup = new FloatableFigure(this);
- verticalGroup.getContainerLayout().setHorizontal(false);
- parent.add(verticalGroup);
- }
-
- protected void createHorizontalGroup(IFigure parent)
- {
- horizontalGroup = new ContainerFigure();
- parent.add(horizontalGroup);
- }
-
- protected void createInteractor(IFigure parent)
- {
- interactor = new Interactor();
- interactor.setForegroundColor(ColorConstants.black);
- interactor.setBackgroundColor(ColorConstants.white);
- parent.add(interactor);
- }
-
- protected void createOuterContentArea(IFigure parent)
- {
- // create a small space between the interactor and the contentArea
- //
- RectangleFigure space = new RectangleFigure();
- space.setVisible(false);
- space.setPreferredSize(new Dimension(5, 10));
- parent.add(space);
-
- outerContentArea = new GraphNodeContainerFigure(this);
- outerContentArea.getContainerLayout().setHorizontal(false);
- parent.add(outerContentArea);
- }
-
- public Interactor getInteractor()
- {
- return interactor;
- }
-
- public ContainerFigure getOuterContentArea()
- {
- return outerContentArea;
- }
-
- public IFigure getConnectionFigure()
- {
- return horizontalGroup;
- }
-
- public Rectangle getConnectionRectangle()
- {
- return horizontalGroup.getBounds();
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/FillLayout.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/FillLayout.java
deleted file mode 100644
index e358c0c4af..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/FillLayout.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.figures;
-
-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;
-
-
-/**
- * Figures using the StackLayout as their layout manager have
- * their children placed on top of one another. Order of
- * placement is determined by the order in which the children
- * were added, first child added placed on the bottom.
- */
-public class FillLayout extends AbstractLayout
-{
-
-protected boolean isHorizontal = false;
-protected int spacing = 0;
-public Dimension min;
-
-public FillLayout(){}
-public FillLayout(boolean dummy){}
-
-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.
- * @since 2.0
- */
-protected Dimension calculatePreferredSize(IFigure figure, int w, int h)
-{
- 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 w, int h)
-{
- 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 w, int h)
-{
- return calculatePreferredSize(figure, w, h);
-}
-
-/*
- * 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();
-
- for (Iterator i = children.iterator(); i.hasNext(); )
- {
- IFigure child = (IFigure)i.next();
- Dimension childSize = child.getPreferredSize();
-
- if (isHorizontal)
- {
- child.setBounds(new Rectangle(r.x, r.y, childSize.width, Math.max(preferredSize.height, r.height)));
- r.x += childSize.width + spacing;
- }
- else
- {
- child.setBounds(new Rectangle(r.x, r.y, Math.max(preferredSize.width, r.width), childSize.height));
- r.y += childSize.height + spacing;
- }
- }
-}
-}
- \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/FloatableFigure.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/FloatableFigure.java
deleted file mode 100644
index c224145ee0..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/FloatableFigure.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.figures;
-
-
-
-public class FloatableFigure extends ContainerFigure
-{
- public GraphNodeFigure graphNodeFigure;
-
- public FloatableFigure(GraphNodeFigure graphNodeFigure)
- {
- super();
- this.graphNodeFigure = graphNodeFigure;
- }
-
- public GraphNodeFigure getGraphNodeFigure()
- {
- return graphNodeFigure;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/GraphNodeContainerFigure.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/GraphNodeContainerFigure.java
deleted file mode 100644
index c06a6556d3..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/GraphNodeContainerFigure.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.figures;
-
-
-
-public class GraphNodeContainerFigure extends ContainerFigure
-{
- public ExpandableGraphNodeFigure expandableGraphNodeFigure;
-
- public GraphNodeContainerFigure(ExpandableGraphNodeFigure expandableGraphNodeFigure)
- {
- super();
- this.expandableGraphNodeFigure = expandableGraphNodeFigure;
- }
-
- public boolean isExpanded()
- {
- return expandableGraphNodeFigure.isExpanded();
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/GraphNodeFigure.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/GraphNodeFigure.java
deleted file mode 100644
index 3d9706d5a4..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/GraphNodeFigure.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.figures;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Rectangle;
-
-
-// ------------------------------
-// | GraphNodeFigure |
-// | |
-// | ------------------------- |
-// | | vertical group | |
-// | | --------------------- | |
-// | | | outlined area | | |
-// | | | ----------------- | | |
-// | | | | icon area | | | |
-// | | | ----------------- | | |
-// | | | ----------------- | | |
-// | | | | inner content | | | |
-// | | | ----------------- | | |
-// | | --------------------- | |
-// | ------------------------- |
-// ------------------------------
-
-public class GraphNodeFigure extends ContainerFigure
-{
- protected ContainerFigure verticalGroup;
- protected ContainerFigure outlinedArea;
- protected ContainerFigure iconArea;
- protected ContainerFigure innerContentArea;
-
- protected boolean isConnected;
- protected boolean isIsolated;
-
- protected List childGraphNodeFigures = new ArrayList();
- protected GraphNodeFigure parentGraphNodeFigure;
-
- public GraphNodeFigure()
- {
- isIsolated = false;
- createFigure();
- }
-
- public boolean isExpanded()
- {
- return true;
- }
-
- public boolean isConnected()
- {
- return isConnected;
- }
-
- public void setConnected(boolean isConnected)
- {
- this.isConnected = isConnected;
- }
-
- public void setIsIsolated(boolean isIsolated)
- {
- this.isIsolated = isIsolated;
- }
-
- public boolean getIsIsolated()
- {
- return isIsolated;
- }
-
- protected void createFigure()
- {
- createVerticalGroup(this);
- createOutlinedArea(verticalGroup);
- }
-
- protected void createVerticalGroup(IFigure parent)
- {
- verticalGroup = new ContainerFigure();
- verticalGroup.getContainerLayout().setHorizontal(false);
- parent.add(verticalGroup);
- }
-
- protected void createOutlinedArea(IFigure parent)
- {
- outlinedArea = new ContainerFigure();
- outlinedArea.getContainerLayout().setHorizontal(false);
- parent.add(outlinedArea);
-
- iconArea = new ContainerFigure();
- outlinedArea.add(iconArea);
-
- innerContentArea = new ContainerFigure();
- innerContentArea.getContainerLayout().setHorizontal(false);
- outlinedArea.add(innerContentArea);
- }
-
- public ContainerFigure getIconArea()
- {
- return iconArea;
- }
-
- public ContainerFigure getOutlinedArea()
- {
- return outlinedArea;
- }
-
- public ContainerFigure getInnerContentArea()
- {
- return innerContentArea;
- }
-
- public IFigure getConnectionFigure()
- {
- return outlinedArea;
- }
-
- public Rectangle getConnectionRectangle()
- {
- return outlinedArea.getBounds();
- }
-
- public List getChildGraphNodeFigures()
- {
- return childGraphNodeFigures;
- }
-
- public void addNotify()
- {
- super.addNotify();
- if (isConnected())
- {
- parentGraphNodeFigure = computeParentGraphNodeFigure(this);
- if (parentGraphNodeFigure != null)
- {
- parentGraphNodeFigure.getChildGraphNodeFigures().add(this);
- }
- }
- }
-
- public void removeNotify()
- {
- super.removeNotify();
- if (parentGraphNodeFigure != null)
- {
- parentGraphNodeFigure.getChildGraphNodeFigures().remove(this);
- }
- }
-
- public GraphNodeFigure getParentGraphNodeFigure()
- {
- return parentGraphNodeFigure;
- }
-
- public GraphNodeFigure computeParentGraphNodeFigure(IFigure figure)
- {
- GraphNodeFigure result = null;
- IFigure parent = figure != null ? figure.getParent() : null;
- while (parent != null)
- {
- if (parent instanceof GraphNodeFigure)
- {
- GraphNodeFigure parentGraphNodeFigure = (GraphNodeFigure)parent;
- if (parentGraphNodeFigure.isConnected())
- {
- result = (GraphNodeFigure)parent;
- break;
- }
- }
- parent = parent.getParent();
- }
- return result;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/Interactor.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/Interactor.java
deleted file mode 100644
index 7a64b8fbac..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/Interactor.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.figures;
-
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.RectangleFigure;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Rectangle;
-
-/**
- * Interactor the +/- control commonly found in trees
- */
-public class Interactor extends RectangleFigure
-{
- protected boolean isExpanded;
-
- public Interactor()
- {
- super();
- setPreferredSize(new Dimension(9, 9));
- }
-
- public void setExpanded(boolean isExpanded)
- {
- this.isExpanded = isExpanded;
- }
-
- public boolean isExpanded()
- {
- return isExpanded;
- }
-
- protected void fillShape(Graphics g)
- {
- super.fillShape(g);
- Rectangle r = getBounds();
- int mx = r.x + r.width / 2;
- int my = r.y + r.height / 2;
- int s = 2;
- g.drawLine(r.x + s, my, r.x + r.width - s - 1, my);
- if (!isExpanded)
- {
- g.drawLine(mx, r.y + s, mx, r.y + r.height - s -1);
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/LabelFigure.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/LabelFigure.java
deleted file mode 100644
index 04c82b8430..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/LabelFigure.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.figures;
-
-import org.eclipse.draw2d.Figure;
-import org.eclipse.draw2d.FigureUtilities;
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Rectangle;
-
-
-public class LabelFigure extends Figure
-{
- protected String text = "";
- protected boolean isShowEmptyLabel = true;
- protected int left = 4;
- protected int right = 4;
- protected int textHeight;
- protected int textWidth;
-
- public LabelFigure()
- {
- setPreferredSize(new Dimension());
- }
-
- protected void setLeft(int left)
- {
- this.left = left;
- }
-
- protected void setRight(int right)
- {
- this.right = right;
- }
-
- public void setShowEmptyLabel(boolean isShowEmptyLabel)
- {
- this.isShowEmptyLabel = isShowEmptyLabel;
- }
-
-
- public void setText(String s)
- {
- if (s == null)
- s = "";
-
- if (!text.equals(s))
- {
- text = s;
- if (text.length() > 0 || isShowEmptyLabel)
- {
- textHeight = FigureUtilities.getFontMetrics(getFont()).getHeight();
- textWidth = FigureUtilities.getTextWidth(text, getFont());
- textWidth = Math.max(textWidth, FigureUtilities.getTextWidth("abcdefg", getFont()));
- setPreferredSize(new Dimension(textWidth + left + right, textHeight));
- }
- else
- {
- setPreferredSize(new Dimension());
- }
- }
- //revalidate();
- //repaint();
- }
-
-
-
- protected void paintFigure(Graphics graphics)
- //protected void fillShape(Graphics graphics)
- {
- super.paintFigure(graphics);
- //super.fillShape(graphics);
- if (text.length() > 0)
- {
- Rectangle r = getBounds();
- graphics.setForegroundColor(getForegroundColor());
- graphics.drawString(text, left + r.x, r.y);// + (r.width - textWidth)/2, r.y + (r.height - textHeight)/2);
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/PostLayoutManager.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/PostLayoutManager.java
deleted file mode 100644
index 21a1f54274..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/PostLayoutManager.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.figures;
-
-import org.eclipse.draw2d.IFigure;
-
-
-public interface PostLayoutManager
-{
- public void postLayout(IFigure figure);
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/RepeatableGraphNodeFigure.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/RepeatableGraphNodeFigure.java
deleted file mode 100644
index fd8d2496c3..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/RepeatableGraphNodeFigure.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.figures;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.RectangleFigure;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.wst.xsd.ui.internal.graph.GraphicsConstants;
-
-
-
-
-// ------------------------------
-// | RepeatableGraphNodeFigure |
-// | |
-// | ------------------------- |
-// | | vertical group | |
-// | | --------------------- | |
-// | | | outlined area | | |
-// | | | ----------------- | | |
-// | | | | icon area | | | |
-// | | | ----------------- | | |
-// | | | ----------------- | | |
-// | | | | inner content | | | |
-// | | | ----------------- | | |
-// | | --------------------- | |
-// | | | |
-// | | ------------------ | |
-// | | | occurence area | | |
-// | | ------------------ | |
-// | ------------------------- |
-// ------------------------------
-
-public class RepeatableGraphNodeFigure extends GraphNodeFigure
-{
- protected ContainerFigure occurenceArea;
- protected LabelFigure occurenceLabel;
-
- public RepeatableGraphNodeFigure()
- {
- super();
- }
-
- protected void createFigure()
- {
- createPreceedingSpace(this);
- createVerticalGroup(this);
- createOutlinedArea(verticalGroup);
- createOccurenceArea(verticalGroup);
- }
-
- protected void createOccurenceArea(IFigure parent)
- {
- occurenceArea = new ContainerFigure();
- occurenceLabel = new LabelFigure();
- occurenceLabel.setForegroundColor(ColorConstants.black);
- occurenceLabel.setShowEmptyLabel(false);
- occurenceLabel.setFont(GraphicsConstants.medium);
- occurenceArea.add(occurenceLabel);
- parent.add(occurenceArea);
- }
-
- protected void createPreceedingSpace(IFigure parent)
- {
- // create a small space
- RectangleFigure space = new RectangleFigure();
- space.setVisible(false);
- space.setPreferredSize(new Dimension(10, 10));
- parent.add(space);
- }
-
- public LabelFigure getOccurenceLabel()
- {
- return occurenceLabel;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/RoundedLineBorder.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/RoundedLineBorder.java
deleted file mode 100644
index 75dbff750c..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/figures/RoundedLineBorder.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.figures;
-
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.LineBorder;
-import org.eclipse.draw2d.geometry.Insets;
-import org.eclipse.swt.graphics.Color;
-
-
-public class RoundedLineBorder extends LineBorder
-{
- protected int arcLength;
- protected int lineStyle = Graphics.LINE_SOLID;
-
- public RoundedLineBorder(Color c, int width, int arcLength)
- {
- super(c, width);
- this.arcLength = arcLength;
- }
-
- public RoundedLineBorder(int width, int arcLength)
- {
- super(width);
- this.arcLength = arcLength;
- }
-
- public RoundedLineBorder(Color c, int width, int arcLength, int lineStyle)
- {
- super(c, width);
- this.arcLength = arcLength;
- this.lineStyle = lineStyle;
- }
-
- public RoundedLineBorder(int width, int arcLength, int lineStyle)
- {
- super(width);
- this.arcLength = arcLength;
- this.lineStyle = lineStyle;
- }
-
- public void paint(IFigure figure, Graphics graphics, Insets insets)
- {
- int rlbWidth = getWidth();
- tempRect.setBounds(getPaintRectangle(figure, insets));
- if (rlbWidth%2 == 1)
- {
- tempRect.width--;
- tempRect.height--;
- }
- tempRect.shrink(rlbWidth/2,rlbWidth/2);
- graphics.setLineWidth(rlbWidth);
- graphics.setLineStyle(lineStyle);
- if (getColor() != null)
- graphics.setForegroundColor(getColor());
- graphics.drawRoundRectangle(tempRect, arcLength, arcLength);
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/model/Category.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/model/Category.java
deleted file mode 100644
index bd99148ff5..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/model/Category.java
+++ /dev/null
@@ -1,266 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.model;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.wst.xsd.ui.internal.XSDEditorPlugin;
-import org.eclipse.xsd.XSDAttributeDeclaration;
-import org.eclipse.xsd.XSDComplexTypeDefinition;
-import org.eclipse.xsd.XSDElementDeclaration;
-import org.eclipse.xsd.XSDModelGroupDefinition;
-import org.eclipse.xsd.XSDNotationDeclaration;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.XSDSchemaDirective;
-import org.eclipse.xsd.XSDSimpleTypeDefinition;
-import org.eclipse.xsd.XSDTypeDefinition;
-
-
-public class Category implements ModelAdapter
-{
- 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;
-
-
- protected XSDSchema schema;
- protected int groupType;
-
- //public void modelNameChanged();
- public Category(XSDSchema schema, int groupType)
- {
- this.schema = schema;
- this.groupType = groupType;
- }
-
- public int getGroupType()
- {
- return groupType;
- }
-
- public XSDSchema getXSDSchema()
- {
- return schema;
- }
-
- public String getName()
- {
- String name = "";
- switch (groupType)
- {
- case ATTRIBUTES : { name = XSDEditorPlugin.getXSDString("_UI_GRAPH_ATTRIBUTES"); break; }
- case NOTATIONS : { name = XSDEditorPlugin.getXSDString("_UI_GRAPH_NOTATIONS"); break; }
- case ELEMENTS : { name = XSDEditorPlugin.getXSDString("_UI_GRAPH_ELEMENTS"); break; }
- case TYPES : { name = XSDEditorPlugin.getXSDString("_UI_GRAPH_TYPES"); break; }
- case GROUPS : { name = XSDEditorPlugin.getXSDString("_UI_GRAPH_GROUPS"); break; }
- case DIRECTIVES : { name = XSDEditorPlugin.getXSDString("_UI_GRAPH_DIRECTIVES"); break; }
- }
- return name;
- }
-
- public List getChildren()
- {
- List list = Collections.EMPTY_LIST;
- switch (groupType)
- {
- case ATTRIBUTES : { list = getAttributeList(); break; }
- case NOTATIONS : { list = getNotations(); break; }
- case ELEMENTS : { list = getGlobalElements(); break; }
- case TYPES : { list = getTypes(); break; }
- case GROUPS : { list = getGroups(); break; }
- case DIRECTIVES : { list = getDirectives(); break; }
- }
- return list;
- }
-
- private boolean isSameNamespace(String ns1, String ns2)
- {
- if (ns1 == null) ns1 = "";
- if (ns2 == null) ns2 = "";
-
- if (ns1.equals(ns2))
- {
- return true;
- }
- return false;
- }
-
- protected List getGlobalElements()
- {
- List elements = schema.getElementDeclarations();
- List list = new ArrayList();
- for (Iterator i = elements.iterator(); i.hasNext(); )
- {
- XSDElementDeclaration elem = (XSDElementDeclaration)i.next();
- String targetNamespace = elem.getTargetNamespace();
- if (isSameNamespace(elem.getTargetNamespace(),schema.getTargetNamespace()))
- {
- list.add(elem);
- }
- }
- return list;
- }
-
- protected List getTypes()
- {
- 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 (isSameNamespace(ct.getTargetNamespace(),schema.getTargetNamespace()))
- {
- list.add(ct);
- }
- }
- }
-
-// List simpleTypes = schema.getTypeDefinitions();
- for (Iterator i = allTypes.iterator(); i.hasNext(); )
- {
- XSDTypeDefinition td = (XSDTypeDefinition)i.next();
- if (td instanceof XSDSimpleTypeDefinition)
- {
- XSDSimpleTypeDefinition st = (XSDSimpleTypeDefinition)td;
- if (isSameNamespace(st.getTargetNamespace(),schema.getTargetNamespace()))
- {
- list.add(st);
- }
- }
- }
- return list;
- }
-
- protected List getGroups()
- {
- List groups = schema.getModelGroupDefinitions();
- List list = new ArrayList();
- for (Iterator i = groups.iterator(); i.hasNext(); )
- {
- XSDModelGroupDefinition group = (XSDModelGroupDefinition)i.next();
- if (isSameNamespace(group.getTargetNamespace(),schema.getTargetNamespace()))
- {
- list.add(group);
- }
- }
- return list;
- }
-
- protected List getDirectives()
- {
- List list = new ArrayList();
- for (Iterator i = schema.getContents().iterator(); i.hasNext(); )
- {
- Object o = i.next();
- if (o instanceof XSDSchemaDirective)
- {
- list.add(o);
- }
- }
- return list;
- }
-
- protected List getAttributeList()
- {
- List attributesList = new ArrayList();
- for (Iterator iter = schema.getAttributeDeclarations().iterator(); iter.hasNext(); )
- {
- Object o = iter.next();
- if (o instanceof XSDAttributeDeclaration)
- {
- XSDAttributeDeclaration attr = (XSDAttributeDeclaration)o;
- if (attr != null)
- {
- if (attr.getTargetNamespace() != null)
- {
- if (!(attr.getTargetNamespace().equals("http://www.w3.org/2001/XMLSchema-instance")))
- {
- if (isSameNamespace(attr.getTargetNamespace(), schema.getTargetNamespace()))
- {
- attributesList.add(attr);
- }
- }
- }
- else
- {
- if (isSameNamespace(attr.getTargetNamespace(),schema.getTargetNamespace()))
- {
- attributesList.add(attr);
- }
- }
- }
- }
- }
- return attributesList;
- }
-
- protected List getNotations()
- {
- List notations = schema.getNotationDeclarations();
- List list = new ArrayList();
- for (Iterator i = notations.iterator(); i.hasNext(); )
- {
- XSDNotationDeclaration notation = (XSDNotationDeclaration)i.next();
- if (isSameNamespace(notation.getTargetNamespace(),schema.getTargetNamespace()))
- {
- list.add(notation);
- }
- }
- return list;
- }
-
- //
- protected List listenerList = new ArrayList();
-
- public void addListener(ModelAdapterListener l)
- {
- listenerList.add(l);
- }
-
- public void removeListener(ModelAdapterListener l)
- {
- listenerList.remove(l);
- }
-
- public Object getProperty(Object modelObject, String propertyName)
- {
- return null;
- }
-
- public void firePropertyChanged(Object modelObject, String propertyName)
- {
- List newList = new ArrayList();
- newList.addAll(listenerList);
- for (Iterator i = newList.iterator(); i.hasNext(); )
- {
- ModelAdapterListener l = (ModelAdapterListener)i.next();
- try
- {
- l.propertyChanged(modelObject, propertyName);
- }
- catch (Exception e)
- {
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/model/ModelAdapter.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/model/ModelAdapter.java
deleted file mode 100644
index 30669878a2..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/model/ModelAdapter.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.model;
-
-
-
-public interface ModelAdapter
-{
- public static final String CHILDREN_PROPERTY = "CHILDREN_PROPERTY";
- public static final String LABEL_PROPERTY = "LABEL_PROPERTY";
- public static final String IMAGE_PROPERTY = "IMAGE_PROPERTY";
- public static final String DETAIL_PROPERTY = "DETAIL_PROPERTY";
-
- public void addListener(ModelAdapterListener l);
- public void removeListener(ModelAdapterListener l);
- public Object getProperty(Object modelObject, String propertyName);
- public void firePropertyChanged(Object modelObject, String propertyName);
-}
-
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/model/ModelAdapterListener.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/model/ModelAdapterListener.java
deleted file mode 100644
index ff6e4db5f6..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/model/ModelAdapterListener.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.model;
-
-
-
-public interface ModelAdapterListener
-{
- public void propertyChanged(Object object, String property);
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/model/XSDModelAdapterFactory.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/model/XSDModelAdapterFactory.java
deleted file mode 100644
index 471aebb9bf..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/model/XSDModelAdapterFactory.java
+++ /dev/null
@@ -1,511 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.graph.model;
-
-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.Notifier;
-import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.wst.xsd.ui.internal.XSDEditorPlugin;
-import org.eclipse.wst.xsd.ui.internal.graph.XSDChildUtility;
-import org.eclipse.wst.xsd.ui.internal.provider.XSDAbstractAdapter;
-import org.eclipse.wst.xsd.ui.internal.provider.XSDModelAdapterFactoryImpl;
-import org.eclipse.xsd.XSDComplexTypeDefinition;
-import org.eclipse.xsd.XSDElementDeclaration;
-import org.eclipse.xsd.XSDNamedComponent;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.XSDSchemaDirective;
-import org.eclipse.xsd.XSDTypeDefinition;
-import org.eclipse.xsd.util.XSDSwitch;
-
-
-
-
-public class XSDModelAdapterFactory
-{
- protected static XSDModelAdapterFactory instance;
- protected static XSDAdapterFactoryImpl xsdAdapterFactoryImpl = new XSDAdapterFactoryImpl();
-
- public static XSDModelAdapterFactory getInstance()
- {
- if (instance == null)
- {
- instance = new XSDModelAdapterFactory();
- }
- return instance;
- }
-
-
- public static ModelAdapter getAdapter(Object o)
- {
- ModelAdapter result = null;
- if (o instanceof Notifier)
- {
- Notifier target = (Notifier)o;
- Adapter adapter = xsdAdapterFactoryImpl.adapt(target);
- if (adapter instanceof XSDObjectAdapter)
- {
- result = (XSDObjectAdapter)adapter;
- }
- }
- else if (o instanceof ModelAdapter)
- {
- result = (ModelAdapter)o;
- }
- return result;
- }
-
-
- public static XSDObjectAdapter getExisitingAdapter(Object xsdObject)
- {
- XSDObjectAdapter result = null;
- if (xsdObject instanceof Notifier)
- {
- Notifier target = (Notifier)xsdObject;
- Adapter adapter = EcoreUtil.getExistingAdapter(target,xsdAdapterFactoryImpl);
- if (adapter instanceof XSDObjectAdapter)
- {
- result = (XSDObjectAdapter)adapter;
- }
- }
- return result;
- }
-
- //
- //
- //
- public static class XSDAdapterFactoryImpl extends AdapterFactoryImpl
- {
- public Adapter createAdapter(Notifier target)
- {
- XSDSwitch xsdSwitch = new XSDSwitch()
- {
- public Object caseXSDElementDeclaration(XSDElementDeclaration object)
- {
- return new XSDElementDeclarationAdapter(object);
- }
-
- public Object caseXSDSchema(XSDSchema object)
- {
- return new XSDSchemaAdapter(object);
- }
-
- public Object defaultCase(EObject object)
- {
- return new XSDObjectAdapter();
- }
- };
- Object o = xsdSwitch.doSwitch((EObject)target);
-
- Adapter result = null;
- if (o instanceof Adapter)
- {
- result = (Adapter)o;
- }
- else
- {
-// System.out.println("did not create adapter for target : " + target);
-// Thread.dumpStack();
- }
- return result;
- }
-
-
- public Adapter adapt(Notifier target)
- {
- return adapt(target, this);
- }
- }
-
-
-
- //
- //
- //
- protected static class XSDObjectAdapter extends AdapterImpl implements ModelAdapter
- {
- protected List listenerList = new ArrayList();
- protected boolean isUpdating = false;
-
- public boolean isAdapterForType(Object type)
- {
- return type == xsdAdapterFactoryImpl;
- }
-
- public void addListener(ModelAdapterListener l)
- {
- listenerList.add(l);
- }
-
- public void removeListener(ModelAdapterListener l)
- {
- listenerList.remove(l);
- }
-
- public Object getProperty(Object modelObject, String propertyName)
- {
- Object result = null;
- if (ModelAdapter.LABEL_PROPERTY.equals(propertyName))
- {
- result = "";
- // TODO... move this logic into each adapter
- //
- if (modelObject instanceof XSDNamedComponent)
- {
- result = ((XSDNamedComponent)modelObject).getName();
- }
- else if (modelObject instanceof XSDSchemaDirective)
- {
- result = ((XSDSchemaDirective)modelObject).getSchemaLocation();
- if (result == null) result = "(" + XSDEditorPlugin.getXSDString("_UI_LABEL_NO_LOCATION_SPECIFIED") + ")";
- if (result.equals("")) result = "(" + XSDEditorPlugin.getXSDString("_UI_LABEL_NO_LOCATION_SPECIFIED") + ")";
- return result;
- }
- }
- else if ("drillDown".equals(propertyName))
- {
- // TODO... move this logic into each adapter
- //
- List list = XSDChildUtility.getModelChildren(modelObject);
- result = list.size() > 0 ? Boolean.TRUE : Boolean.FALSE;
- }
- else if (ModelAdapter.IMAGE_PROPERTY.equals(propertyName))
- {
- // result = XSDEditorPlugin.getDefault().getImage("icons/XSDElement.gif");
- XSDModelAdapterFactoryImpl factory = new XSDModelAdapterFactoryImpl();
- Adapter adapter = factory.createAdapter((Notifier)modelObject);
- result = ((XSDAbstractAdapter)adapter).getImage(modelObject);
- }
- return result;
- }
-
- public void firePropertyChanged(Object modelObject, String propertyName)
- {
- List newList = new ArrayList();
- newList.addAll(listenerList);
- for (Iterator i = newList.iterator(); i.hasNext(); )
- {
- ModelAdapterListener l = (ModelAdapterListener)i.next();
- try
- {
- l.propertyChanged(modelObject, propertyName);
- }
- catch (Exception e)
- {
- }
- }
- }
-
- public void notifyChanged(Notification msg)
- {
- firePropertyChanged(msg.getNotifier(), null);
- }
- }
-
-
-
- //
- //
- //
- protected static class XSDElementDeclarationAdapter extends XSDObjectAdapter implements ModelAdapterListener
- {
- protected XSDElementDeclaration ed;
- protected XSDTypeDefinition typeDefinition;
-
- public XSDElementDeclarationAdapter(XSDElementDeclaration ed)
- {
- this.ed = ed;
- updateTypeDefinition();
- }
-
- protected void updateTypeDefinition()
- {
- XSDTypeDefinition td = ed.getTypeDefinition();
- td = (td instanceof XSDComplexTypeDefinition) ? td : null;
- if (td != typeDefinition)
- {
- if (typeDefinition != null)
- {
- XSDObjectAdapter adapter = (XSDObjectAdapter)xsdAdapterFactoryImpl.adapt(typeDefinition);
- adapter.removeListener(this);
- }
- typeDefinition = td;
- if (typeDefinition != null)
- {
- XSDObjectAdapter adapter = (XSDObjectAdapter)xsdAdapterFactoryImpl.adapt(typeDefinition);
- adapter.addListener(this);
- }
- }
- }
-
-
- public void notifyChanged(Notification msg)
- {
- updateTypeDefinition();
- firePropertyChanged(msg.getNotifier(), null);
- }
-
-
- public void propertyChanged(Object object, String property)
- {
- // here we propagate typeDefinition changes to our listeners
- firePropertyChanged(object, property);
- }
- }
-
-
- //
- //
- protected static class XSDSchemaAdapter extends XSDObjectAdapter
- {
- protected XSDSchema schema;
- protected List groups;
-
- public XSDSchemaAdapter(XSDSchema schema)
- {
- this.schema = schema;
- groups = new ArrayList();
- groups.add(new Category(schema, Category.DIRECTIVES));
- groups.add(new Category(schema, Category.ATTRIBUTES));
- //groups.add(new Category(schema, Category.ATTRIBUTE_GROUPS));
- groups.add(new Category(schema, Category.ELEMENTS));
- groups.add(new Category(schema, Category.TYPES));
- //groups.add(new Category(schema, Category.SIMPLE_TYPES));
- groups.add(new Category(schema, Category.GROUPS));
- }
-
- public void notifyChanged(Notification msg)
- {
- super.notifyChanged(msg);
- for (Iterator i = groups.iterator(); i.hasNext(); )
- {
- ModelAdapter group = (ModelAdapter)i.next();
- group.firePropertyChanged(group, null);
- }
- }
-
- public Object getProperty(Object modelObject, String propertyName)
- {
- Object result = null;
- if ("groups".equals(propertyName))
- {
- /*
- List list = new ArrayList();
- for (Iterator i = groups.iterator(); i.hasNext(); )
- {
- Category group = (Category)i.next();
- if (group.getChildren().size() > 0)
- {
- list.add(group);
- }
- }
- result = list;*/
- result = groups;
- }
- if (result == null)
- {
- result = super.getProperty(modelObject, propertyName);
- }
- return result;
- }
- }
-
-
- public static void addModelAdapterListener(Object modelObject, ModelAdapterListener listener)
- {
- ModelAdapter modelAdapter = getModelAdapter(modelObject);
- if (modelAdapter != null)
- {
- modelAdapter.addListener(listener);
- }
- }
-
-
- public static void removeModelAdapterListener(Object modelObject, ModelAdapterListener listener)
- {
- ModelAdapter modelAdapter = getModelAdapter(modelObject);
- if (modelAdapter != null)
- {
- modelAdapter.removeListener(listener);
- }
- }
-
- protected static ModelAdapter getModelAdapter(Object modelObject)
- {
- ModelAdapter modelAdapter = null;
- if (modelObject instanceof Notifier)
- {
- modelAdapter = (ModelAdapter)xsdAdapterFactoryImpl.adapt((Notifier)modelObject);
- }
- else if (modelObject instanceof ModelAdapter)
- {
- modelAdapter = (ModelAdapter)modelObject;
- }
- return modelAdapter;
- }
-}
-
-
-
-// --------------------------------------------------------------------------------------------
-// todo... revist this stuff
-// --------------------------------------------------------------------------------------------
-
- /*
- public static void handleTypeChange(XSDTypeDefinition td, XSDSchema schema, int change)
- {
- try
- {
- TypeFindingSchemaVisitor visitor = new TypeFindingSchemaVisitor(schema, td, change == Notification.ADD);
- List list = visitor.findElementsUsingType(schema);
-
- if (change == Notification.REMOVE)
- {
- visitor.removeMatchingReferences();
- }
- else if (change == Notification.ADD)
- {
- visitor.setMatchingReferences();
- }
- else
- {
- visitor.cleanUpTypeMismatches();
- }
-
- for (Iterator i = list.iterator(); i.hasNext(); )
- {
- Object o = i.next();
- XSDObjectAdapter adapter = getExisitingAdapter(o);
- if (adapter != null)
- {
- adapter.fireChildrenChangedNotification();
- }
- }
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
-
-
- protected static class TypeFindingSchemaVisitor extends org.eclipse.wst.xsd.utility.XSDVisitor
- {
- protected XSDTypeDefinition td;
- protected List list = new ArrayList();
- protected XSDSchema schema;
- protected boolean matchByName;
-
- public TypeFindingSchemaVisitor(XSDSchema schema, XSDTypeDefinition td, boolean matchByName)
- {
- this.td = td;
- this.schema = schema;
- this.matchByName = matchByName;
- }
-
- public void visitElementDeclaration(XSDElementDeclaration ed)
- {
- if (ed.getTypeDefinition() == td)
- {
- list.add(ed);
- }
- else if (matchByName)
- {
- String[] name = getDOMName(ed);
- if (name[0].equals(td.getTargetNamespace()) && name[1].equals(td.getName()))
- {
- list.add(ed);
- }
- }
- }
-
- public List findElementsUsingType(XSDSchema schema)
- {
- if (td != null)
- {
- visitSchema(schema);
- }
- return list;
- }
-
- public List getMatchingTypeList()
- {
- return list;
- }
-
- public String[] getDOMName(XSDElementDeclaration ed)
- {
- String[] result = new String[2];
- org.w3c.dom.Element domElement = ed.getElement();
- String typeName = domElement.getAttribute("type");
- if (typeName != null && !typeName.endsWith(td.getName()))
- {
- int index = typeName.indexOf(":");
- String prefix = index == -1 ? "" : typeName.substring(0, index);
- result[0] = (String)schema.getQNamePrefixToNamespaceMap().get(prefix);
- if (result[0] == null) result[0] = "";
- if (result[1] == null) result[1] = "";
- result[1] = index == -1 ? typeName : typeName.substring(index + 1);
- }
- else
- {
- result[0] = "";
- result[1] = "";
- }
- return result;
- }
-
-
- public void cleanUpTypeMismatches()
- {
- for (Iterator i = list.iterator(); i.hasNext(); )
- {
- XSDElementDeclaration ed = (XSDElementDeclaration)i.next();
- XSDTypeDefinition candidateTd = ed.getTypeDefinition();
- if (candidateTd != null && candidateTd.getName() != null)
- {
- String[] result = getDOMName(ed);
- ed.setTypeDefinition((XSDTypeDefinition)schema.resolveComplexTypeDefinition(result[0], result[1]));
- }
- }
- }
-
- public void removeMatchingReferences()
- {
- for (Iterator i = list.iterator(); i.hasNext(); )
- {
- XSDElementDeclaration ed = (XSDElementDeclaration)i.next();
- String[] result = getDOMName(ed);
- if (ed.getElement() != null)
- {
- // NOTE ... this forces the model to reset the ed's XSDTypeDefinition without causing the
- // DOM element's 'type' attribute to be set to null
- ed.elementAttributesChanged(ed.getElement());
- }
- }
- }
-
- public void setMatchingReferences()
- {
- for (Iterator i = list.iterator(); i.hasNext(); )
- {
- XSDElementDeclaration ed = (XSDElementDeclaration)i.next();
- ed.setTypeDefinition(td);
- }
- }
- } */
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/GenerateDtd.gif b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/GenerateDtd.gif
deleted file mode 100644
index ac58c1e8ab..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/GenerateDtd.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/GenerateJava.gif b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/GenerateJava.gif
deleted file mode 100644
index 2375c655d8..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/GenerateJava.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/GraphViewElementRef.gif b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/GraphViewElementRef.gif
deleted file mode 100644
index d535dac36d..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/GraphViewElementRef.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/NewXSD.gif b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/NewXSD.gif
deleted file mode 100644
index 47f6730398..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/NewXSD.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/RegexWizardArrow.gif b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/RegexWizardArrow.gif
deleted file mode 100644
index 3d550a30e8..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/RegexWizardArrow.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/ValidateXSD.gif b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/ValidateXSD.gif
deleted file mode 100644
index 2b347ac458..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/ValidateXSD.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDAll.gif b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDAll.gif
deleted file mode 100644
index 6d74e802b5..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDAll.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDAnnotate.gif b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDAnnotate.gif
deleted file mode 100644
index d2108c0368..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDAnnotate.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDAny.gif b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDAny.gif
deleted file mode 100644
index a39f93cdce..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDAny.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDAnyAttribute.gif b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDAnyAttribute.gif
deleted file mode 100644
index 5280cc2904..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDAnyAttribute.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDAppInfo.gif b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDAppInfo.gif
deleted file mode 100644
index 2da001e3e9..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDAppInfo.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDAttribute.gif b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDAttribute.gif
deleted file mode 100644
index 79d49d037b..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDAttribute.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDAttributeGroup.gif b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDAttributeGroup.gif
deleted file mode 100644
index 648462ff67..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDAttributeGroup.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDAttributeGroupRef.gif b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDAttributeGroupRef.gif
deleted file mode 100644
index a89fa8f187..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDAttributeGroupRef.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDAttributeRef.gif b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDAttributeRef.gif
deleted file mode 100644
index 8365af2f3c..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDAttributeRef.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDChoice.gif b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDChoice.gif
deleted file mode 100644
index 89ba825253..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDChoice.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDComplexContent.gif b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDComplexContent.gif
deleted file mode 100644
index 41c68dda8c..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDComplexContent.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDComplexType.gif b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDComplexType.gif
deleted file mode 100644
index 007f8522af..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDComplexType.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDDoc.gif b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDDoc.gif
deleted file mode 100644
index d349a05f2b..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDDoc.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDElement.gif b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDElement.gif
deleted file mode 100644
index dd45f08fb1..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDElement.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDElementRef.gif b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDElementRef.gif
deleted file mode 100644
index 749acfc9c9..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDElementRef.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDExtension.gif b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDExtension.gif
deleted file mode 100644
index 0cfb8076dd..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDExtension.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDField.gif b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDField.gif
deleted file mode 100644
index 378e43e14d..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDField.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDFile.gif b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDFile.gif
deleted file mode 100644
index 3900f1b55d..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDFile.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDGlobalAttribute.gif b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDGlobalAttribute.gif
deleted file mode 100644
index 79d49d037b..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDGlobalAttribute.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDGlobalElement.gif b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDGlobalElement.gif
deleted file mode 100644
index dd45f08fb1..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDGlobalElement.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDGroup.gif b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDGroup.gif
deleted file mode 100644
index 555ef53306..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDGroup.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDGroupRef.gif b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDGroupRef.gif
deleted file mode 100644
index 36213426cf..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDGroupRef.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDImport.gif b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDImport.gif
deleted file mode 100644
index 9e44ce52a9..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDImport.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDInclude.gif b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDInclude.gif
deleted file mode 100644
index b26c527f5e..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDInclude.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDKey.gif b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDKey.gif
deleted file mode 100644
index 04032a915a..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDKey.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDKeyRef.gif b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDKeyRef.gif
deleted file mode 100644
index ee5829d693..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDKeyRef.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDNotation.gif b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDNotation.gif
deleted file mode 100644
index ce9df985b8..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDNotation.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDRedefine.gif b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDRedefine.gif
deleted file mode 100644
index 56964c13a5..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDRedefine.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDSelector.gif b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDSelector.gif
deleted file mode 100644
index 2399a58204..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDSelector.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDSequence.gif b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDSequence.gif
deleted file mode 100644
index 8bf3f972d2..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDSequence.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDSimpleContent.gif b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDSimpleContent.gif
deleted file mode 100644
index 7ef38df720..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDSimpleContent.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDSimpleEnum.gif b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDSimpleEnum.gif
deleted file mode 100644
index 11d7958525..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDSimpleEnum.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDSimpleList.gif b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDSimpleList.gif
deleted file mode 100644
index d08e78f891..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDSimpleList.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDSimplePattern.gif b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDSimplePattern.gif
deleted file mode 100644
index a113cf45a0..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDSimplePattern.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDSimpleRestrict.gif b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDSimpleRestrict.gif
deleted file mode 100644
index 38bc12e32f..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDSimpleRestrict.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDSimpleType.gif b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDSimpleType.gif
deleted file mode 100644
index 75f33c24fa..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDSimpleType.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDSimpleUnion.gif b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDSimpleUnion.gif
deleted file mode 100644
index 292adafc8e..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDSimpleUnion.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDUnique.gif b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDUnique.gif
deleted file mode 100644
index 5a8a650f3d..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/XSDUnique.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/back.gif b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/back.gif
deleted file mode 100644
index 24d1a279e5..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/back.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/browsebutton.gif b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/browsebutton.gif
deleted file mode 100644
index 13dae59bea..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/browsebutton.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/forward.gif b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/forward.gif
deleted file mode 100644
index eab699e385..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/forward.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/generate_xml.gif b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/generate_xml.gif
deleted file mode 100644
index f2e363564f..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/generate_xml.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/regx_wiz.gif b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/regx_wiz.gif
deleted file mode 100644
index 789d137394..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/regx_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/reloadgrammar.gif b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/reloadgrammar.gif
deleted file mode 100644
index c705db0c1e..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/reloadgrammar.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/sort.gif b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/sort.gif
deleted file mode 100644
index 3c65dc4ba1..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/icons/sort.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/preferences/XSDPreferencePage.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/preferences/XSDPreferencePage.java
deleted file mode 100644
index 0506798f4b..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/preferences/XSDPreferencePage.java
+++ /dev/null
@@ -1,256 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.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.swt.widgets.Widget;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.wst.xsd.ui.internal.XSDEditorContextIds;
-import org.eclipse.wst.xsd.ui.internal.XSDEditorPlugin;
-import org.eclipse.wst.xsd.ui.internal.util.ViewUtility;
-
-public class XSDPreferencePage extends PreferencePage implements IWorkbenchPreferencePage, Listener
-{
- Text indentTextField;
- String indentString;
- Text schemaNsPrefixField;
- Text defaultTargetNamespaceText;
- Button qualifyXSDLanguage;
-
- /**
- * Creates preference page controls on demand.
- * @param parent the parent for the preference page
- */
- protected Control createContents(Composite parent)
- {
- WorkbenchHelp.setHelp(parent, XSDEditorContextIds.XSDP_PREFERENCE_PAGE);
-
- Group group = createGroup(parent, 2);
- group.setText(XSDEditorPlugin.getXSDString("_UI_TEXT_XSD_NAMESPACE_PREFIX"));
-
- qualifyXSDLanguage = ViewUtility.createCheckBox(group, XSDEditorPlugin.getXSDString("_UI_QUALIFY_XSD"));
- ViewUtility.createLabel(group, " ");
-
- createLabel(group, XSDEditorPlugin.getXSDString("_UI_TEXT_XSD_DEFAULT_PREFIX"));
- schemaNsPrefixField = createTextField(group);
- schemaNsPrefixField.addKeyListener(new KeyAdapter()
- {
- public void keyPressed(KeyEvent e)
- {
- setValid(true);
- }
- });
-
- createLabel(group, XSDEditorPlugin.getXSDString("_UI_TEXT_XSD_DEFAULT_TARGET_NAMESPACE"));
- defaultTargetNamespaceText = createTextField(group);
-
- initializeValues();
-
- return new Composite(parent, SWT.NULL);
- }
-
- private Group createGroup(Composite parent, int numColumns)
- {
- Group group = new Group(parent, SWT.NULL);
-
- GridLayout layout = new GridLayout();
- layout.numColumns = numColumns;
- group.setLayout(layout);
-
- GridData data = new GridData();
- data.verticalAlignment = GridData.FILL;
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- group.setLayoutData(data);
-
- return group;
- }
-
- private Text createTextField(Composite parent)
- {
- Text text = new Text(parent, SWT.SINGLE | SWT.BORDER);
- GridData data = new GridData();
- data.verticalAlignment = GridData.FILL;
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- text.setLayoutData(data);
-
- return text;
- }
-
- private Label createLabel(Composite parent, String text)
- {
- Label label = new Label(parent, SWT.LEFT);
- label.setText(text);
-
- GridData data = new GridData();
- data.verticalAlignment = GridData.CENTER;
- data.horizontalAlignment = GridData.FILL;
- label.setLayoutData(data);
-
- return label;
- }
-
- /**
- * Does anything necessary because the default button has been pressed.
- */
- protected void performDefaults()
- {
- super.performDefaults();
- initializeDefaults();
- checkValues();
- }
-
- /**
- * Do anything necessary because the OK button has been pressed.
- * @return whether it is okay to close the preference page
- */
- public boolean performOk()
- {
- if (checkValues())
- {
- storeValues();
- return true;
- }
- return false;
- }
-
- protected void performApply()
- {
- if (checkValues())
- {
- storeValues();
- }
- }
-
- /**
- * Handles events generated by controls on this page.
- * @param e the event to handle
- */
- public void handleEvent(Event e)
- {
- Widget source = e.widget;
- }
-
- /**
- * @see IWorkbenchPreferencePage
- */
- public void init(IWorkbench workbench)
- {
- }
-
- /**
- * The indent is stored in the preference store associated with the XML Schema Model
- */
- public IPreferenceStore getPreferenceStore()
- {
- return XSDEditorPlugin.getPlugin().getPreferenceStore();
- }
-
- /**
- * Initializes states of the controls using default values
- * in the preference store.
- */
- private void initializeDefaults()
- {
- schemaNsPrefixField.setText(getPreferenceStore().getDefaultString(XSDEditorPlugin.CONST_XSD_DEFAULT_PREFIX_TEXT));
- qualifyXSDLanguage.setSelection(getPreferenceStore().getDefaultBoolean(XSDEditorPlugin.CONST_XSD_LANGUAGE_QUALIFY));
- defaultTargetNamespaceText.setText(getPreferenceStore().getString(XSDEditorPlugin.CONST_DEFAULT_TARGET_NAMESPACE));
- }
-
- /**
- * Initializes states of the controls from the preference store.
- */
- private void initializeValues()
- {
- IPreferenceStore store = getPreferenceStore();
- schemaNsPrefixField.setText(store.getString(XSDEditorPlugin.CONST_XSD_DEFAULT_PREFIX_TEXT));
- qualifyXSDLanguage.setSelection(store.getBoolean(XSDEditorPlugin.CONST_XSD_LANGUAGE_QUALIFY));
- defaultTargetNamespaceText.setText(store.getString(XSDEditorPlugin.CONST_DEFAULT_TARGET_NAMESPACE));
- }
-
- /**
- * Stores the values of the controls back to the preference store.
- */
- private void storeValues()
- {
- IPreferenceStore store = getPreferenceStore();
-
- store.setValue(XSDEditorPlugin.CONST_XSD_DEFAULT_PREFIX_TEXT, getXMLSchemaPrefix());
- store.setValue(XSDEditorPlugin.CONST_XSD_LANGUAGE_QUALIFY, getQualify());
- store.setValue(XSDEditorPlugin.CONST_DEFAULT_TARGET_NAMESPACE, getXMLSchemaTargetNamespace());
-
- XSDEditorPlugin.getPlugin().savePluginPreferences();
- }
-
- public String getXMLSchemaPrefix()
- {
- String prefix = schemaNsPrefixField.getText();
- if (prefix == null || prefix.equals(""))
- {
- return "xsd";
- }
- return prefix;
- }
-
- public boolean getQualify()
- {
- return qualifyXSDLanguage.getSelection();
- }
-
- /**
- * Get the xml schema default target namespace
- */
- public String getXMLSchemaTargetNamespace()
- {
- String targetNamespace = defaultTargetNamespaceText.getText();
- if (targetNamespace == null || targetNamespace.equals(""))
- {
- return XSDEditorPlugin.DEFAULT_TARGET_NAMESPACE;
- }
- return targetNamespace;
- }
-
- public boolean checkValues()
- {
-// KCPort TODO String errorMessage = ValidateHelper.checkXMLName(schemaNsPrefixField.getText());
- String errorMessage = null;
-
- if (errorMessage == null || errorMessage.length() == 0)
- {
- setErrorMessage(null);
- setValid(true);
- return true;
- }
- else
- {
- setErrorMessage(XSDEditorPlugin.getXSDString("_ERROR_LABEL_INVALID_PREFIX"));
- setValid(false);
- return false;
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/AnyAttributePropertySource.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/AnyAttributePropertySource.java
deleted file mode 100644
index 0f4e7e707a..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/AnyAttributePropertySource.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.properties;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.eclipse.wst.xsd.ui.internal.XSDEditorPlugin;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.util.XSDConstants;
-
-
-public class AnyAttributePropertySource extends BasePropertySource implements IPropertySource
-{
- private String[] namespaceComboValues = {
- "",
- "##any",
- "##other",
- "##targetNamespace",
- "##local"
- };
-
- private String[] processContentsComboValues = {
- "",
- XSDEditorPlugin.getXSDString("_UI_COMBO_LAX"),
- XSDEditorPlugin.getXSDString("_UI_COMBO_SKIP"),
- XSDEditorPlugin.getXSDString("_UI_COMBO_STRICT")
- };
- public AnyAttributePropertySource()
- {
- }
-
- public AnyAttributePropertySource(XSDSchema xsdSchema)
- {
- super(xsdSchema);
- }
-
- public AnyAttributePropertySource(Viewer viewer, XSDSchema xsdSchema)
- {
- super(viewer, xsdSchema);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getEditableValue()
- */
- public Object getEditableValue()
- {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors()
- */
- public IPropertyDescriptor[] getPropertyDescriptors()
- {
- List list = new ArrayList();
-
- XSDComboBoxPropertyDescriptor namespaceDescriptor = new XSDComboBoxPropertyDescriptor(
- XSDConstants.NAMESPACE_ATTRIBUTE,
- XSDConstants.NAMESPACE_ATTRIBUTE,
- namespaceComboValues);
- list.add(namespaceDescriptor);
-
- XSDComboBoxPropertyDescriptor processContentsDescriptor = new XSDComboBoxPropertyDescriptor(
- XSDConstants.PROCESSCONTENTS_ATTRIBUTE,
- XSDConstants.PROCESSCONTENTS_ATTRIBUTE,
- processContentsComboValues);
- list.add(processContentsDescriptor);
-
- IPropertyDescriptor[] result = new IPropertyDescriptor[list.size()];
- list.toArray(result);
- return result;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java.lang.Object)
- */
- public Object getPropertyValue(Object id)
- {
- Object result = null;
- if (id instanceof String)
- {
- result = element.getAttribute((String) id);
- if (result == null)
- {
- result = "";
- }
- return result;
- }
- return "";
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#isPropertySet(java.lang.Object)
- */
- public boolean isPropertySet(Object id)
- {
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#resetPropertyValue(java.lang.Object)
- */
- public void resetPropertyValue(Object id)
- {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#setPropertyValue(java.lang.Object, java.lang.Object)
- */
- public void setPropertyValue(Object id, Object value)
- {
- if (value == null)
- {
- value = "";
- }
- if (value instanceof String)
- {
- if (((String) id).equals(XSDConstants.NAMESPACE_ATTRIBUTE))
- {
- String namespace = (String)value;
- beginRecording(XSDEditorPlugin.getXSDString("_UI_NAMESPACE_CHANGE"), element);
- if (namespace != null && namespace.length() > 0)
- {
- element.setAttribute(XSDConstants.NAMESPACE_ATTRIBUTE, namespace);
- }
- else
- {
- element.removeAttribute(XSDConstants.NAMESPACE_ATTRIBUTE);
- }
- endRecording(element);
- }
- else if (((String) id).equals(XSDConstants.PROCESSCONTENTS_ATTRIBUTE))
- {
- String processContents = (String)value;
- beginRecording(XSDEditorPlugin.getXSDString("_UI_PROCESSCONTENTS_CHANGE"), element);
- if (processContents != null && processContents.length() > 0)
- {
- element.setAttribute(XSDConstants.PROCESSCONTENTS_ATTRIBUTE, processContents);
- }
- else
- {
- element.removeAttribute(XSDConstants.PROCESSCONTENTS_ATTRIBUTE);
- }
- endRecording(element);
- }
- }
- Runnable delayedUpdate = new Runnable()
- {
- public void run()
- {
- if (viewer != null)
- viewer.refresh();
- }
- };
- Display.getCurrent().asyncExec(delayedUpdate);
-
- }
-
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/AnyContentPropertyDescriptor.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/AnyContentPropertyDescriptor.java
deleted file mode 100644
index b11ef1e94f..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/AnyContentPropertyDescriptor.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.properties;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.DialogCellEditor;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.views.properties.PropertyDescriptor;
-import org.eclipse.wst.xsd.ui.internal.XSDEditorContextIds;
-import org.eclipse.wst.xsd.ui.internal.XSDEditorPlugin;
-import org.eclipse.wst.xsd.ui.internal.util.ViewUtility;
-import org.w3c.dom.CharacterData;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-public class AnyContentPropertyDescriptor extends PropertyDescriptor
-{
- Element element;
- /**
- * @param id
- * @param displayName
- */
- public AnyContentPropertyDescriptor(Object id, String displayName, Element element)
- {
- super(id, displayName);
- this.element = element;
- }
-
- public CellEditor createPropertyEditor(Composite parent)
- {
- CellEditor editor = new AnyContentDialogCellEditor(parent);
- if (getValidator() != null)
- editor.setValidator(getValidator());
- return editor;
- }
-
- public class AnyContentDialogCellEditor extends DialogCellEditor {
-
- /**
- * Creates a new Font dialog cell editor parented under the given control.
- * The cell editor value is <code>null</code> initially, and has no
- * validator.
- *
- * @param parent the parent control
- */
- protected AnyContentDialogCellEditor(Composite parent) {
- super(parent);
- }
-
- /**
- * @see org.eclipse.jface.viewers.DialogCellEditor#openDialogBox(Control)
- */
- protected Object openDialogBox(Control cellEditorWindow)
- {
- Shell shell = Display.getCurrent().getActiveShell();
-
- AnyContentDialog dialog = new AnyContentDialog(shell);
- dialog.setBlockOnOpen(true);
- dialog.create();
-
- String value = (String)getValue();
-
- int result = dialog.open();
-
- if (result == Window.OK)
- {
- return dialog.getComment();
- }
- return value;
- }
-
- }
-
- public class AnyContentDialog extends org.eclipse.jface.dialogs.Dialog
- {
- protected Text commentField;
- protected Button okButton, cancelButton;
- private String comment;
-
- public AnyContentDialog(Shell shell)
- {
- super(shell);
- }
-
- protected void configureShell(Shell shell)
- {
- super.configureShell(shell);
- }
-
- protected void buttonPressed(int buttonId)
- {
- if (buttonId == Dialog.OK)
- {
- comment = commentField.getText();
- }
- super.buttonPressed(buttonId);
- }
-
- public String getComment() { return comment; }
-
- //
- // Create the controls
- //
- public Control createDialogArea(Composite parent)
- {
- int tabIndex = 0;
- Composite client = (Composite)super.createDialogArea(parent);
- getShell().setText("Content for " + element.getLocalName());
-
- commentField = ViewUtility.createMultiTextField(client, 400, 200, true);
-
- WorkbenchHelp.setHelp(commentField, XSDEditorContextIds.XSDE_ANNOTATION_COMMENT);
- commentField.setToolTipText(XSDEditorPlugin.getXSDString("_UI_TOOLTIP_COMMENT"));
-
- String initialString = (String)getInitialContent();
- commentField.setText(initialString);
- return client;
- }
-
- private Object getInitialContent()
- {
- Object result = null;
- if (element.hasChildNodes())
- {
- // if the element is Text
- Node node = element.getFirstChild();
- if (node instanceof CharacterData)
- {
- result = ((CharacterData)node).getData();
- }
- }
- else
- {
- result = "";
- }
- return result;
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/AnyElementPropertySource.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/AnyElementPropertySource.java
deleted file mode 100644
index df43637d1d..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/AnyElementPropertySource.java
+++ /dev/null
@@ -1,228 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.properties;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.eclipse.wst.xsd.ui.internal.XSDEditorPlugin;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.util.XSDConstants;
-
-
-public class AnyElementPropertySource
- extends BasePropertySource
- implements IPropertySource
-{
-
- private String[] namespaceComboValues = {
- "",
- "##any",
- "##other",
- "##targetNamespace",
- "##local"
- };
-
- private String[] processContentsComboValues = {
- "",
- XSDEditorPlugin.getXSDString("_UI_COMBO_LAX"),
- XSDEditorPlugin.getXSDString("_UI_COMBO_SKIP"),
- XSDEditorPlugin.getXSDString("_UI_COMBO_STRICT")
- };
-
- /**
- *
- */
- public AnyElementPropertySource()
- {
- super();
- }
- /**
- * @param viewer
- * @param xsdSchema
- */
- public AnyElementPropertySource(Viewer viewer, XSDSchema xsdSchema)
- {
- super(viewer, xsdSchema);
- }
- /**
- * @param xsdSchema
- */
- public AnyElementPropertySource(XSDSchema xsdSchema)
- {
- super(xsdSchema);
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getEditableValue()
- */
- public Object getEditableValue()
- {
- return null;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors()
- */
- public IPropertyDescriptor[] getPropertyDescriptors()
- {
- List list = new ArrayList();
-
- XSDComboBoxPropertyDescriptor namespaceDescriptor = new XSDComboBoxPropertyDescriptor(
- XSDConstants.NAMESPACE_ATTRIBUTE,
- XSDConstants.NAMESPACE_ATTRIBUTE,
- namespaceComboValues);
- list.add(namespaceDescriptor);
-
- XSDComboBoxPropertyDescriptor processContentsDescriptor = new XSDComboBoxPropertyDescriptor(
- XSDConstants.PROCESSCONTENTS_ATTRIBUTE,
- XSDConstants.PROCESSCONTENTS_ATTRIBUTE,
- processContentsComboValues);
- list.add(processContentsDescriptor);
-
-// These are moved to the tabbed properties general section
-// PropertyDescriptor minOccursDescriptor =
-// new TextPropertyDescriptor(
-// XSDConstants.MINOCCURS_ATTRIBUTE,
-// XSDConstants.MINOCCURS_ATTRIBUTE);
-// list.add(minOccursDescriptor);
-// PropertyDescriptor maxOccursDescriptor =
-// new TextPropertyDescriptor(
-// XSDConstants.MAXOCCURS_ATTRIBUTE,
-// XSDConstants.MAXOCCURS_ATTRIBUTE);
-// list.add(maxOccursDescriptor);
-
- IPropertyDescriptor[] result = new IPropertyDescriptor[list.size()];
- list.toArray(result);
- return result;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java.lang.Object)
- */
- public Object getPropertyValue(Object id)
- {
- Object result = null;
- if (id instanceof String)
- {
- result = element.getAttribute((String) id);
- if (result == null)
- {
- result = "";
- }
- return result;
-
-// if (((String) id).equals(XSDConstants.NAMESPACE_ATTRIBUTE))
-// {
-// }
-// else if (((String) id).equals(XSDConstants.PROCESSCONTENTS_ATTRIBUTE))
-// {
-// }
- }
- return "";
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#isPropertySet(java.lang.Object)
- */
- public boolean isPropertySet(Object id)
- {
- return false;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#resetPropertyValue(java.lang.Object)
- */
- public void resetPropertyValue(Object id)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#setPropertyValue(java.lang.Object, java.lang.Object)
- */
- public void setPropertyValue(Object id, Object value)
- {
- if (value == null)
- {
- value = "";
- }
- if (value instanceof String)
- {
- if (((String) id).equals(XSDConstants.MAXOCCURS_ATTRIBUTE))
- {
- String max = (String)value;
- String min = element.getAttribute(XSDConstants.MINOCCURS_ATTRIBUTE);
- beginRecording(XSDEditorPlugin.getXSDString("_UI_MAXOCCURS_CHANGE"), element);
- if (max.length() > 0)
- {
- element.setAttribute(XSDConstants.MAXOCCURS_ATTRIBUTE, max);
- }
- else
- {
- element.removeAttribute(XSDConstants.MAXOCCURS_ATTRIBUTE);
- }
- endRecording(element);
- }
- else if (((String) id).equals(XSDConstants.MINOCCURS_ATTRIBUTE))
- {
- String min = (String)value;
- String max = element.getAttribute(XSDConstants.MAXOCCURS_ATTRIBUTE);
- beginRecording(XSDEditorPlugin.getXSDString("_UI_MINOCCURS_CHANGE"), element);
- if (min.length() > 0)
- {
- element.setAttribute(XSDConstants.MINOCCURS_ATTRIBUTE, min);
- }
- else
- {
- element.removeAttribute(XSDConstants.MINOCCURS_ATTRIBUTE);
- }
- endRecording(element);
- }
- else if (((String) id).equals(XSDConstants.NAMESPACE_ATTRIBUTE))
- {
- String namespace = (String)value;
- beginRecording(XSDEditorPlugin.getXSDString("_UI_NAMESPACE_CHANGE"), element);
- if (namespace.length() > 0)
- {
- element.setAttribute(XSDConstants.NAMESPACE_ATTRIBUTE, namespace);
- }
- else
- {
- element.removeAttribute(XSDConstants.NAMESPACE_ATTRIBUTE);
- }
- endRecording(element);
- }
- else if (((String) id).equals(XSDConstants.PROCESSCONTENTS_ATTRIBUTE))
- {
- String processContents = (String)value;
- beginRecording(XSDEditorPlugin.getXSDString("_UI_PROCESSCONTENTS_CHANGE"), element);
- if (processContents.length() > 0)
- {
- element.setAttribute(XSDConstants.PROCESSCONTENTS_ATTRIBUTE, processContents);
- }
- else
- {
- element.removeAttribute(XSDConstants.PROCESSCONTENTS_ATTRIBUTE);
- }
- endRecording(element);
- }
- }
- Runnable delayedUpdate = new Runnable()
- {
- public void run()
- {
- if (viewer != null)
- viewer.refresh();
- }
- };
- Display.getCurrent().asyncExec(delayedUpdate);
-
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/AppInfoPropertySource.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/AppInfoPropertySource.java
deleted file mode 100644
index b99c76815a..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/AppInfoPropertySource.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.properties;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.eclipse.ui.views.properties.PropertyDescriptor;
-import org.eclipse.ui.views.properties.TextPropertyDescriptor;
-import org.eclipse.wst.xsd.ui.internal.XSDEditorPlugin;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.util.XSDConstants;
-import org.w3c.dom.CharacterData;
-import org.w3c.dom.Node;
-
-public class AppInfoPropertySource
- extends BasePropertySource
- implements IPropertySource
-{
- public static String CONTENT = "Content";
-
- /**
- *
- */
- public AppInfoPropertySource()
- {
- super();
- }
- /**
- * @param viewer
- * @param xsdSchema
- */
- public AppInfoPropertySource(Viewer viewer, XSDSchema xsdSchema)
- {
- super(viewer, xsdSchema);
- }
- /**
- * @param xsdSchema
- */
- public AppInfoPropertySource(XSDSchema xsdSchema)
- {
- super(xsdSchema);
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getEditableValue()
- */
- public Object getEditableValue()
- {
- return null;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors()
- */
- public IPropertyDescriptor[] getPropertyDescriptors()
- {
- List list = new ArrayList();
- // Create a descriptor and set a category
- PropertyDescriptor sourceDescriptor =
- new TextPropertyDescriptor(
- XSDConstants.SOURCE_ATTRIBUTE,
- XSDConstants.SOURCE_ATTRIBUTE);
- list.add(sourceDescriptor);
- AnyContentPropertyDescriptor contentDescriptor =
- new AnyContentPropertyDescriptor(
- CONTENT,
- CONTENT,
- element);
- list.add(contentDescriptor);
-
- IPropertyDescriptor[] result = new IPropertyDescriptor[list.size()];
- list.toArray(result);
- return result;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java.lang.Object)
- */
- public Object getPropertyValue(Object id)
- {
- Object result = null;
- if (id instanceof String)
- {
- if (((String) id).equals(CONTENT))
- {
- try
- {
- if (element.hasChildNodes())
- {
- // if the element is Text
- Node node = element.getFirstChild();
- if (node instanceof CharacterData)
- {
- return ((CharacterData)node).getData();
- }
- }
- else
- {
- return "";
- }
- }
- catch (Exception e)
- {
-
- }
-
- }
- else
- {
- result = element.getAttribute((String) id);
- }
- }
- if (result == null)
- {
- result = "";
- }
- return result;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#isPropertySet(java.lang.Object)
- */
- public boolean isPropertySet(Object id)
- {
- return false;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#resetPropertyValue(java.lang.Object)
- */
- public void resetPropertyValue(Object id)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#setPropertyValue(java.lang.Object, java.lang.Object)
- */
- public void setPropertyValue(Object id, Object value)
- {
- if (value != null)
- {
- if (value instanceof String)
- {
- if (((String)id).equals(XSDConstants.SOURCE_ATTRIBUTE))
- {
- beginRecording(XSDEditorPlugin.getXSDString("_UI_SOURCE_ATTRIBUTE_CHANGE"), element);
- if (((String)value).length() > 0)
- {
- element.setAttribute(XSDConstants.SOURCE_ATTRIBUTE, (String)value);
- }
- else
- {
- element.removeAttribute(XSDConstants.SOURCE_ATTRIBUTE);
- }
- endRecording(element);
- }
- else if (((String)id).equals(CONTENT))
- {
- beginRecording(XSDEditorPlugin.getXSDString("_UI_COMMENT_CHANGE"), element);
- try
- {
- if (element.hasChildNodes())
- {
- // if the element is Text
- Node node = element.getFirstChild();
- if (node instanceof CharacterData)
- {
- ((CharacterData)node).setData((String)value);
- }
- }
- else
- {
- if (((String)value).length() > 0)
- {
- Node childNode = element.getOwnerDocument().createTextNode((String)value);
- element.appendChild(childNode);
- }
- }
- endRecording(element);
- }
- catch (Exception e)
- {
-
- }
- }
- else // shouldn't be here
- {
- element.setAttribute((String) id, (String) value);
- }
- }
- else if (value instanceof Integer)
- {
- }
- }
- else
- {
- element.removeAttribute((String) id);
- }
- Runnable delayedUpdate = new Runnable()
- {
- public void run()
- {
- if (viewer != null)
- viewer.refresh();
- }
- };
- Display.getCurrent().asyncExec(delayedUpdate);
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/AttributeGroupRefPropertySource.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/AttributeGroupRefPropertySource.java
deleted file mode 100644
index 74ca7021ec..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/AttributeGroupRefPropertySource.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.properties;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.eclipse.wst.xsd.ui.internal.XSDEditorPlugin;
-import org.eclipse.wst.xsd.ui.internal.util.TypesHelper;
-import org.eclipse.wst.xsd.ui.internal.util.XSDDOMHelper;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.util.XSDConstants;
-import org.w3c.dom.Element;
-
-public class AttributeGroupRefPropertySource
- extends BasePropertySource
- implements IPropertySource
-{
- private String[] refComboValues = { "" };
- /**
- *
- */
- public AttributeGroupRefPropertySource()
- {
- super();
- }
- /**
- * @param viewer
- * @param xsdSchema
- */
- public AttributeGroupRefPropertySource(Viewer viewer, XSDSchema xsdSchema)
- {
- super(viewer, xsdSchema);
- }
- /**
- * @param xsdSchema
- */
- public AttributeGroupRefPropertySource(XSDSchema xsdSchema)
- {
- super(xsdSchema);
- }
-
- public void setInput(Element element)
- {
- this.element = element;
- TypesHelper helper = new TypesHelper(xsdSchema);
- java.util.List items = helper.getGlobalAttributes();
-
- if (XSDDOMHelper.inputEquals(element, XSDConstants.ATTRIBUTE_ELEMENT_TAG, true))
- {
- items = helper.getGlobalAttributes();
-// WorkbenchHelp.setHelp(client, XSDEditorContextIds.XSDE_ATTRIBUTE_REF_DESIGN_VIEW);
-// WorkbenchHelp.setHelp(refCombo, XSDEditorContextIds.XSDE_ATTRIBUTE_REF_NAME);
- }
- else if (XSDDOMHelper.inputEquals(element, XSDConstants.ATTRIBUTEGROUP_ELEMENT_TAG, true))
- {
- items = helper.getGlobalAttributeGroups();
-// WorkbenchHelp.setHelp(client, XSDEditorContextIds.XSDE_ATTRIBUTE_GROUP_REF_DESIGN_VIEW);
-// WorkbenchHelp.setHelp(refCombo, XSDEditorContextIds.XSDE_ATTRIBUTE_GROUP_REF_NAME);
- }
- int size = items.size() + 1;
- refComboValues = new String[size];
- refComboValues[0] = "";
- if (items != null)
- {
- for (int i = 0; i < items.size(); i++)
- {
- refComboValues[i + 1] = (String) items.get(i);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getEditableValue()
- */
- public Object getEditableValue()
- {
- return null;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors()
- */
- public IPropertyDescriptor[] getPropertyDescriptors()
- {
- List list = new ArrayList();
- // Create a descriptor and set a category
- XSDComboBoxPropertyDescriptor refDescriptor =
- new XSDComboBoxPropertyDescriptor(
- XSDConstants.REF_ATTRIBUTE,
- XSDConstants.REF_ATTRIBUTE,
- refComboValues);
- list.add(refDescriptor);
-
- IPropertyDescriptor[] result = new IPropertyDescriptor[list.size()];
- list.toArray(result);
- return result;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java.lang.Object)
- */
- public Object getPropertyValue(Object id)
- {
- Object result = null;
- if (id instanceof String)
- {
- result = element.getAttribute((String) id);
- if (result == null)
- {
- result = "";
- }
-// if (((String) id).equals(XSDConstants.REF_ATTRIBUTE))
-// {
-// }
- return result;
- }
- return "";
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#isPropertySet(java.lang.Object)
- */
- public boolean isPropertySet(Object id)
- {
- return false;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#resetPropertyValue(java.lang.Object)
- */
- public void resetPropertyValue(Object id)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#setPropertyValue(java.lang.Object, java.lang.Object)
- */
- public void setPropertyValue(Object id, Object value)
- {
- if (value == null)
- {
- value = "";
- }
- if (value instanceof String)
- {
- if (((String) id).equals(XSDConstants.REF_ATTRIBUTE))
- {
- beginRecording(XSDEditorPlugin.getXSDString("_UI_ATTRIBUTEGROUP_REF_CHANGE"), element);
- element.setAttribute(XSDConstants.REF_ATTRIBUTE, (String) value);
- endRecording(element);
- }
- }
- Runnable delayedUpdate = new Runnable()
- {
- public void run()
- {
- if (viewer != null)
- viewer.refresh();
- }
- };
- Display.getCurrent().asyncExec(delayedUpdate);
-
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/AttributePropertySource.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/AttributePropertySource.java
deleted file mode 100644
index f89b2f0f54..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/AttributePropertySource.java
+++ /dev/null
@@ -1,294 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.properties;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.eclipse.ui.views.properties.PropertyDescriptor;
-import org.eclipse.ui.views.properties.TextPropertyDescriptor;
-import org.eclipse.wst.xsd.ui.internal.XSDEditorPlugin;
-import org.eclipse.wst.xsd.ui.internal.refactor.rename.GlobalAttributeRenamer;
-import org.eclipse.wst.xsd.ui.internal.util.XSDDOMHelper;
-import org.eclipse.xsd.XSDAttributeDeclaration;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.util.XSDConstants;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-
-public class AttributePropertySource
- extends BasePropertySource
- implements IPropertySource
-{
- private String[] useComboValues =
- {
- "",
- "prohibited", // XSDEditorPlugin.getXSDString("_UI_COMBO_BOX_PROHIBITED"),
- "optional", // XSDEditorPlugin.getXSDString("_UI_COMBO_BOX_OPTIONAL"),
- "required" // XSDEditorPlugin.getXSDString("_UI_COMBO_BOX_REQUIRED")
- };
-
- protected String formComboValues[] =
- {
- "",
- XSDEditorPlugin.getXSDString("_UI_COMBO_UNQUALIFIED"),
- XSDEditorPlugin.getXSDString("_UI_COMBO_QUALIFIED")
- };
-
-
- /**
- *
- */
- public AttributePropertySource()
- {
- super();
- }
- /**
- * @param viewer
- * @param xsdSchema
- */
- public AttributePropertySource(Viewer viewer, XSDSchema xsdSchema)
- {
- super(viewer, xsdSchema);
- }
- /**
- * @param xsdSchema
- */
- public AttributePropertySource(XSDSchema xsdSchema)
- {
- super(xsdSchema);
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getEditableValue()
- */
- public Object getEditableValue()
- {
- return null;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors()
- */
- public IPropertyDescriptor[] getPropertyDescriptors()
- {
- List list = new ArrayList();
- // Create a descriptor and set a category
- PropertyDescriptor nameDescriptor = new TextPropertyDescriptor(XSDConstants.NAME_ATTRIBUTE, XSDConstants.NAME_ATTRIBUTE);
- list.add(nameDescriptor);
-// nameDescriptor.setCategory(XSDEditorPlugin.getXSDString("_UI_LABEL_GENERAL"));
- TypesPropertyDescriptor typeDescriptor = new TypesPropertyDescriptor(
- XSDConstants.TYPE_ATTRIBUTE,
- XSDConstants.TYPE_ATTRIBUTE,
- element, xsdSchema);
- list.add(typeDescriptor);
-// typeDescriptor.setCategory(XSDEditorPlugin.getXSDString("_UI_LABEL_GENERAL"));
-
- Attr fixedAttr = element.getAttributeNode(XSDConstants.FIXED_ATTRIBUTE);
- Attr defaultAttr = element.getAttributeNode(XSDConstants.DEFAULT_ATTRIBUTE);
- String str;
- if (fixedAttr != null)
- {
- str = XSDConstants.FIXED_ATTRIBUTE;
- }
- else if (defaultAttr != null)
- {
- str = XSDConstants.DEFAULT_ATTRIBUTE;
- }
- else
- {
- str = XSDConstants.FIXED_ATTRIBUTE + "/" + XSDConstants.DEFAULT_ATTRIBUTE;
- }
-
- FixedOrDefaultTextPropertyDescriptor fixedOrDefaultDescriptor =
- new FixedOrDefaultTextPropertyDescriptor(
- str,
- str,
- element);
- list.add(fixedOrDefaultDescriptor);
-// fixedOrDefaultDescriptor.setCategory(XSDEditorPlugin.getXSDString("_UI_LABEL_OTHER"));
-
- Object parentNode = element.getParentNode();
- if (XSDDOMHelper.inputEquals(parentNode, XSDConstants.SCHEMA_ELEMENT_TAG, false))
- {
- }
- else
- {
- XSDComboBoxPropertyDescriptor useDescriptor =
- new XSDComboBoxPropertyDescriptor(
- XSDConstants.USE_ATTRIBUTE,
- XSDConstants.USE_ATTRIBUTE,
- useComboValues);
- list.add(useDescriptor);
-// useDescriptor.setCategory(XSDEditorPlugin.getXSDString("_UI_LABEL_OTHER"));
- XSDComboBoxPropertyDescriptor formDescriptor =
- new XSDComboBoxPropertyDescriptor(
- XSDConstants.FORM_ATTRIBUTE,
- XSDConstants.FORM_ATTRIBUTE,
- formComboValues);
- list.add(formDescriptor);
-// formDescriptor.setCategory(XSDEditorPlugin.getXSDString("_UI_LABEL_OTHER"));
- }
-
- IPropertyDescriptor[] result = new IPropertyDescriptor[list.size()];
- list.toArray(result);
- return result;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java.lang.Object)
- */
- public Object getPropertyValue(Object id)
- {
- Object result = null;
- if (id instanceof String)
- {
- result = element.getAttribute((String) id);
- if (result == null)
- {
- result = "";
- }
- if (((String) id).equals(XSDConstants.TYPE_ATTRIBUTE))
- {
- if (result.equals(""))
- {
- if (checkForAnonymousType(element))
- {
- return "**anonymous**";
- }
- else
- {
- return XSDEditorPlugin.getXSDString("_UI_NO_TYPE");
- }
- }
- else
- {
- return result;
- }
- }
- return result;
- }
- return "";
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#isPropertySet(java.lang.Object)
- */
- public boolean isPropertySet(Object id)
- {
- return false;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#resetPropertyValue(java.lang.Object)
- */
- public void resetPropertyValue(Object id)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#setPropertyValue(java.lang.Object, java.lang.Object)
- */
- public void setPropertyValue(Object id, Object value)
- {
- if (value == null)
- {
- value = "";
- }
- if (value instanceof String)
- {
- if (((String) id).equals(XSDConstants.TYPE_ATTRIBUTE))
- {
-// beginRecording(XSDEditorPlugin.getXSDString("_UI_TYPE_CHANGE"), element);
-// element.setAttribute(XSDConstants.TYPE_ATTRIBUTE, (String)value);
-// updateElementToNotAnonymous(element);
-// endRecording(element);
- }
- else if (((String) id).equals(XSDConstants.NAME_ATTRIBUTE))
- {
- beginRecording(XSDEditorPlugin.getXSDString("_UI_ATTRIBUTE_NAME_CHANGE"), element);
- // now rename any references to this element
- if (xsdSchema != null)
- {
- XSDConcreteComponent comp = xsdSchema.getCorrespondingComponent(element);
- if (comp != null && comp instanceof XSDAttributeDeclaration && comp.getRootContainer().equals(xsdSchema))
- {
- XSDAttributeDeclaration xsdAttributeDeclaration = (XSDAttributeDeclaration)comp;
- xsdAttributeDeclaration.setName((String)value);
- GlobalAttributeRenamer renamer = new GlobalAttributeRenamer(xsdAttributeDeclaration, (String)value);
- renamer.visitSchema(xsdSchema);
- }
- }
- element.setAttribute(XSDConstants.NAME_ATTRIBUTE, (String)value);
- endRecording(element);
- }
- else if (((String) id).equals(XSDConstants.FIXED_ATTRIBUTE) || ((String) id).equals(XSDConstants.DEFAULT_ATTRIBUTE))
- {
- beginRecording(XSDEditorPlugin.getXSDString("_UI_ATTRIBUTE_VALUE_CHANGE"), element);
- if (((String)value).equals(""))
- {
- element.removeAttribute((String)id);
- }
- else
- {
- element.setAttribute((String) id, (String) value);
- }
- endRecording(element);
- }
- else if (((String) id).equals(XSDConstants.USE_ATTRIBUTE))
- {
- beginRecording(XSDEditorPlugin.getXSDString("_UI_ATTRIBUTE_USE_CHANGE"), element);
- if (((String)value).equals(""))
- {
- element.removeAttribute(XSDConstants.USE_ATTRIBUTE);
- }
- else
- {
- element.setAttribute((String) id, (String)value);
- }
- endRecording(element);
- }
- else if (((String) id).equals(XSDConstants.FORM_ATTRIBUTE))
- {
- beginRecording(XSDEditorPlugin.getXSDString("_UI_ATTRIBUTE_FORM_CHANGE"), element);
- if (((String)value).equals(""))
- {
- element.removeAttribute(XSDConstants.FORM_ATTRIBUTE);
- }
- else
- {
- element.setAttribute(XSDConstants.FORM_ATTRIBUTE, (String)value);
- }
- endRecording(element);
- }
- }
- Runnable delayedUpdate = new Runnable()
- {
- public void run()
- {
- if (viewer != null)
- viewer.refresh();
- }
- };
- Display.getCurrent().asyncExec(delayedUpdate);
-
- }
-
- boolean checkForAnonymousType(Element element)
- {
- NodeList list = element.getElementsByTagNameNS(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, XSDConstants.SIMPLETYPE_ELEMENT_TAG);
- if (list.getLength() > 0)
- {
- return true;
- }
- return false;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/AttributesTable.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/AttributesTable.java
deleted file mode 100644
index f80e72eb90..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/AttributesTable.java
+++ /dev/null
@@ -1,331 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.properties;
-
-//import java.text.Collator;
-//import java.util.Comparator;
-//import java.util.List;
-//
-//import org.eclipse.jface.viewers.CellEditor;
-//import org.eclipse.jface.viewers.ColumnPixelData;
-//import org.eclipse.jface.viewers.ICellModifier;
-//import org.eclipse.jface.viewers.ILabelProvider;
-//import org.eclipse.jface.viewers.IStructuredContentProvider;
-//import org.eclipse.jface.viewers.ITableLabelProvider;
-//import org.eclipse.jface.viewers.LabelProvider;
-//import org.eclipse.jface.viewers.TableLayout;
-//import org.eclipse.jface.viewers.TableViewer;
-//import org.eclipse.jface.viewers.TextCellEditor;
-//import org.eclipse.jface.viewers.Viewer;
-//import org.eclipse.swt.SWT;
-//import org.eclipse.swt.events.MouseAdapter;
-//import org.eclipse.swt.events.MouseEvent;
-//import org.eclipse.swt.graphics.Image;
-//import org.eclipse.swt.widgets.Composite;
-//import org.eclipse.swt.widgets.Control;
-//import org.eclipse.swt.widgets.Table;
-//import org.eclipse.swt.widgets.TableColumn;
-//import org.eclipse.swt.widgets.TableItem;
-//import org.eclipse.ui.IEditorPart;
-//import org.eclipse.ui.views.properties.ComboBoxPropertyDescriptor;
-//import org.eclipse.ui.views.properties.IPropertyDescriptor;
-//import org.eclipse.ui.views.properties.IPropertySource;
-//import org.w3c.dom.Element;
-
-public class AttributesTable // extends TableViewer implements ICellModifier
-{
-// protected static final String PROPERTY = "property"; //$NON-NLS-1$
-// protected static final String VALUE = "value"; //$NON-NLS-1$
-//
-// protected IEditorPart editorPart;
-// protected String[] columnProperties = {PROPERTY, VALUE};
-// protected PropertyTableProvider tableProvider = new PropertyTableProvider(this);
-// protected CellEditor cellEditor;
-// //protected StringComboBoxCellEditor comboCellEditor;
-// protected IPropertySource propertySource;
-//
-// public AttributesTable(IEditorPart editorPart, Composite parent)
-// {
-// super(new Table(parent, SWT.FULL_SELECTION | SWT.MULTI | SWT.FLAT | SWT.H_SCROLL | SWT.V_SCROLL));
-// this.editorPart = editorPart;
-// getTable().setLinesVisible(true);
-// getTable().setHeaderVisible(true);
-//
-// setContentProvider(tableProvider);
-// setLabelProvider(tableProvider);
-// setColumnProperties(columnProperties);
-//
-// for (int i = 0; i < columnProperties.length; i++)
-// {
-// TableColumn column = new TableColumn(getTable(), SWT.NONE, i);
-// column.setText(columnProperties[i]);
-// column.setAlignment(SWT.LEFT);
-// }
-//
-//// TableLayout layout = new TableLayout();
-//// ColumnWeightData data = new ColumnWeightData(40, 40, true);
-//// layout.addColumnData(data);
-////
-//// ColumnWeightData data2 = new ColumnWeightData(80, 80, true);
-//// layout.addColumnData(data2);
-//
-// TableLayout layout = new TableLayout();
-// layout.addColumnData(new ColumnPixelData(130,true));
-// layout.addColumnData(new ColumnPixelData(130,true));
-// getTable().setLayout(layout);
-//
-//
-// cellEditor = new TextCellEditor(getTable());
-// resetCellEditors();
-//
-// setCellModifier(this);
-// }
-//
-// public void setPropertySource(IPropertySource propertySource)
-// {
-// this.propertySource = propertySource;
-// }
-//
-// /* (non-Javadoc)
-// * @see org.eclipse.jface.viewers.ICellModifier#canModify(java.lang.Object, java.lang.String)
-// */
-// public boolean canModify(Object element, String property)
-// {
-// return property.equals(VALUE);
-// }
-//
-// /* (non-Javadoc)
-// * @see org.eclipse.jface.viewers.ICellModifier#getValue(java.lang.Object, java.lang.String)
-// */
-// public Object getValue(Object element, String property)
-// {
-// int column = 0;
-// if (property.equals(columnProperties[0]))
-// {
-// column = 0;
-// }
-// else if (property.equals(columnProperties[1]))
-// {
-// column = 1;
-// }
-// return tableProvider.getColumnValue(element, column);
-// }
-//
-// /* (non-Javadoc)
-// * @see org.eclipse.jface.viewers.ICellModifier#modify(java.lang.Object, java.lang.String, java.lang.Object)
-// */
-// public void modify(Object element, String property, Object value)
-// {
-// TableItem item = (TableItem)element;
-// IPropertyDescriptor propertyDescriptor = (IPropertyDescriptor)item.getData();
-//
-// // if the new value is the same as the old value, the user has only clicked
-// // on the cell in the course of 'browsing' ... so don't edit the value
-// Object oldValue = getValue(propertyDescriptor, property);
-// if (value != null && !value.equals(oldValue))
-// {
-// // we assume the value is empty that the attribute should be removed
-// // todo... we probably need to look at this in more detail
-// if (value instanceof String && ((String)value).length() == 0)
-// {
-// value = null;
-// }
-// propertySource.setPropertyValue(propertyDescriptor.getId(), value);
-// }
-// }
-//
-//
-// protected void hookControl(Control control) {
-// // we need to hook up our own mouse listener first
-// // so that we can update the cellEditors before
-// // the 'internal' listener tries to get hold of them
-// Table tableControl = (Table)control;
-// tableControl.addMouseListener(new MouseAdapter() {
-// public void mouseDown(MouseEvent e) {
-// System.out.println("Mouse down");
-// updateCellEditors();
-// }
-// });
-// super.hookControl(control);
-// }
-//
-// protected void updateCellEditors()
-// {
-// CellEditor[] cellEditors = new CellEditor[2];
-// cellEditors[0] = cellEditor;
-// cellEditors[1] = cellEditor;
-//
-// Element element = (Element)getInput();
-//
-// IPropertyDescriptor[] propertyDescriptors = propertySource.getPropertyDescriptors();
-// int index = getTable().getSelectionIndex();
-// if (index >= 0 && index < propertyDescriptors.length)
-// {
-// CellEditor[] oldCellEditors = getCellEditors();
-// CellEditor oldCellEditor = (oldCellEditors.length > 1) ? oldCellEditors[1] : null;
-// if (oldCellEditor != null && oldCellEditor != cellEditor)
-// {
-// oldCellEditor.deactivate();
-// oldCellEditor.dispose();
-// }
-// cellEditors[1] = propertyDescriptors[index].createPropertyEditor(getTable());
-// }
-// setCellEditors(cellEditors);
-//
-//// IPropertyDescriptor[] propertyDescriptors = propertySource.getPropertyDescriptors();
-////
-//// int index = getTable().getSelectionIndex();
-//// //cellEditor.dispose();
-////
-//// if (index >= 0 && index < propertyDescriptors.length)
-//// {
-//// cellEditor = propertyDescriptors[index].createPropertyEditor(getTable());
-//// Control control = cellEditor.getControl();
-//// if (control == null) {
-//// cellEditor.deactivate();
-//// cellEditor = null;
-//// return;
-//// }
-//// setCellEditors(new CellEditor[] {null, cellEditor});
-//// cellEditor.activate();
-//// cellEditor.setFocus();
-//// }
-// }
-//
-//
-// public String[] getStringArray(List list)
-// {
-// String[] result = new String[list.size()];
-// for (int i = 0; i < result.length; i++)
-// {
-// result[i] = (String)list.get(i);
-// }
-// return result;
-// }
-//
-// protected void resetCellEditors()
-// {
-// CellEditor[] cellEditors = new CellEditor[2];
-// cellEditors[0] = null;
-// cellEditors[1] = cellEditor;
-// setCellEditors(cellEditors);
-// }
-//
-//
-// class PropertyTableProvider extends LabelProvider implements ITableLabelProvider, IStructuredContentProvider
-// {
-// protected TableViewer viewer;
-//
-// PropertyTableProvider(TableViewer viewer)
-// {
-// this.viewer = viewer;
-// }
-//
-// public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
-// {
-//// resetCellEditors();
-//// if (newInput instanceof XMLElement)
-//// {
-//// propertySource = new ExtensiblePropertySource(editorPart, (XMLElement)newInput);
-//// }
-//// if (newInput instanceof Element)
-//// {
-//// if (XSDDOMHelper.inputEquals(newInput, XSDConstants.ELEMENT_ELEMENT_TAG, false))
-//// {
-//// propertySource = new ElementPropertySource((Element)newInput, viewer);
-//// }
-//// else
-//// {
-//// propertySource = new ReadOnlyPropertySource(editorPart, (Element)newInput);
-//// }
-//// }
-//// else
-//// {
-//// propertySource = null;
-//// }
-// }
-//
-// public Image getColumnImage(Object element, int columnIndex)
-// {
-// return null;
-// }
-//
-// public Object getColumnValue(Object o, int columnIndex)
-// {
-// IPropertyDescriptor propertyDescriptor = (IPropertyDescriptor)o;
-// if (columnIndex == 0)
-// {
-// return propertyDescriptor.getId();
-// }
-// else
-// {
-// return propertySource.getPropertyValue(propertyDescriptor.getId());
-// }
-// }
-//
-// public String getColumnText(Object o, int columnIndex)
-// {
-// IPropertyDescriptor propertyDescriptor = (IPropertyDescriptor)o;
-// // (columnIndex == 1 && propertyDescriptor instanceof XSDComboBoxPropertyDescriptor)
-// if ((columnIndex == 1 && propertyDescriptor instanceof OptionsComboBoxPropertyDescriptor) ||
-// (columnIndex == 1 && propertyDescriptor instanceof ComboBoxPropertyDescriptor))
-// {
-// ILabelProvider lp = propertyDescriptor.getLabelProvider();
-// if (lp != null)
-// {
-// return lp.getText(propertyDescriptor.getId());
-// }
-// }
-//
-// Object id = propertyDescriptor.getId();
-// String attribute = "";
-// if (id != null && attribute instanceof String)
-// {
-// attribute = (String)id;
-// }
-// Object value = propertySource.getPropertyValue(attribute);
-// String attributeValue = "";
-// if (value != null)
-// {
-// attributeValue = (String)value;
-// }
-//
-// return (columnIndex == 0) ? attribute : attributeValue;
-//
-//// return (columnIndex == 0) ? propertyDescriptor.getId().toString() : propertySource.getPropertyValue(propertyDescriptor.getId()).toString();
-// }
-//
-// public Object[] getElements(Object o)
-// {
-// Object[] result = propertySource.getPropertyDescriptors();
-// // For some strange reson the ViewerSorter doesn't seem to be working for this table
-// // As a workaround we sort them in this method before returning them to the viewer
-//// if (result.length > 0)
-//// {
-//// Arrays.sort(result, new InternalComparator());
-//// }
-// return result;
-// }
-// }
-//
-// class InternalComparator implements Comparator
-// {
-// public int compare(Object e1, Object e2)
-// {
-// IPropertyDescriptor p1 = (IPropertyDescriptor)e1;
-// IPropertyDescriptor p2 = (IPropertyDescriptor)e2;
-// String p1Name = p1.getDisplayName();
-// String p2Name = p2.getDisplayName();
-// return Collator.getInstance().compare(p1.getDisplayName(), p2.getDisplayName());
-// }
-// }
-//
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/BasePropertySource.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/BasePropertySource.java
deleted file mode 100644
index 9d92d1838c..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/BasePropertySource.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.properties;
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.eclipse.wst.xml.core.NameValidator;
-import org.eclipse.wst.xml.core.internal.document.DocumentImpl;
-import org.eclipse.wst.xsd.ui.internal.util.XSDDOMHelper;
-import org.eclipse.xsd.XSDSchema;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-
-public abstract class BasePropertySource implements IPropertySource
-{
- protected Element element;
- protected Viewer viewer;
- protected IPropertyDescriptor[] propertyDescriptors;
- protected XSDSchema xsdSchema;
- protected String [] trueFalseComboValues = {
- "",
- "false",
- "true"
- };
-
- public BasePropertySource()
- {
-
- }
-
- public DocumentImpl getDocument(Element element)
- {
- return (DocumentImpl) element.getOwnerDocument();
- }
-
- public void beginRecording(String description, Element element)
- {
- getDocument(element).getModel().beginRecording(this, description);
- }
-
- public void endRecording(Element element)
- {
- DocumentImpl doc = (DocumentImpl) getDocument(element);
-
- doc.getModel().endRecording(this);
- }
-
-
- public BasePropertySource(Viewer viewer, XSDSchema xsdSchema)
- {
- this.viewer = viewer;
- this.xsdSchema = xsdSchema;
- }
-
- public BasePropertySource(XSDSchema xsdSchema)
- {
- this.xsdSchema = xsdSchema;
- }
-
- public void setViewer(Viewer viewer)
- {
- this.viewer = viewer;
- }
-
- public void setInput(Element element)
- {
- this.element = element;
- }
-
- protected XSDDOMHelper domHelper = new XSDDOMHelper();
- /**
- * Gets the domHelper.
- * @return Returns a XSDDomHelper
- */
- public XSDDOMHelper getDomHelper()
- {
- return domHelper;
- }
-
- protected boolean hasElementChildren(Node parentNode)
- {
- boolean hasChildrenElements = false;
- if (parentNode != null && parentNode.hasChildNodes())
- {
- NodeList nodes = parentNode.getChildNodes();
- for (int i = 0; i < nodes.getLength(); i++)
- {
- if (nodes.item(i) instanceof Element)
- {
- hasChildrenElements = true;
- break;
- }
- }
- }
- return hasChildrenElements;
- }
-
- protected boolean validateName(String name)
- {
- return NameValidator.isValid(name);
- }
-
- // TODO
- protected boolean validateLanguage(String lang)
- {
- return true;
- }
-
- // TODO
- protected boolean validatePrefix(String prefix)
- {
- return true;
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/ComplexTypePropertySource.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/ComplexTypePropertySource.java
deleted file mode 100644
index 7cb09e9281..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/ComplexTypePropertySource.java
+++ /dev/null
@@ -1,380 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.properties;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.eclipse.wst.xsd.ui.internal.XSDEditorPlugin;
-import org.eclipse.wst.xsd.ui.internal.actions.SetBaseTypeAction;
-import org.eclipse.wst.xsd.ui.internal.refactor.rename.GlobalSimpleOrComplexTypeRenamer;
-import org.eclipse.wst.xsd.ui.internal.util.XSDDOMHelper;
-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;
-
-public class ComplexTypePropertySource
- extends BasePropertySource
- implements IPropertySource
-{
- private String DERIVED_BY_ID = "derived by"; // XSDEditorPlugin.getXSDString("_UI_LABEL_DERIVED_BY");
- private String BASE_TYPE_ID = "base type"; // XSDEditorPlugin.getXSDString("_UI_LABEL_BASE_TYPE");
-
- private String[] blockOrFinalComboValues =
- {
- "",
- "#all",
- "extension",
- "restriction"
- };
-
- private String derivedByChoicesComboValues[] =
- {
- "",
- XSDConstants.RESTRICTION_ELEMENT_TAG,
- XSDConstants.EXTENSION_ELEMENT_TAG
- };
-
- /**
- *
- */
- public ComplexTypePropertySource()
- {
- super();
- }
- /**
- * @param viewer
- * @param xsdSchema
- */
- public ComplexTypePropertySource(Viewer viewer, XSDSchema xsdSchema)
- {
- super(viewer, xsdSchema);
- }
- /**
- * @param xsdSchema
- */
- public ComplexTypePropertySource(XSDSchema xsdSchema)
- {
- super(xsdSchema);
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getEditableValue()
- */
- public Object getEditableValue()
- {
- return null;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors()
- */
- public IPropertyDescriptor[] getPropertyDescriptors()
- {
- List list = new ArrayList();
- // Create a descriptor and set a category
- boolean isAnonymousType = checkForAnonymousType(element);
-// The three properties name, base type and derived by have been moved to the general tab
-// if (isAnonymousType)
-// {
-// PropertyDescriptor nameDescriptor =
-// new PropertyDescriptor(
-// XSDConstants.NAME_ATTRIBUTE,
-// XSDConstants.NAME_ATTRIBUTE);
-// list.add(nameDescriptor);
-// }
-// else
-// {
-// PropertyDescriptor nameDescriptor =
-// new TextPropertyDescriptor(
-// XSDConstants.NAME_ATTRIBUTE,
-// XSDConstants.NAME_ATTRIBUTE);
-// list.add(nameDescriptor);
-// }
-
- Element contentModelElement = getDomHelper().getContentModelFromParent(element);
-// SimpleContentPropertyDescriptor typeDescriptor = new SimpleContentPropertyDescriptor(
-// BASE_TYPE_ID,
-// BASE_TYPE_ID,
-// contentModelElement, xsdSchema);
-// list.add(typeDescriptor);
-// XSDComboBoxPropertyDescriptor derivedByDescriptor =
-// new XSDComboBoxPropertyDescriptor(
-// DERIVED_BY_ID,
-// DERIVED_BY_ID,
-// derivedByChoicesComboValues);
-// list.add(derivedByDescriptor);
-
- XSDComboBoxPropertyDescriptor abstractDescriptor =
- new XSDComboBoxPropertyDescriptor(
- XSDConstants.ABSTRACT_ATTRIBUTE,
- XSDConstants.ABSTRACT_ATTRIBUTE,
- trueFalseComboValues);
- list.add(abstractDescriptor);
-
- XSDComboBoxPropertyDescriptor mixedDescriptor =
- new XSDComboBoxPropertyDescriptor(
- XSDConstants.MIXED_ATTRIBUTE,
- XSDConstants.MIXED_ATTRIBUTE,
- trueFalseComboValues);
- list.add(mixedDescriptor);
-
- XSDComboBoxPropertyDescriptor blockDescriptor =
- new XSDComboBoxPropertyDescriptor(
- XSDConstants.BLOCK_ATTRIBUTE,
- XSDConstants.BLOCK_ATTRIBUTE,
- blockOrFinalComboValues);
- list.add(blockDescriptor);
- XSDComboBoxPropertyDescriptor finalDescriptor =
- new XSDComboBoxPropertyDescriptor(
- XSDConstants.FINAL_ATTRIBUTE,
- XSDConstants.FINAL_ATTRIBUTE,
- blockOrFinalComboValues);
- list.add(finalDescriptor);
-
- IPropertyDescriptor[] result = new IPropertyDescriptor[list.size()];
- list.toArray(result);
- return result;
- }
-
- public void setInput(Element element)
- {
- this.element = element;
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java.lang.Object)
- */
- public Object getPropertyValue(Object id)
- {
- Object result = null;
- if (id instanceof String)
- {
- String attributeName = (String)id;
- result = element.getAttribute((String) id);
- Element contentModelElement = getDomHelper().getContentModelFromParent(element);
- String baseType = getDomHelper().getBaseType(contentModelElement);
-
- if (result == null)
- {
- result = "";
- }
-
- if (attributeName.equals(DERIVED_BY_ID))
- {
- return getDomHelper().getDerivedByName(contentModelElement);
- }
- else if (attributeName.equals(BASE_TYPE_ID))
- {
- if (baseType != null)
- {
- return baseType;
- }
- else
- {
- return "";
- }
- }
- else if (attributeName.equals(XSDConstants.NAME_ATTRIBUTE))
- {
- String name = element.getAttribute(XSDConstants.NAME_ATTRIBUTE);
-
- boolean isAnonymousType = checkForAnonymousType(element);
- if (isAnonymousType)
- {
- return "**anonymous**";
- }
- else
- {
- return name;
- }
- }
-
- return result;
-// if (((String) id).equals(XSDConstants.ABSTRACT_ATTRIBUTE)
-// || ((String) id).equals(XSDConstants.MIXED_ATTRIBUTE))
-// {
-// }
-// else if (((String) id).equals(XSDConstants.BLOCK_ATTRIBUTE))
-// {
-// }
-// else if (((String) id).equals(XSDConstants.FINAL_ATTRIBUTE))
-// {
-// }
- }
- return "";
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#isPropertySet(java.lang.Object)
- */
- public boolean isPropertySet(Object id)
- {
- return false;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#resetPropertyValue(java.lang.Object)
- */
- public void resetPropertyValue(Object id)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#setPropertyValue(java.lang.Object, java.lang.Object)
- */
- public void setPropertyValue(Object id, Object value)
- {
- if (value == null)
- {
- value = "";
- }
- if (value instanceof String)
- {
- String newValue = (String)value;
- String attributeName = (String)id;
-
- if (attributeName.equals(XSDConstants.NAME_ATTRIBUTE))
- {
- if (validateName(newValue))
- {
- beginRecording(XSDEditorPlugin.getXSDString("_UI_COMPLEXTYPE_NAME_CHANGE"), element);
- if (newValue.length() > 0)
- {
- // now rename any references to this type
- if (xsdSchema != null)
- {
- XSDConcreteComponent comp = xsdSchema.getCorrespondingComponent(element);
- if (comp != null && comp instanceof XSDComplexTypeDefinition && comp.getContainer().equals(xsdSchema))
- {
-// XSDComplexTypeDefinition ct = (XSDComplexTypeDefinition)comp;
-// ct.setName(newValue);
- GlobalSimpleOrComplexTypeRenamer renamer = new GlobalSimpleOrComplexTypeRenamer((XSDNamedComponent)comp, newValue);
- renamer.visitSchema(xsdSchema);
- }
- }
- element.setAttribute(XSDConstants.NAME_ATTRIBUTE, newValue);
- }
- else
- {
- element.removeAttribute(XSDConstants.NAME_ATTRIBUTE);
- }
- endRecording(element);
- }
- }
- else if (attributeName.equals(DERIVED_BY_ID))
- {
- Element contentModelElement = getDomHelper().getContentModelFromParent(element);
- String baseType = getDomHelper().getBaseType(contentModelElement);
- beginRecording(XSDEditorPlugin.getXSDString("_UI_DERIVEDBY_CHANGE"), element);
- Element derivedByElem = getDomHelper().getDerivedByElement(element);
- getDomHelper().changeDerivedByType(contentModelElement, newValue, baseType);
- endRecording(element);
- }
- else if (attributeName.equals(BASE_TYPE_ID))
- {
- String derivedBy = getDomHelper().getDerivedByName(element);
-
- SetBaseTypeAction setBaseTypeAction = new SetBaseTypeAction(XSDEditorPlugin.getXSDString("_UI_LABEL_SET_BASE_TYPE"));
- setBaseTypeAction.setXSDSchema(xsdSchema);
- setBaseTypeAction.setComplexTypeElement(element);
- setBaseTypeAction.setType(newValue);
- setBaseTypeAction.setDerivedBy(derivedBy);
- setBaseTypeAction.performAction();
-
-// handleBaseTypeComboChange(newValue);
-
- }
- else
- {
- if (attributeName.equals(XSDConstants.ABSTRACT_ATTRIBUTE))
- {
- beginRecording(XSDEditorPlugin.getXSDString("_UI_COMPLEXTYPE_ABSTRACT_CHANGE"), element);
- }
- else if (attributeName.equals(XSDConstants.MIXED_ATTRIBUTE))
- {
- beginRecording(XSDEditorPlugin.getXSDString("_UI_COMPLEXTYPE_MIXED_CHANGE"), element);
- }
- else if (attributeName.equals(XSDConstants.BLOCK_ATTRIBUTE))
- {
- beginRecording(XSDEditorPlugin.getXSDString("_UI_COMPLEXTYPE_BLOCK_CHANGE"), element);
- }
- else if (attributeName.equals(XSDConstants.FINAL_ATTRIBUTE))
- {
- beginRecording(XSDEditorPlugin.getXSDString("_UI_COMPLEXTYPE_FINAL_CHANGE"), element);
- }
-
- if (newValue.length() > 0)
- {
- element.setAttribute((String) id, (String)value);
- }
- else
- {
- element.removeAttribute((String) id);
- }
- endRecording(element);
- }
- }
- Runnable delayedUpdate = new Runnable()
- {
- public void run()
- {
- if (viewer != null)
- viewer.refresh();
- }
- };
- Display.getCurrent().asyncExec(delayedUpdate);
-
- }
-
- boolean checkForAnonymousType(Element element)
- {
- Object parentElement = (Object)element.getParentNode();
- boolean isAnonymous = false;
- if (parentElement != null)
- {
- if (XSDDOMHelper.inputEquals(parentElement, XSDConstants.ELEMENT_ELEMENT_TAG, false))
- {
- isAnonymous = true;
- }
- }
- return isAnonymous;
- }
-
-
-// private void handleBaseTypeComboChange(String newType)
-// {
-// String tempChoice = newType;
-// TypesHelper helper = new TypesHelper(xsdSchema);
-// if (helper.getBuiltInTypeNamesList().contains(tempChoice) ||
-// helper.getUserSimpleTypeNamesList().contains(tempChoice))
-// {
-// derivedByCombo.setText(XSDConstants.EXTENSION_ELEMENT_TAG);
-// derivedByCombo.setEnabled(false);
-// }
-// else if (helper.getUserComplexTypeNamesList().contains(tempChoice))
-// {
-// Element contentModelElement = getDomHelper().getContentModelFromParent(element);
-// String derivedByString = getDomHelper().getDerivedByName(contentModelElement);
-// derivedByCombo.setText(derivedByString);
-// derivedByCombo.setEnabled(true);
-// }
-// else
-// {
-// derivedByCombo.setText("");
-// derivedByCombo.setEnabled(false);
-// }
-// }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/DocumentationPropertySource.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/DocumentationPropertySource.java
deleted file mode 100644
index 06e9ef793b..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/DocumentationPropertySource.java
+++ /dev/null
@@ -1,243 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.properties;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.eclipse.ui.views.properties.PropertyDescriptor;
-import org.eclipse.ui.views.properties.TextPropertyDescriptor;
-import org.eclipse.wst.xsd.ui.internal.XSDEditorPlugin;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.util.XSDConstants;
-import org.w3c.dom.CharacterData;
-import org.w3c.dom.Node;
-
-
-public class DocumentationPropertySource
- extends BasePropertySource
- implements IPropertySource
-{
- public static String CONTENT = "Content";
-
- /**
- *
- */
- public DocumentationPropertySource()
- {
- super();
- }
- /**
- * @param viewer
- * @param xsdSchema
- */
- public DocumentationPropertySource(Viewer viewer, XSDSchema xsdSchema)
- {
- super(viewer, xsdSchema);
-
- }
- /**
- * @param xsdSchema
- */
- public DocumentationPropertySource(XSDSchema xsdSchema)
- {
- super(xsdSchema);
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getEditableValue()
- */
- public Object getEditableValue()
- {
- return null;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors()
- */
- public IPropertyDescriptor[] getPropertyDescriptors()
- {
- List list = new ArrayList();
- // Create a descriptor and set a category
- PropertyDescriptor languageDescriptor =
- new TextPropertyDescriptor(
- "xml:lang",
- "xml:lang"
- );
- list.add(languageDescriptor);
- PropertyDescriptor sourceDescriptor =
- new TextPropertyDescriptor(
- XSDConstants.SOURCE_ATTRIBUTE,
- XSDConstants.SOURCE_ATTRIBUTE);
- list.add(sourceDescriptor);
- AnyContentPropertyDescriptor contentDescriptor =
- new AnyContentPropertyDescriptor(
- CONTENT,
- CONTENT,
- element);
- list.add(contentDescriptor);
-
- IPropertyDescriptor[] result = new IPropertyDescriptor[list.size()];
- list.toArray(result);
- return result;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java.lang.Object)
- */
- public Object getPropertyValue(Object id)
- {
- Object result = null;
- if (id instanceof String)
- {
- if (((String) id).equals(CONTENT))
- {
- try
- {
- if (element.hasChildNodes())
- {
- // if the element is Text
- Node node = element.getFirstChild();
- if (node instanceof CharacterData)
- {
- return ((CharacterData)node).getData();
- }
- }
- else
- {
- return "";
- }
- }
- catch (Exception e)
- {
-
- }
-
- }
- else
- {
- result = element.getAttribute((String) id);
- }
- }
- if (result == null)
- {
- result = "";
- }
- return result;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#isPropertySet(java.lang.Object)
- */
- public boolean isPropertySet(Object id)
- {
- return false;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#resetPropertyValue(java.lang.Object)
- */
- public void resetPropertyValue(Object id)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#setPropertyValue(java.lang.Object, java.lang.Object)
- */
- public void setPropertyValue(Object id, Object value)
- {
- if (value != null)
- {
- if (value instanceof String)
- {
- String newValue = (String)value;
- if (((String)id).equals("xml:lang"))
- {
- beginRecording(XSDEditorPlugin.getXSDString("_UI_DOCUMENTATION_LANG_CHANGE"), element);
- if (newValue.length() > 0)
- {
- if (validateLanguage(newValue))
- {
- element.setAttribute("xml:lang", newValue);
- }
- }
- else
- {
- // clearErrorMessage();
- element.removeAttribute("xml:lang");
- }
- endRecording(element);
- }
- else if (((String)id).equals(XSDConstants.SOURCE_ATTRIBUTE))
- {
- beginRecording(XSDEditorPlugin.getXSDString("_UI_DOCUMENTATION_SOURCE_CHANGE"), element);
- if (newValue.length() > 0)
- {
- element.setAttribute(XSDConstants.SOURCE_ATTRIBUTE, newValue);
- }
- else
- {
- element.removeAttribute(XSDConstants.SOURCE_ATTRIBUTE);
- }
- endRecording(element);
- }
- else if (((String)id).equals(CONTENT))
- {
- beginRecording(XSDEditorPlugin.getXSDString("_UI_DOCUMENTATION_COMMENT_CHANGE"), element);
- try
- {
- if (element.hasChildNodes())
- {
- // if the element is Text
- Node node = element.getFirstChild();
- if (node instanceof CharacterData)
- {
- ((CharacterData)node).setData(newValue);
- }
- }
- else
- {
- if (newValue.length() > 0)
- {
- Node childNode = element.getOwnerDocument().createTextNode(newValue);
- element.appendChild(childNode);
- }
- }
- endRecording(element);
- }
- catch (Exception e)
- {
-
- }
- }
- else // shouldn't be here
- {
- element.setAttribute((String) id, newValue);
- }
- }
- else if (value instanceof Integer)
- {
- }
- }
- else
- {
- element.removeAttribute((String) id);
- }
- Runnable delayedUpdate = new Runnable()
- {
- public void run()
- {
- if (viewer != null)
- viewer.refresh();
- }
- };
- Display.getCurrent().asyncExec(delayedUpdate);
-
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/DynamicCellEditor.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/DynamicCellEditor.java
deleted file mode 100644
index b09526a9d9..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/DynamicCellEditor.java
+++ /dev/null
@@ -1,1174 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.properties;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.ACC;
-import org.eclipse.swt.accessibility.AccessibleAdapter;
-import org.eclipse.swt.accessibility.AccessibleControlAdapter;
-import org.eclipse.swt.accessibility.AccessibleControlEvent;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.accessibility.AccessibleTextAdapter;
-import org.eclipse.swt.accessibility.AccessibleTextEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.List;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.TypedListener;
-
-public class DynamicCellEditor extends Composite
-{
- Text text;
- List list;
- int maxItemCount = 5;
- Shell popup;
- Button arrow;
- boolean hasFocus;
-
- public DynamicCellEditor(Composite parent, int style) {
- super (parent, checkStyle (style));
-
- style = getStyle();
-
- int textStyle = SWT.SINGLE;
- if ((style & SWT.READ_ONLY) != 0) textStyle |= SWT.READ_ONLY;
- if ((style & SWT.FLAT) != 0) textStyle |= SWT.FLAT;
- text = new Text (this, textStyle);
-
- popup = new Shell (getShell (), SWT.NO_TRIM);
-
- int listStyle = SWT.SINGLE | SWT.V_SCROLL;
- if ((style & SWT.FLAT) != 0) listStyle |= SWT.FLAT;
- if ((style & SWT.RIGHT_TO_LEFT) != 0) listStyle |= SWT.RIGHT_TO_LEFT;
- if ((style & SWT.LEFT_TO_RIGHT) != 0) listStyle |= SWT.LEFT_TO_RIGHT;
- list = new List (popup, listStyle);
-
- int arrowStyle = SWT.ARROW | SWT.DOWN;
- if ((style & SWT.FLAT) != 0) arrowStyle |= SWT.FLAT;
- arrow = new Button (this, arrowStyle);
-
- Listener listener = new Listener () {
- public void handleEvent (Event event) {
- if (popup == event.widget) {
- popupEvent (event);
- return;
- }
- if (text == event.widget) {
- textEvent (event);
- return;
- }
- if (list == event.widget) {
- listEvent (event);
- return;
- }
- if (arrow == event.widget) {
- arrowEvent (event);
- return;
- }
- if (DynamicCellEditor.this == event.widget) {
- comboEvent (event);
- return;
- }
-
- }
- };
-
- int [] comboEvents = {SWT.Dispose, SWT.Move, SWT.Resize};
- for (int i=0; i<comboEvents.length; i++) this.addListener (comboEvents [i], listener);
-
- int [] popupEvents = {SWT.Close, SWT.Paint, SWT.Deactivate};
- for (int i=0; i<popupEvents.length; i++) popup.addListener (popupEvents [i], listener);
-
- int [] textEvents = {SWT.KeyDown, SWT.KeyUp, SWT.Modify, SWT.MouseDown, SWT.MouseUp, SWT.Traverse, SWT.FocusIn, SWT.FocusOut};
- for (int i=0; i<textEvents.length; i++) text.addListener (textEvents [i], listener);
-
- int [] listEvents = {SWT.MouseUp, SWT.Selection, SWT.Traverse, SWT.KeyDown, SWT.KeyUp, SWT.FocusIn, SWT.FocusOut};
- for (int i=0; i<listEvents.length; i++) list.addListener (listEvents [i], listener);
-
- int [] arrowEvents = {SWT.Selection, SWT.FocusIn, SWT.FocusOut};
- for (int i=0; i<arrowEvents.length; i++) arrow.addListener (arrowEvents [i], listener);
-
- initAccessible();
-}
-static int checkStyle (int style) {
- int mask = SWT.BORDER | SWT.READ_ONLY | SWT.FLAT | SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT;
- return style & mask;
-}
-/**
-* Adds an item.
-* <p>
-* The item is placed at the end of the list.
-* Indexing is zero based.
-*
-* @param string the new item
-*
-* @exception org.eclipse.swt.SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception org.eclipse.swt.SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-* @exception org.eclipse.swt.SWTError(ERROR_NULL_ARGUMENT)
-* when the string is null
-* @exception org.eclipse.swt.SWTError(ERROR_ITEM_NOT_ADDED)
-* when the item cannot be added
-*/
-public void add (String string) {
- checkWidget();
- if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- list.add (string);
-}
-/**
-* Adds an item at an index.
-* <p>
-* The item is placed at an index in the list.
-* Indexing is zero based.
-*
-* This operation will fail when the index is
-* out of range.
-*
-* @param string the new item
-* @param index the index for the item
-*
-* @exception org.eclipse.swt.SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception org.eclipse.swt.SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-* @exception org.eclipse.swt.SWTError(ERROR_NULL_ARGUMENT)
-* when the string is null
-* @exception org.eclipse.swt.SWTError(ERROR_ITEM_NOT_ADDED)
-* when the item cannot be added
-*/
-public void add (String string, int index) {
- checkWidget();
- if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- list.add (string, index);
-}
-/**
-* Adds the listener to receive events.
-* <p>
-*
-* @param listener the listener
-*
-* @exception org.eclipse.swt.SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception org.eclipse.swt.SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-* @exception org.eclipse.swt.SWTError(ERROR_NULL_ARGUMENT)
-* when listener is null
-*/
-public void addModifyListener (ModifyListener listener) {;
- checkWidget();
- if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Modify, typedListener);
-}
-/**
-* Adds the listener to receive events.
-* <p>
-*
-* @param listener the listener
-*
-* @exception org.eclipse.swt.SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception org.eclipse.swt.SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-* @exception org.eclipse.swt.SWTError(ERROR_NULL_ARGUMENT)
-* when listener is null
-*/
-public void addSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Selection,typedListener);
- addListener (SWT.DefaultSelection,typedListener);
-}
-void arrowEvent (Event event) {
- switch (event.type) {
- case SWT.FocusIn: {
- if (hasFocus) return;
- hasFocus = true;
- if (getEditable ()) text.selectAll ();
- Event e = new Event();
- e.time = event.time;
- notifyListeners(SWT.FocusIn, e);
- break;
- }
- case SWT.FocusOut: {
- event.display.asyncExec(new Runnable() {
- public void run() {
- if (DynamicCellEditor.this.isDisposed()) return;
- Control focusControl = getDisplay().getFocusControl();
- if (focusControl == list || focusControl == text) return;
- hasFocus = false;
- Event e = new Event();
- notifyListeners(SWT.FocusOut, e);
- }
- });
- break;
- }
- case SWT.Selection: {
- dropDown (!isDropped ());
- break;
- }
- }
-}
-/**
-* Clears the current selection.
-* <p>
-*
-* @exception org.eclipse.swt.SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception org.eclipse.swt.SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
-public void clearSelection () {
- checkWidget();
- text.clearSelection ();
- list.deselectAll ();
-}
-void comboEvent (Event event) {
- switch (event.type) {
- case SWT.Dispose:
- if (popup != null && !popup.isDisposed ()) popup.dispose ();
- popup = null;
- text = null;
- list = null;
- arrow = null;
- break;
- case SWT.Move:
- dropDown(false);
- break;
- case SWT.Resize:
- internalLayout();
- break;
- }
-}
-
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget();
- int width = 0, height = 0;
- Point textSize = text.computeSize (wHint, SWT.DEFAULT, changed);
- Point arrowSize = arrow.computeSize(SWT.DEFAULT, SWT.DEFAULT, changed);
- Point listSize = list.computeSize (wHint, SWT.DEFAULT, changed);
- int borderWidth = getBorderWidth();
-
- height = Math.max (hHint, Math.max(textSize.y, arrowSize.y) + 2*borderWidth);
- width = Math.max (wHint, Math.max(textSize.x + arrowSize.x + 2*borderWidth, listSize.x + 2) );
- return new Point (width, height);
-}
-/**
-* Deselects an item.
-* <p>
-* If the item at an index is selected, it is
-* deselected. If the item at an index is not
-* selected, it remains deselected. Indices
-* that are out of range are ignored. Indexing
-* is zero based.
-*
-* @param index the index of the item
-*
-* @exception org.eclipse.swt.SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception org.eclipse.swt.SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
-public void deselect (int index) {
- checkWidget();
- list.deselect (index);
-}
-/**
-* Deselects all items.
-* <p>
-*
-* If an item is selected, it is deselected.
-* If an item is not selected, it remains unselected.
-*
-* @exception org.eclipse.swt.SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception org.eclipse.swt.SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
-public void deselectAll () {
- checkWidget();
- list.deselectAll ();
-}
-void dropDown (boolean drop) {
- if (drop == isDropped ()) return;
- if (!drop) {
- popup.setVisible (false);
- text.setFocus();
- return;
- }
-
- int index = list.getSelectionIndex ();
- if (index != -1) list.setTopIndex (index);
- Display display = getDisplay ();
- Rectangle listRect = list.getBounds ();
- Rectangle parentRect = display.map (getParent (), null, getBounds());
- Point comboSize = getSize ();
- Rectangle displayRect = getMonitor().getClientArea();
- int width = Math.max (comboSize.x, listRect.width + 2);
- int height = listRect.height + 2;
- int x = parentRect.x;
- int y = parentRect.y + comboSize.y;
- if (y + height > displayRect.y + displayRect.height) y = parentRect.y - height;
- popup.setBounds (x, y, width, height);
- popup.setVisible (true);
- list.setFocus();
-}
-public Control [] getChildren () {
- checkWidget();
- return new Control [0];
-}
-boolean getEditable () {
- return text.getEditable ();
-}
-/**
-* Gets an item at an index.
-* <p>
-* Indexing is zero based.
-*
-* This operation will fail when the index is out
-* of range or an item could not be queried from
-* the OS.
-*
-* @param index the index of the item
-* @return the item
-*
-* @exception org.eclipse.swt.SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception org.eclipse.swt.SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-* @exception org.eclipse.swt.SWTError(ERROR_CANNOT_GET_ITEM)
-* when the operation fails
-*/
-public String getItem (int index) {
- checkWidget();
- return list.getItem (index);
-}
-/**
-* Gets the number of items.
-* <p>
-* This operation will fail if the number of
-* items could not be queried from the OS.
-*
-* @return the number of items in the widget
-*
-* @exception org.eclipse.swt.SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception org.eclipse.swt.SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-* @exception org.eclipse.swt.SWTError(ERROR_CANNOT_GET_COUNT)
-* when the operation fails
-*/
-public int getItemCount () {
- checkWidget();
- return list.getItemCount ();
-}
-/**
-* Gets the height of one item.
-* <p>
-* This operation will fail if the height of
-* one item could not be queried from the OS.
-*
-* @return the height of one item in the widget
-*
-* @exception org.eclipse.swt.SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception org.eclipse.swt.SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-* @exception org.eclipse.swt.SWTError(ERROR_CANNOT_GET_ITEM_HEIGHT)
-* when the operation fails
-*/
-public int getItemHeight () {
- checkWidget();
- return list.getItemHeight ();
-}
-/**
-* Gets the items.
-* <p>
-* This operation will fail if the items cannot
-* be queried from the OS.
-*
-* @return the items in the widget
-*
-* @exception org.eclipse.swt.SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception org.eclipse.swt.SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-* @exception org.eclipse.swt.SWTError(ERROR_CANNOT_GET_ITEM)
-* when the operation fails
-*/
-public String [] getItems () {
- checkWidget();
- return list.getItems ();
-}
-/**
-* Gets the selection.
-* <p>
-* @return a point representing the selection start and end
-*
-* @exception org.eclipse.swt.SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception org.eclipse.swt.SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
-public Point getSelection () {
- checkWidget();
- return text.getSelection ();
-}
-/**
-* Gets the index of the selected item.
-* <p>
-* Indexing is zero based.
-* If no item is selected -1 is returned.
-*
-* @return the index of the selected item.
-*
-* @exception org.eclipse.swt.SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception org.eclipse.swt.SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
-public int getSelectionIndex () {
- checkWidget();
- return list.getSelectionIndex ();
-}
-/**
-* Gets the widget text.
-* <p>
-* If the widget has no text, an empty string is returned.
-*
-* @return the widget text
-*
-* @exception org.eclipse.swt.SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception org.eclipse.swt.SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
-public String getText () {
- checkWidget();
- return text.getText ();
-}
-/**
-* Gets the height of the combo's text field.
-* <p>
-* The operation will fail if the height cannot
-* be queried from the OS.
-
-* @return the height of the combo's text field.
-*
-* @exception org.eclipse.swt.SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception org.eclipse.swt.SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-* @exception org.eclipse.swt.SWTError(ERROR_ERROR_CANNOT_GET_ITEM_HEIGHT)
-* when the operation fails
-*/
-public int getTextHeight () {
- checkWidget();
- return text.getLineHeight();
-}
-/**
-* Gets the text limit.
-* <p>
-* @return the text limit
-*
-* @exception org.eclipse.swt.SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception org.eclipse.swt.SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
-public int getTextLimit () {
- checkWidget();
- return text.getTextLimit ();
-}
-/**
-* Gets the index of an item.
-* <p>
-* The list is searched starting at 0 until an
-* item is found that is equal to the search item.
-* If no item is found, -1 is returned. Indexing
-* is zero based.
-*
-* @param string the search item
-* @return the index of the item
-*
-* @exception org.eclipse.swt.SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception org.eclipse.swt.SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-* @exception org.eclipse.swt.SWTError(ERROR_NULL_ARGUMENT)
-* when string is null
-*/
-public int indexOf (String string) {
- checkWidget();
- if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- return list.indexOf (string);
-}
-/**
-* Gets the index of an item.
-* <p>
-* The widget is searched starting at start including
-* the end position until an item is found that
-* is equal to the search itenm. If no item is
-* found, -1 is returned. Indexing is zero based.
-*
-* @param string the search item
-* @param index the starting position
-* @return the index of the item
-*
-* @exception org.eclipse.swt.SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception org.eclipse.swt.SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-* @exception org.eclipse.swt.SWTError(ERROR_NULL_ARGUMENT)
-* when string is null
-*/
-public int indexOf (String string, int start) {
- checkWidget();
- if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- return list.indexOf (string, start);
-}
-
-void initAccessible() {
- getAccessible().addAccessibleListener(new AccessibleAdapter() {
- public void getHelp(AccessibleEvent e) {
- e.result = getToolTipText();
- }
- });
-
- getAccessible().addAccessibleTextListener(new AccessibleTextAdapter() {
- public void getCaretOffset(AccessibleTextEvent e) {
- e.offset = text.getCaretPosition();
- }
- });
-
- getAccessible().addAccessibleControlListener(new AccessibleControlAdapter() {
- public void getChildAtPoint(AccessibleControlEvent e) {
- Point testPoint = toControl(new Point(e.x, e.y));
- if (getBounds().contains(testPoint)) {
- e.childID = ACC.CHILDID_SELF;
- }
- }
-
- public void getLocation(AccessibleControlEvent e) {
- Rectangle location = getBounds();
- Point pt = toDisplay(new Point(location.x, location.y));
- e.x = pt.x;
- e.y = pt.y;
- e.width = location.width;
- e.height = location.height;
- }
-
- public void getChildCount(AccessibleControlEvent e) {
- e.detail = 0;
- }
-
- public void getRole(AccessibleControlEvent e) {
- e.detail = ACC.ROLE_COMBOBOX;
- }
-
- public void getState(AccessibleControlEvent e) {
- e.detail = ACC.STATE_NORMAL;
- }
-
- public void getValue(AccessibleControlEvent e) {
- e.result = getText();
- }
- });
-}
-boolean isDropped () {
- return popup.getVisible ();
-}
-public boolean isFocusControl () {
- checkWidget();
- if (text.isFocusControl() || arrow.isFocusControl() || list.isFocusControl() || popup.isFocusControl()) {
- return true;
- } else {
- return super.isFocusControl();
- }
-}
-
-//public boolean isListVisible()
-//{
-// checkWidget();
-// return list.isVisible();
-//}
-
-void internalLayout () {
- if (isDropped ()) dropDown (false);
-
- Rectangle rect = getClientArea();
- int width = rect.width;
- int height = rect.height;
- Point arrowSize = arrow.computeSize(SWT.DEFAULT, height);
- text.setBounds (0, 0, width - arrowSize.x, height);
- arrow.setBounds (width - arrowSize.x, 0, arrowSize.x, arrowSize.y);
-
- Point size = getSize();
- int itemCount = list.getItemCount();
- itemCount = (itemCount == 0) ? maxItemCount : Math.min(maxItemCount, itemCount);
- int itemHeight = list.getItemHeight () * itemCount;
- Point listSize = list.computeSize (SWT.DEFAULT, itemHeight);
- list.setBounds (1, 1, Math.max (size.x - 2, listSize.x), listSize.y);
-}
-void listEvent (Event event) {
- switch (event.type) {
- case SWT.FocusIn: {
- if (hasFocus) return;
- hasFocus = true;
- if (getEditable ()) text.selectAll ();
- Event e = new Event();
- e.time = event.time;
- notifyListeners(SWT.FocusIn, e);
- break;
- }
- case SWT.FocusOut: {
- event.display.asyncExec(new Runnable() {
- public void run() {
- if (DynamicCellEditor.this.isDisposed()) return;
- Control focusControl = getDisplay().getFocusControl();
- if (focusControl == text || focusControl == arrow || focusControl == list) return;
- hasFocus = false;
- Event e = new Event();
- notifyListeners(SWT.FocusOut, e);
- }
- });
- break;
- }
- case SWT.MouseUp: {
- if (event.button != 1) return;
- dropDown (false);
- break;
- }
- case SWT.Selection: {
- int index = list.getSelectionIndex ();
- if (index == -1) return;
- text.setText (list.getItem (index));
- text.selectAll ();
- list.setSelection(index);
- Event e = new Event();
- e.time = event.time;
- e.stateMask = event.stateMask;
- e.doit = event.doit;
- notifyListeners(SWT.Selection, e);
- event.doit = e.doit;
- break;
- }
- case SWT.Traverse: {
- switch (event.detail) {
- case SWT.TRAVERSE_TAB_NEXT:
- case SWT.TRAVERSE_RETURN:
- case SWT.TRAVERSE_ESCAPE:
- case SWT.TRAVERSE_ARROW_PREVIOUS:
- case SWT.TRAVERSE_ARROW_NEXT:
- event.doit = false;
- break;
- }
- Event e = new Event();
- e.time = event.time;
- e.detail = event.detail;
- e.doit = event.doit;
- e.keyCode = event.keyCode;
- notifyListeners(SWT.Traverse, e);
- event.doit = e.doit;
- break;
- }
- case SWT.KeyUp: {
- Event e = new Event();
- e.time = event.time;
- e.character = event.character;
- e.keyCode = event.keyCode;
- e.stateMask = event.stateMask;
- notifyListeners(SWT.KeyUp, e);
- break;
- }
- case SWT.KeyDown: {
- if (event.character == SWT.ESC) {
- // escape key cancels popup list
- dropDown (false);
- }
- if (event.character == SWT.CR || event.character == '\t') {
- // Enter and Tab cause default selection
- dropDown (false);
- Event e = new Event();
- e.time = event.time;
- e.stateMask = event.stateMask;
- notifyListeners(SWT.DefaultSelection, e);
- }
- //At this point the widget may have been disposed.
- // If so, do not continue.
- if (isDisposed()) break;
- Event e = new Event();
- e.time = event.time;
- e.character = event.character;
- e.keyCode = event.keyCode;
- e.stateMask = event.stateMask;
- notifyListeners(SWT.KeyDown, e);
- break;
-
- }
- }
-}
-void popupEvent(Event event) {
- switch (event.type) {
- case SWT.Paint:
- // draw black rectangle around list
- Rectangle listRect = list.getBounds();
- Color black = getDisplay().getSystemColor(SWT.COLOR_BLACK);
- event.gc.setForeground(black);
- event.gc.drawRectangle(0, 0, listRect.width + 1, listRect.height + 1);
- break;
- case SWT.Close:
- event.doit = false;
- dropDown (false);
- break;
- case SWT.Deactivate:
- dropDown (false);
- break;
- }
-}
-public void redraw () {
- super.redraw();
- text.redraw();
- arrow.redraw();
- if (popup.isVisible()) list.redraw();
-}
-public void redraw (int x, int y, int width, int height, boolean all) {
- super.redraw(x, y, width, height, true);
-}
-
-/**
-* Removes an item at an index.
-* <p>
-* Indexing is zero based.
-*
-* This operation will fail when the index is out
-* of range or an item could not be removed from
-* the OS.
-*
-* @param index the index of the item
-* @return the selection state
-*
-* @exception org.eclipse.swt.SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception org.eclipse.swt.SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-* @exception org.eclipse.swt.SWTError(ERROR_ITEM_NOT_REMOVED)
-* when the operation fails
-*/
-public void remove (int index) {
- checkWidget();
- list.remove (index);
-}
-/**
-* Removes a range of items.
-* <p>
-* Indexing is zero based. The range of items
-* is from the start index up to and including
-* the end index.
-*
-* This operation will fail when the index is out
-* of range or an item could not be removed from
-* the OS.
-*
-* @param start the start of the range
-* @param end the end of the range
-*
-* @exception org.eclipse.swt.SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception org.eclipse.swt.SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-* @exception org.eclipse.swt.SWTError(ERROR_ITEM_NOT_REMOVED)
-* when the operation fails
-*/
-public void remove (int start, int end) {
- checkWidget();
- list.remove (start, end);
-}
-/**
-* Removes an item.
-* <p>
-* This operation will fail when the item
-* could not be removed from the OS.
-*
-* @param string the search item
-*
-* @exception org.eclipse.swt.SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception org.eclipse.swt.SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-* @exception org.eclipse.swt.SWTError(ERROR_NULL_ARGUMENT)
-* when string is null
-* @exception org.eclipse.swt.SWTError(ERROR_ITEM_NOT_REMOVED)
-* when the operation fails
-*/
-public void remove (String string) {
- checkWidget();
- if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- list.remove (string);
-}
-/**
-* Removes all items.
-* <p>
-* @exception org.eclipse.swt.SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception org.eclipse.swt.SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
-public void removeAll () {
- checkWidget();
- text.setText (""); //$NON-NLS-1$
- list.removeAll ();
-}
-/**
-* Removes the listener.
-* <p>
-*
-* @param listener the listener
-*
-* @exception org.eclipse.swt.SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception org.eclipse.swt.SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-* @exception org.eclipse.swt.SWTError(ERROR_NULL_ARGUMENT)
-* when listener is null
-*/
-public void removeModifyListener (ModifyListener listener) {
- checkWidget();
- if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- removeListener(SWT.Modify, listener);
-}
-/**
-* Removes the listener.
-* <p>
-*
-* @param listener the listener
-*
-* @exception org.eclipse.swt.SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception org.eclipse.swt.SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-* @exception org.eclipse.swt.SWTError(ERROR_NULL_ARGUMENT)
-* when listener is null
-*/
-public void removeSelectionListener (SelectionListener listener) {
- checkWidget();
- if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- removeListener(SWT.Selection, listener);
- removeListener(SWT.DefaultSelection,listener);
-}
-/**
-* Selects an item.
-* <p>
-* If the item at an index is not selected, it is
-* selected. Indices that are out of
-* range are ignored. Indexing is zero based.
-*
-* @param index the index of the item
-*
-* @exception org.eclipse.swt.SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception org.eclipse.swt.SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-*/
-public void select (int index) {
- checkWidget();
- if (index == -1) {
- list.deselectAll ();
- text.setText (""); //$NON-NLS-1$
- return;
- }
- if (0 <= index && index < list.getItemCount()) {
- if (index != getSelectionIndex()) {
- text.setText (list.getItem (index));
- text.selectAll ();
- list.select (index);
- list.showSelection ();
- }
- }
-}
-public void setBackground (Color color) {
- super.setBackground(color);
- if (text != null) text.setBackground(color);
- if (list != null) list.setBackground(color);
- if (arrow != null) arrow.setBackground(color);
-}
-public boolean setFocus () {
- checkWidget();
- return text.setFocus ();
-}
-public void setFont (Font font) {
- super.setFont (font);
- text.setFont (font);
- list.setFont (font);
- internalLayout ();
-}
-public void setForeground (Color color) {
- super.setForeground(color);
- if (text != null) text.setForeground(color);
- if (list != null) list.setForeground(color);
- if (arrow != null) arrow.setForeground(color);
-}
-/**
-* Sets the text of an item; indexing is zero based.
-*
-* This operation will fail when the index is out
-* of range or an item could not be changed in
-* the OS.
-*
-* @param index the index for the item
-* @param string the item
-*
-* @exception org.eclipse.swt.SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception org.eclipse.swt.SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-* @exception org.eclipse.swt.SWTError(ERROR_NULL_ARGUMENT)
-* when items is null
-* @exception org.eclipse.swt.SWTError(ERROR_ITEM_NOT_MODIFIED)
-* when the operation fails
-*/
-public void setItem (int index, String string) {
- checkWidget();
- if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- list.setItem (index, string);
-}
-/**
-* Sets all items.
-*
-* @param items the array of items
-*
-* @exception org.eclipse.swt.SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception org.eclipse.swt.SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-* @exception org.eclipse.swt.SWTError(ERROR_NULL_ARGUMENT)
-* when items is null
-* @exception org.eclipse.swt.SWTError(ERROR_ITEM_NOT_ADDED)
-* when the operation fails
-*/
-public void setItems (String [] items) {
- checkWidget();
- if (items == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- int style = getStyle();
- if ((style & SWT.READ_ONLY) != 0) text.setText (""); //$NON-NLS-1$
- list.setItems (items);
-}
-/**
-* Sets the new selection.
-*
-* @param selection point representing the start and the end of the new selection
-*
-* @exception org.eclipse.swt.SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception org.eclipse.swt.SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-* @exception org.eclipse.swt.SWTError(ERROR_NULL_ARGUMENT)
-* when selection is null
-*/
-public void setSelection (Point selection) {
- checkWidget();
- if (selection == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- text.setSelection (selection.x, selection.y);
-}
-
-/**
-* Sets the widget text.
-*
-* @param string the widget text
-*
-* @exception org.eclipse.swt.SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception org.eclipse.swt.SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-* @exception org.eclipse.swt.SWTError(ERROR_NULL_ARGUMENT)
-* when string is null
-*/
-public void setText (String string) {
- checkWidget();
- if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- int index = list.indexOf (string);
- if (index == -1) {
- list.deselectAll ();
- text.setText (string);
- return;
- }
- text.setText (string);
- text.selectAll ();
- list.setSelection (index);
- list.showSelection ();
-}
-/**
-* Sets the text limit.
-*
-* @param limit new text limit
-*
-* @exception org.eclipse.swt.SWTError(ERROR_THREAD_INVALID_ACCESS)
-* when called from the wrong thread
-* @exception org.eclipse.swt.SWTError(ERROR_WIDGET_DISPOSED)
-* when the widget has been disposed
-* @exception org.eclipse.swt.SWTError(ERROR_CANNOT_BE_ZERO)
-* when limit is 0
-*/
-public void setTextLimit (int limit) {
- checkWidget();
- text.setTextLimit (limit);
-}
-
-public void setToolTipText (String string) {
- checkWidget();
- super.setToolTipText(string);
- arrow.setToolTipText (string);
- text.setToolTipText (string);
-}
-
-public void setVisible (boolean visible) {
- super.setVisible(visible);
- if (!visible) popup.setVisible(false);
-}
-
-void textEvent (Event event) {
- switch (event.type) {
- case SWT.FocusIn: {
- if (hasFocus) return;
- hasFocus = true;
- if (getEditable ()) text.selectAll ();
- Event e = new Event();
- e.time = event.time;
- notifyListeners(SWT.FocusIn, e);
- break;
- }
- case SWT.FocusOut: {
- event.display.asyncExec(new Runnable() {
- public void run() {
- if (DynamicCellEditor.this.isDisposed()) return;
- Control focusControl = getDisplay().getFocusControl();
- if (focusControl == list || focusControl == arrow) return;
- hasFocus = false;
- Event e = new Event();
- notifyListeners(SWT.FocusOut, e);
- }
- });
- break;
- }
- case SWT.KeyDown: {
-
- if (event.character == SWT.ESC) { // escape key cancels popup list
- dropDown (false);
- }
- if (event.character == SWT.CR) {
- dropDown (false);
- Event e = new Event();
- e.time = event.time;
- e.stateMask = event.stateMask;
- notifyListeners(SWT.DefaultSelection, e);
- }
- //At this point the widget may have been disposed.
- // If so, do not continue.
- if (isDisposed()) break;
-
- if (event.keyCode == SWT.ARROW_UP || event.keyCode == SWT.ARROW_DOWN) {
- int oldIndex = getSelectionIndex ();
- if (event.keyCode == SWT.ARROW_UP) {
- select (Math.max (oldIndex - 1, 0));
- } else {
- select (Math.min (oldIndex + 1, getItemCount () - 1));
- }
-
- if (oldIndex != getSelectionIndex ()) {
- Event e = new Event();
- e.time = event.time;
- e.stateMask = event.stateMask;
- notifyListeners(SWT.Selection, e);
- }
- //At this point the widget may have been disposed.
- // If so, do not continue.
- if (isDisposed()) break;
- }
-
- // Further work : Need to add support for incremental search in
- // pop up list as characters typed in text widget
-
- Event e = new Event();
- e.time = event.time;
- e.character = event.character;
- e.keyCode = event.keyCode;
- e.stateMask = event.stateMask;
- notifyListeners(SWT.KeyDown, e);
- break;
- }
- case SWT.KeyUp: {
- Event e = new Event();
- e.time = event.time;
- e.character = event.character;
- e.keyCode = event.keyCode;
- e.stateMask = event.stateMask;
- notifyListeners(SWT.KeyUp, e);
- break;
- }
- case SWT.Modify: {
- list.deselectAll ();
- Event e = new Event();
- e.time = event.time;
- notifyListeners(SWT.Modify, e);
- break;
- }
- case SWT.MouseDown: {
- if (event.button != 1) return;
- if (text.getEditable ()) return;
- boolean dropped = isDropped ();
- text.selectAll ();
- if (!dropped) setFocus ();
- dropDown (!dropped);
- break;
- }
- case SWT.MouseUp: {
- if (event.button != 1) return;
- if (text.getEditable ()) return;
- text.selectAll ();
- break;
- }
- case SWT.Traverse: {
- switch (event.detail) {
- case SWT.TRAVERSE_RETURN:
- case SWT.TRAVERSE_ARROW_PREVIOUS:
- case SWT.TRAVERSE_ARROW_NEXT:
- // The enter causes default selection and
- // the arrow keys are used to manipulate the list contents so
- // do not use them for traversal.
- event.doit = false;
- break;
- }
-
- Event e = new Event();
- e.time = event.time;
- e.detail = event.detail;
- e.doit = event.doit;
- e.keyCode = event.keyCode;
- notifyListeners(SWT.Traverse, e);
- event.doit = e.doit;
- break;
- }
- }
-}
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/ElementPropertySource.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/ElementPropertySource.java
deleted file mode 100644
index 1eba5d953d..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/ElementPropertySource.java
+++ /dev/null
@@ -1,546 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.properties;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.eclipse.ui.views.properties.PropertyDescriptor;
-import org.eclipse.ui.views.properties.TextPropertyDescriptor;
-import org.eclipse.wst.xsd.ui.internal.XSDEditorPlugin;
-import org.eclipse.wst.xsd.ui.internal.refactor.rename.GlobalElementRenamer;
-import org.eclipse.wst.xsd.ui.internal.util.TypesHelper;
-import org.eclipse.wst.xsd.ui.internal.util.XSDDOMHelper;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDElementDeclaration;
-import org.eclipse.xsd.XSDNamedComponent;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.util.XSDConstants;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-
-public class ElementPropertySource extends BasePropertySource implements IPropertySource
-{
- private static final String PROPERTY_NAME = "org.eclipse.wst.xsd.ui.internal.name";
- private String[] blockComboValues =
- { "", "#all", "extension", "restriction", "substitution" };
- private String[] finalComboValues =
- { "", "#all", "extension", "restriction" };
- private String[] substitutionGroupComboValues = { "" };
- private String[] formComboValues =
- {
- "",
- XSDEditorPlugin.getXSDString("_UI_COMBO_UNQUALIFIED"),
- XSDEditorPlugin.getXSDString("_UI_COMBO_QUALIFIED")
- };
-
- public ElementPropertySource()
- {
- super();
- }
-
- public ElementPropertySource(XSDSchema xsdSchema)
- {
- super(xsdSchema);
- }
-
- public ElementPropertySource(Viewer viewer, XSDSchema xsdSchema)
- {
- super(viewer, xsdSchema);
- }
-
- public void setInput(Element element)
- {
- this.element = element;
- TypesHelper helper = new TypesHelper(xsdSchema);
- List globals = helper.getGlobalElements();
- int size = globals.size() + 1;
- substitutionGroupComboValues = new String[size];
- substitutionGroupComboValues[0] = "";
- if (globals != null)
- {
- for (int k = 0; k < globals.size(); k++)
- {
- substitutionGroupComboValues[k + 1] = (String) globals.get(k);
- }
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.views.properties.IPropertySource#getEditableValue()
- */
- public Object getEditableValue()
- {
-// return element.getNodeName();
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors()
- */
- public IPropertyDescriptor[] getPropertyDescriptors()
- {
- Object parentNode = element.getParentNode();
- boolean isGlobalElement = XSDDOMHelper.inputEquals(parentNode, XSDConstants.SCHEMA_ELEMENT_TAG, false);
-
- List list = new ArrayList();
- // Create a descriptor and set a category
-// These have been moved to the general tab
-// PropertyDescriptor nameDescriptor =
-// new TextPropertyDescriptor(
-// XSDConstants.NAME_ATTRIBUTE,
-// XSDConstants.NAME_ATTRIBUTE);
-// list.add(nameDescriptor);
-// TypesPropertyDescriptor typeDescriptor = new TypesPropertyDescriptor(
-// XSDConstants.TYPE_ATTRIBUTE,
-// XSDConstants.TYPE_ATTRIBUTE,
-// element, xsdSchema);
-// list.add(typeDescriptor);
- if (isGlobalElement)
- {
- XSDComboBoxPropertyDescriptor abstractDescriptor =
- new XSDComboBoxPropertyDescriptor(
- XSDConstants.ABSTRACT_ATTRIBUTE,
- XSDConstants.ABSTRACT_ATTRIBUTE,
- trueFalseComboValues);
- list.add(abstractDescriptor);
- }
- if (!isGlobalElement)
- {
- PropertyDescriptor minOccursDescriptor =
- new TextPropertyDescriptor(
- XSDConstants.MINOCCURS_ATTRIBUTE,
- XSDConstants.MINOCCURS_ATTRIBUTE);
- list.add(minOccursDescriptor);
-
- PropertyDescriptor maxOccursDescriptor =
- new TextPropertyDescriptor(
- XSDConstants.MAXOCCURS_ATTRIBUTE,
- XSDConstants.MAXOCCURS_ATTRIBUTE);
- list.add(maxOccursDescriptor);
- }
- XSDComboBoxPropertyDescriptor nillableDescriptor =
- new XSDComboBoxPropertyDescriptor(
- XSDConstants.NILLABLE_ATTRIBUTE,
- XSDConstants.NILLABLE_ATTRIBUTE,
- trueFalseComboValues);
- list.add(nillableDescriptor);
- XSDComboBoxPropertyDescriptor blockDescriptor =
- new XSDComboBoxPropertyDescriptor(
- XSDConstants.BLOCK_ATTRIBUTE,
- XSDConstants.BLOCK_ATTRIBUTE,
- blockComboValues);
- list.add(blockDescriptor);
- if (isGlobalElement)
- {
- XSDComboBoxPropertyDescriptor finalDescriptor =
- new XSDComboBoxPropertyDescriptor(
- XSDConstants.FINAL_ATTRIBUTE,
- XSDConstants.FINAL_ATTRIBUTE,
- finalComboValues);
- list.add(finalDescriptor);
- XSDComboBoxPropertyDescriptor substitutionGroupDescriptor =
- new XSDComboBoxPropertyDescriptor(
- XSDConstants.SUBSTITUTIONGROUP_ATTRIBUTE,
- XSDConstants.SUBSTITUTIONGROUP_ATTRIBUTE,
- substitutionGroupComboValues);
- list.add(substitutionGroupDescriptor);
- }
- if (!isGlobalElement)
- {
- XSDComboBoxPropertyDescriptor formDescriptor =
- new XSDComboBoxPropertyDescriptor(
- XSDConstants.FORM_ATTRIBUTE,
- XSDConstants.FORM_ATTRIBUTE,
- formComboValues);
- list.add(formDescriptor);
- }
-
- Attr fixedAttr = element.getAttributeNode(XSDConstants.FIXED_ATTRIBUTE);
- Attr defaultAttr = element.getAttributeNode(XSDConstants.DEFAULT_ATTRIBUTE);
- String str;
- if (fixedAttr != null)
- {
- str = XSDConstants.FIXED_ATTRIBUTE;
- }
- else if (defaultAttr != null)
- {
- str = XSDConstants.DEFAULT_ATTRIBUTE;
- }
- else
- {
- str = XSDConstants.FIXED_ATTRIBUTE + "/" + XSDConstants.DEFAULT_ATTRIBUTE;
- }
-
- FixedOrDefaultTextPropertyDescriptor fixedOrDefaultDescriptor =
- new FixedOrDefaultTextPropertyDescriptor(
- str,
- str,
- element);
- list.add(fixedOrDefaultDescriptor);
-
- IPropertyDescriptor[] result = new IPropertyDescriptor[list.size()];
- list.toArray(result);
- return result;
- // return propertyDescriptors;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java.lang.Object)
- */
- public Object getPropertyValue(Object id)
- {
- Object result = null;
- if (id instanceof String)
- {
- String attributeName = (String)id;
- result = element.getAttribute(attributeName);
- if (result == null)
- {
- result = "";
- }
- if (attributeName.equals(XSDConstants.TYPE_ATTRIBUTE))
- {
- boolean isAnonymous = checkForAnonymousType(element);
- if (isAnonymous)
- {
- return "**anonymous**";
- }
- if (result.equals(""))
- {
- result = XSDEditorPlugin.getXSDString("_UI_NO_TYPE");
- }
- return result;
- }
- else if (attributeName.equals(XSDConstants.MAXOCCURS_ATTRIBUTE)
- || attributeName.equals(XSDConstants.MINOCCURS_ATTRIBUTE)
- || attributeName.equals(XSDConstants.SUBSTITUTIONGROUP_ATTRIBUTE)
- || attributeName.equals(XSDConstants.FORM_ATTRIBUTE)
- || attributeName.equals(XSDConstants.ABSTRACT_ATTRIBUTE)
- || attributeName.equals(XSDConstants.NILLABLE_ATTRIBUTE)
- || attributeName.equals(XSDConstants.BLOCK_ATTRIBUTE)
- || attributeName.equals(XSDConstants.FINAL_ATTRIBUTE)
- || attributeName.equals(XSDConstants.FIXED_ATTRIBUTE)
- || attributeName.equals(XSDConstants.DEFAULT_ATTRIBUTE)
- || attributeName.equals(XSDConstants.NAME_ATTRIBUTE))
- {
- return result;
- }
- }
- return "";
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.views.properties.IPropertySource#isPropertySet(java.lang.Object)
- */
- public boolean isPropertySet(Object id)
- {
- return false;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.views.properties.IPropertySource#resetPropertyValue(java.lang.Object)
- */
- public void resetPropertyValue(Object id)
- {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.views.properties.IPropertySource#setPropertyValue(java.lang.Object,
- * java.lang.Object)
- */
- public void setPropertyValue(Object id, Object value)
- {
- if (value == null)
- {
- value = "";
- }
- if (value instanceof String)
- {
- String newValue = (String)value;
- String attributeName = (String)id;
-
- if (attributeName.equals(XSDConstants.MAXOCCURS_ATTRIBUTE))
- {
- beginRecording(XSDEditorPlugin.getXSDString("_UI_MAXOCCURS_CHANGE"), element);
- }
- else if (attributeName.equals(XSDConstants.MINOCCURS_ATTRIBUTE))
- {
- beginRecording(XSDEditorPlugin.getXSDString("_UI_MINOCCURS_CHANGE"), element);
- }
- else if (attributeName.equals(XSDConstants.SUBSTITUTIONGROUP_ATTRIBUTE))
- {
- beginRecording(XSDEditorPlugin.getXSDString("_UI_ELEMENT_SUBSTITUTIONGROUP_CHANGE"), element);
- }
- else if (attributeName.equals(XSDConstants.FORM_ATTRIBUTE))
- {
- beginRecording(XSDEditorPlugin.getXSDString("_UI_ELEMENT_FORM_CHANGE"), element);
- }
- else if (attributeName.equals(XSDConstants.ABSTRACT_ATTRIBUTE))
- {
- beginRecording(XSDEditorPlugin.getXSDString("_UI_ELEMENT_ABSTRACT_CHANGE"), element);
- }
- else if (attributeName.equals(XSDConstants.NILLABLE_ATTRIBUTE))
- {
- beginRecording(XSDEditorPlugin.getXSDString("_UI_ELEMENT_NILLABLE_CHANGE"), element);
- }
- else if (attributeName.equals(XSDConstants.BLOCK_ATTRIBUTE))
- {
- beginRecording(XSDEditorPlugin.getXSDString("_UI_ELEMENT_BLOCK_CHANGE"), element);
- }
- else if (attributeName.equals(XSDConstants.FINAL_ATTRIBUTE))
- {
- beginRecording(XSDEditorPlugin.getXSDString("_UI_ELEMENT_FINAL_CHANGE"), element);
- }
- else if (attributeName.equals(XSDConstants.FIXED_ATTRIBUTE) || attributeName.equals(XSDConstants.DEFAULT_ATTRIBUTE))
- {
- beginRecording(XSDEditorPlugin.getXSDString("_UI_ELEMENT_VALUE_CHANGE"), element);
- }
- else if (attributeName.equals(XSDConstants.NAME_ATTRIBUTE))
- {
- if (validateName(newValue))
- {
- beginRecording(XSDEditorPlugin.getXSDString("_UI_ELEMENT_NAME_CHANGE"), element);
- // now rename any references to this element
- if (xsdSchema != null)
- {
- XSDConcreteComponent comp = xsdSchema.getCorrespondingComponent(element);
- if (comp != null && comp instanceof XSDElementDeclaration && comp.getContainer().equals(xsdSchema))
- {
- GlobalElementRenamer renamer = new GlobalElementRenamer((XSDNamedComponent)comp, newValue);
- renamer.visitSchema(xsdSchema);
- }
- }
- }
- }
- else if (attributeName.equals(XSDConstants.TYPE_ATTRIBUTE))
- {
- // put logic in descriptor/cell editor
-// beginRecording(XSDEditorPlugin.getXSDString("_UI_ELEMENT_TYPE_CHANGE"), element);
- }
-
- if (newValue.length() > 0)
- {
- element.setAttribute((String) id, (String) value);
- }
- else
- {
- if (!attributeName.equals(XSDConstants.NAME_ATTRIBUTE))
- {
- element.removeAttribute((String) id);
- }
- }
- endRecording(element);
- }
- Runnable delayedUpdate = new Runnable()
- {
- public void run()
- {
- if (viewer != null)
- viewer.refresh();
- }
- };
- Display.getCurrent().asyncExec(delayedUpdate);
-
- }
-
- boolean checkForAnonymousType(Element element)
- {
- /* Using Ed's model to check
- boolean isAnonymous = false;
-
- XSDConcreteComponent component = getXSDSchema().getCorrespondingComponent(element);
- if (component instanceof XSDElementDeclaration)
- {
- XSDElementDeclaration xsdElem = (XSDElementDeclaration)component;
- isAnonymous = xsdElem.isSetAnonymousTypeDefinition();
- }
- return isAnonymous;
- */
-
- boolean isAnonymous = false;
-
- Node aNode = getDomHelper().getChildNode(element, XSDConstants.SIMPLETYPE_ELEMENT_TAG);
- if (aNode != null)
- {
- return true;
- }
- aNode = getDomHelper().getChildNode(element, XSDConstants.COMPLEXTYPE_ELEMENT_TAG);
- if (aNode != null)
- {
- isAnonymous = true;
- }
- return isAnonymous;
- }
-
-
-// void updateElementToAnonymous(Element element, String xsdType)
-// {
-// String prefix = element.getPrefix();
-// prefix = (prefix == null) ? "" : (prefix + ":");
-//
-// updateElementToNotAnonymous(element);
-// boolean hasChildrenElements = hasElementChildren(element);
-//
-// Element childNode = null;
-// if (xsdType.equals(XSDConstants.COMPLEXTYPE_ELEMENT_TAG))
-// {
-// childNode = element.getOwnerDocument().createElementNS(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, prefix + XSDConstants.COMPLEXTYPE_ELEMENT_TAG);
-// }
-// else if (xsdType.equals(XSDConstants.SIMPLETYPE_ELEMENT_TAG))
-// {
-// childNode = element.getOwnerDocument().createElementNS(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, prefix + XSDConstants.SIMPLETYPE_ELEMENT_TAG);
-// }
-//
-// element.appendChild(childNode);
-// formatChild(childNode, hasChildrenElements);
-//
-//
-// /* Using Ed's model to do the above
-// XSDConcreteComponent component = getXSDSchema().getCorrespondingComponent(element);
-// if (component instanceof XSDElementDeclaration)
-// {
-// XSDElementDeclaration xsdElem = (XSDElementDeclaration)component;
-// XSDFactoryImpl factory = new XSDFactoryImpl();
-// XSDComplexTypeDefinition complex = factory.createXSDComplexTypeDefinition();
-// XSDSimpleTypeDefinition simple = factory.createXSDSimpleTypeDefinition();
-//
-// Node child = element.getFirstChild();
-// if (XSDDOMHelper.inputEquals(child, XSDConstants.SIMPLETYPE_ELEMENT_TAG, false) ||
-// XSDDOMHelper.inputEquals(child, XSDConstants.COMPLEXTYPE_ELEMENT_TAG, false))
-// {
-// element.removeChild(child);
-// }
-//
-// FormatProcessor formatProcessor = new FormatProcessor();
-// if (xsdType.equals(XSDConstants.COMPLEXTYPE_ELEMENT_TAG))
-// {
-// xsdElem.setAnonymousTypeDefinition(complex);
-// Element elem = complex.getElement();
-// formatProcessor.formatWithSiblingIndent((XMLNode)elem);
-// }
-// else if (xsdType.equals(XSDConstants.SIMPLETYPE_ELEMENT_TAG))
-// {
-// xsdElem.setAnonymousTypeDefinition(simple);
-// Element elem = simple.getElement();
-// formatProcessor.formatWithSiblingIndent((XMLNode)elem);
-// }
-// }
-// component.updateElement();
-// */
-// }
-//
-// boolean isSTAnonymous(Element element)
-// {
-// Node aNode = getDomHelper().getChildNode(element, XSDConstants.SIMPLETYPE_ELEMENT_TAG);
-// if (aNode != null)
-// {
-// if (XSDDOMHelper.inputEquals(aNode, XSDConstants.SIMPLETYPE_ELEMENT_TAG, false))
-// {
-// return true;
-// }
-// }
-// return false;
-// }
-//
-// boolean isCTAnonymous(Element element)
-// {
-// Node aNode = getDomHelper().getChildNode(element, XSDConstants.COMPLEXTYPE_ELEMENT_TAG);
-// if (aNode != null)
-// {
-// if (XSDDOMHelper.inputEquals(aNode, XSDConstants.COMPLEXTYPE_ELEMENT_TAG, false))
-// {
-// return true;
-// }
-// }
-// return false;
-// }
-//
-// XSDTypeDefinition getAnonymousTypeDefinition(Element element)
-// {
-// Node typeDefinitionNode = getDomHelper().getChildNode(element, XSDConstants.SIMPLETYPE_ELEMENT_TAG);
-// if (typeDefinitionNode == null)
-// {
-// typeDefinitionNode = getDomHelper().getChildNode(element, XSDConstants.COMPLEXTYPE_ELEMENT_TAG);
-// }
-// if (typeDefinitionNode != null)
-// {
-// XSDConcreteComponent component = getXSDSchema().getCorrespondingComponent(typeDefinitionNode);
-// if (component instanceof XSDTypeDefinition)
-// {
-// return (XSDTypeDefinition)component;
-// }
-// }
-// return null;
-//
-// /* XSDConcreteComponent component = getXSDSchema().getCorrespondingComponent(element);
-// if (component instanceof XSDElementDeclaration)
-// {
-// XSDElementDeclaration xsdElem = (XSDElementDeclaration)component;
-//
-// return xsdElem.getAnonymousTypeDefinition();
-// }
-// return null;
-// */
-// }
-//
-// void updateElementToNotAnonymous(Element element)
-// {
-// NodeList children = element.getChildNodes();
-// if (children != null)
-// {
-// for (int i = 0; i < children.getLength(); i++)
-// {
-// Node node = (Node)children.item(i);
-// if (node instanceof Element)
-// {
-// if (node.getLocalName().equals(XSDConstants.SIMPLETYPE_ELEMENT_TAG) ||
-// node.getLocalName().equals(XSDConstants.COMPLEXTYPE_ELEMENT_TAG))
-// {
-// XSDDOMHelper.removeNodeAndWhitespace(node);
-// i=0;
-// }
-// }
-// }
-// }
-// /* XSDConcreteComponent component = getXSDSchema().getCorrespondingComponent(element);
-// if (component instanceof XSDElementDeclaration)
-// {
-// XSDElementDeclaration xsdElem = (XSDElementDeclaration)component;
-// if (xsdElem.isSetAnonymousTypeDefinition())
-// {
-// xsdElem.unsetAnonymousTypeDefinition();
-// xsdElem.setAnonymousTypeDefinition(null);
-// }
-// }
-// component.updateElement();
-// */
-// }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/EnumerationPropertySource.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/EnumerationPropertySource.java
deleted file mode 100644
index 65124f7015..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/EnumerationPropertySource.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.properties;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.eclipse.ui.views.properties.PropertyDescriptor;
-import org.eclipse.ui.views.properties.TextPropertyDescriptor;
-import org.eclipse.wst.xsd.ui.internal.XSDEditorPlugin;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.util.XSDConstants;
-
-
-public class EnumerationPropertySource
- extends BasePropertySource
- implements IPropertySource
-{
- /**
- *
- */
- public EnumerationPropertySource()
- {
- super();
- }
- /**
- * @param viewer
- * @param xsdSchema
- */
- public EnumerationPropertySource(Viewer viewer, XSDSchema xsdSchema)
- {
- super(viewer, xsdSchema);
- }
- /**
- * @param xsdSchema
- */
- public EnumerationPropertySource(XSDSchema xsdSchema)
- {
- super(xsdSchema);
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getEditableValue()
- */
- public Object getEditableValue()
- {
- return null;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors()
- */
- public IPropertyDescriptor[] getPropertyDescriptors()
- {
- List list = new ArrayList();
- // Create a descriptor and set a category
- PropertyDescriptor nameDescriptor =
- new TextPropertyDescriptor(
- XSDConstants.VALUE_ATTRIBUTE,
- XSDConstants.VALUE_ATTRIBUTE);
- list.add(nameDescriptor);
-
- IPropertyDescriptor[] result = new IPropertyDescriptor[list.size()];
- list.toArray(result);
- return result;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java.lang.Object)
- */
- public Object getPropertyValue(Object id)
- {
- Object result = null;
- if (id instanceof String)
- {
- result = element.getAttribute((String) id);
- }
- if (result == null)
- {
- result = "";
- }
- return result;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#isPropertySet(java.lang.Object)
- */
- public boolean isPropertySet(Object id)
- {
- return false;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#resetPropertyValue(java.lang.Object)
- */
- public void resetPropertyValue(Object id)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#setPropertyValue(java.lang.Object, java.lang.Object)
- */
- public void setPropertyValue(Object id, Object value)
- {
- if (value != null)
- {
- if (value instanceof String)
- {
- beginRecording(XSDEditorPlugin.getXSDString("_UI_ENUM_VALUE_CHANGE"), element);
- element.setAttribute(XSDConstants.VALUE_ATTRIBUTE, (String)value);
- endRecording(element);
- }
- }
- Runnable delayedUpdate = new Runnable()
- {
- public void run()
- {
- if (viewer != null)
- viewer.refresh();
- }
- };
- Display.getCurrent().asyncExec(delayedUpdate);
-
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/FixedOrDefaultTextPropertyDescriptor.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/FixedOrDefaultTextPropertyDescriptor.java
deleted file mode 100644
index 21e09aa229..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/FixedOrDefaultTextPropertyDescriptor.java
+++ /dev/null
@@ -1,307 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.properties;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.DialogCellEditor;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.views.properties.PropertyDescriptor;
-import org.eclipse.wst.xsd.ui.internal.XSDEditorContextIds;
-import org.eclipse.wst.xsd.ui.internal.XSDEditorPlugin;
-import org.eclipse.wst.xsd.ui.internal.util.ViewUtility;
-import org.eclipse.xsd.util.XSDConstants;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Element;
-
-
-public class FixedOrDefaultTextPropertyDescriptor extends PropertyDescriptor
-{
- protected static String choice = "";
- Element element;
- /**
- * @param id
- * @param displayName
- */
- public FixedOrDefaultTextPropertyDescriptor(Object id, String displayName, Element element)
- {
- super(id, displayName);
- this.element = element;
- }
-
- public CellEditor createPropertyEditor(Composite parent)
- {
- CellEditor editor = new FixedOrDefaultTextCellEditor(parent);
- if (getValidator() != null)
- editor.setValidator(getValidator());
- return editor;
- }
-
-// public void setChoice(String newChoice)
-// {
-// choice = newChoice;
-// }
-
- public Object getId()
- {
- Attr fixedAttr = element.getAttributeNode(XSDConstants.FIXED_ATTRIBUTE);
- Attr defaultAttr = element.getAttributeNode(XSDConstants.DEFAULT_ATTRIBUTE);
- if (fixedAttr != null)
- {
- choice = "fixed";
- }
- else if (defaultAttr != null) // what if both attributes were specified? Use default...
- {
- choice = "default";
- }
- else
- {
- choice = "";
- }
-
- if (choice.equals("fixed"))
- {
- return "fixed";
- }
- else if (choice.equals("default"))
- {
- return "default";
- }
- else
- {
- return super.getId();
- }
- }
-
- public String getDisplayName()
- {
- Attr fixedAttr = element.getAttributeNode(XSDConstants.FIXED_ATTRIBUTE);
- Attr defaultAttr = element.getAttributeNode(XSDConstants.DEFAULT_ATTRIBUTE);
- if (fixedAttr != null)
- {
- choice = "fixed";
- }
- else if (defaultAttr != null) // what if both attributes were specified? Use default...
- {
- choice = "default";
- }
- else
- {
- choice = "fixed/default";
- }
-
- if (choice.equals("fixed"))
- {
- return "fixed";
- }
- else if (choice.equals("default"))
- {
- return "default";
- }
- else
- {
- return super.getDisplayName();
- }
- }
-
- class FixedOrDefaultTextCellEditor extends DialogCellEditor
- {
- public FixedOrDefaultTextCellEditor(Composite parent)
- {
- super(parent);
- }
-
- protected Object openDialogBox(Control cellEditorWindow)
- {
- Shell shell = Display.getCurrent().getActiveShell();
-
- FixedOrDefaultDialog dialog = new FixedOrDefaultDialog(shell);
-
- dialog.setBlockOnOpen(true);
- dialog.create();
-
- String value = (String)getValue();
-
- int result = dialog.open();
-
- if (result == Window.OK)
- {
- String newValue = dialog.getValue();
- fireApplyEditorValue();
- }
- deactivate();
- return null;
- }
- }
-
- class FixedOrDefaultDialog extends Dialog implements SelectionListener
- {
- private int FIXED = 0;
- private int DEFAULT = 1;
- private int type;
- private int value;
- protected Button fixedButton, defaultButton;
- protected Text valueField;
- protected String valueString = "";
-
- public FixedOrDefaultDialog(Shell shell)
- {
- super(shell);
- }
-
- protected void configureShell(Shell shell)
- {
- super.configureShell(shell);
- }
-
- protected void buttonPressed(int buttonId)
- {
- if (buttonId == Dialog.OK)
- {
- valueString = valueField.getText();
- applyEditorValueAndDeactivate();
- }
- super.buttonPressed(buttonId);
- }
-
- public String getValue() { return valueString; }
- public String getType() { return type == FIXED? "fixed" : "default"; }
-
- //
- // Create the controls
- //
- public Control createDialogArea(Composite parent)
- {
- Composite client = (Composite)super.createDialogArea(parent);
- getShell().setText("Fixed/Default Value");
-
- GridLayout gl = new GridLayout(1, true);
-// gl.marginHeight = 0;
-// gl.marginWidth = 0;
-// gl.horizontalSpacing = 0;
-// gl.verticalSpacing = 0;
- client.setLayout(gl);
-
- GridData gd = new GridData();
- gd.grabExcessHorizontalSpace = true;
- gd.grabExcessVerticalSpace = true;
- gd.horizontalAlignment = GridData.FILL;
- gd.verticalAlignment = GridData.FILL;
- gd.horizontalIndent = 0;
- client.setLayoutData(gd);
-
-// isTextReadOnly = false;
-
- fixedButton = ViewUtility.createRadioButton(client, XSDEditorPlugin.getXSDString("_UI_FIXED"));
-// WorkbenchHelp.setHelp(fixedButton, XSDEditorContextIds.XSDE_ELEMENT_FIXED);
-
- defaultButton = ViewUtility.createRadioButton(client, XSDEditorPlugin.getXSDString("_UI_DEFAULT"));
-// WorkbenchHelp.setHelp(defaultButton, XSDEditorContextIds.XSDE_ELEMENT_DEFAULT);
-
- valueField = ViewUtility.createTextField(client, 30);
-
-// WorkbenchHelp.setHelp(valueField, XSDEditorContextIds.XSDE_ELEMENT_VALUE);
-// valueField.setToolTipText(XSDEditorPlugin.getXSDString("_UI_TOOLTIP_ELEMENT_VALUE"));
-
- WorkbenchHelp.setHelp(fixedButton, XSDEditorContextIds.XSDE_ATTRIBUTE_FIXED);
- WorkbenchHelp.setHelp(defaultButton, XSDEditorContextIds.XSDE_ATTRIBUTE_DEFAULT);
- // WorkbenchHelp.setHelp(valueField, XSDEditorContextIds.XSDE_ATTRIBUTE_VALUE);
-
- Attr fixedAttr = element.getAttributeNode(XSDConstants.FIXED_ATTRIBUTE);
- Attr defaultAttr = element.getAttributeNode(XSDConstants.DEFAULT_ATTRIBUTE);
-
- if (fixedAttr != null)
- {
- fixedButton.setSelection(true);
- defaultButton.setSelection(false);
- choice = "fixed";
- type = FIXED;
- valueField.setText(element.getAttribute("fixed"));
- valueField.setFocus();
- valueField.selectAll();
- }
- if (defaultAttr != null) // what if both attributes were specified? Use default...
- {
- fixedButton.setSelection(false);
- defaultButton.setSelection(true);
- choice = "default";
- type = DEFAULT;
- valueField.setText(element.getAttribute("default"));
- valueField.setFocus();
- valueField.selectAll();
- }
-
- fixedButton.addSelectionListener(this);
- defaultButton.addSelectionListener(this);
- return client;
- }
-
- void applyEditorValueAndDeactivate()
- {
- String value = valueField.getText();
- if (value != null && value.length() > 0)
- {
- choice = type == FIXED? "fixed" : "default";
- }
- if (value != null && value.length() > 0)
- {
- if (choice.equals("fixed"))
- {
- element.removeAttribute(XSDConstants.DEFAULT_ATTRIBUTE);
- element.setAttribute(XSDConstants.FIXED_ATTRIBUTE, value);
- }
- else if (choice.equals("default"))
- {
- element.removeAttribute(XSDConstants.FIXED_ATTRIBUTE);
- element.setAttribute(XSDConstants.DEFAULT_ATTRIBUTE, value);
- }
- }
- if (value.equals(""))
- {
- choice = "";
- element.removeAttribute(XSDConstants.DEFAULT_ATTRIBUTE);
- element.removeAttribute(XSDConstants.FIXED_ATTRIBUTE);
- }
- }
-
- public void widgetSelected(SelectionEvent e)
- {
- if (e.widget == fixedButton && fixedButton.getSelection())
- {
- type = FIXED;
- choice = "fixed";
- }
- else if (e.widget == defaultButton && defaultButton.getSelection())
- {
- type = DEFAULT;
- choice = "default";
- }
- }
-
- public void widgetDefaultSelected(SelectionEvent e)
- {
- }
-
- }
-
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/GroupRefPropertySource.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/GroupRefPropertySource.java
deleted file mode 100644
index 7f10f66946..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/GroupRefPropertySource.java
+++ /dev/null
@@ -1,229 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.properties;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.eclipse.ui.views.properties.PropertyDescriptor;
-import org.eclipse.ui.views.properties.TextPropertyDescriptor;
-import org.eclipse.wst.xsd.ui.internal.XSDEditorPlugin;
-import org.eclipse.wst.xsd.ui.internal.util.TypesHelper;
-import org.eclipse.wst.xsd.ui.internal.util.XSDDOMHelper;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.util.XSDConstants;
-import org.w3c.dom.Element;
-
-
-public class GroupRefPropertySource
- extends BasePropertySource
- implements IPropertySource
-{
- private String[] refComboValues = { "" };
- /**
- *
- */
- public GroupRefPropertySource()
- {
- super();
- }
-
-// public void setReferenceComboContextHelp(String contextId)
-// {
-// WorkbenchHelp.setHelp(refCombo, contextId);
-// }
-
- /**
- * @param viewer
- * @param xsdSchema
- */
- public GroupRefPropertySource(Viewer viewer, XSDSchema xsdSchema)
- {
- super(viewer, xsdSchema);
- }
- /**
- * @param xsdSchema
- */
- public GroupRefPropertySource(XSDSchema xsdSchema)
- {
- super(xsdSchema);
- }
-
- public void setInput(Element element)
- {
- this.element = element;
- TypesHelper helper = new TypesHelper(xsdSchema);
- java.util.List items = helper.getGlobalElements();
- if (XSDDOMHelper.inputEquals(element, XSDConstants.GROUP_ELEMENT_TAG, true))
- {
- items = helper.getModelGroups();
- // Need tooltip for Group Ref
-// minimumField.setToolTipText(XSDEditorPlugin.getXSDString("_UI_TOOLTIP_ELEMENT_MINIMUM"));
-// WorkbenchHelp.setHelp(minimumField, XSDEditorContextIds.XSDE_GROUP_REF_MINIMUM);
-// maximumField.setToolTipText(XSDEditorPlugin.getXSDString("_UI_TOOLTIP_ELEMENT_MAXIMUM"));
-// WorkbenchHelp.setHelp(maximumField, XSDEditorContextIds.XSDE_GROUP_REF_MAXIMUM);
- }
- else if (XSDDOMHelper.inputEquals(element, XSDConstants.ELEMENT_ELEMENT_TAG, true))
- {
- items = helper.getGlobalElements();
-// minimumField.setToolTipText(XSDEditorPlugin.getXSDString("_UI_TOOLTIP_ELEMENT_MINIMUM"));
-// WorkbenchHelp.setHelp(minimumField, XSDEditorContextIds.XSDE_ELEMENT_REF_MINIMUM);
-// maximumField.setToolTipText(XSDEditorPlugin.getXSDString("_UI_TOOLTIP_ELEMENT_MAXIMUM"));
-// WorkbenchHelp.setHelp(maximumField, XSDEditorContextIds.XSDE_ELEMENT_REF_MAXIMUM);
- }
-
- int size = items.size() + 1;
- refComboValues = new String[size];
- refComboValues[0] = "";
- if (items != null)
- {
- for (int i = 0; i < items.size(); i++)
- {
- refComboValues[i + 1] = (String) items.get(i);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getEditableValue()
- */
- public Object getEditableValue()
- {
- return null;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors()
- */
- public IPropertyDescriptor[] getPropertyDescriptors()
- {
- List list = new ArrayList();
- XSDComboBoxPropertyDescriptor refDescriptor =
- new XSDComboBoxPropertyDescriptor(
- XSDConstants.REF_ATTRIBUTE,
- XSDConstants.REF_ATTRIBUTE,
- refComboValues);
- list.add(refDescriptor);
-
- PropertyDescriptor minOccursDescriptor =
- new TextPropertyDescriptor(
- XSDConstants.MINOCCURS_ATTRIBUTE,
- XSDConstants.MINOCCURS_ATTRIBUTE);
- list.add(minOccursDescriptor);
- PropertyDescriptor maxOccursDescriptor =
- new TextPropertyDescriptor(
- XSDConstants.MAXOCCURS_ATTRIBUTE,
- XSDConstants.MAXOCCURS_ATTRIBUTE);
- list.add(maxOccursDescriptor);
- IPropertyDescriptor[] result = new IPropertyDescriptor[list.size()];
- list.toArray(result);
- return result;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java.lang.Object)
- */
- public Object getPropertyValue(Object id)
- {
- Object result = null;
- if (id instanceof String)
- {
- result = element.getAttribute((String) id);
- if (result == null)
- {
- result = "";
- }
- return result;
-
-// if (((String) id).equals(XSDConstants.REF_ATTRIBUTE))
-// {
-// return result;
-// }
- }
- return "";
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#isPropertySet(java.lang.Object)
- */
- public boolean isPropertySet(Object id)
- {
- return false;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#resetPropertyValue(java.lang.Object)
- */
- public void resetPropertyValue(Object id)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#setPropertyValue(java.lang.Object, java.lang.Object)
- */
- public void setPropertyValue(Object id, Object value)
- {
- if (value == null)
- {
- value = "";
- }
- if (value instanceof String)
- {
- String newValue = (String)value;
- String attributeName = (String)id;
- if (((String) id).equals(XSDConstants.MAXOCCURS_ATTRIBUTE))
- {
- String max = (String)value;
- String min = element.getAttribute(XSDConstants.MINOCCURS_ATTRIBUTE);
- beginRecording(XSDEditorPlugin.getXSDString("_UI_MAXOCCURS_CHANGE"), element);
- if (max.length() > 0)
- {
- element.setAttribute(XSDConstants.MAXOCCURS_ATTRIBUTE, max);
- }
- else
- {
- element.removeAttribute(XSDConstants.MAXOCCURS_ATTRIBUTE);
- }
- endRecording(element);
- }
- else if (((String) id).equals(XSDConstants.MINOCCURS_ATTRIBUTE))
- {
- String min = (String)value;
- String max = element.getAttribute(XSDConstants.MAXOCCURS_ATTRIBUTE);
- beginRecording(XSDEditorPlugin.getXSDString("_UI_MINOCCURS_CHANGE"), element);
- if (min.length() > 0)
- {
- element.setAttribute(XSDConstants.MINOCCURS_ATTRIBUTE, min);
- }
- else
- {
- element.removeAttribute(XSDConstants.MINOCCURS_ATTRIBUTE);
- }
- endRecording(element);
- }
- else if (((String) id).equals(XSDConstants.REF_ATTRIBUTE))
- {
- beginRecording(XSDEditorPlugin.getXSDString("_UI_GROUP_REF_CHANGE"), element);
- element.setAttribute((String) id, newValue);
- endRecording(element);
- }
- }
-// Runnable delayedUpdate = new Runnable()
-// {
-// public void run()
-// {
- if (viewer != null)
- viewer.refresh();
-// }
-// };
-// Display.getCurrent().asyncExec(delayedUpdate);
-
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/ImportPropertySource.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/ImportPropertySource.java
deleted file mode 100644
index 896c922500..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/ImportPropertySource.java
+++ /dev/null
@@ -1,335 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.properties;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.eclipse.ui.views.properties.PropertyDescriptor;
-import org.eclipse.ui.views.properties.TextPropertyDescriptor;
-import org.eclipse.wst.xsd.ui.internal.XSDEditorContextIds;
-import org.eclipse.wst.xsd.ui.internal.XSDEditorPlugin;
-import org.eclipse.wst.xsd.ui.internal.refactor.delete.XSDExternalFileCleanup;
-import org.eclipse.wst.xsd.ui.internal.util.TypesHelper;
-import org.eclipse.wst.xsd.ui.internal.util.XSDSchemaHelper;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDImport;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.XSDSchemaDirective;
-import org.eclipse.xsd.util.XSDConstants;
-import org.w3c.dom.Element;
-
-
-public class ImportPropertySource
- extends SchemaDirectiveHelperPropertySource
- implements IPropertySource
-{
- boolean isSetNamespace = false;
- /**
- * @param viewer
- * @param xsdSchema
- */
- public ImportPropertySource(Viewer viewer, XSDSchema xsdSchema, IFile currentIFile)
- {
- super(viewer, xsdSchema, false);
- this.currentIFile = currentIFile;
-// WorkbenchHelp.setHelp(controlsContainer, XSDEditorContextIds.XSDE_IMPORT_DESIGN_VIEW);
-//WorkbenchHelp.setHelp(selectButton, XSDEditorContextIds.XSDE_INCLUDE_HELPER_SELECT);
-//WorkbenchHelp.setHelp(prefixField, XSDEditorContextIds.XSDE_IMPORT_PREFIX);
- }
- /**
- * @param xsdSchema
- */
- public ImportPropertySource(XSDSchema xsdSchema, IFile currentIFile)
- {
- super(xsdSchema, false);
- this.currentIFile = currentIFile;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getEditableValue()
- */
- public Object getEditableValue()
- {
- return null;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors()
- */
- public IPropertyDescriptor[] getPropertyDescriptors()
- {
- List list = new ArrayList();
- // Create a descriptor and set a category
-
- SchemaLocationPropertyDescriptor schemaLocationDescriptor =
- new SchemaLocationPropertyDescriptor(
- XSDConstants.SCHEMALOCATION_ATTRIBUTE,
- XSDConstants.SCHEMALOCATION_ATTRIBUTE
- );
- schemaLocationDescriptor.setHelpContextIds(XSDEditorContextIds.XSDE_INCLUDE_HELPER_SELECT);
- list.add(schemaLocationDescriptor);
-
- if (isSetNamespace)
- {
- PropertyDescriptor prefixDescriptor =
- new TextPropertyDescriptor(
- "Prefix",
- "Prefix");
- prefixDescriptor.setHelpContextIds(XSDEditorContextIds.XSDE_IMPORT_PREFIX);
- list.add(prefixDescriptor);
- }
- else
- {
- PropertyDescriptor prefixDescriptor =
- new PropertyDescriptor(
- "Prefix",
- "Prefix");
- prefixDescriptor.setHelpContextIds(XSDEditorContextIds.XSDE_IMPORT_PREFIX);
- list.add(prefixDescriptor);
- }
-
- PropertyDescriptor namespaceDescriptor =
- new PropertyDescriptor(
- XSDConstants.NAMESPACE_ATTRIBUTE,
- XSDConstants.NAMESPACE_ATTRIBUTE);
- list.add(namespaceDescriptor);
-
- IPropertyDescriptor[] result = new IPropertyDescriptor[list.size()];
- list.toArray(result);
- return result;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java.lang.Object)
- */
- public Object getPropertyValue(Object id)
- {
- Object result = null;
- if (id instanceof String)
- {
- result = element.getAttribute((String) id);
- String attributeName = (String)id;
- if (result == null)
- {
- result = "";
- }
-
- if (attributeName.equals("Prefix"))
- {
- TypesHelper helper = new TypesHelper(xsdSchema);
- String aPrefix = helper.getPrefix(element.getAttribute(XSDConstants.NAMESPACE_ATTRIBUTE), false);
- if (aPrefix != null && aPrefix.length() > 0)
- {
- return aPrefix;
- }
- return "";
- }
- else
- {
- return result;
- }
- }
- return "";
-
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#isPropertySet(java.lang.Object)
- */
- public boolean isPropertySet(Object id)
- {
- return false;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#resetPropertyValue(java.lang.Object)
- */
- public void resetPropertyValue(Object id)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#setPropertyValue(java.lang.Object, java.lang.Object)
- */
- public void setPropertyValue(Object id, Object value)
- {
- if (value == null)
- {
- value = "";
- }
- if (value instanceof String)
- {
- String newValue = (String)value;
- TypesHelper typesHelper = new TypesHelper(xsdSchema);
- String namespace = element.getAttribute(XSDConstants.NAMESPACE_ATTRIBUTE);
- String oldPrefixValue = typesHelper.getPrefix(namespace, false);
-
- String schemaLocation = element.getAttribute(XSDConstants.SCHEMALOCATION_ATTRIBUTE);
- if (((String) id).equals("Prefix"))
- {
- if (validatePrefix(newValue) && schemaLocation.length() > 0)
- {
- Map map = xsdSchema.getQNamePrefixToNamespaceMap();
-
- if (map.containsKey(newValue))
- {
-// setErrorMessage(XSDEditorPlugin.getXSDString("_ERROR_LABEL_PREFIX_EXISTS"));
- }
- else
- {
- beginRecording(XSDEditorPlugin.getXSDString("_UI_PREFIX_CHANGE"), element);
-
- Element schemaElement = xsdSchema.getElement();
- map.remove(oldPrefixValue);
- map.put(newValue, namespace);
- XSDSchemaHelper.updateElement(xsdSchema);
-
- endRecording(element);
- }
- }
- }
- else if (((String) id).equals(XSDConstants.SCHEMALOCATION_ATTRIBUTE))
- {
- updateExternalModel((String)value, selectedIFile, selectedNamespace, selectedXSDSchema);
- }
- }
- Runnable delayedUpdate = new Runnable()
- {
- public void run()
- {
- if (viewer != null)
- viewer.refresh();
- }
- };
- Display.getCurrent().asyncExec(delayedUpdate);
-
- }
-
- public void setInput(Element element)
- {
- this.element = element;
- String namespace = element.getAttribute(XSDConstants.NAMESPACE_ATTRIBUTE);
- if (namespace != null && namespace.trim().length() > 0)
- {
- isSetNamespace = true;
- }
-
- }
-
- protected void updateExternalModel(String newLocation, IFile newFile, String namespace, XSDSchema externalSchema)
- {
- if (xsdSchema == null) // in case we have a bad schema
- {
- return;
- }
- Element importElement = element;
- if (namespace == null)
- {
- namespace = "";
- }
-
- XSDConcreteComponent comp = xsdSchema.getCorrespondingComponent(element);
- if (comp instanceof XSDImport)
- {
- beginRecording(XSDEditorPlugin.getXSDString("_UI_IMPORT_CHANGE"), importElement);
- java.util.Map map = xsdSchema.getQNamePrefixToNamespaceMap();
-
- // Referential integrity on old import
- // How can we be sure that if the newlocation is the same as the oldlocation
- // the file hasn't changed
-
- XSDSchema referencedSchema = ((XSDSchemaDirective)comp).getResolvedSchema();
- if (referencedSchema != null)
- {
- XSDExternalFileCleanup cleanHelper = new XSDExternalFileCleanup(referencedSchema);
- cleanHelper.visitSchema(xsdSchema);
- }
-
- Element schemaElement = xsdSchema.getElement();
-
-// String oldPrefix = prefixField.getText();
-//
-// // Use the existing xmlns if available
-// if (!map.containsValue(namespace))
-// {
-// if (oldPrefix.length() > 0)
-// {
-// schemaElement.removeAttribute("xmlns:"+oldPrefix);
-// map.remove(oldPrefix);
-// }
-// }
-
- XSDImport xsdImport = (XSDImport)comp;
-// xsdImport.setSchemaLocation(null);
-// xsdImport.setResolvedSchema(externalSchema);
-
- // update the xmlns in the schema element first, and then update the import element next
- // so that the last change will be in the import element. This keeps the selection
- // on the import element
- TypesHelper helper = new TypesHelper(externalSchema);
- String prefix = helper.getPrefix(namespace, false);
-
- boolean prefixAlreadyExists = false;
- if (map.containsKey(prefix))
- {
- prefixAlreadyExists = true;
- }
-
- if (prefix == null || (prefix !=null && prefix.length() == 0) || prefixAlreadyExists)
- {
- prefix = "pref";
-
- int prefixExtension = 1;
- while (map.containsKey(prefix) && prefixExtension < 100)
- {
- prefix = prefix + String.valueOf(prefixExtension);
- prefixExtension++;
- }
- }
-
- if (namespace.length() > 0)
- {
- // if ns already in map, use its corresponding prefix
- if (map.containsValue(namespace))
- {
- TypesHelper typesHelper = new TypesHelper(xsdSchema);
- prefix = typesHelper.getPrefix(namespace, false);
- }
- else // otherwise add to the map
- {
-// prefixMap.put(prefix, newLocation);
- schemaElement.setAttribute("xmlns:"+prefix, namespace);
- }
- }
-
- // Now update the import element's attributes
- importElement.setAttribute(XSDConstants.SCHEMALOCATION_ATTRIBUTE, newLocation);
-
- if (!namespace.equals(""))
- {
- importElement.setAttribute(XSDConstants.NAMESPACE_ATTRIBUTE, namespace);
- }
- else
- {
- importElement.removeAttribute(XSDConstants.NAMESPACE_ATTRIBUTE);
- }
-
-// if (getEditor() != null)
-// {
-// getEditor().reparseSchema();
-// getEditor().getGraphViewer().setSchema(getXSDSchema());
-// }
-
- endRecording(importElement);
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/IncludePropertySource.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/IncludePropertySource.java
deleted file mode 100644
index bbc15e86c3..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/IncludePropertySource.java
+++ /dev/null
@@ -1,238 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.properties;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.eclipse.wst.xsd.ui.internal.refactor.delete.XSDExternalFileCleanup;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDInclude;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.util.XSDConstants;
-import org.w3c.dom.Element;
-
-public class IncludePropertySource
- extends SchemaDirectiveHelperPropertySource
- implements IPropertySource
-{
- /**
- *
- */
- public IncludePropertySource(IFile currentIFile)
- {
- super(true);
- this.currentIFile = currentIFile;
- }
- /**
- * @param viewer
- * @param xsdSchema
- */
- public IncludePropertySource(Viewer viewer, XSDSchema xsdSchema, IFile currentIFile)
- {
- super(viewer, xsdSchema, true);
- this.currentIFile = currentIFile;
- }
- /**
- * @param xsdSchema
- */
- public IncludePropertySource(XSDSchema xsdSchema, IFile currentIFile)
- {
- super(xsdSchema, true);
- this.currentIFile = currentIFile;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getEditableValue()
- */
- public Object getEditableValue()
- {
- return null;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors()
- */
- public IPropertyDescriptor[] getPropertyDescriptors()
- {
- List list = new ArrayList();
- // Create a descriptor and set a category
-
- SchemaLocationPropertyDescriptor schemaLocationDescriptor =
- new SchemaLocationPropertyDescriptor(
- XSDConstants.SCHEMALOCATION_ATTRIBUTE,
- XSDConstants.SCHEMALOCATION_ATTRIBUTE);
-
- list.add(schemaLocationDescriptor);
-
-
- IPropertyDescriptor[] result = new IPropertyDescriptor[list.size()];
- list.toArray(result);
- return result;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java.lang.Object)
- */
- public Object getPropertyValue(Object id)
- {
- Object result = null;
- if (id instanceof String)
- {
- result = element.getAttribute((String) id);
- String attributeName = (String)id;
- if (result == null)
- {
- result = "";
- }
- return result;
- }
- return "";
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#isPropertySet(java.lang.Object)
- */
- public boolean isPropertySet(Object id)
- {
- return false;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#resetPropertyValue(java.lang.Object)
- */
- public void resetPropertyValue(Object id)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#setPropertyValue(java.lang.Object, java.lang.Object)
- */
- public void setPropertyValue(Object id, Object value)
- {
- if (value == null)
- {
- value = "";
- }
- if (value instanceof String)
- {
- if (((String) id).equals(XSDConstants.SCHEMALOCATION_ATTRIBUTE))
- {
- //element.setAttribute(XSDConstants.SCHEMALOCATION_ATTRIBUTE, (String)value);
- updateExternalModel((String)value, selectedIFile, selectedNamespace, selectedXSDSchema);
- }
- }
- Runnable delayedUpdate = new Runnable()
- {
- public void run()
- {
- if (viewer != null)
- viewer.refresh();
- }
- };
- Display.getCurrent().asyncExec(delayedUpdate);
- }
-
- protected void updateExternalModel(String newLocation, IFile newFile, String namespace, XSDSchema externalSchema)
- {
- Element includeElement = element;
-
- String existingSchemaLocation = includeElement.getAttribute(XSDConstants.SCHEMALOCATION_ATTRIBUTE);
-
-// beginRecording(XSDEditorPlugin.getXSDString("_UI_INCLUDE_CHANGE"), includeElement);
- beginRecording("Include Change", includeElement);
- includeElement.setAttribute(XSDConstants.SCHEMALOCATION_ATTRIBUTE, newLocation);
-
- // If there is no existing schemaLocation, then just set it
- if (existingSchemaLocation == null)
- {
- return;
- }
-
- XSDConcreteComponent includeComponent = xsdSchema.getCorrespondingComponent(includeElement);
- if (includeComponent instanceof XSDInclude)
- {
- XSDInclude include = (XSDInclude) includeComponent;
-
- XSDSchema referencedSchema = include.getResolvedSchema();
- if (referencedSchema != null)
- {
- XSDExternalFileCleanup cleanHelper = new XSDExternalFileCleanup(referencedSchema);
- cleanHelper.visitSchema(xsdSchema);
-
- xsdSchema.update();
- include.updateElement();
- }
-
- }
- endRecording(includeElement);
- }
-
-
-// Redefine's version
-// protected void updateExternalModel(IFile newFile, String namespace, XSDSchema externalSchema)
-// {
-// Element redefineElement = (Element) getNode();
-//
-// redefineElement.setAttribute(XSDConstants.SCHEMALOCATION_ATTRIBUTE, locationField.getText());
-//
-// String existingSchemaLocation = redefineElement.getAttribute(XSDConstants.SCHEMALOCATION_ATTRIBUTE);
-//
-// // If there is no existing schemaLocation, then just set it and return
-// if (existingSchemaLocation == null)
-// {
-// return;
-// }
-//
-// XSDConcreteComponent redefineComponent = getXSDSchema().getCorrespondingComponent(redefineElement);
-// if (redefineComponent instanceof XSDRedefine)
-// {
-// XSDRedefine redefine = (XSDRedefine) redefineComponent;
-// XSDExternalFileCleanup cleanup = new XSDExternalFileCleanup(redefine.getIncorporatedSchema());
-//
-// cleanup.visitSchema(getXSDSchema());
-// if (getEditor() != null)
-// {
-//// DisplayErrorInTaskList task = new DisplayErrorInTaskList(getEditor().getEditorIDocument(), getEditor().getFileResource(), cleanup.getMessages());
-//// task.run();
-//
-// // Workaround to reset included elements in XSD model
-// getEditor().reparseSchema();
-// getEditor().getGraphViewer().setSchema(getXSDSchema());
-// }
-// }
-//
-// /* since we are reparsing, we don't need this
-//
-// Iterator contents = getXSDSchema().getContents().iterator();
-// while (contents.hasNext())
-// {
-// XSDSchemaContent content = (XSDSchemaContent)contents.next();
-// if (content instanceof XSDSchemaDirective)
-// {
-// XSDSchemaDirective directive = (XSDSchemaDirective)content;
-//
-// if (directive.getSchemaLocation().equals(oldSchemaLocation) && directive instanceof XSDRedefine)
-// {
-// directive.unsetSchemaLocation();
-// directive.setSchemaLocation(locationField.getText());
-// directive.unsetResolvedSchema();
-// redefineElement.setAttribute(XSDConstants.SCHEMALOCATION_ATTRIBUTE, locationField.getText());
-// getXSDSchema().updateDocument();
-// XSDSchemaHelper.updateElement(directive);
-//// directive.updateElement();
-// break;
-// }
-// }
-// }
-// */
-// }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/KeyrefPropertySource.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/KeyrefPropertySource.java
deleted file mode 100644
index c3b4a4f3bb..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/KeyrefPropertySource.java
+++ /dev/null
@@ -1,210 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.properties;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.eclipse.wst.xsd.ui.internal.XSDEditorPlugin;
-import org.eclipse.wst.xsd.ui.internal.util.TypesHelper;
-import org.eclipse.xsd.XSDIdentityConstraintDefinition;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.util.XSDConstants;
-import org.w3c.dom.Element;
-
-
-public class KeyrefPropertySource
- extends BasePropertySource
- implements IPropertySource
-{
- private String[] refComboValues = { "" };
- /**
- *
- */
- public KeyrefPropertySource()
- {
- super();
- }
- /**
- * @param viewer
- * @param xsdSchema
- */
- public KeyrefPropertySource(Viewer viewer, XSDSchema xsdSchema)
- {
- super(viewer, xsdSchema);
- }
- /**
- * @param xsdSchema
- */
- public KeyrefPropertySource(XSDSchema xsdSchema)
- {
- super(xsdSchema);
- }
-
- public void setInput(Element element)
- {
- this.element = element;
- TypesHelper helper = new TypesHelper(xsdSchema);
- java.util.List items = new ArrayList();
-
-
- if (xsdSchema != null)
- {
- Iterator iter = xsdSchema.getIdentityConstraintDefinitions().iterator();
- String name = element.getAttribute(XSDConstants.NAME_ATTRIBUTE);
- while (iter.hasNext())
- {
- XSDIdentityConstraintDefinition constraint = (XSDIdentityConstraintDefinition)iter.next();
- if (name != null && !name.equals(""))
- {
- if (constraint.getName() != null)
- {
- if (!name.equals(constraint.getQName(xsdSchema)))
- {
- items.add(constraint.getQName(xsdSchema));
- }
- }
- }
- else
- {
- if (constraint.getName() != null)
- {
- items.add(constraint.getQName(xsdSchema));
- }
- }
- }
- }
-
- int size = items.size() + 1;
- refComboValues = new String[size];
- refComboValues[0] = "";
- if (items != null)
- {
- for (int i = 0; i < items.size(); i++)
- {
- refComboValues[i + 1] = (String) items.get(i);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getEditableValue()
- */
- public Object getEditableValue()
- {
- return null;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors()
- */
- public IPropertyDescriptor[] getPropertyDescriptors()
- {
- List list = new ArrayList();
- // Create a descriptor and set a category
-// This property is moved to the General Tab
-// PropertyDescriptor nameDescriptor =
-// new TextPropertyDescriptor(
-// XSDConstants.NAME_ATTRIBUTE,
-// XSDConstants.NAME_ATTRIBUTE);
-// list.add(nameDescriptor);
-
- XSDComboBoxPropertyDescriptor refDescriptor =
- new XSDComboBoxPropertyDescriptor(
- XSDConstants.REFER_ATTRIBUTE,
- XSDConstants.REFER_ATTRIBUTE,
- refComboValues);
- list.add(refDescriptor);
-
-
- IPropertyDescriptor[] result = new IPropertyDescriptor[list.size()];
- list.toArray(result);
- return result;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java.lang.Object)
- */
- public Object getPropertyValue(Object id)
- {
- Object result = null;
-
- if (id instanceof String)
- {
- result = element.getAttribute((String) id);
- if (result == null)
- {
- result = "";
- }
- return result;
-// if (((String) id).equals(XSDConstants.REFER_ATTRIBUTE))
-// {
-// return result;
-// }
- }
- return "";
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#isPropertySet(java.lang.Object)
- */
- public boolean isPropertySet(Object id)
- {
- return false;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#resetPropertyValue(java.lang.Object)
- */
- public void resetPropertyValue(Object id)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#setPropertyValue(java.lang.Object, java.lang.Object)
- */
- public void setPropertyValue(Object id, Object value)
- {
- if (value == null)
- {
- value = "";
- }
- if (value instanceof String)
- {
- String newValue = (String)value;
- if (((String) id).equals(XSDConstants.NAME_ATTRIBUTE))
- {
- if (validateName(newValue))
- {
- beginRecording(XSDEditorPlugin.getXSDString("_UI_KEYREF_NAME_CHANGE"), element);
- element.setAttribute(XSDConstants.NAME_ATTRIBUTE, newValue);
- endRecording(element);
- }
- }
- else if (((String) id).equals(XSDConstants.REFER_ATTRIBUTE))
- {
- beginRecording(XSDEditorPlugin.getXSDString("_UI_KEYREF_REFER_CHANGE"), element);
- element.setAttribute((String) id, newValue);
- endRecording(element);
- }
- }
- Runnable delayedUpdate = new Runnable()
- {
- public void run()
- {
- if (viewer != null)
- viewer.refresh();
- }
- };
- Display.getCurrent().asyncExec(delayedUpdate);
-
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/ModelGroupPropertySource.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/ModelGroupPropertySource.java
deleted file mode 100644
index 750b81dc10..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/ModelGroupPropertySource.java
+++ /dev/null
@@ -1,266 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.properties;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.eclipse.ui.views.properties.PropertyDescriptor;
-import org.eclipse.ui.views.properties.TextPropertyDescriptor;
-import org.eclipse.wst.xsd.ui.internal.XSDEditorPlugin;
-import org.eclipse.wst.xsd.ui.internal.util.XSDDOMHelper;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.util.XSDConstants;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-
-public class ModelGroupPropertySource // all or sequence or choice
- extends BasePropertySource
- implements IPropertySource
-{
- private String[] modelGroupComboValues = { "sequence", "choice", "all" };
- /**
- *
- */
- public ModelGroupPropertySource()
- {
- super();
- }
- /**
- * @param viewer
- * @param xsdSchema
- */
- public ModelGroupPropertySource(Viewer viewer, XSDSchema xsdSchema)
- {
- super(viewer, xsdSchema);
- }
- /**
- * @param xsdSchema
- */
- public ModelGroupPropertySource(XSDSchema xsdSchema)
- {
- super(xsdSchema);
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getEditableValue()
- */
- public Object getEditableValue()
- {
- return null;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors()
- */
- public IPropertyDescriptor[] getPropertyDescriptors()
- {
- List list = new ArrayList();
-
- XSDComboBoxPropertyDescriptor modelGroupDescriptor =
- new XSDComboBoxPropertyDescriptor(
- "model group",
- "model group",
- modelGroupComboValues);
- list.add(modelGroupDescriptor);
-
- PropertyDescriptor minOccursDescriptor =
- new TextPropertyDescriptor(
- XSDConstants.MINOCCURS_ATTRIBUTE,
- XSDConstants.MINOCCURS_ATTRIBUTE);
- list.add(minOccursDescriptor);
- PropertyDescriptor maxOccursDescriptor =
- new TextPropertyDescriptor(
- XSDConstants.MAXOCCURS_ATTRIBUTE,
- XSDConstants.MAXOCCURS_ATTRIBUTE);
- list.add(maxOccursDescriptor);
- IPropertyDescriptor[] result = new IPropertyDescriptor[list.size()];
- list.toArray(result);
- return result;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java.lang.Object)
- */
- public Object getPropertyValue(Object id)
- {
- Object result = null;
- if (id instanceof String)
- {
- result = element.getAttribute((String) id);
- String attributeName = (String)id;
- if (result == null)
- {
- result = "";
- }
- if (attributeName.equals("model group"))
- {
- result = element.getLocalName();
- return result;
- }
- }
- return "";
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#isPropertySet(java.lang.Object)
- */
- public boolean isPropertySet(Object id)
- {
- return false;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#resetPropertyValue(java.lang.Object)
- */
- public void resetPropertyValue(Object id)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#setPropertyValue(java.lang.Object, java.lang.Object)
- */
- public void setPropertyValue(Object id, Object value)
- {
- String property = (String)id;
- if (value == null)
- {
- value = "";
- }
- if (value instanceof String)
- {
- String newValue = (String)value;
- if (property.equals("model group"))
- {
- Document doc = element.getOwnerDocument();
- Element parent = (Element)element.getParentNode();
- String prefix = element.getPrefix();
- prefix = prefix == null ? "" : prefix + ":";
- Element newNode = null;
- // int compositor = XSDCompositor.SEQUENCE;
- beginRecording(XSDEditorPlugin.getXSDString("_UI_GROUP_SCOPE_CHANGE"), parent);
- changeContentModel(parent, newValue);
- endRecording(parent);
- XSDDOMHelper domHelper = new XSDDOMHelper();
- setInput(domHelper.getContentModelFromParent(parent));
- }
- else if (property.equals(XSDConstants.MAXOCCURS_ATTRIBUTE))
- {
- String max = (String)value;
- String min = element.getAttribute(XSDConstants.MINOCCURS_ATTRIBUTE);
- beginRecording(XSDEditorPlugin.getXSDString("_UI_MAXOCCURS_CHANGE"), element);
- if (max.length() > 0)
- {
- element.setAttribute(XSDConstants.MAXOCCURS_ATTRIBUTE, max);
- }
- else
- {
- element.removeAttribute(XSDConstants.MAXOCCURS_ATTRIBUTE);
- }
- endRecording(element);
- }
- else if (((String) id).equals(XSDConstants.MINOCCURS_ATTRIBUTE))
- {
- String min = (String)value;
- String max = element.getAttribute(XSDConstants.MAXOCCURS_ATTRIBUTE);
- beginRecording(XSDEditorPlugin.getXSDString("_UI_MINOCCURS_CHANGE"), element);
- if (min.length() > 0)
- {
- element.setAttribute(XSDConstants.MINOCCURS_ATTRIBUTE, min);
- }
- else
- {
- element.removeAttribute(XSDConstants.MINOCCURS_ATTRIBUTE);
- }
- endRecording(element);
- }
- }
-
- Runnable delayedUpdate = new Runnable()
- {
- public void run()
- {
- if (viewer != null)
- viewer.refresh();
- }
- };
- Display.getCurrent().asyncExec(delayedUpdate);
-
- }
-
- public void setInput(Element element)
- {
- super.setInput(element);
-
- if (element != null)
- {
- boolean parentIsSequence = false;
- boolean parentIsChoice = false;
-
- Object parent = element.getParentNode();
-
- if (XSDDOMHelper.inputEquals(parent, XSDConstants.SEQUENCE_ELEMENT_TAG, false))
- {
- parentIsSequence = true;
- }
- else if (XSDDOMHelper.inputEquals(parent, XSDConstants.CHOICE_ELEMENT_TAG, false))
- {
- parentIsChoice = true;
- }
-
- if (parentIsChoice || parentIsSequence)
- {
- modelGroupComboValues = new String[2];
- modelGroupComboValues[0] = XSDConstants.SEQUENCE_ELEMENT_TAG;
- modelGroupComboValues[1] = XSDConstants.CHOICE_ELEMENT_TAG;
- }
- else
- {
- modelGroupComboValues = new String[3];
- modelGroupComboValues[0] = XSDConstants.SEQUENCE_ELEMENT_TAG;
- modelGroupComboValues[1] = XSDConstants.CHOICE_ELEMENT_TAG;
- modelGroupComboValues[2] = XSDConstants.ALL_ELEMENT_TAG;
- }
- }
- }
-
- private void changeContentModel(Element parent, String contentModel)
- {
- Document doc = parent.getOwnerDocument();
- XSDDOMHelper domHelper = new XSDDOMHelper();
-
- String prefix = parent.getPrefix();
- prefix = prefix == null ? "" : prefix + ":";
-
- Element contentModelElement = domHelper.getContentModelFromParent(parent);
-
- if (contentModelElement.getLocalName().equals(contentModel))
- {
- return; // it's already the content model
- }
-
- Element 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);
- newNode.appendChild(node.cloneNode(true));
- }
- }
- parent.replaceChild(newNode, contentModelElement);
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/NamePropertySource.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/NamePropertySource.java
deleted file mode 100644
index bbfb786416..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/NamePropertySource.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.properties;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.eclipse.ui.views.properties.PropertyDescriptor;
-import org.eclipse.ui.views.properties.TextPropertyDescriptor;
-import org.eclipse.wst.xsd.ui.internal.XSDEditorPlugin;
-import org.eclipse.wst.xsd.ui.internal.refactor.rename.GlobalAttributeGroupRenamer;
-import org.eclipse.wst.xsd.ui.internal.refactor.rename.GlobalGroupRenamer;
-import org.eclipse.wst.xsd.ui.internal.util.XSDDOMHelper;
-import org.eclipse.xsd.XSDAttributeGroupDefinition;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDModelGroupDefinition;
-import org.eclipse.xsd.XSDNamedComponent;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.util.XSDConstants;
-
-public class NamePropertySource
- extends BasePropertySource
- implements IPropertySource
-{
- /**
- *
- */
- public NamePropertySource()
- {
- super();
- }
- /**
- * @param viewer
- * @param xsdSchema
- */
- public NamePropertySource(Viewer viewer, XSDSchema xsdSchema)
- {
- super(viewer, xsdSchema);
- }
- /**
- * @param xsdSchema
- */
- public NamePropertySource(XSDSchema xsdSchema)
- {
- super(xsdSchema);
-
-// From attribute group
-// WorkbenchHelp.setHelp(client, XSDEditorContextIds.XSDE_ATTRIBUTE_GROUP_DESIGN_VIEW);
-// WorkbenchHelp.setHelp(nameField, XSDEditorContextIds.XSDE_ATTRIBUTE_GROUP_NAME);
-
-// From unique
-// WorkbenchHelp.setHelp(nameField, XSDEditorContextIds.XSDE_UNIQUE_BASE_NAME);
-
-// From key
-// WorkbenchHelp.setHelp(nameField, XSDEditorContextIds.XSDE_UNIQUE_BASE_NAME);
-
-// From group
-// WorkbenchHelp.setHelp(controlsContainer, XSDEditorContextIds.XSDE_GROUP_DESIGN_VIEW);
-// WorkbenchHelp.setHelp(nameField, XSDEditorContextIds.XSDE_GROUP_NAME);
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getEditableValue()
- */
- public Object getEditableValue()
- {
- return null;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors()
- */
- public IPropertyDescriptor[] getPropertyDescriptors()
- {
- List list = new ArrayList();
- // Create a descriptor and set a category
- PropertyDescriptor nameDescriptor =
- new TextPropertyDescriptor(
- XSDConstants.NAME_ATTRIBUTE,
- XSDConstants.NAME_ATTRIBUTE);
- list.add(nameDescriptor);
-
- IPropertyDescriptor[] result = new IPropertyDescriptor[list.size()];
- list.toArray(result);
- return result;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java.lang.Object)
- */
- public Object getPropertyValue(Object id)
- {
- Object result = null;
- if (id instanceof String)
- {
- result = element.getAttribute((String) id);
- }
- if (result == null)
- {
- result = "";
- }
- return result;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#isPropertySet(java.lang.Object)
- */
- public boolean isPropertySet(Object id)
- {
- return false;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#resetPropertyValue(java.lang.Object)
- */
- public void resetPropertyValue(Object id)
- {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#setPropertyValue(java.lang.Object, java.lang.Object)
- */
- public void setPropertyValue(Object id, Object value)
- {
- if (value != null)
- {
- if (value instanceof String)
- {
- String newValue = (String)value;
- if (XSDDOMHelper.inputEquals(element, XSDConstants.ATTRIBUTEGROUP_ELEMENT_TAG, false))
- {
- beginRecording(XSDEditorPlugin.getXSDString("_UI_ATTRIBUTEGROUP_NAME_CHANGE"), element);
-
- // now rename any references to this element
- if (xsdSchema != null)
- {
- XSDConcreteComponent comp = xsdSchema.getCorrespondingComponent(element);
- if (comp != null && comp instanceof XSDAttributeGroupDefinition && comp.getContainer().equals(xsdSchema))
- {
- GlobalAttributeGroupRenamer renamer = new GlobalAttributeGroupRenamer((XSDNamedComponent)comp, (String)value);
- renamer.visitSchema(xsdSchema);
- }
- }
- element.setAttribute(XSDConstants.NAME_ATTRIBUTE, (String)value);
- endRecording(element);
- }
- else if (XSDDOMHelper.inputEquals(element, XSDConstants.UNIQUE_ELEMENT_TAG, false))
- {
- if (validateName(newValue))
- {
- beginRecording(XSDEditorPlugin.getXSDString("_UI_UNIQUE_NAME_CHANGE"), element);
- if (newValue.length() > 0)
- {
- element.setAttribute(XSDConstants.NAME_ATTRIBUTE, newValue);
- }
- else
- {
- element.setAttribute(XSDConstants.NAME_ATTRIBUTE, "");
- }
- endRecording(element);
- }
- }
- else if (XSDDOMHelper.inputEquals(element, XSDConstants.KEY_ELEMENT_TAG, false))
- {
- if (validateName(newValue))
- {
- beginRecording(XSDEditorPlugin.getXSDString("_UI_KEY_NAME_CHANGE"), element);
- if (newValue.length() > 0)
- {
- element.setAttribute(XSDConstants.NAME_ATTRIBUTE, newValue);
- }
- else
- {
- element.setAttribute(XSDConstants.NAME_ATTRIBUTE, "");
- }
- endRecording(element);
- }
- }
- else if (XSDDOMHelper.inputEquals(element, XSDConstants.GROUP_ELEMENT_TAG, false))
- {
- if (validateName(newValue))
- {
- beginRecording(XSDEditorPlugin.getXSDString("_UI_GROUP_NAME_CHANGE"), element);
- // now rename any references to this element
- if (xsdSchema != null)
- {
- XSDConcreteComponent comp = xsdSchema.getCorrespondingComponent(element);
- if (comp != null && comp instanceof XSDModelGroupDefinition && comp.getContainer().equals(xsdSchema))
- {
- GlobalGroupRenamer renamer = new GlobalGroupRenamer((XSDNamedComponent)comp, newValue);
- renamer.visitSchema(xsdSchema);
- }
- }
- element.setAttribute(XSDConstants.NAME_ATTRIBUTE, newValue);
- endRecording(element);
- }
-
- }
- }
- }
- Runnable delayedUpdate = new Runnable()
- {
- public void run()
- {
- if (viewer != null)
- viewer.refresh();
- }
- };
- Display.getCurrent().asyncExec(delayedUpdate);
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/NotationPropertySource.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/NotationPropertySource.java
deleted file mode 100644
index 573d83dd32..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/NotationPropertySource.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.properties;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.eclipse.ui.views.properties.PropertyDescriptor;
-import org.eclipse.ui.views.properties.TextPropertyDescriptor;
-import org.eclipse.wst.xsd.ui.internal.XSDEditorPlugin;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.util.XSDConstants;
-
-
-public class NotationPropertySource
- extends BasePropertySource
- implements IPropertySource
-{
- /**
- *
- */
- public NotationPropertySource()
- {
- super();
- }
- /**
- * @param viewer
- * @param xsdSchema
- */
- public NotationPropertySource(Viewer viewer, XSDSchema xsdSchema)
- {
- super(viewer, xsdSchema);
- }
- /**
- * @param xsdSchema
- */
- public NotationPropertySource(XSDSchema xsdSchema)
- {
- super(xsdSchema);
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getEditableValue()
- */
- public Object getEditableValue()
- {
- return null;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors()
- */
- public IPropertyDescriptor[] getPropertyDescriptors()
- {
- List list = new ArrayList();
- // Create a descriptor and set a category
-// Removed for tabbed properties
-// PropertyDescriptor nameDescriptor =
-// new TextPropertyDescriptor(
-// XSDConstants.NAME_ATTRIBUTE,
-// XSDConstants.NAME_ATTRIBUTE);
-// list.add(nameDescriptor);
-
- PropertyDescriptor publicDescriptor =
- new TextPropertyDescriptor(
- XSDConstants.PUBLIC_ATTRIBUTE,
- XSDConstants.PUBLIC_ATTRIBUTE);
- list.add(publicDescriptor);
-
- PropertyDescriptor systemDescriptor =
- new TextPropertyDescriptor(
- XSDConstants.SYSTEM_ATTRIBUTE,
- XSDConstants.SYSTEM_ATTRIBUTE);
- list.add(systemDescriptor);
-
- IPropertyDescriptor[] result = new IPropertyDescriptor[list.size()];
- list.toArray(result);
- return result;
-
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java.lang.Object)
- */
- public Object getPropertyValue(Object id)
- {
- Object result = null;
- if (id instanceof String)
- {
- result = element.getAttribute((String) id);
- }
- if (result == null)
- {
- result = "";
- }
- return result;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#isPropertySet(java.lang.Object)
- */
- public boolean isPropertySet(Object id)
- {
- return false;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#resetPropertyValue(java.lang.Object)
- */
- public void resetPropertyValue(Object id)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#setPropertyValue(java.lang.Object, java.lang.Object)
- */
- public void setPropertyValue(Object id, Object value)
- {
- if (value == null)
- {
- value = "";
- }
- if (value instanceof String)
- {
- String newValue = (String)value;
- if (((String)id).equals(XSDConstants.NAME_ATTRIBUTE))
- {
- if (validateName(newValue))
- {
- beginRecording(XSDEditorPlugin.getXSDString("_UI_NOTATION_NAME_CHANGE"), element);
- if (newValue.length() > 0)
- {
- element.setAttribute(XSDConstants.NAME_ATTRIBUTE, newValue);
- }
- else
- {
- element.setAttribute(XSDConstants.NAME_ATTRIBUTE, "");
- }
- endRecording(element);
- }
- }
- else if (((String)id).equals(XSDConstants.PUBLIC_ATTRIBUTE))
- {
- beginRecording(XSDEditorPlugin.getXSDString("_UI_NOTATION_PUBLIC_CHANGE"), element);
- if (newValue.length() > 0)
- {
- element.setAttribute(XSDConstants.PUBLIC_ATTRIBUTE, newValue);
- }
- else
- {
- element.setAttribute(XSDConstants.PUBLIC_ATTRIBUTE, "");
- }
- endRecording(element);
- }
- else if (((String)id).equals(XSDConstants.SYSTEM_ATTRIBUTE))
- {
- beginRecording(XSDEditorPlugin.getXSDString("_UI_NOTATION_SYSTEM_CHANGE"), element);
- if (newValue.length() > 0)
- {
- element.setAttribute(XSDConstants.SYSTEM_ATTRIBUTE, newValue);
- }
- else
- {
- element.removeAttribute(XSDConstants.SYSTEM_ATTRIBUTE);
- }
- endRecording(element);
- }
- }
- Runnable delayedUpdate = new Runnable()
- {
- public void run()
- {
- if (viewer != null)
- viewer.refresh();
- }
- };
- Display.getCurrent().asyncExec(delayedUpdate);
-
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/OptionsTextCellEditor.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/OptionsTextCellEditor.java
deleted file mode 100644
index 3f0e59191a..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/OptionsTextCellEditor.java
+++ /dev/null
@@ -1,241 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.properties;
-
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.FocusAdapter;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Layout;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.wst.xsd.ui.internal.util.ViewUtility;
-
-
-public abstract class OptionsTextCellEditor extends CellEditor implements SelectionListener, KeyListener
-{
- private Composite fEditor;
- protected Text fText;
- protected boolean isTextReadOnly;
- Button moreButton;
- Shell dialog;
-
- private String fSelection;
- protected Object fValue;
- int selection;
- Object typeObject;
-
- private class ComboCellLayout extends Layout
- {
- public void layout(Composite editor, boolean force)
- {
- Rectangle bounds= editor.getClientArea();
- Point size= moreButton.computeSize(SWT.DEFAULT, bounds.height, force);
- fText.setBounds(0, 0, bounds.width - size.x, bounds.height);
- moreButton.setBounds(bounds.width - size.x, 0, size.x, size.y);
- }
-
- public Point computeSize(Composite editor, int wHint, int hHint, boolean force)
- {
- if (wHint != SWT.DEFAULT && hHint != SWT.DEFAULT)
- {
- return new Point(wHint, hHint);
- }
- Point size= fText.computeSize(SWT.DEFAULT, SWT.DEFAULT, force);
-// size.x += moreButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, force).x;
- return size;
- }
- }
-
-/**
- * Creates a new combo box cell editor with the given choices.
- */
- public OptionsTextCellEditor(Composite parent)
- {
- super(parent);
- fSelection = "";
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.CellEditor#createControl(org.eclipse.swt.widgets.Composite)
- */
- protected Control createControl(Composite parent)
- {
- fEditor = ViewUtility.createComposite(parent, 2);
- fEditor.setLayout(new ComboCellLayout());
-
- if (isTextReadOnly)
- {
- fText = new Text(fEditor, SWT.LEFT | SWT.READ_ONLY);
- }
- else
- {
- fText = new Text(fEditor, SWT.LEFT);
- }
-// fText.setEnabled(false);
-
- fText.setBackground(parent.getBackground());
- fText.setText("");
- fText.addKeyListener(this);
- fText.addFocusListener(new FocusAdapter()
- {
- public void focusLost(FocusEvent e)
- {
- if (!moreButton.isFocusControl())
- {
- OptionsTextCellEditor.this.focusLost();
- }
- }
- });
-
- moreButton = ViewUtility.createPushButton(fEditor, "...");
- moreButton.addSelectionListener(new SelectionAdapter()
- {
- public void widgetSelected(SelectionEvent e)
- {
- // System.out.println("More Button Clicked");
- openDialog();
- }
- });
- moreButton.addKeyListener(this);
- moreButton.addFocusListener(new FocusAdapter() {
- public void focusLost(FocusEvent e) {
- if (!fText.isFocusControl() && (dialog==null ||
- dialog.isDisposed() ||
- (dialog!=null && !dialog.isFocusControl())))
- {
- // System.out.println("MoreButton focusLost");
- OptionsTextCellEditor.this.focusLost();
- }
- }
- });
-
-
- setValueValid(true);
-
- return fEditor;
- }
-
- public void activate()
- {
- // System.out.println("Cell editor activated");
- fText.setText(fValue == null ? "" : fValue.toString());
- }
-
- protected void focusLost() {
- // System.out.println("CELLEDITOR FOCUS LOST");
- if (isActivated()) {
- applyEditorValueAndDeactivate();
- }
- }
-
- void applyEditorValueAndDeactivate() {
- // must set the selection before getting value
-// if (dialog != null && !dialog.isDisposed())
-// {
-// dialog.close();
-// dialog.dispose();
-// }
- fireApplyEditorValue();
- deactivate();
- }
-
- public void keyPressed(KeyEvent e)
- {
- if (e.character == SWT.ESC)
- { // Escape character
- fireCancelEditor();
- }
- else if ((e.character == SWT.CR) || (e.character == SWT.LF))
- { // Return key
- applyEditorValueAndDeactivate();
- }
- }
-
- public void keyReleased(KeyEvent e)
- {
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.CellEditor#doGetValue()
- * Returns the cell editor's value.
- */
- protected Object doGetValue()
- {
- return fValue;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.CellEditor#doSetFocus()
- * Set the focus to the cell editor's UI representation.
- */
- protected void doSetFocus()
- {
-// fButton.setFocus();
-// System.out.println("doSetFocus() " + moreButton.setFocus());
- fText.setFocus();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.CellEditor#doSetValue(java.lang.Object)
- * Sets the value of the cell editor to the given value.
- */
- protected void doSetValue(Object value)
- {
- fValue = value;
- }
-
- protected Point getButtonAbsoluteLocation()
- {
- Rectangle buttonBounds = moreButton.getBounds();
- int x = buttonBounds.x;
- int y = buttonBounds.y;
- Control c = moreButton;
- while (c != null)
- {
- c = c.getParent();
- if (c == null)
- break;
- x += c.getBounds().x;
- y += c.getBounds().y;
- }
- x += buttonBounds.width + 5;
- y += buttonBounds.height;
- Point p = new Point(x,y);
- return p;
- }
-
- protected void cancel()
- {
- dialog.close();
- dialog.dispose();
- }
-
- protected abstract void openDialog();
-
- public void widgetSelected(SelectionEvent e)
- {
- }
- public void widgetDefaultSelected(SelectionEvent e)
- {
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/PatternPropertySource.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/PatternPropertySource.java
deleted file mode 100644
index 38f166ab5d..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/PatternPropertySource.java
+++ /dev/null
@@ -1,272 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.properties;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.DialogCellEditor;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.eclipse.ui.views.properties.PropertyDescriptor;
-import org.eclipse.wst.xsd.ui.internal.XSDEditorPlugin;
-import org.eclipse.wst.xsd.ui.internal.wizards.RegexWizard;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.util.XSDConstants;
-
-
-public class PatternPropertySource
- extends BasePropertySource
- implements IPropertySource
-{
- /**
- *
- */
- public PatternPropertySource()
- {
- super();
-// expressionField.setToolTipText(XSDEditorPlugin.getXSDString("_UI_TOOLTIP_PATTERN"));
-// WorkbenchHelp.setHelp(expressionField, XSDEditorContextIds.XSDE_PATTERN_VALUE);
-// WorkbenchHelp.setHelp(activateWizardButton, XSDEditorContextIds.XSDE_PATTERN_REGULAR);
-// activateWizardButton.setToolTipText(XSDEditorPlugin.getXSDString("_UI_TOOLTIP_REGEX_WIZARD_BUTTON"));
- }
- /**
- * @param viewer
- * @param xsdSchema
- */
- public PatternPropertySource(Viewer viewer, XSDSchema xsdSchema)
- {
- super(viewer, xsdSchema);
- }
- /**
- * @param xsdSchema
- */
- public PatternPropertySource(XSDSchema xsdSchema)
- {
- super(xsdSchema);
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getEditableValue()
- */
- public Object getEditableValue()
- {
- return null;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors()
- */
- public IPropertyDescriptor[] getPropertyDescriptors()
- {
- List list = new ArrayList();
- // Create a descriptor and set a category
-
- PatternTextPropertyDescriptor patternDescriptor =
- new PatternTextPropertyDescriptor(
- XSDConstants.VALUE_ATTRIBUTE,
- XSDConstants.VALUE_ATTRIBUTE);
- list.add(patternDescriptor);
-
- IPropertyDescriptor[] result = new IPropertyDescriptor[list.size()];
- list.toArray(result);
- return result;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java.lang.Object)
- */
- public Object getPropertyValue(Object id)
- {
- Object result = null;
- if (id instanceof String)
- {
- result = element.getAttribute((String) id);
- }
- if (result == null)
- {
- result = "";
- }
- return result;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#isPropertySet(java.lang.Object)
- */
- public boolean isPropertySet(Object id)
- {
- return false;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#resetPropertyValue(java.lang.Object)
- */
- public void resetPropertyValue(Object id)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#setPropertyValue(java.lang.Object, java.lang.Object)
- */
- public void setPropertyValue(Object id, Object value)
- {
- if (value == null)
- {
- value = "";
- }
- if (value instanceof String)
- {
- if (((String) id).equals(XSDConstants.VALUE_ATTRIBUTE))
- {
- beginRecording(XSDEditorPlugin.getXSDString("_UI_PATTERN_VALUE_CHANGE"), element);
- element.setAttribute(XSDConstants.VALUE_ATTRIBUTE, (String)value);
- endRecording(element);
- }
- }
- Runnable delayedUpdate = new Runnable()
- {
- public void run()
- {
- if (viewer != null)
- viewer.refresh();
- }
- };
- Display.getCurrent().asyncExec(delayedUpdate);
-
- }
-
- public class PatternTextPropertyDescriptor extends PropertyDescriptor
- {
- /**
- * @param id
- * @param displayName
- */
- public PatternTextPropertyDescriptor(Object id, String displayName)
- {
- super(id, displayName);
- }
-
- public CellEditor createPropertyEditor(Composite parent)
- {
- // CellEditor editor = new PatternTextCellEditor(parent);
- CellEditor editor = new PatternDialogCellEditor(parent);
- if (getValidator() != null)
- editor.setValidator(getValidator());
- return editor;
- }
- }
-
- public class PatternDialogCellEditor extends DialogCellEditor {
-
- /**
- * Creates a new Font dialog cell editor parented under the given control.
- * The cell editor value is <code>null</code> initially, and has no
- * validator.
- *
- * @param parent the parent control
- */
- protected PatternDialogCellEditor(Composite parent) {
- super(parent);
- }
-
- /**
- * @see org.eclipse.jface.viewers.DialogCellEditor#openDialogBox(Control)
- */
- protected Object openDialogBox(Control cellEditorWindow)
- {
- String initialValue = element.getAttribute(XSDConstants.VALUE_ATTRIBUTE);
- if (initialValue == null)
- {
- initialValue = "";
- }
- RegexWizard wizard = new RegexWizard(initialValue);
- Shell shell = Display.getCurrent().getActiveShell();
- WizardDialog wizardDialog = new WizardDialog(shell, wizard);
- wizardDialog.create();
-
- String value = (String)getValue();
-
- int result = wizardDialog.open();
-
- if (result == Window.OK)
- {
- return wizard.getPattern();
- }
- return value;
- }
-
- }
-
-// class PatternTextCellEditor extends OptionsTextCellEditor
-// {
-// protected Button fixedButton, defaultButton;
-//
-// public PatternTextCellEditor(Composite parent)
-// {
-// super(parent);
-// }
-//
-// protected Control createControl(Composite parent)
-// {
-// isTextReadOnly = false;
-// return super.createControl(parent);
-// }
-//
-// protected void openDialog()
-// {
-// RegexWizard wizard = new RegexWizard(element.getAttribute(XSDConstants.VALUE_ATTRIBUTE));
-// Shell shell = Display.getCurrent().getActiveShell();
-// WizardDialog wizardDialog = new WizardDialog(shell, wizard);
-// wizardDialog.create();
-//
-// dialog = wizardDialog.getShell();
-// Display display = dialog.getDisplay();
-// dialog.addShellListener(new ShellAdapter()
-// {
-// public void shellDeactivated(ShellEvent e)
-// {
-// cancel();
-// }
-// });
-//
-// int result = wizardDialog.open();
-//
-// if (result == Window.OK)
-// {
-// fText.setText(wizard.getPattern());
-// applyEditorValueAndDeactivate();
-// }
-//
-// }
-//
-// protected void cancel()
-// {
-// super.cancel();
-// }
-//
-// void applyEditorValueAndDeactivate()
-// {
-// String value = fText.getText();
-// doSetValue(value);
-// fireApplyEditorValue();
-// deactivate();
-// }
-//
-// protected Object doGetValue()
-// {
-// fValue = fText.getText();
-// return fText.getText();
-// }
-//
-// }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/ReadOnlyPropertySource.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/ReadOnlyPropertySource.java
deleted file mode 100644
index 0f5cb7f09b..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/ReadOnlyPropertySource.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.properties;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.eclipse.ui.views.properties.PropertyDescriptor;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-
-public class ReadOnlyPropertySource implements IPropertySource
-{
- protected Element element;
-
- public ReadOnlyPropertySource(IEditorPart editPart, Element element)
- {
- this.element = element;
- }
-
- public Object getEditableValue()
- {
- return null;
- }
-
- public IPropertyDescriptor[] getPropertyDescriptors()
- {
- List list = new ArrayList();
- NamedNodeMap map = element.getAttributes();
- int mapLength = map.getLength();
- for (int i = 0; i < mapLength; i++)
- {
- Attr attr = (Attr) map.item(i);
- list.add(new PropertyDescriptor(attr.getName(), attr.getName()));
- }
- IPropertyDescriptor[] result = new IPropertyDescriptor[list.size()];
- list.toArray(result);
- return result;
- }
-
- public Object getPropertyValue(Object id)
- {
- Object result = null;
- if (id instanceof String)
- {
- result = element.getAttribute((String) id);
- }
- return result != null ? result : "";
- }
-
- public boolean isPropertySet(Object id)
- {
- return false;
- }
-
- public void resetPropertyValue(Object id)
- {
- }
-
- public void setPropertyValue(Object id, Object value)
- {
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/SchemaDirectiveHelperPropertySource.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/SchemaDirectiveHelperPropertySource.java
deleted file mode 100644
index b8e1ed26ce..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/SchemaDirectiveHelperPropertySource.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.properties;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.DialogCellEditor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.views.navigator.ResourceNavigator;
-import org.eclipse.ui.views.properties.PropertyDescriptor;
-import org.eclipse.wst.common.ui.viewers.ResourceFilter;
-import org.eclipse.wst.xml.uriresolver.util.URIHelper;
-import org.eclipse.wst.xsd.ui.internal.XSDEditorPlugin;
-import org.eclipse.wst.xsd.ui.internal.wizards.XSDSelectIncludeFileWizard;
-import org.eclipse.xsd.XSDSchema;
-
-public abstract class SchemaDirectiveHelperPropertySource
- extends BasePropertySource
-{
- protected IFile currentIFile;
-
- IFile selectedIFile;
- String selectedNamespace;
- XSDSchema selectedXSDSchema;
- boolean isInclude;
- /**
- *
- */
- public SchemaDirectiveHelperPropertySource(boolean isInclude)
- {
- super();
- this.isInclude = isInclude;
- }
- /**
- * @param viewer
- * @param xsdSchema
- */
- public SchemaDirectiveHelperPropertySource(
- Viewer viewer,
- XSDSchema xsdSchema,
- boolean isInclude)
- {
- super(viewer, xsdSchema);
- this.isInclude = isInclude;
- }
- /**
- * @param xsdSchema
- */
- public SchemaDirectiveHelperPropertySource(XSDSchema xsdSchema, boolean isInclude)
- {
- super(xsdSchema);
- this.isInclude = isInclude;
- }
-
-
- public class SchemaLocationPropertyDescriptor extends PropertyDescriptor
- {
- /**
- * @param id
- * @param displayName
- */
- public SchemaLocationPropertyDescriptor(Object id, String displayName)
- {
- super(id, displayName);
- }
-
- public CellEditor createPropertyEditor(Composite parent)
- {
- CellEditor editor = new SchemaLocationDialogCellEditor(parent);
- if (getValidator() != null)
- editor.setValidator(getValidator());
- return editor;
- }
- }
-
- public class SchemaLocationDialogCellEditor extends DialogCellEditor {
-
- /**
- * Creates a new Font dialog cell editor parented under the given control.
- * The cell editor value is <code>null</code> initially, and has no
- * validator.
- *
- * @param parent the parent control
- */
- protected SchemaLocationDialogCellEditor(Composite parent) {
- super(parent);
- }
-
- /**
- * @see org.eclipse.jface.viewers.DialogCellEditor#openDialogBox(Control)
- */
- protected Object openDialogBox(Control cellEditorWindow)
- {
- Shell shell = Display.getCurrent().getActiveShell();
-
-// oldSchemaLocation = locationField.getText().trim();
-// IFile currentIFile = ((IFileEditorInput)getIEditorPart().getEditorInput()).getFile();
- ViewerFilter filter = new ResourceFilter(new String[] { ".xsd" },
- new IFile[] { currentIFile },
- null);
-//
-
- IViewPart viewParts[] = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getViews();
- ResourceNavigator resourceNav = null;
- for (int i = 0; i < viewParts.length; i++)
- {
- if (viewParts[i] instanceof ResourceNavigator)
- {
- resourceNav = (ResourceNavigator) viewParts[i];
- break;
- }
- }
- IStructuredSelection selection = StructuredSelection.EMPTY;
- if (resourceNav != null)
- {
- selection = (IStructuredSelection)resourceNav.getViewSite().getSelectionProvider().getSelection();
- }
-
- XSDSelectIncludeFileWizard fileSelectWizard =
- new XSDSelectIncludeFileWizard(xsdSchema, isInclude,
- XSDEditorPlugin.getXSDString("_UI_FILEDIALOG_SELECT_XML_SCHEMA"),
- XSDEditorPlugin.getXSDString("_UI_FILEDIALOG_SELECT_XML_DESC"),
- filter,
- selection);
-
- WizardDialog wizardDialog = new WizardDialog(shell, fileSelectWizard);
- wizardDialog.create();
- wizardDialog.setBlockOnOpen(true);
- int result = wizardDialog.open();
-
-
- String value = (String)getValue();
- // System.out.println("VALUE IS *** = " + value);
- if (result == Window.OK)
- {
- selectedIFile = fileSelectWizard.getResultFile();
- String schemaFileString = value;
- if (selectedIFile != null)
- {
- schemaFileString = URIHelper.getRelativeURI(selectedIFile.getLocation(), currentIFile.getLocation());
- }
- else
- {
- schemaFileString = fileSelectWizard.getURL();
- }
-
-// updateExternalModel(selectedIFile, fileSelectWizard.getNamespace(), fileSelectWizard.getExternalSchema());
- selectedNamespace = fileSelectWizard.getNamespace();
- selectedXSDSchema = fileSelectWizard.getExternalSchema();
-
- return schemaFileString;
- }
- return value;
- }
- }
-
- public IFile getSelectedIFile()
- {
- return selectedIFile;
- }
-
- public String getSelectedNamespace()
- {
- return selectedNamespace;
- }
-
- public XSDSchema getSelectedXSDSchema()
- {
- return selectedXSDSchema;
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/SchemaPropertySource.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/SchemaPropertySource.java
deleted file mode 100644
index 051c3c8587..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/SchemaPropertySource.java
+++ /dev/null
@@ -1,530 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.properties;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.eclipse.ui.views.properties.PropertyDescriptor;
-import org.eclipse.ui.views.properties.TextPropertyDescriptor;
-import org.eclipse.wst.xml.core.internal.document.DocumentImpl;
-import org.eclipse.wst.xsd.ui.internal.XSDEditorPlugin;
-import org.eclipse.wst.xsd.ui.internal.refactor.rename.TargetNamespaceChangeHandler;
-import org.eclipse.wst.xsd.ui.internal.util.TypesHelper;
-import org.eclipse.wst.xsd.ui.internal.util.XSDSchemaHelper;
-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 SchemaPropertySource
- extends BasePropertySource
- implements IPropertySource
-{
- private String oldPrefix = "";
- private String oldNamespace = "";
-
- private String[] attributeFormDefaultComboValues =
- {
- "",
- XSDEditorPlugin.getXSDString("_UI_COMBO_UNQUALIFIED"),
- XSDEditorPlugin.getXSDString("_UI_COMBO_QUALIFIED")
- };
-
- private String[] elementFormDefaultComboValues =
- {
- "",
- XSDEditorPlugin.getXSDString("_UI_COMBO_UNQUALIFIED"),
- XSDEditorPlugin.getXSDString("_UI_COMBO_QUALIFIED")
- };
-
- private String[] blockDefaultComboValues =
- {
- "",
- "#all",
- "extension",
- "restriction",
- "substitution"
- };
-
- private String[] finalDefaultComboValues =
- {
- "",
- "#all",
- "extension",
- "restriction"
- };
-
- /**
- *
- */
- public SchemaPropertySource()
- {
- super();
- }
- /**
- * @param viewer
- * @param xsdSchema
- */
- public SchemaPropertySource(Viewer viewer, XSDSchema xsdSchema)
- {
- super(viewer, xsdSchema);
- }
- /**
- * @param xsdSchema
- */
- public SchemaPropertySource(XSDSchema xsdSchema)
- {
- super(xsdSchema);
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getEditableValue()
- */
- public Object getEditableValue()
- {
- return null;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors()
- */
- public IPropertyDescriptor[] getPropertyDescriptors()
- {
- List list = new ArrayList();
- // Create a descriptor and set a category
-// These have been moved to the General tab
-// PropertyDescriptor prefixDescriptor =
-// new TextPropertyDescriptor(
-// "prefix",
-// "prefix");
-// list.add(prefixDescriptor);
-// prefixDescriptor.setCategory("Namespace");
-//
-// PropertyDescriptor targetNamespaceDescriptor =
-// new TextPropertyDescriptor(
-// XSDConstants.TARGETNAMESPACE_ATTRIBUTE,
-// XSDConstants.TARGETNAMESPACE_ATTRIBUTE);
-// list.add(targetNamespaceDescriptor);
-// targetNamespaceDescriptor.setCategory("Namespace");
-
- PropertyDescriptor versionDescriptor =
- new TextPropertyDescriptor(
- XSDConstants.VERSION_ATTRIBUTE,
- XSDConstants.VERSION_ATTRIBUTE);
-// versionDescriptor.setDescription("Version attribute"); // XSDEditorPlugin.getXSDString("_UI_TOOLTIP_VERSION"));
- list.add(versionDescriptor);
- PropertyDescriptor xmlLangDescriptor =
- new TextPropertyDescriptor(
- "xml:lang",
- "xml:lang");
- list.add(xmlLangDescriptor);
-
- XSDComboBoxPropertyDescriptor attributeFormDefaultDescriptor =
- new XSDComboBoxPropertyDescriptor(
- XSDConstants.ATTRIBUTEFORMDEFAULT_ATTRIBUTE,
- XSDConstants.ATTRIBUTEFORMDEFAULT_ATTRIBUTE,
- attributeFormDefaultComboValues);
- list.add(attributeFormDefaultDescriptor);
-
-
- XSDComboBoxPropertyDescriptor elementFormDefaultDescriptor =
- new XSDComboBoxPropertyDescriptor(
- XSDConstants.ELEMENTFORMDEFAULT_ATTRIBUTE,
- XSDConstants.ELEMENTFORMDEFAULT_ATTRIBUTE,
- elementFormDefaultComboValues);
- list.add(elementFormDefaultDescriptor);
-
- XSDComboBoxPropertyDescriptor blockDefaultDescriptor =
- new XSDComboBoxPropertyDescriptor(
- XSDConstants.BLOCKDEFAULT_ATTRIBUTE,
- XSDConstants.BLOCKDEFAULT_ATTRIBUTE,
- blockDefaultComboValues);
- list.add(blockDefaultDescriptor);
- XSDComboBoxPropertyDescriptor finalDefaultDescriptor =
- new XSDComboBoxPropertyDescriptor(
- XSDConstants.FINALDEFAULT_ATTRIBUTE,
- XSDConstants.FINALDEFAULT_ATTRIBUTE,
- finalDefaultComboValues);
- list.add(finalDefaultDescriptor);
-
- IPropertyDescriptor[] result = new IPropertyDescriptor[list.size()];
- list.toArray(result);
- return result;
- // return propertyDescriptors;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java.lang.Object)
- */
- public Object getPropertyValue(Object id)
- {
- Object result = null;
- if (id instanceof String)
- {
- result = element.getAttribute((String) id);
- String attributeName = (String)id;
- if (result == null)
- {
- result = "";
- }
-
- if (attributeName.equals("prefix"))
- {
- TypesHelper helper = new TypesHelper(xsdSchema);
- String aPrefix = helper.getPrefix(element.getAttribute(XSDConstants.TARGETNAMESPACE_ATTRIBUTE), false);
- // System.out.println("schema targetNS is " + xsdSchema.getTargetNamespace());
- if (aPrefix != null && aPrefix.length() > 0)
- {
- return aPrefix;
- }
- return "";
- }
- else
- {
- return result;
- }
- }
- return "";
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#isPropertySet(java.lang.Object)
- */
- public boolean isPropertySet(Object id)
- {
- return false;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#resetPropertyValue(java.lang.Object)
- */
- public void resetPropertyValue(Object id)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#setPropertyValue(java.lang.Object, java.lang.Object)
- */
- public void setPropertyValue(Object id, Object value)
- {
- if (value == null)
- {
- value = "";
- }
- if (value instanceof String)
- {
- String newValue = (String)value;
- String attributeName = (String)id;
- if (attributeName.equals("prefix"))
- {
- updatePrefix(newValue);
- }
- else if (attributeName.equals(XSDConstants.TARGETNAMESPACE_ATTRIBUTE))
- {
- updateTargetNamespace(newValue);
- }
- else if (attributeName.equals("xml:lang"))
- {
- validateLanguage(newValue);
- // return; // we will accept the value even though it does not conform
- beginRecording(XSDEditorPlugin.getXSDString("_UI_SCHEMA_LANG_CHANGE"), element);
- }
- else if (attributeName.equals(XSDConstants.VERSION_ATTRIBUTE))
- {
- beginRecording(XSDEditorPlugin.getXSDString("_UI_SCHEMA_VERSION_CHANGE"), element);
- }
- else if (attributeName.equals(XSDConstants.ATTRIBUTEFORMDEFAULT_ATTRIBUTE))
- {
- beginRecording(XSDEditorPlugin.getXSDString("_UI_SCHEMA_ATTRIBUTEFORMDEFAULT_CHANGE"), element);
- }
- else if (attributeName.equals(XSDConstants.ELEMENTFORMDEFAULT_ATTRIBUTE))
- {
- beginRecording(XSDEditorPlugin.getXSDString("_UI_SCHEMA_ELEMENTFORMDEFAULT_CHANGE"), element);
- }
- else if (attributeName.equals(XSDConstants.BLOCKDEFAULT_ATTRIBUTE))
- {
- beginRecording(XSDEditorPlugin.getXSDString("_UI_SCHEMA_BLOCKDEFAULT_CHANGE"), element);
- }
- else if (attributeName.equals(XSDConstants.FINALDEFAULT_ATTRIBUTE))
- {
- beginRecording(XSDEditorPlugin.getXSDString("_UI_SCHEMA_FINALDEFAULT_CHANGE"), element);
- }
-
- if (!attributeName.equals("prefix") && !attributeName.equals(XSDConstants.TARGETNAMESPACE_ATTRIBUTE))
- {
- if (newValue.equals(""))
- {
- element.removeAttribute(attributeName);
- }
- else
- {
- element.setAttribute(attributeName, newValue);
- }
- endRecording(element);
- }
- }
- Runnable delayedUpdate = new Runnable()
- {
- public void run()
- {
- if (viewer != null)
- viewer.refresh();
- }
- };
- Display.getCurrent().asyncExec(delayedUpdate);
-
- }
-
- public void setInput(Element element)
- {
- super.setInput(element);
-
- oldNamespace = "";
- oldPrefix = "";
-
- if (element!= null)
- {
- String targetNamespace = element.getAttribute(XSDConstants.TARGETNAMESPACE_ATTRIBUTE);
- oldNamespace = targetNamespace;
-
- TypesHelper helper = new TypesHelper(xsdSchema);
- String aPrefix = helper.getPrefix(targetNamespace, false);
- if (aPrefix != null && aPrefix.length() > 0)
- {
- oldPrefix = aPrefix;
- }
- }
-
-// For debugging
-// System.out.println("old Prefix is " + oldPrefix);
-// System.out.println("old NS is " + oldNamespace);
- if (xsdSchema != null)
- {
- Map map = xsdSchema.getQNamePrefixToNamespaceMap();
-// System.out.println("SetInput: Prefixes: " + map.values());
-// System.out.println("SetInput: NS:" + map.keySet());
- }
-
- }
-
-
- private void updatePrefix(String newPrefix)
- {
- updateNamespaceInfo(newPrefix, oldNamespace);
- }
-
- private void updateTargetNamespace(String newTargetNamespace)
- {
- updateNamespaceInfo(oldPrefix, newTargetNamespace);
- }
-
- private void updateNamespaceInfo(String newPrefix, String newTargetNamespace)
- {
-// System.out.println("\nold Prefix is " + oldPrefix);
-// System.out.println("old NS is " + oldNamespace);
-// System.out.println("new Prefix is " + newPrefix);
-// System.out.println("new NS is " + newTargetNamespace);
-
- DocumentImpl doc = (DocumentImpl)element.getOwnerDocument();
-
- String modelTargetNamespace = xsdSchema.getTargetNamespace();
-// System.out.println("Model TargetNS is " + modelTargetNamespace);
- if (modelTargetNamespace == null)
- {
- modelTargetNamespace = "";
- }
-
- String targetNamespace = newTargetNamespace.trim();
- String prefix = newPrefix.trim();
-
- if (!validatePrefix(prefix) || !validateTargetNamespace(targetNamespace))
- {
- return;
- }
-
- if (prefix.length() > 0 && targetNamespace.length() == 0)
- {
- // can't have blank targetnamespace and yet specify a prefix
- return;
- }
-
- doc.getModel().beginRecording(this, "Target Namespace Change");
- String xsdForXSDPrefix = xsdSchema.getSchemaForSchemaQNamePrefix();
- Map map = xsdSchema.getQNamePrefixToNamespaceMap();
-
-// For debugging
-// System.out.println("1. SW Map is " + map.values());
-// System.out.println("1. SW Map keys are " + map.keySet());
-
- // Check if prefix is blank
- // if it is, then make sure we have a prefix
- // for schema for schema
- if (prefix.length() == 0)
- {
- // if prefix for schema for schema is blank
- // then set it to value specified in preference
- // and update ALL nodes with this prefix
- if (xsdForXSDPrefix == null || (xsdForXSDPrefix != null && xsdForXSDPrefix.trim().length() == 0))
- {
- // get preference prefix
- xsdForXSDPrefix = XSDEditorPlugin.getPlugin().getXMLSchemaPrefix();
- // get a unique prefix by checking what's in the map
-
- xsdForXSDPrefix = getUniqueSchemaForSchemaPrefix(xsdForXSDPrefix, map);
- element.setAttribute("xmlns:" + xsdForXSDPrefix, XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001);
-
- updateAllNodes(element, xsdForXSDPrefix);
-
- // remove the old xmlns attribute for the schema for schema
- if (element.getAttribute("xmlns") != null &&
- element.getAttribute("xmlns").equals(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001))
- {
- element.removeAttribute("xmlns");
- }
- }
- }
-
- if (targetNamespace.length() > 0 ||
- (targetNamespace.length() == 0 && prefix.length() == 0))
- {
- // clean up the old prefix for this schema
- if (oldPrefix != null && oldPrefix.length() > 0)
- {
- element.removeAttribute("xmlns:"+oldPrefix);
-// element.setAttribute("xmlns:" + prefix, targetNamespace);
-// java.util.Map prefixToNameSpaceMap = xsdSchema.getQNamePrefixToNamespaceMap();
-// prefixToNameSpaceMap.remove(oldPrefix);
- }
- else // if no prefix
- {
- if (element.getAttribute("xmlns") != null)
- {
- if (!element.getAttribute("xmlns").equals(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001))
- {
- element.removeAttribute("xmlns");
- }
- }
- }
- }
-
- if (targetNamespace.length() > 0)
- {
- if (!modelTargetNamespace.equals(targetNamespace))
- {
- element.setAttribute(XSDConstants.TARGETNAMESPACE_ATTRIBUTE, targetNamespace);
- }
- // now set the new xmlns:prefix attribute
- if (prefix.length() > 0)
- {
- element.setAttribute("xmlns:" + prefix, targetNamespace);
- }
- else
- {
- element.setAttribute("xmlns", targetNamespace);
- }
- // set the targetNamespace attribute
- }
- else // else targetNamespace is blank
- {
- if (prefix.length() == 0)
- {
- element.removeAttribute(XSDConstants.TARGETNAMESPACE_ATTRIBUTE);
- }
- }
-
-// System.out.println("1.5 SW Map is " + map.values());
-// System.out.println("1.5 SW Map keys are " + map.keySet());
-
- // do our own referential integrity
- TargetNamespaceChangeHandler targetNamespaceChangeHandler = new TargetNamespaceChangeHandler(xsdSchema, oldNamespace, targetNamespace);
- targetNamespaceChangeHandler.resolve();
-
- oldPrefix = prefix;
- oldNamespace = targetNamespace;
-
- XSDSchemaHelper.updateElement(xsdSchema);
-
- doc.getModel().endRecording(this);
-
-// For debugging
- map = xsdSchema.getQNamePrefixToNamespaceMap();
-// System.out.println("2. SW Map is " + map.values());
-// System.out.println("2. SW Map keys are " + map.keySet());
- }
-
-
- private String getUniqueSchemaForSchemaPrefix(String xsdForXSDPrefix, Map map)
- {
- if (xsdForXSDPrefix == null || (xsdForXSDPrefix != null && xsdForXSDPrefix.trim().length() == 0))
- {
- xsdForXSDPrefix = "xsd";
- }
- // ensure prefix is unique
- int prefixExtension = 1;
- while (map.containsKey(xsdForXSDPrefix) && prefixExtension < 100)
- {
- xsdForXSDPrefix = xsdForXSDPrefix + String.valueOf(prefixExtension);
- prefixExtension++;
- }
- return xsdForXSDPrefix;
- }
-
- private void updateAllNodes(Element element, String prefix)
- {
- element.setPrefix(prefix);
- NodeList list = element.getChildNodes();
- if (list != null)
- {
- for (int i=0; i < list.getLength(); i++)
- {
- Node child = list.item(i);
- if (child != null && child instanceof Element)
- {
- child.setPrefix(prefix);
- if (child.hasChildNodes())
- {
- updateAllNodes((Element)child, prefix);
- }
- }
- }
- }
- }
-
- protected boolean validateTargetNamespace(String ns)
- {
- // will allow blank namespace !!
- if (ns.equals(""))
- {
- return true;
- }
-
- String errorMessage = null;
- try
- {
- URI testURI = new URI(ns);
- }
- catch (URISyntaxException e)
- {
- errorMessage = XSDEditorPlugin.getXSDString("_WARN_INVALID_TARGET_NAMESPACE");
- }
-
- if (errorMessage == null || errorMessage.length() == 0)
- {
- return true;
- }
- return false;
- }
-
-}
-
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/SimpleContentPropertyDescriptor.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/SimpleContentPropertyDescriptor.java
deleted file mode 100644
index 1948146370..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/SimpleContentPropertyDescriptor.java
+++ /dev/null
@@ -1,209 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.properties;
-
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.wst.xsd.ui.internal.properties.section.SimpleContentBaseTypeOptionsDialog;
-import org.eclipse.xsd.XSDSchema;
-import org.w3c.dom.Element;
-
-public class SimpleContentPropertyDescriptor extends TypesPropertyDescriptor
-{
- public SimpleContentPropertyDescriptor(Object id, String displayName, Element element, XSDSchema xsdSchema)
- {
- super(id, displayName, element, xsdSchema);
- }
-
- public CellEditor createPropertyEditor(Composite parent)
- {
- // CellEditor editor = new SimpleContentBaseTypeOptionsTextCellEditor(parent);
- CellEditor editor = new SimpleContentBaseTypeDialogCellEditor(parent);
- if (getValidator() != null)
- editor.setValidator(getValidator());
- return editor;
- }
-
- public class SimpleContentBaseTypeDialogCellEditor extends TypesDialogCellEditor
- {
-
- /**
- * Creates a new Font dialog cell editor parented under the given control.
- * The cell editor value is <code>null</code> initially, and has no
- * validator.
- *
- * @param parent the parent control
- */
- protected SimpleContentBaseTypeDialogCellEditor(Composite parent)
- {
- super(parent);
- }
-
- protected Object openDialogBox(Control cellEditorWindow)
- {
- Shell shell = Display.getCurrent().getActiveShell();
-
- // SimpleContentBaseTypeOptionsDialog dialog = new SimpleContentBaseTypeOptionsDialog(shell);
- SimpleContentBaseTypeOptionsDialog dialog = new SimpleContentBaseTypeOptionsDialog(shell, element, property, xsdSchema);
-
- dialog.setBlockOnOpen(true);
- dialog.create();
-
- String value = (String)getValue();
-
- int result = dialog.open();
-
- if (result == Window.OK)
- {
- value = dialog.getType();
- return value;
- }
- deactivate();
- return value;
- }
- }
-
-// class SimpleContentBaseTypeOptionsDialog extends TypesDialog
-// {
-// public SimpleContentBaseTypeOptionsDialog(Shell shell)
-// {
-// super(shell);
-// showAnonymous = false;
-// }
-//
-//// protected void ok()
-//// {
-//// TableItem[] items = table.getItems();
-//// selection = table.getSelectionIndex();
-//// if (items != null && items.length > 0 && selection >= 0)
-//// {
-//// typeObject = items[selection].getData();
-//// }
-//// System.out.println("typeObject is " + typeObject);
-////
-//// doSetValue(typeObject);
-//// applyEditorValueAndDeactivate();
-//// dialog.close();
-//// }
-//
-// public void handleSetInput()
-// {
-// XSDDOMHelper domHelper = new XSDDOMHelper();
-// typeSection.getSimpleType().setSelection(false);
-// typeSection.getUserSimpleType().setSelection(false);
-// typeSection.getUserComplexType().setSelection(false);
-// showAnonymous = false;
-// if (element != null)
-// {
-// String derivedBy = domHelper.getDerivedByName(element);
-// String baseType = domHelper.getBaseType(element);
-// boolean derivedByRestriction = true;
-//
-// if (XSDDOMHelper.inputEquals(element, XSDConstants.COMPLEXCONTENT_ELEMENT_TAG, false))
-// {
-// typeSection.getSimpleType().setEnabled(false);
-// typeSection.getUserSimpleType().setEnabled(false);
-// typeSection.getUserComplexType().setSelection(true);
-//
-// previousType = 3;
-// }
-// else if (XSDDOMHelper.inputEquals(element, XSDConstants.SIMPLECONTENT_ELEMENT_TAG, false))
-// {
-// typeSection.getSimpleType().setEnabled(false);
-// typeSection.getUserSimpleType().setEnabled(false);
-//
-// if (derivedBy.equals("restriction"))
-// {
-// typeSection.getSimpleType().setEnabled(false);
-// typeSection.getUserSimpleType().setEnabled(false);
-// typeSection.getUserComplexType().setEnabled(true);
-// }
-// else if (derivedBy.equals("extension"))
-// {
-// derivedByRestriction = false;
-// typeSection.getSimpleType().setEnabled(true);
-// typeSection.getUserSimpleType().setEnabled(true);
-// typeSection.getUserComplexType().setEnabled(true);
-// }
-// }
-//
-// if (derivedBy != null)
-// {
-// if (baseType != null && !baseType.equals(""))
-// {
-// Element parent = (Element)element.getParentNode();
-// XSDConcreteComponent component = null;
-// if (parent != null)
-// {
-// component = xsdSchema.getCorrespondingComponent(parent);
-// }
-// XSDTypeDefinition baseTypeDefinition = null;
-// if (component instanceof XSDComplexTypeDefinition)
-// {
-// XSDComplexTypeDefinition complexType = (XSDComplexTypeDefinition)component;
-// baseTypeDefinition = complexType.getBaseTypeDefinition();
-// }
-//
-// if (typeSection.getBuiltInTypeNamesList(xsdSchema).contains(baseType) && !derivedByRestriction)
-// {
-// typeSection.getSimpleType().setSelection(true);
-// populateBuiltInType();
-// int i = typeSection.getBuiltInTypeNamesList(xsdSchema).indexOf(baseType);
-// table.setSelection(i);
-// previousType = 1;
-// }
-// else if (baseTypeDefinition instanceof XSDSimpleTypeDefinition && !derivedByRestriction)
-// {
-// typeSection.getUserSimpleType().setSelection(true);
-// populateUserSimpleType();
-// int i = typeSection.getUserSimpleTypeNamesList(xsdSchema).indexOf(baseType);
-// if (showAnonymous)
-// {
-// table.setSelection(i + 1);
-// }
-// else
-// {
-// table.setSelection(i);
-// }
-// previousType = 2;
-// }
-// else if (baseTypeDefinition instanceof XSDComplexTypeDefinition)
-// {
-// typeSection.getUserComplexType().setSelection(true);
-// populateUserComplexType();
-// int i = typeSection.getUserComplexTypeNamesList(xsdSchema).indexOf(baseType);
-// if (showAnonymous)
-// {
-// table.setSelection(i + 1);
-// }
-// else
-// {
-// table.setSelection(i);
-// }
-// previousType = 3;
-// }
-// }
-// else
-// {
-// typeSection.getUserComplexType().setSelection(true);
-// populateUserComplexType();
-// table.setSelection(0);
-// }
-// }
-//
-// }
-// }
-// }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/SimpleContentPropertySource.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/SimpleContentPropertySource.java
deleted file mode 100644
index f0233cd274..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/SimpleContentPropertySource.java
+++ /dev/null
@@ -1,230 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.properties;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.eclipse.wst.xsd.ui.internal.XSDEditorPlugin;
-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 SimpleContentPropertySource
- extends BasePropertySource
- implements IPropertySource
-{
- private String DERIVED_BY_ID = "derived by"; // XSDEditorPlugin.getXSDString("_UI_LABEL_DERIVED_BY");
- private String BASE_TYPE_ID = "base"; // XSDEditorPlugin.getXSDString("_UI_LABEL_BASE_TYPE");
-
- private String derivedByChoicesComboValues[] =
- {
- "",
- XSDConstants.RESTRICTION_ELEMENT_TAG,
- XSDConstants.EXTENSION_ELEMENT_TAG
- };
-
- /**
- *
- */
- public SimpleContentPropertySource()
- {
- super();
- }
- /**
- * @param viewer
- * @param xsdSchema
- */
- public SimpleContentPropertySource(Viewer viewer, XSDSchema xsdSchema)
- {
- super(viewer, xsdSchema);
- }
- /**
- * @param xsdSchema
- */
- public SimpleContentPropertySource(XSDSchema xsdSchema)
- {
- super(xsdSchema);
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getEditableValue()
- */
- public Object getEditableValue()
- {
- return null;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors()
- */
- public IPropertyDescriptor[] getPropertyDescriptors()
- {
- List list = new ArrayList();
- // Create a descriptor and set a category
-
- SimpleContentPropertyDescriptor typeDescriptor = new SimpleContentPropertyDescriptor(
- BASE_TYPE_ID,
- BASE_TYPE_ID,
- element, xsdSchema);
- list.add(typeDescriptor);
- XSDComboBoxPropertyDescriptor derivedByDescriptor =
- new XSDComboBoxPropertyDescriptor(
- DERIVED_BY_ID,
- DERIVED_BY_ID,
- derivedByChoicesComboValues);
- list.add(derivedByDescriptor);
-
- IPropertyDescriptor[] result = new IPropertyDescriptor[list.size()];
- list.toArray(result);
- return result;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java.lang.Object)
- */
- public Object getPropertyValue(Object id)
- {
- Object result = null;
- if (id instanceof String)
- {
- if (((String) id).equals(DERIVED_BY_ID))
- {
- String derivedBy = getDomHelper().getDerivedByName(element);
- if (derivedBy == null)
- {
- derivedBy = "";
- }
- return derivedBy;
- }
- else if (((String) id).equals(BASE_TYPE_ID))
- {
- String baseType = getDomHelper().getBaseType(element);
- if (baseType == null)
- {
- baseType = "";
- }
- return baseType;
- }
- }
- return "";
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#isPropertySet(java.lang.Object)
- */
- public boolean isPropertySet(Object id)
- {
- return false;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#resetPropertyValue(java.lang.Object)
- */
- public void resetPropertyValue(Object id)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#setPropertyValue(java.lang.Object, java.lang.Object)
- */
- public void setPropertyValue(Object id, Object value)
- {
- if (value != null)
- {
- if (value instanceof String)
- {
- String origBaseType = getDomHelper().getBaseType(element);
- String derivedBy = getDomHelper().getDerivedByName(element);
-
- if (((String) id).equals(BASE_TYPE_ID))
- {
- Document doc = element.getOwnerDocument();
- Element childElement = null;
- beginRecording(XSDEditorPlugin.getXSDString("_UI_TYPE_CHANGE"), element);
- getDomHelper().setDerivedByBaseType(element, derivedBy, (String)value);
- endRecording(element);
- }
- else if (((String) id).equals(DERIVED_BY_ID))
- {
- beginRecording(XSDEditorPlugin.getXSDString("_UI_DERIVEDBY_CHANGE"), element);
- String newDerivedBy = (String)value;
- if (newDerivedBy.equals(XSDConstants.RESTRICTION_ELEMENT_TAG))
- {
- String prefix = element.getPrefix();
- String anyType = prefix == null? "anyType" : prefix + ":anyType";
- getDomHelper().changeDerivedByType(element, (String)value, anyType);
- }
- else
- {
- Element derivedByElem = getDomHelper().getDerivedByElement(element);
- if (checkForAnonymousType(derivedByElem))
- {
-// KCPort
-// ArrayList message = new ArrayList();
-// ErrorMessage aTask = new ErrorMessage();
-// Node aNode = getDomHelper().getChildNode(derivedByElem, XSDConstants.SIMPLETYPE_ELEMENT_TAG);
-////////////// shall we remove the node and its children??
-//// getDomHelper().removeNodeAndWhitespace(aNode);
-//////////////
-//// if (aNode instanceof Element)
-//// {
-//// Element st = (Element)aNode;
-//// if (st instanceof NodeImpl)
-//// {
-//// aTask.setNode((NodeImpl)st);
-//// }
-//// }
-// if (derivedByElem instanceof NodeImpl)
-// {
-// aTask.setModelObject(derivedByElem);
-// }
-// aTask.setLocalizedMessage(XSDEditorPlugin.getXSDString("_ERROR_REMOVE_LOCAL_SIMPLETYPE"));
-// message.add(aTask);
-// if (getEditor() != null)
-// {
-// getEditor().createTasksInTaskList(message);
-// }
- }
- getDomHelper().changeDerivedByType(element, (String)value, origBaseType);
- }
-
-
- endRecording(element);
-// setInput(element);
- }
- }
- }
- Runnable delayedUpdate = new Runnable()
- {
- public void run()
- {
- if (viewer != null)
- viewer.refresh();
- }
- };
- Display.getCurrent().asyncExec(delayedUpdate);
- }
-
- boolean checkForAnonymousType(Element element)
- {
- boolean isAnonymous = false;
-
- Node aNode = getDomHelper().getChildNode(element, XSDConstants.SIMPLETYPE_ELEMENT_TAG);
- if (aNode != null)
- {
- return true;
- }
- return isAnonymous;
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/SimpleRestrictPropertySource.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/SimpleRestrictPropertySource.java
deleted file mode 100644
index 38a8819a48..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/SimpleRestrictPropertySource.java
+++ /dev/null
@@ -1,362 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.properties;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.eclipse.ui.views.properties.TextPropertyDescriptor;
-import org.eclipse.wst.xsd.ui.internal.XSDEditorPlugin;
-import org.eclipse.wst.xsd.ui.internal.actions.DOMAttribute;
-import org.eclipse.wst.xsd.ui.internal.util.XSDDOMHelper;
-import org.eclipse.wst.xsd.ui.internal.util.XSDSchemaHelper;
-import org.eclipse.xsd.XSDComplexTypeDefinition;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDFacet;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.XSDSimpleTypeDefinition;
-import org.eclipse.xsd.XSDTypeDefinition;
-import org.eclipse.xsd.impl.XSDFactoryImpl;
-import org.eclipse.xsd.util.XSDConstants;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-public class SimpleRestrictPropertySource
- extends BasePropertySource
- implements IPropertySource
-{
- private String BASE_TYPE_ID = XSDEditorPlugin.getXSDString("_UI_LABEL_BASE_TYPE");
- private String [] whiteSpaceComboChoices = { "", "preserve", "replace", "collapse" };
- /**
- *
- */
- public SimpleRestrictPropertySource()
- {
- super();
- }
- /**
- * @param viewer
- * @param xsdSchema
- */
- public SimpleRestrictPropertySource(Viewer viewer, XSDSchema xsdSchema)
- {
- super(viewer, xsdSchema);
- }
- /**
- * @param xsdSchema
- */
- public SimpleRestrictPropertySource(XSDSchema xsdSchema)
- {
- super(xsdSchema);
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getEditableValue()
- */
- public Object getEditableValue()
- {
- return null;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors()
- */
- public IPropertyDescriptor[] getPropertyDescriptors()
- {
- List list = new ArrayList();
- // Create a descriptor and set a category
-
- SimpleContentPropertyDescriptor typeDescriptor = new SimpleContentPropertyDescriptor(
- XSDConstants.BASE_ATTRIBUTE,
- XSDConstants.BASE_ATTRIBUTE,
- (Element)element.getParentNode(), xsdSchema); // get the parent node!
- list.add(typeDescriptor);
-
- Iterator facets = xsdSimpleType.getValidFacets().iterator();
-
- while(facets.hasNext())
- {
- String aValidFacet = (String)facets.next();
- if (!(aValidFacet.equals(XSDConstants.PATTERN_ELEMENT_TAG) || aValidFacet.equals(XSDConstants.ENUMERATION_ELEMENT_TAG)))
- {
- if (aValidFacet.equals(XSDConstants.WHITESPACE_ELEMENT_TAG))
- {
- XSDComboBoxPropertyDescriptor whitespaceDescriptor = new XSDComboBoxPropertyDescriptor(
- aValidFacet, aValidFacet, whiteSpaceComboChoices);
- list.add(whitespaceDescriptor);
- }
- else
- {
- list.add(new TextPropertyDescriptor(aValidFacet, aValidFacet));
- }
- }
- }
-
-
- IPropertyDescriptor[] result = new IPropertyDescriptor[list.size()];
- list.toArray(result);
- return result;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java.lang.Object)
- */
- public Object getPropertyValue(Object id)
- {
- Object result = null;
- if (id instanceof String)
- {
- if (((String) id).equals(XSDConstants.BASE_ATTRIBUTE))
- {
- String baseType = element.getAttribute(XSDConstants.BASE_ATTRIBUTE);
- if (baseType == null)
- {
- baseType = "";
- }
- return baseType;
- }
- else
- {
- String aFacet = (String)id;
- Iterator facets = xsdSimpleType.getFacets().iterator();
-
- while(facets.hasNext())
- {
- XSDFacet aValidFacet = (XSDFacet)facets.next();
- if (aValidFacet.getFacetName().equals(aFacet))
- {
- result = aValidFacet.getLexicalValue();
- if (result == null)
- {
- result = "";
- }
- return result;
- }
- }
- }
- }
- return "";
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#isPropertySet(java.lang.Object)
- */
- public boolean isPropertySet(Object id)
- {
- return false;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#resetPropertyValue(java.lang.Object)
- */
- public void resetPropertyValue(Object id)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#setPropertyValue(java.lang.Object, java.lang.Object)
- */
- public void setPropertyValue(Object id, Object value)
- {
- if (value != null)
- {
- if (value instanceof String)
- {
- String newValue = (String)value;
- String origBaseType = getDomHelper().getBaseType(element);
-
- if (((String) id).equals(XSDConstants.BASE_ATTRIBUTE))
- {
- Document doc = element.getOwnerDocument();
- Element childElement = null;
- beginRecording(XSDEditorPlugin.getXSDString("_UI_TYPE_CHANGE"), element);
-
- Element parent = (Element)element.getParentNode();
- if (XSDDOMHelper.inputEquals(parent, XSDConstants.SIMPLETYPE_ELEMENT_TAG, false))
- {
-// updateElementToNotAnonymous(element);
- }
- getDomHelper().setSimpleContentType(element, newValue);
- endRecording(element);
- }
- else
- {
- Element simpleTypeElement = xsdSimpleType.getElement();
- XSDDOMHelper xsdDOMHelper = new XSDDOMHelper();
- Element derivedByElement = xsdDOMHelper.getDerivedByElement(simpleTypeElement);
- beginRecording(XSDEditorPlugin.getXSDString("_UI_FACET_CHANGE"), simpleTypeElement);
- String prefix = simpleTypeElement.getPrefix();
- prefix = (prefix == null) ? "" : (prefix + ":");
-
- String aFacet = (String)id;
- XSDFactoryImpl factory = new XSDFactoryImpl();
-
- Element childNodeElement = null;
- DOMAttribute valueAttr = null;
- XSDFacet facet = null;
- if (aFacet.equals(XSDConstants.TOTALDIGITS_ELEMENT_TAG))
- {
- facet = xsdSimpleType.getTotalDigitsFacet();
- }
- else if (aFacet.equals(XSDConstants.FRACTIONDIGITS_ELEMENT_TAG))
- {
- facet = xsdSimpleType.getFractionDigitsFacet();
- }
- else if (aFacet.equals(XSDConstants.WHITESPACE_ELEMENT_TAG))
- {
- facet = xsdSimpleType.getWhiteSpaceFacet();
- }
- else if (aFacet.equals(XSDConstants.MAXEXCLUSIVE_ELEMENT_TAG))
- {
- facet = xsdSimpleType.getMaxExclusiveFacet();
- }
- else if (aFacet.equals(XSDConstants.MAXINCLUSIVE_ELEMENT_TAG))
- {
- facet = xsdSimpleType.getMaxInclusiveFacet();
- }
- else if (aFacet.equals(XSDConstants.MINEXCLUSIVE_ELEMENT_TAG))
- {
- facet = xsdSimpleType.getMinExclusiveFacet();
- }
- else if (aFacet.equals(XSDConstants.MININCLUSIVE_ELEMENT_TAG))
- {
- facet = xsdSimpleType.getMinInclusiveFacet();
- }
- else if (aFacet.equals(XSDConstants.LENGTH_ELEMENT_TAG))
- {
- facet = xsdSimpleType.getLengthFacet();
- }
- else if (aFacet.equals(XSDConstants.MAXLENGTH_ELEMENT_TAG))
- {
- facet = xsdSimpleType.getMaxLengthFacet();
- }
- else if (aFacet.equals(XSDConstants.MINLENGTH_ELEMENT_TAG))
- {
- facet = xsdSimpleType.getMinLengthFacet();
- }
-
- if (facet != null)
- {
- facet.setLexicalValue(newValue);
- }
- else
- {
- facet = (XSDFacet)factory.createXSDTotalDigitsFacet();
- childNodeElement = (derivedByElement.getOwnerDocument()).createElementNS(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001, prefix + aFacet);
- valueAttr = new DOMAttribute(XSDConstants.VALUE_ATTRIBUTE, "");
- childNodeElement.setAttribute(valueAttr.getName(), valueAttr.getValue());
- valueAttr.setValue(newValue);
- childNodeElement.setAttribute(valueAttr.getName(), valueAttr.getValue());
- boolean hasChildrenElements = hasElementChildren(derivedByElement);
- element.appendChild(childNodeElement);
- //formatChild(childNodeElement, hasChildrenElements);
- }
- XSDSchemaHelper.updateElement(xsdSimpleType);
- if (facet != null)
- {
- XSDSchemaHelper.updateElement(facet);
- }
- }
- }
- }
- Runnable delayedUpdate = new Runnable()
- {
- public void run()
- {
- if (viewer != null)
- viewer.refresh();
- }
- };
- Display.getCurrent().asyncExec(delayedUpdate);
-
- }
-
- protected boolean isAnonymous;
- protected XSDSimpleTypeDefinition xsdSimpleType;
- public void setInput(Element element)
- {
- this.element = element;
- if (xsdSchema == null)
- {
- return;
- }
- String type = element.getLocalName();
-
- isAnonymous = checkForAnonymousType(element);
-
- int restrictionType = 0; // 0 = SimpleType restriction
- // 1 = SimpleContent restriction
- // ComplexContent restriction different window
-
- if (XSDDOMHelper.inputEquals(element, XSDConstants.RESTRICTION_ELEMENT_TAG, false))
- {
- String baseType = element.getAttribute(XSDConstants.BASE_ATTRIBUTE);
-
- XSDTypeDefinition baseTypeDefinition = null;
-
- Element parent = (Element)element.getParentNode();
- if (XSDDOMHelper.inputEquals(parent, XSDConstants.SIMPLECONTENT_ELEMENT_TAG, false))
- {
- restrictionType = 1;
- Element grandparent = (Element)parent.getParentNode();
- XSDConcreteComponent component = null;
- if (grandparent != null)
- {
- component = xsdSchema.getCorrespondingComponent(grandparent);
- }
- if (component instanceof XSDComplexTypeDefinition)
- {
- XSDComplexTypeDefinition complexType = (XSDComplexTypeDefinition)component;
- baseTypeDefinition = complexType.getBaseTypeDefinition();
- }
- }
- else if (XSDDOMHelper.inputEquals(parent, XSDConstants.SIMPLETYPE_ELEMENT_TAG, false))
- {
- restrictionType = 0;
- XSDConcreteComponent component = null;
- if (parent != null)
- {
- component = xsdSchema.getCorrespondingComponent(parent);
- }
- if (component instanceof XSDSimpleTypeDefinition)
- {
- XSDSimpleTypeDefinition simpleType = (XSDSimpleTypeDefinition)component;
- baseTypeDefinition = simpleType.getBaseTypeDefinition();
- }
- }
-
- XSDConcreteComponent xsdConcreteComponent = null;
- if (element.getParentNode() != null)
- {
- xsdConcreteComponent = xsdSchema.getCorrespondingComponent(element.getParentNode());
- }
-
- if (xsdConcreteComponent instanceof XSDSimpleTypeDefinition)
- {
- xsdSimpleType = (XSDSimpleTypeDefinition)xsdConcreteComponent;
- }
- //facetViewer.setInput(xsdSimpleType);
- }
- }
-
- boolean checkForAnonymousType(Element element)
- {
- boolean isAnonymous = false;
-
- Node aNode = getDomHelper().getChildNode(element, XSDConstants.SIMPLETYPE_ELEMENT_TAG);
- if (aNode != null)
- {
- return true;
- }
- return isAnonymous;
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/SimpleTypeListPropertySource.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/SimpleTypeListPropertySource.java
deleted file mode 100644
index fc104c0824..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/SimpleTypeListPropertySource.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.properties;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.util.XSDConstants;
-
-public class SimpleTypeListPropertySource
- extends BasePropertySource
- implements IPropertySource
-{
- /**
- *
- */
- public SimpleTypeListPropertySource()
- {
- super();
- }
- /**
- * @param viewer
- * @param xsdSchema
- */
- public SimpleTypeListPropertySource(Viewer viewer, XSDSchema xsdSchema)
- {
- super(viewer, xsdSchema);
- }
- /**
- * @param xsdSchema
- */
- public SimpleTypeListPropertySource(XSDSchema xsdSchema)
- {
- super(xsdSchema);
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getEditableValue()
- */
- public Object getEditableValue()
- {
- return null;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors()
- */
- public IPropertyDescriptor[] getPropertyDescriptors()
- {
- List list = new ArrayList();
- // Create a descriptor and set a category
- TypesPropertyDescriptor typeDescriptor = new TypesPropertyDescriptor(
- XSDConstants.ITEMTYPE_ATTRIBUTE,
- XSDConstants.ITEMTYPE_ATTRIBUTE,
- element, xsdSchema);
-
- typeDescriptor.setLabelProvider(new LabelProvider()
- {
- public String getText(Object element)
- {
- return (String) element;
- }
- });
- list.add(typeDescriptor);
-
- IPropertyDescriptor[] result = new IPropertyDescriptor[list.size()];
- list.toArray(result);
- return result;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java.lang.Object)
- */
- public Object getPropertyValue(Object id)
- {
- Object result = null;
- if (id instanceof String)
- {
- if (((String) id).equals(XSDConstants.ITEMTYPE_ATTRIBUTE))
- {
- result = element.getAttribute((String) id);
- if (result == null)
- {
- result = "**anonymous**";
- }
- return result;
- }
- }
- return "";
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#isPropertySet(java.lang.Object)
- */
- public boolean isPropertySet(Object id)
- {
- return false;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#resetPropertyValue(java.lang.Object)
- */
- public void resetPropertyValue(Object id)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#setPropertyValue(java.lang.Object, java.lang.Object)
- */
- public void setPropertyValue(Object id, Object value)
- {
- if (value != null)
- {
- if (value instanceof String)
- {
- if (((String) id).equals(XSDConstants.ITEMTYPE_ATTRIBUTE))
- {
- beginRecording("ItemType Change", element);
- element.setAttribute(XSDConstants.ITEMTYPE_ATTRIBUTE, (String)value);
- endRecording(element);
- }
- }
- }
- Runnable delayedUpdate = new Runnable()
- {
- public void run()
- {
- if (viewer != null)
- viewer.refresh();
- }
- };
- Display.getCurrent().asyncExec(delayedUpdate);
-
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/SimpleTypePropertySource.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/SimpleTypePropertySource.java
deleted file mode 100644
index 99885fad54..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/SimpleTypePropertySource.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.properties;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.eclipse.ui.views.properties.PropertyDescriptor;
-import org.eclipse.ui.views.properties.TextPropertyDescriptor;
-import org.eclipse.wst.xsd.ui.internal.XSDEditorPlugin;
-import org.eclipse.wst.xsd.ui.internal.refactor.rename.GlobalSimpleOrComplexTypeRenamer;
-import org.eclipse.wst.xsd.ui.internal.util.XSDDOMHelper;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDNamedComponent;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.XSDSimpleTypeDefinition;
-import org.eclipse.xsd.util.XSDConstants;
-import org.w3c.dom.Node;
-
-public class SimpleTypePropertySource
- extends BasePropertySource
- implements IPropertySource
-{
- private boolean isAnonymous = false;
- /**
- *
- */
- public SimpleTypePropertySource()
- {
- super();
- }
- /**
- * @param viewer
- * @param xsdSchema
- */
- public SimpleTypePropertySource(Viewer viewer, XSDSchema xsdSchema)
- {
- super(viewer, xsdSchema);
- }
- /**
- * @param xsdSchema
- */
- public SimpleTypePropertySource(XSDSchema xsdSchema)
- {
- super(xsdSchema);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getEditableValue()
- */
- public Object getEditableValue()
- {
- return null;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors()
- */
- public IPropertyDescriptor[] getPropertyDescriptors()
- {
- Node parent = element.getParentNode();
- if (XSDDOMHelper.inputEquals(parent, XSDConstants.RESTRICTION_ELEMENT_TAG, false) ||
- XSDDOMHelper.inputEquals(parent, XSDConstants.ELEMENT_ELEMENT_TAG, false) ||
- XSDDOMHelper.inputEquals(parent, XSDConstants.UNION_ELEMENT_TAG, false) ||
- XSDDOMHelper.inputEquals(parent, XSDConstants.LIST_ELEMENT_TAG, false) ||
- XSDDOMHelper.inputEquals(parent, XSDConstants.ATTRIBUTE_ELEMENT_TAG, false))
- {
- isAnonymous = true;
- }
-
- List list = new ArrayList();
- if (!isAnonymous)
- {
- // Create a descriptor and set a category
- PropertyDescriptor nameDescriptor =
- new TextPropertyDescriptor(
- XSDConstants.NAME_ATTRIBUTE,
- XSDConstants.NAME_ATTRIBUTE);
- list.add(nameDescriptor);
- }
- else
- {
- PropertyDescriptor readOnly = new PropertyDescriptor(XSDConstants.NAME_ATTRIBUTE, XSDConstants.NAME_ATTRIBUTE);
- list.add(readOnly);
- }
-
- IPropertyDescriptor[] result = new IPropertyDescriptor[list.size()];
- list.toArray(result);
- return result;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java.lang.Object)
- */
- public Object getPropertyValue(Object id)
- {
- Object result = null;
- if (id instanceof String)
- {
- result = element.getAttribute((String) id);
- if (isAnonymous)
- {
- result = "**anonymous**";
- }
- }
- if (result == null)
- {
- result = "";
- }
- return result;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#isPropertySet(java.lang.Object)
- */
- public boolean isPropertySet(Object id)
- {
- return false;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#resetPropertyValue(java.lang.Object)
- */
- public void resetPropertyValue(Object id)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#setPropertyValue(java.lang.Object, java.lang.Object)
- */
- public void setPropertyValue(Object id, Object value)
- {
- if (value == null)
- {
- value = "";
- }
- if (value instanceof String)
- {
- String name = (String)value;
- if (validateName(name))
- {
- beginRecording(XSDEditorPlugin.getXSDString("_UI_SIMPLETYPE_NAME_CHANGE"), element);
- if (name != null && name.length() > 0)
- {
- // now rename any references to this type
- if (xsdSchema != null)
- {
- XSDConcreteComponent comp = xsdSchema.getCorrespondingComponent(element);
- if (comp != null && comp instanceof XSDSimpleTypeDefinition && comp.getContainer().equals(xsdSchema))
- {
-// ((XSDNamedComponent)comp).setName(name);
- GlobalSimpleOrComplexTypeRenamer renamer = new GlobalSimpleOrComplexTypeRenamer((XSDNamedComponent)comp, name);
- renamer.visitSchema(xsdSchema);
- }
- }
- element.setAttribute(XSDConstants.NAME_ATTRIBUTE, name);
- }
- else
- {
- element.setAttribute(XSDConstants.NAME_ATTRIBUTE, "");
- }
- endRecording(element);
- }
- }
- Runnable delayedUpdate = new Runnable()
- {
- public void run()
- {
- if (viewer != null)
- viewer.refresh();
- }
- };
- Display.getCurrent().asyncExec(delayedUpdate);
-
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/SimpleTypeUnionPropertySource.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/SimpleTypeUnionPropertySource.java
deleted file mode 100644
index ec0adf72e8..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/properties/SimpleTypeUnionPropertySource.java
+++ /dev/null
@@ -1,494 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.properties;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.DialogCellEditor;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.eclipse.ui.views.properties.PropertyDescriptor;
-import org.eclipse.wst.xsd.ui.internal.XSDEditorPlugin;
-import org.eclipse.wst.xsd.ui.internal.util.TypesHelper;
-import org.eclipse.wst.xsd.ui.internal.util.ViewUtility;
-import org.eclipse.wst.xsd.ui.internal.widgets.TypeSection;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.util.XSDConstants;
-
-
-public class SimpleTypeUnionPropertySource
- extends BasePropertySource
- implements IPropertySource
-{
- /**
- *
- */
- public SimpleTypeUnionPropertySource()
- {
- super();
- }
- /**
- * @param viewer
- * @param xsdSchema
- */
- public SimpleTypeUnionPropertySource(Viewer viewer, XSDSchema xsdSchema)
- {
- super(viewer, xsdSchema);
- }
- /**
- * @param xsdSchema
- */
- public SimpleTypeUnionPropertySource(XSDSchema xsdSchema)
- {
- super(xsdSchema);
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getEditableValue()
- */
- public Object getEditableValue()
- {
- return null;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors()
- */
- public IPropertyDescriptor[] getPropertyDescriptors()
- {
- List list = new ArrayList();
- // Create a descriptor and set a category
- SimpleUnionMemberTypesPropertyDescriptor typeDescriptor = new SimpleUnionMemberTypesPropertyDescriptor(
- XSDConstants.MEMBERTYPES_ATTRIBUTE,
- XSDConstants.MEMBERTYPES_ATTRIBUTE);
-
- typeDescriptor.setLabelProvider(new LabelProvider()
- {
- public String getText(Object element)
- {
- return (String) element;
- }
- });
- list.add(typeDescriptor);
-
- IPropertyDescriptor[] result = new IPropertyDescriptor[list.size()];
- list.toArray(result);
- return result;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java.lang.Object)
- */
- public Object getPropertyValue(Object id)
- {
- Object result = null;
- if (id instanceof String)
- {
- if (((String) id).equals(XSDConstants.MEMBERTYPES_ATTRIBUTE))
- {
- result = element.getAttribute((String) id);
- if (result == null)
- {
- result = "";
- }
- return result;
- }
- }
- return "";
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#isPropertySet(java.lang.Object)
- */
- public boolean isPropertySet(Object id)
- {
- return false;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#resetPropertyValue(java.lang.Object)
- */
- public void resetPropertyValue(Object id)
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#setPropertyValue(java.lang.Object, java.lang.Object)