blob: 819f13b52063a5c7234c20a4f80b61a1f12c20c5 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<title> Searching the workbench </title>
<link rel="stylesheet" href="../book.css" charset="ISO-8859-1" type="text/css">
</head>
<body>
<h1> Searching the workbench </h1>
<p> In this section, you will search the workbench for Java elements. </p>
<p> In the Search dialog, you can perform file, text or Java searches. Java searches
operate on the structure of the code. File searches operate on the files
by name and/or text content. Java searches are faster, since there is an
underlying indexing structure for the code structure. Text searches allow
you to find matches inside comments and strings.
</p>
<h2> Performing a Java search from the workbench </h2>
<ol>
<li> In the Java perspective, click the <strong>Search</strong> button
in the workbench toolbar or use <strong>Search &gt; Java</strong> from
the menu bar. </li>
<li> If it is not already selected, select the <strong>Java Search</strong>
tab. </li>
<li> In the <strong>Search string</strong> field, type <em>runTest</em>.
In the <em>Search For</em> area, select <strong>Method</strong>, and in the <em>Limit
To</em> area, select <strong>References</strong>.<br>
Verify that the Scope is set to <strong>Workspace</strong>.
<p> <img src="../images/qs-47.gif" width=557 height=415 alt="Java Search page">
</p>
Then click <strong>Search</strong>. While searching you may click <strong>Cancel</strong>
at any time to stop the search. Partial results will be shown. </li>
<li> In the Java perspective, the Search view shows the search results.
<p> <img src="../images/qs-48.gif" width=764 height=191 alt="Search results view">
</p>
Use the <strong>Show Next Match</strong> and <strong>Show Previous
Match</strong> buttons to navigate to each match. If the file in which the
match was found is not currently open, it is opened in an editor. </li>
<li> When you navigate to a search match using the Search view buttons,
the file opens in the editor at the position of the match. Search matches
are tagged with a search marker in the vertical ruler.
<p> <img src="../images/qs-49.gif" width=765 height=534 alt="Editor with Search marker">
</p>
</li>
</ol>
<h2> Searching from a Java view </h2>
<p> Java searches can also be performed from specific views, including the Outline,
Hierarchy view and the Package Explorer view. </p>
<ol>
<li> In the Package Explorer view, double-click <em>junit.framework.Assert.java</em>
to open it in an editor. </li>
<li> In the Outline view, select the fail(String) method, and from its context
menu, select&nbsp;<strong>References &gt; Workspace</strong>.
<p> <img src="../images/qs-50.gif" width=765 height=533 alt="Search context menu in Outline view">
</p>
</li>
</ol>
<h2> Searching from an editor </h2>
<p> From the Package Explorer view, open <em>junit.framework.TestCase.java</em>.
In the editor, select the class name <em>TestCase</em> and from the context
menu, select <strong> References &gt; Workspace</strong>.
</p>
<img src="../images/qs-52.gif" width=652 height=487 alt="Search context menu in editor">
<p>
<h2> Continuing a search from the search view </h2>
<p> The Search Results view shows the results for the TestCase search. Select
a search result and open the context menu. You can continue searching the selected
element's references and declarations. </p>
<img src="../images/qs-53.gif" width=574 height=563 alt="Search context menu in Search results view">
<h2> Performing a file search </h2>
<ol>
<li> In the Java perspective, click the&nbsp;<strong>Search</strong> button
in the workbench toolbar or select <strong>Search &gt; File</strong> from the menu bar. </li>
<li> If it is not already selected, select the <strong>File Search</strong>
tab.</li>
<li> In the <strong>Containing text</strong> field, type <em>TestCase</em>.
Make sure that the <strong>File name patterns</strong> field is set
to <em>*.java</em>. The Scope should be set to <em>Workspace</em>.
Then click <strong>Search</strong>.
<p> <img src="../images/qs-54.gif" width=488 height=410 alt="File search tab">
</p>
</li>
<li> To find all files of a given file name pattern, leave the Containing
Text field empty. </li>
</ol>
<h2> Viewing previous search results </h2>
<p> In the Search Results view, click the arrow next to the<strong> Previous
Search Results</strong> toolbar button to see a menu containing the list of the most
recent searches. You can choose items from this menu to view previous
searches.&nbsp; The list can be cleared by choosing <strong>Clear History</strong>.
</p>
<img src="../images/qs-55.gif" width=764 height=194 alt="Previous search results menu">
<p>
The <strong>Previous Search Results</strong> button will display a dialog
with the list of all previous searches from the current session.
</p>
<img src="../images/qs-56.gif" width=416 height=345 alt="Previous search results dialog">
<p>
Selecting a previous search from this dialog will let you view that search.
</p>
<img src="../images/ngrelc.gif" width=159 height=27 alt="Related concepts" border="0">
<p>
<a href="../concepts/concepts-8.htm">Java search</a> </p>
<p> <img src="../images/ngrelt.gif" width=159 height=27 alt="Related tasks" border="0">
</p>
<p> <a href="../tasks/tasks-103.htm">Conducting a Java search using the search
dialog</a><br>
<a href="../tasks/tasks-104.htm">Conducting a Java search using pop-up menus</a>
</p>
<p> <img src="../images/ngrelr.gif" width=159 height=27 alt="Related reference" border="0">
</p>
<p> <a href="../reference/ref-menu-refactor.htm">Refactoring actions</a><br>
<a href="../reference/ref-117.htm">Refactoring wizard</a><br>
<a href="../reference/ref-23.htm">Refactoring preferences</a> </p>
<p><a href="../notices.html"><img src="../cpy.gif" border="0" alt="Legal notices" width="324" height="14"></a>
</p>
</body>
</html>