Java Reference
In-Depth Information
affected references, even those in other files. It also takes care of any version con-
trol system actions necessary to keep your tree appropriately synchronized.
These refactorings can be applied in a variety of contexts, including
HTML
, JavaScript and
CSS
files as well as their parent directories
■
CSS
class
and
id
attributes
■
JavaScript functions, parameters, and variables
■
Referenced external files, including anchors, images, stylesheets, and
JavaScript
■
The
Copy
refactoring is also supported for
HTML
,
CSS
, and JavaScript files, but
only for the files themselves, not functions, selectors, and so forth. The
Copy
refactoring is a convenient way to create a clone of a file to use as a starting point,
although a more generic approach is to use
IDEA
's file template feature to design
your own JavaScript,
HTML
, or
CSS
starting points.
Another useful refactorings
, Extract Include
, makes it easy to move an inline
block of JavaScript or
CSS
out of your
HTML
and into its own external file.
IDEA
automatically creates the new file and supplies the appropriate tag reference
where the block once stood. You can select this option from anywhere in a Java-
Script or
CSS
style block. The
Inline
refactoring does the opposite, pulling in the
contents of an included file and omitting the need for an
include
statement.
Another refactoring that now extends to web content is
IDEA
's
Safe Delete
mechanism. As you'll recall from earlier chapters, you activate the
Safe Delete
refac-
toring by pressing
Alt+Delete
on a file in the project browser, or through the
Refactor | Safe Delete
command. When this refactoring is activated,
IDEA
searches for usages of the file to be deleted and informs you about all references to
that file in other project files. The found references are shown in the
Refactoring
Preview
tool window, and you may jump to the relevant places to resolve possible
conflicts. This is helpful when an
HTML
, JavaScript, or
CSS
file is referenced in
multiple locations and its simple deletion (via
Delete
command) may lead to mul-
tiple broken references. Note that as with other path-sensitive commands, this fea-
ture works correctly only for files referenced explicitly through relative or aliased
paths within the project's content roots.
11.6 Summary
Since its inception,
IDEA
has promised to be the premiere Java editor on the mar-
ket—the most complete, the most intelligent, and the most easy to use—and no