Using Refactoring to Rename or Delete XML Schema Components
See Also
You can use refactoring in XML schema tools to rename or safely delete schema components and update all references throughout your project. You can use the following refactoring actions in XML schema files:
- Rename. Enables you to change the name of a schema component and update all the source code in your project to reference the component by its new name.
- The rename action will check for usages of the component in the current project if the component is a global component.
- Non-global components will be renamed without checking for usages and without showing the XML Refactoring window.
- The rename action will check for usages of the component in WSDL and BPEL files.
- Safely Delete. Checks for references to a schema component and then automatically deletes that component if there are no other references to that component.
- The safely delete action will check for usages of the component in the project, if the component is a global component.
- Non-global components will be deleted without checking for usages and without showing the XML Refactoring window.
- The safely delete action will also check for usages of the component in WSDL and BPEL files.
- If references to the selected component are found, you must remove those references before you can safely delete the component.
- Undo [action]. After performing a Rename or Safely Delete refactoring action, you can undo that action. The Undo [action] menu option is only enabled after you completed a Refactor >action command. Undo is disabled if any member of the refactoring set is modified after the initial refactoring action.
- Redo [action]. After performing an Undo of a Rename or Safely Delete refactoring action, you can redo that action. The Redo [action] menu option is only enabled after you completed an Undo [action] command.
To rename an XML schema component:
- Open the XML schema file in the Schema view or the Design view of the XML schema editor.
- Navigate to and select the XML schema component to rename.
- Right-click and choose Refactor > Rename from the pop-up menu.
The Rename dialog box opens.
- In the New Name field, type the new name of the XML schema component.
- To preview all changes in the XML Refactoring window, select the Preview All Changes checkbox.
- Click Next.
The IDE finds all usages of the XML schema component and shows the results in the XML Refactoring window. The preview shows the components in the project files.
- If you cleared the Preview All Changes checkbox, the rename action happens without additional confirmation. In this case, this is the last step of the rename action.
- In the XML Refactoring window, review the refactoring changes.
- Clear the checkbox of any node where you do not want to change the name of the XML schema component.
- Click Do Refactoring to apply the selected changes.
The IDE executes the rename action, saves all the files affected by the rename action, and closes the XML Refactoring window.
To safely delete an XML schema component:
- Open the XML schema file in the Schema view or the Design view of the XML schema editor.
- Navigate to and select the XML schema component to delete.
- Right-click and choose Refactor > Safely Delete from the pop-up menu.
The Safe Delete dialog box opens and shows you the name of the XML schema component you selected for deletion.
- To preview all changes in the XML Refactoring window, select the Preview All Changes checkbox.
- Click Next.
The IDE finds usages of the XML schema component. If usages are found, a Safe Delete warning dialog box opens. This warning dialog box may also contain errors.
- (Optional) In the Safe Delete warning dialog box, click Find Usages to show the XML Usages window which contains usage information for the selected component.
You can return to the refactoring action by clicking the Rerun Delete component-name button.
- In the Safe Delete warning dialog box, click Next.
- If you cleared the Preview All Changes checkbox, the delete action happens without additional confirmation. In this case, this is the last step of the delete action.
- In the XML Refactoring window, review the refactoring changes.
- Clear the checkbox of any node where you do not want to apply the change.
- Click Do Refactoring to apply the selected changes.
The IDE deletes the XML schema component and all references to the component, saves all the files affected by the refactoring action, and closes the XML Refactoring window.
To undo refactoring changes:
- After completing a Refactor > action command, select any XML schema component node in the Schema view or the Design view of the XML schema editor.
- Right-click and choose Refactor > Undo [action] from the pop-up menu.
The IDE rolls back all the changes in all the files that were affected by the refactoring.
To redo undone refactoring changes:
- After completing a Refactor > Undo [action] command, select any XML schema component node in the Schema view or the Design view of the XML schema editor.
- Right-click and choose Refactor > Redo [action] from the pop-up menu.
The IDE reverses the changes from the last Refactor > Undo [action] command.
- See Also
- XML Refactoring Window (XML Schema Tools)
- About XML Schema Tools
Legal Notices