IT tutorials
 
Mobile
 

BlackBerry Java Application Development - Changing the perspective

6/7/2013 7:50:08 PM
- How To Install Windows Server 2012 On VirtualBox
- How To Bypass Torrent Connection Blocking By Your ISP
- How To Install Actual Facebook App On Kindle Fire

Introducing Eclipse perspectives

Eclipse uses the term perspective to mean a saved configuration of views and their placement on the workbench. So far, you've seen only the "Java" perspective that is used when developing applications. This perspective contains things such as a task list, console output, and documentation views, but there is another important perspective that we will encounter next — the Debug perspective.

The views in the Java perspective aren't particularly useful when you are debugging an application, so they are hidden and an all new set of windows is displayed once you switch to the Debug perspective. These views include the call stack, variables, and watch windows that are more useful when trying to look at the current state of the running application. Let's take a look at that right now by going back to the simulator and finding that bug we made.

Time for action - changing the perspective

  1. After starting the application under the debugger you left the simulator still running and waiting to be used. Go back to the simulator and find the HelloWorldDemo application and activate it by pressing the F9 or Enter key.

  2. Unlike before, this time you see a new dialog being displayed right away. Generally, you don't want to see this dialog each time so check the Remember my decision checkbox and then click on the Yes button.

  3. Now, Eclipse looks very different than it did just a moment ago. Eclipse has been brought to the foreground and is now showing the Debug perspective. The code view isn't showing any of the HelloWorldDemo application though because the actual error occurred deep inside the framework.

  4. Because the actual bug happened deep inside a framework method, the source code for that method can't be shown. Instead, you need to look at the call stack and find the last point where the code in the application was executed. Click on the item labeled HelloWorldScreen.<init>() line:79; this should display the source code for HelloWorldDemo.java in the code view. Now, place the cursor on your bug at line 79.

  5. As we know where the problem is, it's time to go and fix it. There are some tricks to keep on debugging the application, but for now let's just stop debugging the application. Do this by simply closing the simulator by using the standard methods.

  6. Now that the debugging session is over I bet you expected Eclipse to change the screen back to normal. I did too, but this is not the case. To change the perspective back to the Java perspective, just click on the Java button on the perspective toolbar above the variables view.

What just happened?

How's that for some fun? In this section, you did some basic debugging by creating a bug in the source and then running the application in the simulator. You saw how the debugger stopped when the bug was encountered and used the call stack to find the source of the problem.

There are a lot of other things that you could have done once the debugger was active. Eclipse has a lot of tools that make the interactive debugger powerful and useful. The call stack is just one of the many windows available on the Debug perspective. The variables and watches allow you to see the current state of variables at each step in the call stack.

Additionally, above the call stack as part of the Debug window you will find the Run menu that gives you all the normal run operations. There are buttons for each operation such as Step Over, Step In, and Step Out as well as Run and others. Furthermore, there are special actions available on the right-click menu such as Set Next Statement or Run to line, which can be very helpful in some situations.

One of the surprises is the discovery of the Debug perspective and how it changes the way Eclipse looks and what windows are displayed. This change is a little startling if you aren't already familiar with it and having to change it back can also be confusing when getting started with Eclipse. Perspectives are an integral part of the debugging process though, and it won't be unusual for long.

 
Others
 
- BlackBerry Java Application Development - Starting the debugger
- BlackBerry Java Application Development - Running an application in the simulator
- Windows Phone 7 : Silverlight User Interface Development - Designing for Windows Phone 7 (part 2) - Designer and Developer Mechanics
- Windows Phone 7 : Silverlight User Interface Development - Designing for Windows Phone 7 (part 1) - Design Approach, Design Resources
- Developing BlackBerry Tablet Applications : Working with the File System - SQLite Databases
- Developing BlackBerry Tablet Applications : File System Access (part 3) - File Browse for Multiple Files
- Developing BlackBerry Tablet Applications : File System Access (part 2) - File Browse for Single File
- Developing BlackBerry Tablet Applications : File System Access (part 1)
- iPhone Developer : Assembling Views and Animations - Managing Subviews - Tagging and Retrieving Views
- iPhone Developer : Assembling Views and Animations - Recovering a View Hierarchy Tree, Querying Subviews
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
programming4us programming4us
 
Popular tags
 
Video Tutorail Microsoft Access Microsoft Excel Microsoft OneNote Microsoft PowerPoint Microsoft Project Microsoft Visio Microsoft Word Active Directory Biztalk Exchange Server Microsoft LynC Server Microsoft Dynamic Sharepoint Sql Server Windows Server 2008 Windows Server 2012 Windows 7 Windows 8 Adobe Indesign Adobe Flash Professional Dreamweaver Adobe Illustrator Adobe After Effects Adobe Photoshop Adobe Fireworks Adobe Flash Catalyst Corel Painter X CorelDRAW X5 CorelDraw 10 QuarkXPress 8 windows Phone 7 windows Phone 8 BlackBerry Android Ipad Iphone iOS