Eclipse: How debug without source jar? - eclipse

I am using Eclipse 3.4. I want to be able to put a breakpoint in a line of code that's in a jar for which I dont have the source code and no source code is available. How can I do this?

Even without the source you can view the outlines for classes and from the outline view, set breakpoints on methods.
If you must see some representation of the source, these are both pretty good: http://jadclipse.sourceforge.net/wiki/index.php/Main_Page and http://java.decompiler.free.fr/

Try this: Bytecode Outline Plugin for Eclipse

Related

Eclipse Class Editor Formatting

Eclipse's class editor has no formatting or collapsable fields / methods. How can I make the class editor have the same text formatting as the java editor? Or at least make it more readable and user friendly, such as the one in Netbeans.
Opening a class in Netbeans:
Opening a class in ECLIPSE:
I would like to make classes more readable in Eclipse, is there any way to do that? I have tried attaching a source / javadocs before with no luck. I am hoping there is a simpler way
You want to see a source like representation of a .class file. Although not exactly what you are looking for JD-Eclipse can be used for that purpose. Addmitedly the scope is broader, because it is a full blown decompiler, that will actually show you the code, but should work for you.
When installed it will by default open .class files and present the code instead of default view that only presents somewhat raw results of parsing bytecode.
Another option is Bytecode Outline that is not a decompiler, it only deassemples bytecodes in the editor, but can make debugging a bit easier, because it seems to handle line numbers in sync with the debugger, unlike JD-Eclipse, which just outputs line number comments.

In an eclipse plugin: How can I programmatically highlight lines of codes in the java editor?

I am trying to develop an eclipse plugin that does some documentation check on java code and highlights some lines of code in the editor.
To achieve my goal, I DON'T want to create a new editor in eclipse, I simply want to extend the default java editor to draw a line under (or highlight) the methods that do not satisfy some set of predetermined requirements.
Do I need to create a PresentationReconciler? If yes, how do I make the JDT or workbench use my reconciler.
I have never done plugin development and this is my first attempt.
Several starting points for you:
Annotations are an UI feature of JFace's text editor that allows you to visually mark some places in an open editor.
Markers are a Workbench feature, more high-level. They are generic "objects that may be associated with Workbench resources", and they can display in several places: in text editors (as annotations) or in the Problems view, for example.
Depending on what you want to do, you would plug in your plug-in into extension points related to either of those.
The Eclipse Java editor is located in the org.eclipse.jdt.internal.ui.javaeditor.JavaEditor package.
The "internal" in the package name means that the Eclipse development team can change how the Java editor works with new revisions.
Try this help page: Juno Help on syntax highlighting
At the end of the page, it describes how to dynamically add a PresentationReconciler, which is used for syntax highlighting. See if that fits the problem that you want to solve.
I assume you already have a plugin project.
In your plugin.xml, open the tab Extensions, click Add..., search for org.eclipse.ui.editors, then you should see a template named Editor, which will produce a simple xml editor to experiment and play with. Also, you will be able to see the needed structure to define a custom editor.
Hope this helps...
I don't know if you still have a need for this, but you are going to want to use Annotations to keep track of what parts of the editor you need to highlight.
For actually doing the graphical effect of highlighting, you could do syntax highlighting via a PresentationReconciler, but I have no experience with that.
We used a technique we borrowed from http://editbox.sourceforge.net/, replacing the background image of the editor Shell. Its open source, so check it out. (Our code might also help -- its at https://github.com/IDE4edu/EclipseEditorOverlay )

How can I set a breakpoint in java core class in eclipse?

I am using the eclipse3.4.6 and I have attached the src.zip to eclipse. I can successfully view the source code eclipse, but the breakpoint set in java core class dosn't work;
for example.
HashMap test = new HashMap();
test.put("a", 0);
I can't step into test.put("a", 0) even if I set a breakpoint in HashMap.class at the begenning of 'put' method.
Thanks in advance.
Please make sure you are using JDK not JRE in build path of your project.
I think you might be setting a "line breakpoint" which Eclipse isn't able to map to the right line possible because the source you are looking at is not exactly the same as that of the class that is running.
Try setting a "method breakpoint" instead. Open the HashMap class and in the Outline view, right click the put method and select Toggle Method Breakpoint.

Using Breakpoint in Eclipse with counterclockwise debugger

While everything is configured properly, clojure working fine with Eclipse, I am unable to add breakpoint to code. On right clicking in Text Editor's window there is no option as "toggle breakpoint" for debugging.
http://code.google.com/p/counterclockwise/issues/detail?id=288&start=100
I posted an issue to CCW bugtracker.
It seems, latest version of the CCW plugin somehow forget about debugging.
This is usually indicative that Eclipse do not think that your source file corresponds to a class file that it knows of.
In other words, it has no idea that your code is actually code.

Execute code when Eclipse workbench loads

I'm writing an Eclipse plug-in and I've bumped into an issue. Amongst others I'm creating a new custom perspective. I need to execute some code when the workbench loads. I'm using a WorkbenchAdvisor and putting the code in the initialize method. However as it is now it's not being called...
Apparently I need to call this PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor(); but I don't know where to put this... I can't put it in the createInitialLayout of the perspective because this is only called when the perspective is created for the first time.
Any ideas please?
Thanks and regards,
Krt_Malta
You can use the startup extension point to run code before your plugin is loaded. You should place the extension in an seperate plugin, as all code inside the plugin with the startup extension is loaded after the workbench is started.
The interface to look for is org.eclipse.ui.IStartup.
http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/extension-points/org_eclipse_ui_startup.html
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/api/org/eclipse/ui/IStartup.html