Chapter 9. Editors Features

9.1. OpenOn

OpenOn let's you easily navigate through your project without using the Package Explorer view (project tree). With OpenOn, you can simply click on a reference to another file and that file will be opened.

OpenOn is available for the following files:

  • XML Files

  • JSP Pages

9.1.1. XML Files

Press and hold down the Ctrl key. As you move the mouse cursor over different file references in the file, they display an underline. When you have the mouse cursor over the name of the file you want to open, click and the file will open in its own editor. In this example the managed bean NameBean will open.

NameBean Managed Bean

Figure 9.1. NameBean Managed Bean

This is the result of using OpenOn.

NameBean Java Class

Figure 9.2. NameBean Java Class

You can also try OpenOn with defined attributes.

OpenOn With Defined Attributes

Figure 9.3. OpenOn With Defined Attributes

You can also open any JSP pages.

JSP Page OpenOn

Figure 9.4. JSP Page OpenOn

9.1.2. JSP Pages

OpenOn is also very useful in JSP pages. It will allow you to quickly jump to the reference instead of having to hunt around in the project structure.

You can easily open the imported property files.

OpenOn With Imported Property Files

Figure 9.5. OpenOn With Imported Property Files

Use OpenOn to open a CSS file used with a JSP page:

OpenOn With CSS File

Figure 9.6. OpenOn With CSS File

Open managed beans:

OpenOn With Maneaged Beans

Figure 9.7. OpenOn With Maneaged Beans

For JSP files in a JSF project, you can also easily open the navigation rules by applying OpenOn to the JSF tag for the navigation outcome:

OpenOn With JSF Tag

Figure 9.8. OpenOn With JSF Tag

9.2. Code Assist and Dynamic Code Assist (based on project data)

9.2.1. Content Assist Features

9.2.1.1. Content Assist

Content assist is available when working with

  • JSF project files

  • Struts project files

  • JSP files

9.2.1.2. JSF Project Files

When working with JSF project in Red Hat Developer Studio, you can use various Content Assist features while developing:

  • Content Assist for XML, JSP and JSF configuration files

  • Content Assist based on project data

  • Content Assist with graphical JSF editor

9.2.1.2.1. Content Assist for XML, JSP and JSF configuration files

At any point when working with any XML, JSP and JSF configuration files Content Assist is available to help you. Simply type Ctrl-Space to see what is available.

Content Assist for JSF configuration file:

Content Assist In JSF Configuration File

Figure 9.9. Content Assist In JSF Configuration File

Content Assist for JSF JSP file:

Content Assist In JSP File

Figure 9.10. Content Assist In JSP File

Content Assist for other JSF XML project files (web.xml shown):

Content Assist In web.xml file

Figure 9.11. Content Assist In web.xml file

9.2.1.2.2. Content Assist Based on Project Data

Red Hat Developer Studio takes Content Assist to the next level. Red Hat Developer Studio will constantly scan your project and you will be able to insert code into the JSP page from your project that includes:

  • Values from Property files

  • Managed beans attributes

  • Navigation Rule Outcomes

The first screen shot shows how to insert message from a Properties files. You simply put the cursor inside the value attribute and press Ctrl-Space. Red Hat Developer Studio will scan your project and show a list of possible values to insert.

Inserting Message

Figure 9.12. Inserting Message

In the following screen shot we are inserting a Managed bean attribute value. Again, by simply clicking Ctrl-Space, Red Hat Developer Studio will show a list of all possible values that you can insert:

Once you select a Managed bean, it will show you a list of all available attributes for the selected Managed bean (userBean).

Attributes List

Figure 9.13. Attributes List

Code Assist based on project data will also prompt you for navigation rules that exist in your JSF configuration file.

Code Assist

Figure 9.14. Code Assist

9.2.1.2.3. Content Assist within JSF Graphical Editor

Red Hat Developer Studio also provides Content Assist when working within the graphical JSF configuration editor. Just click Ctrl-Space.

Content Assist In Graphical JSF Configuration Editor

Figure 9.15. Content Assist In Graphical JSF Configuration Editor

9.2.1.3. Struts Project Files

9.2.1.3.1. Content Assist for Struts Configuration File
Struts Content Assist

Figure 9.16. Struts Content Assist

9.2.1.3.2. Content Assist for Struts JSP File
Struts JSP Content Assist

