XML Schema Analysis, Safe Rename, and Safe Delete
Draft Version 1.5
8 May 2006 (Revised 1 June 2006)
Jeri Lockhart
This document describes changes and additions to TPR3 for the Analysis View, Safe Rename, Safe Delete, and Find Usages..
The Find Unused Globals, Find Primitive
Uses, Find Substitution Groups, and Find Derivations of a Complex Type
queries will continue to be invoked from the Analysis View, but the
menu UI will change.
Instead of using the
column view control, the queries will be listed in a sectioned
document-style UI, which makes better use of horizontal space. This is a rough sketch:

If more
queries are added for Coke, a nested version of this UI will be used so
that the queries can be categorized.
TPR3 Find Usages Results Window
The results of the Analysis View
queries will move to the IDE output mode to the same window as the Find
Usages output (see TPR3 screenshot above). The window will be
renamed from "XML Usages" to "XML Analysis" or "XML Query Results".
For the Find Usages query, the child tab will be labeled
"Find XML Usages". The tabs for the other queries
will be labeled "Find Primitive", "Find Substitution Groups", or "Find
Derivations", as appropriate. The advantages of moving the
results to the output mode, are that the results can be retained when
selecting a new query, and that the actions to navigate or
highlight the Schema View or Source View will be easier to use.
A button to layout the graph will be added to the vertical
toolbar on the left side of the window, immediately beneath the
Refresh button. [Need an icon for the Graph Layout button]
If there's time, a graph search facility will be added. The
search textfield will be part of a horizontal toolbar on the lower end
of the graph pane. If this search facility is added, the Graph
Layout button will be relocated to the graph toolbar. The
minimum capability of the search facility would be to highlight nodes
whose labels match, case-insensitively, the text that is typed
into the search text field
- Rename and Safely Delete Schema Components
In TPR3, there are two kinds of
delete actions on a schema component node in the Schema
View, "Delete" and "Safely Delete". Safely Delete checks for
usages
of the component in the schema file and warns the user if usages are
found. For Coke, Rename and Safely Delete will be changed
to behave
like the Java refactoring rename and delete actions.
The schema components nodes will have a "Refactoring" popup item.
In addition the following rename actions will behave like an
explicit rename refactoring:
- Rename a component in a property sheet
- Rename a component in place in the Schema View or Instance View
The Java "Refactor" item in the main menu of the IDE does not have any affect on Schema refactoring.
Behaviour of Rename:
["refactoring set" refers to the set of schema models and multiviews that is modified during a rename or delete refactoring]
- Rename 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 a preview window. Otherwise, the behaviour is
the same as that for a global component (auto save and undo/redo
capability).
- It will also check for usages of the component in WSDL and BPEL files. [see related section "Scope of Find Usages Action"]
- The UI will be blocked while the usages are being found.
- After the IDE has completed the search for usages:
- They will be shown in a preview window if the user has specified "Preview All Changes" , which is the default
- The Preview shows the components in the files of the project that use the rename component.
- If the Preview window is shown, the user can deselect components that should be excluded from the refactoring
- If any changes are made to the refactoring set,
such as a user edit, another refactoring, or a deletion of a file, the
Preview will be disabled. Unlike Java refactoring, which disables
the Preview if any Java changes occur in the IDE, only changes to the
refactoring set will disable the XML Preview.
- Modifications to models that are external to the Preview, even
if the change is to add a usage of the rename component to an external
model, do not affect the Preview.
- If the Preview has been disabled, the user must refresh the Preview before running the refactoring.
- From the Preview, the user runs the refactoring by pressing the "Do Refactoring" button [Should this button be labeled "Refactor"?]
- The refactoring will run automatically if the user has unchecked "Preview All Changes" when first invoking the rename
- The UI is blocked by a modal progress dialog while the refactoring is running
- After the refactoring has completed, if the Preview was shown, it is automatically closed
- After the refactoring the files are automatically saved.
- Undo/Redo behaviour [see note]
- To undo the rename, the user selects "Undo Rename" from the
schema component node's popup menu.
- The Undo menu item is enabled after a rename
refactoring has completed.
- Undo is disabled if any member of the refactoring set is modified after the refactoring
- After undoing the rename, the user can redo the rename from the same popup menu
- The undo depth is one, i.e., only the last refactoring can be undone
Behaviour of Safe Delete:
- Safely Delete will check for usages of the component in the project, if the component is global
- Non-global components will be deleted without checking
for usages and without showing a preview window. Otherwise, the
behaviour is the same as that for a global component (auto save and
undo/redo capability). [Should BPEL assignment XPATH statements be checked for usages of local components?]
- Scope of Find Usages Action It will also check for usages of the component in WSDL and BPEL files [see related section "Scope of Find Usages Action"]
- When the user invokes Safely Delete, he or she can choose to bypass the Preview
- If usages are found, a warning dialog will be shown. (The dialog could also contain Errors).
- If only warnings are issued, the user can
- Continue to the Preview
- If usages had been found, and the user has chosen to proceed to the
Preview, the Preview will display the message "Delete component but
keep the 5 usages of it. [1 occurrence]".
- (The Java delete preview has this message: "Delete classes and keep references to them, if any. [1 occurrence]" )
- or, if bypassing the Preview, proceed directly to the refactoring,
- or press the "Show Usages" button
- The Show Usages results is identical to the TPR3 Show Usages, except that there is a button "Rerun Safe Delete".
- or cancel the deleteThe refactoring will run automatically if
the user has unchecked "Preview All Changes" when first invoking the
delete
- The UI is blocked by a modal progress dialog while the refactoring is running
- After the refactoring has completed, if the Preview was shown,
it is automatically closed.
- After the refactoring the files are automatically saved.
- Undo/Redo behaviour is similar to the undo/redo behaviour for rename
Note on Undo/Redo:
If feasible, the following "smart" Undo/Redo behaviour will be implemented:
- To undo the refactoring, the user can do one of the following:
- Select "Undo" from the
schema component node's popup menu.
- Select Edit | Undo from the IDE main menu when a multiview in the refactoring set is active
- Press Ctrl+Z when a multiview in the refactoring set is active
- The menu items and accelerator are enabled after a refactoring is done, and remain enabled even if a model in the
refactoring set is subsequently modified.
- When the user selects Undo, a warning message will be issued
if any of the models in the refactoring set have been modified after
the refactoring. The user can choose to
- undo only the model for the currently active multiview
- cancel the undo request
- After undoing the rename, the user can redo the refactoring from the popup menu, the main Edit menu, or with Ctrl+Y
- There is no limit to the number of undos that can be accumulated
 |

|
| Old TPR3 Schema Component Node Popup |
New Coke Schema Component Popup
["Show Usages" changed to "Find Usages" |
|
|
|
|
 |
|
Java Refactoring Popup on Method Node in Projects Explorer
(Shown for comparison) |
|

Warning if trying to delete a component that has usages.
- Scope of Find Usages Action
The
Find Usages action on the nodes for global component in the Schema View
will use refactoring engines provided by the WSDL, BPEL, and Schema
modules to find usages of the component in the current project. The
file nodes in the visualization will have different icons, node shapes
and/or node colors to differentiate them.