Eclipse: The icons in "Display View" are all greyed out - java

The discussion here describes the "display view" in eclipse which allows one to to quickly evaluate java expressions. The thing is, when I open the display view the icons remain greyed out and I can't execute anything. The only icon that isn't is "clear console". The odd thing is, alot of the screenshots on the web show the same behaviour but the people posting about the feature don't mentioned it. There aren't any options in the context sensitive menu either. I'm trying it on a java project. I've tried it in the debug view and I get the same issue.
I'll provide a screenshot once my hosting is sorted.
I'm using eclipse 3.4.

To be able to use it, you're supposed to be in debug mode (set a breakpoint to freeze execution). That gives you a context, a stack frame to work in.
Once you're there, you select expressions in the display view and only then can you execute them, evaluate etc. If no text in the view is selected, none of the actions will be available.

As I understand, the purpose of the 'Display' view is to allow to evaluate expression during debug sessions. Are you trying to evaluate some expressions statically (i.e. with no running application in debug mode)?

Related

Context sensitive menu in eclipse editor

If I use eclipse and right click on a part of Java source code, the context menu depends on the syntactic element the user clicks on (like: a method, a variable,...).
How can I implement this kind of behaviour in my own eclipse plugin, e.g. add an item to the context menu only if the user clicks on a method in Java source code. Furthermore, the plugin needs to know which method the user clicks on.
I guess I have to relate the clicking position to the abstract syntax tree that eclipse builds but I have no idea how to do that.
You do this with Eclipse Commands and you can enable them and change their visibility in many ways, depending on selection, global state, etc.
I guess I have to relate the clicking position to the abstract syntax
tree that eclipse builds but I have no idea how to do that.
The good news is you (generally) don't have to do that, Eclipse has done all that heavy lifting for you.
It is quite a broad subject, so I suggest working through some tutorials on Commands first:
Adding menus, toolbar and popup menus to the Eclipse IDE - Tutorial
Eclipse Commands Advanced - Tutorial

Eclipse debugging : Stack trace on event

Im trying to get the code flow of an open source platform. I have got the source code and ran the program from eclipse. The program has an option called "Run job" and I want to know where the control goes when that option is clicked. How can achieve this?
First, try to identify the control with the label "Run job".
You could do this by searching the source code in Eclipse with Search > File and then setting "Containing Text" to "Run job" and "File name patterns" to "*.java".
Probably in the same file, there is an ActionListener (or similar) added to the control that calls a method, when the control is clicked. This is the method you're looking for. (Add a breakpoint to see the flow in the debugger or try to understand it from the code.)
Apart from searching for the appropriate handlers and buttons in the source code (if you know the names), you can also enable tracing.
In your run configuration, there should be a tab for tracing. There, you'll want to enable some of the options under org.eclipse.ui that start with trace/.
You will get a lot of debug output, and there might be no trace option for the event you'd like to see. However it works well for things like keybindings (trace/keyBindings) and knowing which UI element got an event (trace/graphics). Note that some also take arguments, e.g. a commandId (something like org.eclipse.ui.edit.copy, will depend on your application).
You can find a small help text for each option here.

Step Back debugging in Eclipse

sometimes when I debug in Eclipse, I found some thing wrong so I want come back and debug again, but I want to do that just for couple statements.
I saw
How to step back in Eclipse debugger?
is it possible to "go back" in java eclipse debugger like dragging the arrow in VS
and I know about Drop to frame but I can't use this to step back any line I want. I need some thing else. For example if you use debug in Visual Studio, you can drag and drop the debug arrow anywhere you want. You can bring the debugger to previous statement and debug it again. I need something like this in Eclipse but Drop to frame doesn't do that.
Thanks.
The linked answers suggest to use a third-party product to provide exactly this feature. If you don't want to do that and are not satisfied with drop to frame, there is one more option. You can set a breakpoint before the interesting place (or just drop to that frame), and then evaluate arbitrary code in this context (see Eclipse Help or this blog post).

Keep Component Inspector state between applications switch in NetBeans

On NetBeans 7.0.1, if you are designing two User Interfaces, the "Component Inspector" becomes available while at "Design View", if you switch from one UI to another the Inspector randomly collapses all nodes and you lose focus of the component you had previously selected.
This is annoying because you have to keep expanding the nodes to get focus on what you were working.
One solution is to have multiple NetBeans instances, this may work if you must have two UI opened at the same time, but what if you must have five UIs opened at the same time? 5 NetBeans instances is not an option.
So, do you know what do I have to do so the Component Inspector does not collapse when switching between files? or in another words, how to keep the component inspector state between applications switch?
Thanks for your help!
(Posting this as an answer to show screenshots)
I do not get the same behavior as you do. In my case the Inspector does not collapse the panels when switching between open files, only when closing & opening a file. My IDE looks like the screenshots below when switching between the file tabs (CheckPanel.java & PasswordEditPanel.java).
So the functionality is definitely there, but something is amiss in your case.

Eclipse RCP: Why is the view missing when running as a Product?

I'm brushing up my Eclipse RCP skill by trying to enhance my one-year-old side RCP application. This application has one perspective, and this perspective has 3 views, and I'm adding another view into the same perspective. To add this new view, I added it in the MANIFEST.MF file under Extensions tab and created the Java file for it.
When I run it as an Application, it works. I see all 4 views in the application. But, when I run it as a Product, that new view is missing. It almost seems like the new view is not registered in the Product. There's no error in the console log either. I think I must be missing a step here, but I can't seem figure out here... pretty frustrating!
Note: The views are added into the perspective programmatically (in Java code), not through MANIFEST.MF file. I just realized that even when I change the existing view's layout (ex: size, or location), it doesn't get reflected when running as a Product either, but it works when running as an Application... sigh!
Note: I commented out all the code in my perspective class, in another word, all the views are removed from the perspective. When I launch the Product, I'm still seeing 3 views in the application. I'm thinking there's something to do with caching, but I'm just bummed now.
Any helps are greatly appreciated here! Thanks much,
Okay, after aimlessly clicking around, I figured out the solution. The workspace data needs to be cleared to pick up changes from the perspective.
To do so...
Right click the product file
Choose "Run Configurations..."
Under "Main" tab, check "Clear" checkbox and "workspace" radio button.
Run it.
Hope this will save some of you from troubles.
I've been bitten by this a couple of times until I figured out the easiest workaround: it's sufficient to reset the perspective. There are two ways to achieve this:
Right-click on your perspective in the perspective selector bar at the top right and click on Reset.
Switch to your perspective and then go to Window | Reset perspective....
After that, the changes to your perspective should be picked up.

Categories

Resources