JDeveloper Role files – What are they?

When JDeveloper first starts up, you are prompted to select a Role that you would like to have JDev run in.
If you don't see this dialog at startup, look in the Tools -> Preferences -> Roles menu.

roles_menu_startup 

For most of us, one of these roles will work just fine.  But what if you wanted to create your own Role?  What does it really mean to create your own Role?

To see what each of these roles does behind the scenes, you can take a look at it's source XML file.  All of the role xml files are located at:

<ORACLE_HOME>/middleware/jdeveloper/jdev/roles

For the most part, the different roles remove the unneeded extensions, so that JDeveloper only loads what you need for that specific role.  You can also modify what menus are loaded when the IDE starts.  This is sometimes referred to as Menu Shaping.

To create your own Role file, it's best to start with one of the existing roles and modify it to meet your needs.

Taking a look at the Java or J2EE Role files will show that they only disable certain extensions.  No menu modification are made.

To get the best example of what can be done, take a look at the Customization Role (oracle.fusion.cust.role.xml)

In this file you will see two tags that do the work of disabling extensions and hiding the menus

<disabled-extensions>

and

<c:menu-customizations>

Here is an example of a very basic Roles file.  It only has one disabled extension and one hidden menu.

*********************************************************************************************************

<?xml version="1.0" encoding="US-ASCII" ?>

<role xmlns="http://xmlns.oracle.com/ide/roles"
    id="unique_id_of_your_role"
          rsbundle="name_of_resource_file"
    version="1.0">

  <name>My Developer Role</name>
  <description>A Customized role just for me</description>

  <disabled-extensions> 
  <!--Disable extensions for features not suitable during your role -->
        <extension refid="oracle.almplugins" />
  </disabled-extensions>

  <hooks xmlns="http://jcp.org/jsr/198/extension-manifest"
         xmlns:c="http://xmlns.oracle.com/ide/customization">

    <c:menu-customizations> 
     <!--Hide menus not suitable during your role -->

        <c:action idref="RefactorMenuId">
            <c:hidden>true</c:hidden>
        </c:action>

    </c:menu-customizations>

  </hooks>
</role>

*********************************************************************************************************

After you have created your file, name it something like my_role.xml and save it to the

<ORACLE_HOME>/middleware/jdeveloper/jdev/roles

directory.  The next time you start JDeveloper, your role will show up in the list with the name that you set in the Role file as one of the selections

my_role_startup .

I'm pretty much always using the Java role myself, and I use the context menus for most of the actions on the code in the editor.   Here is a complete Role file that I use most of the time.  It is based on the Java Role file and it also removes a few of the menus that I never use from the main menu bar.

my_role.xml

A list of all the extensions currently running in your version of JDeveloper, can be found in the Help -> About menu under the Extensions tab.

To find Menu IdRef's take a look at my earlier post on How to find the IdRef for most menu commands

Those are the basics of Roles files.  In a future post, I'll cover how you can use a resource file to help localize the properties used in the role file.

Learn more about how to package and distribute your role file so others on your team can use the same role if they like.

 

Troubleshooting

Just in case you run into problems, here are some tips....

-- Make sure that you have the "Always prompt for role selection on startup" checked so that if something goes wrong, you can just select one of the default roles and be back to normal.  If you need to, you can set this under Tools -> Preferences -> Roles as well.

-- If you don't see your role in the list, it's usually because there is an error in the structure of the xml file. Make sure to validate your xml file after you save it.

-- If JDeveloper fails to load at all, after you select your Role, you are probably trying to disable an extension that is needed by something else that you aren't disabling.  This is a trial error process unfortunately.

Good luck with creating your own Roles.  Feel free to leave any ideas or suggestions in the comments.

Comments:

I downloaded JDeveloper 10g so I could learn it and practice it from home, it was 10.1.3.3. Well needless to say I cannot connect to the database with it. It is locked. I get this warning ORA-28000: the account is locked, which is telling me that I have tried too many times to log onto the database. I have tried actually changing stuff right from the command line interface with SQL, but it tells me that I don't have administration rights. So can someone please help me with this, I'm lost and confused. I have tried many things and nothing seems to work.

Posted by Jim on December 30, 2010 at 08:09 AM PST #

Post a Comment:
  • HTML Syntax: NOT allowed
About

profile image
My name is John 'JB' Brock.
This Blog will focus on tips and tricks for working with the JDeveloper Extension SDK.
I hope to bring clarity to some of the mysteries around developing extensions for JDeveloper.


Search

Archives
« July 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
  
       
Today