blob: 73774caad6faf4c14dfef2d2134f0cf5dab23e93 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html lang="en">
<head>
<meta name="copyright" content="Copyright (c) IBM Corporation and others 2000, 2011. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
<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">
<title>
Opening a Java editor
</title>
</head>
<body>
<h1>
Opening a Java editor
</h1>
<p>
In this section, you will learn how to open an editor for Java files. You will also learn about some of the basic Java editor features.
</p>
<ol>
<li> Expand the package <em>junit.samples</em> and select the file <em>VectorTest.java</em>.
You can open <em>VectorTest.java</em> in the Java editor by double clicking on
it. In general you can open a Java editor for Java files, types, methods and fields by simply double
clicking on them. For example, to open the editor directly on the method <em>testClone</em>
defined in <em>VectorTest.java</em>, expand the file in the Package Explorer and double click on the method.</li>
<li> Notice the syntax highlighting. Different kinds of elements in the
Java source are rendered in unique colors.&nbsp; Examples of Java source
elements that are rendered differently are:
<ul>
<li> Regular comments </li>
<li> Javadoc comments </li>
<li> Keywords </li>
<li> Strings </li>
</ul>
<p>
<img src="images/editor_vectortest.png" alt="Syntax highlighting">
</p>
</li>
<li> Look at the Outline view. It displays an outline of the Java file including
the package declaration, import declarations, fields, types and methods. The
Outline view uses icons to annotate Java elements.&nbsp; For example, icons indicate whether a Java element is
static (<img src="../images/org.eclipse.jdt.ui/ovr16/static_co.png" alt="S" >),
abstract (<img src="../images/org.eclipse.jdt.ui/ovr16/abstract_co.png" alt="A" >),
or final (<img src="../images/org.eclipse.jdt.ui/ovr16/final_co.png" alt="F" >).&nbsp; Different icons show you whether a method overrides a method from a
base class (<img src="../images/org.eclipse.jdt.ui/ovr16/over_co.png" alt="overridden">
) or
when it implements a method from an interface (<img src="../images/org.eclipse.jdt.ui/ovr16/implm_co.png" alt="implements">
).
<p>
<img src="images/view_outline_vectortest.png" alt="Outline view">
</p>
</li>
<li> Toggle the <strong>Hide Fields</strong>, <strong>Hide Static Members</strong>,
and <strong>Hide Non-Public Members</strong> buttons in the Outline view toolbar
to filter the view's display.
Before going to the next step make sure that the <STRONG>Hide Non-Public
Members</STRONG> and <STRONG>Hide Static Fields and Methods</STRONG>
buttons are not pressed.<p>
<img src="images/view_outline_vectortest_filtered.png" alt="Outline view tool bar">
</p>
</li>
<li>In the Outline view, select different
elements and note that they are again displayed in a whole file view
in the editor. The Outline view selection now contains a range indicator
on the vertical ruler on the left border of the Java editor that indicates
the range of the selected element.
<p>
<img src="images/editor_vectortest_outline_main.png" alt="Range indicator">
</p>
</li>
</ol>
<P class="nav_footer" id="nav_footer">Next Section: <A href="qs-Quickviews.htm">Using quick views</A>
</P>
<p>
<img src="../images/ngrelc.png" alt="Related concepts" >
</p>
<p>
<a href="../concepts/concept-java-views.htm">Java views</a><br>
<a href="../concepts/concept-java-editor.htm">Java editor</a><br>
<a href="../concepts/concept-java-views-sorting.htm">Sorting elements in Java views</a><br>
</p>
<p>
<img src="../images/ngrelr.png" alt="Related reference">
</p>
<p>
<a href="../reference/views/ref-view-outline.htm">Java Outline View</a><br>
<a href="../reference/preferences/java/ref-preferences-editor.htm">Java Editor Preferences</a><br>
</p>
</body>
</html>