Figure 9.17. Struts JSP Content Assist

9.2.1.4. JSP Pages

9.2.1.4.1. Content Assist for JSF Tags
JSF Tags Content Assist

Figure 9.18. JSF Tags Content Assist

9.2.1.4.2. Content Assist for JSTL Tags
JSTL Tags Content Assist

Figure 9.19. JSTL Tags Content Assist

9.2.1.4.3. Content Assist for HTML Tags
HTML Tags Content Assist

Figure 9.20. HTML Tags Content Assist

9.2.1.4.4. Content Assist for JavaScript Tags
JavaScript Tags Content Assist

Figure 9.21. JavaScript Tags Content Assist

9.2.1.4.5. Content Assist within JSF Configuration Editor
Content Assist In JSF Configuration Editor

Figure 9.22. Content Assist In JSF Configuration Editor

9.2.2. Adding dynamic code assist to custom components that were added to Red Hat Palette

Here is what you need to do to add project based code assist to a custom component added in Red Hat Developer Studio:

  1. Create a new file in <RedHatDeveloperStudio>\eclipse\plugins\com.exadel.prompting.knowledgebase_7.1.0\schemas\tld. For example call it JeniaFaces.xml

Here is a sample code snipped that adds code assist to the component you mention above:

<?xml version="1.0" encoding="UTF-8"?>
<Schema location="" prefix="jdt" uri="http://www.jenia.org/jsf/dataTools">
    <ElementType bodyContent="refused" content="mixed" endTag="required"
        name="singleRowSelector" startTag="required">
        <AttributeType name="selection" required="true">
            <proposal type="jsfVariables"/>
            <proposal type="beanProperty">
            <param name="type" value="java.lang.String"/>
            </proposal>
        </AttributeType>
        <attribute type="selection"/>
    </ElementType>
</Schema>
  1. Adds code assist for JSF pre-defined objects, such as value="#{param}":


<AttributeType ...>
       <proposal type="jsfVariables"/>
</AttributeType>
  1. Adds bundle resource (property file) code assist:


<AttributeType ...>
       <proposal type="bundleProperty"/>
</AttributeType>
  1. Adds managed bean property code assist:


<AttributeType ...>
       <proposal type="beanProperty"/>
</AttributeType>
  1. Adds managed bean property but with a specified type:


<AttributeType ...>
       <proposal type="beanProperty">
          <param name="type" value="java.lang.Boolean"/>
       </proposal>
</AttributeType>
  1. Adds managed bean method with a signature:


<AttributeType ...>
       <proposal type="beanMethodBySignature">
          <param name="paramType" value="javax.faces.context.FacesContext"/>
          <param name="paramType" value="javax.faces.component.UIComponent"/>
          <param name="paramType" value="java.lang.Object"/>
          <param name="returnType" value="void"/>
       </proposal>
</AttributeType>
  1. Restart Eclipse. You should now have code assist for the component. The new XML file will be copied to the workspace.

9.3. Full Control over Source Files - Synchronized Source and Visual Editing

Red Hat Developer Studio offers the flexibility to edit any files in either source or extra visual modes at the same time.

The project is yours and so is the source. Red Hat Developer Studio provides you many different graphical editors to speed your application development. At the same time, you always have full control over all project source files. Any changes you make in the source view, will immediately appear in the graphical view.

The JSF configuration file editor has three views: Diagram, Tree and Source. All views are synchronized, you can edit the file in any view.

Diagram View

Figure 9.23. Diagram View

Tree View

Figure 9.24. Tree View

Source View

Figure 9.25. Source View

The same applies to all other Red Hat Developer Studio editors.

Web XML editor is shown. Web XML editor has a graphical view (Tree) and source (Source).

Tree View

Figure 9.26. Tree View

Source View

Figure 9.27. Source View

Red Hat Developer Studio TLD file editor shown in Tree view. At any point you can edit the source by going switching to Source view.

Tree Editor

Figure 9.28. Tree Editor

Source Editor

Figure 9.29. Source Editor

The Struts configuration file editor has three views: Diagram, Tree and Source. All views are synchronized, you can edit the file in any view.

Struts Diagram View

Figure 9.30. Struts Diagram View

Source view. Any changes here will immediately appear in all other views.

Struts Source View

Figure 9.31. Struts Source View