blob: 497714ac650299db6b576baf9e33211949b5e7c2 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<title>
Using the Local History
</title>
<link rel="stylesheet" href="../book.css" charset="ISO-8859-1" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
</head>
<body>
<h1>
Using the local history
</h1>
<p>
In this section, you will use the local history feature to switch to a previously saved version of an individual
Java element.
</p>
<ol>
<li>
Open <em>junit.samples.VectorTest.java</em> file in the Java editor and select the method
<em>testCapacity()</em> in the Outline view.
</li>
<li>
Change the content of the method so that the 'for' statements reads as:<br>
<p><code>
for (int i= 0; i &lt; 99; i++)
</code></p>
Save the file by pressing Ctrl+S.
</li>
<li>
In the Outline view, select the method <code>testCapacity()</code>, and from its context menu, select <strong>Replace
With &gt; Element from Local History</strong>.
</li>
<li>
In the <strong>Replace Java Element from Local History</strong> dialog, the Local History list
shows the various saved states of the method. The Java Source Compare pane shows details of the
differences between the selected history resource and the existing workbench resource.
<p>
<img src="../images/qs-15.gif" width=497 height=398 alt="Replace from local history">
</p>
</li>
<li>
In the Local History pane, select the method that you changed, then click the <strong> Replace
button</strong>. In the Java editor, the method is replaced with the selected history version.
</li>
<li>
Save the file.
</li>
<li>
Beside replacing a method's version with a previous one you can also restore Java elements that were
deleted. Again, select the method <em>testCapacity()</em> in the Outline view, and from its context
menu, select <strong>Delete</strong>. Confirm the resulting dialog with <strong>Yes</strong> and
save the file.
</li>
<li>
Now select the type <em>VectorTest</em> in the Outline view, and from its context menu, select
<strong>Restore from Local History...</strong>. Select and check the method <em>testCapacity()</em>
in the Available Java Elements pane. As before, the Local History pane shows the versions saved
in the local history. The Java Source Compare pane shows the details of the differences between the
selected history version and the existing workbench resource.
<p>
<img src="../images/qs-15a.gif" width=497 height=398 alt="Restore from local history">
</p>
</li>
<li>
In the Local History pane, select the earlier version and then click <strong>Restore</strong>.
</li>
<li>
Press <strong>Ctrl+S</strong> to save the file.
</li>
</ol>
<p>
<img border="0" src="../images/ngrelc.gif" alt="Related concepts" width="159" height="27">
</p>
<p>
<a href="../concepts/concepts-7.htm">Java editor</a><br>
</p>
<p>
<img src="../images/ngrelt.gif" alt="Related tasks" border="0" height="27" width="159">
</p>
<p>
<a href="../tasks/tasks-54.htm">Using the Java editor</a><br>
<a href="../tasks/tasks-62.htm">Using the local history</a><br>
</p>
<p>
<a href="../hglegal2003.htm"><img src="../images/ngibmcpy2003.gif" width=324 height=14 alt="Copyright (c) 2000, 2003 IBM Corporation and others. All Rights Reserved." border="0"></a>
</p>
</body>
</html>